From: Nabige Aala <nabige.aala@oss.qualcomm.com>
To: Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Kuogee Hsieh <quic_khsieh@quicinc.com>,
Shawn Guo <shengchao.guo@oss.qualcomm.com>
Cc: Ritesh Kumar <ritesh.kumar@oss.qualcomm.com>,
Mahadevan P <mahadevan.p@oss.qualcomm.com>,
Nabige Aala <nabige.aala@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org
Subject: [PATCH v3 09/11] phy: qcom: edp: Generalize power-on path for per-SoC overrides
Date: Mon, 16 Nov 2026 18:46:48 +0530 [thread overview]
Message-ID: <20261116-nord-drv-dt-v3-9-e3d3bf0e2c49@oss.qualcomm.com> (raw)
In-Reply-To: <20261116-nord-drv-dt-v3-0-e3d3bf0e2c49@oss.qualcomm.com>
From: Ritesh Kumar <ritesh.kumar@oss.qualcomm.com>
Add tx_res_config() and set_voltages() callbacks to phy_ver_ops so
SoCs with different register layouts can override TX resistor
calibration and TX drive-level writes independently.
Move the TX_BAND and RES_CODE/TX_EMP writes out of the common
power-on path into qcom_edp_tx_res_config_default(), which is
assigned to all existing SoC ops tables. Likewise, dispatch
set_voltages() through the ops pointer in qcom_edp_set_voltages()
before falling back to the default TXn_TX_DRV_LVL writes.
Add phy_status_reg, tx2_tx3_lane_ctl and bias1_en_2lane fields to
qcom_edp_phy_cfg so the power-on path reads register offsets and
the 2-lane bias value from the per-SoC config rather than using
hardcoded constants. Populate these fields for all existing SoC
configs with the current values, preserving existing behaviour.
No functional change for existing SoCs.
Signed-off-by: Ritesh Kumar <ritesh.kumar@oss.qualcomm.com>
Signed-off-by: Nabige Aala <nabige.aala@oss.qualcomm.com>
---
drivers/phy/qualcomm/phy-qcom-edp.c | 59 +++++++++++++++++++++++++++++--------
1 file changed, 46 insertions(+), 13 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
index a3c893f72908..41bcfffbb357 100644
--- a/drivers/phy/qualcomm/phy-qcom-edp.c
+++ b/drivers/phy/qualcomm/phy-qcom-edp.c
@@ -82,6 +82,8 @@ struct phy_ver_ops {
int (*com_configure_pll)(const struct qcom_edp *edp);
int (*com_configure_ssc)(const struct qcom_edp *edp);
int (*com_ldo_config)(const struct qcom_edp *edp);
+ int (*tx_res_config)(const struct qcom_edp *edp);
+ int (*set_voltages)(struct qcom_edp *edp, u8 swing, u8 emph);
};
struct qcom_edp_phy_cfg {
@@ -91,6 +93,9 @@ struct qcom_edp_phy_cfg {
const struct qcom_edp_swing_pre_emph_cfg *dp_swing_pre_emph_cfg;
const struct qcom_edp_swing_pre_emph_cfg *edp_swing_pre_emph_cfg;
const struct phy_ver_ops *ver_ops;
+ u32 phy_status_reg;
+ u8 bias1_en_2lane;
+ u32 tx2_tx3_lane_ctl;
};
struct qcom_edp {
@@ -383,6 +388,9 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
if (ret)
return ret;
+ if (edp->cfg->ver_ops->set_voltages)
+ return edp->cfg->ver_ops->set_voltages(edp, swing, emph);
+
writel(swing, edp->tx0 + TXn_TX_DRV_LVL);
writel(emph, edp->tx0 + TXn_TX_EMP_POST1_LVL);
@@ -645,6 +653,20 @@ static int qcom_edp_ldo_config_v4(const struct qcom_edp *edp)
return 0;
}
+static int qcom_edp_tx_res_config_default(const struct qcom_edp *edp)
+{
+ writel(0x04, edp->tx0 + TXn_TX_BAND);
+ writel(0x04, edp->tx1 + TXn_TX_BAND);
+ writel(0x11, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX0);
+ writel(0x11, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX1);
+ writel(0x11, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX0);
+ writel(0x11, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX1);
+ writel(0x10, edp->tx0 + TXn_TX_EMP_POST1_LVL);
+ writel(0x10, edp->tx1 + TXn_TX_EMP_POST1_LVL);
+
+ return 0;
+}
+
static const struct phy_ver_ops qcom_edp_phy_ops_v3 = {
.com_power_on = qcom_edp_phy_power_on_v4,
.com_resetsm_cntrl = qcom_edp_phy_com_resetsm_cntrl_v4,
@@ -653,6 +675,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v3 = {
.com_configure_pll = qcom_edp_com_configure_pll_v4,
.com_configure_ssc = qcom_edp_com_configure_ssc_v4,
.com_ldo_config = qcom_edp_ldo_config_v3,
+ .tx_res_config = qcom_edp_tx_res_config_default,
};
static const struct phy_ver_ops qcom_edp_phy_ops_v4 = {
@@ -663,6 +686,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v4 = {
.com_configure_pll = qcom_edp_com_configure_pll_v4,
.com_configure_ssc = qcom_edp_com_configure_ssc_v4,
.com_ldo_config = qcom_edp_ldo_config_v4,
+ .tx_res_config = qcom_edp_tx_res_config_default,
};
static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
@@ -672,6 +696,8 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
.ver_ops = &qcom_edp_phy_ops_v4,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
@@ -680,6 +706,8 @@ static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v3,
.ver_ops = &qcom_edp_phy_ops_v3,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static const struct qcom_edp_phy_cfg sc8180x_dp_phy_cfg = {
@@ -688,6 +716,8 @@ static const struct qcom_edp_phy_cfg sc8180x_dp_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg_v2,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v2,
.ver_ops = &qcom_edp_phy_ops_v3,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
@@ -696,6 +726,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
.ver_ops = &qcom_edp_phy_ops_v4,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
@@ -705,6 +737,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
.ver_ops = &qcom_edp_phy_ops_v4,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static int qcom_edp_phy_power_on_v6(const struct qcom_edp *edp)
@@ -898,6 +932,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
.com_configure_pll = qcom_edp_com_configure_pll_v6,
.com_configure_ssc = qcom_edp_com_configure_ssc_v6,
.com_ldo_config = qcom_edp_ldo_config_v6,
+ .tx_res_config = qcom_edp_tx_res_config_default,
};
static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
@@ -906,6 +941,8 @@ static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
.ver_ops = &qcom_edp_phy_ops_v6,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static int qcom_edp_com_configure_ssc_v8(const struct qcom_edp *edp)
@@ -1031,7 +1068,6 @@ static int qcom_edp_com_configure_pll_v8(const struct qcom_edp *edp)
return 0;
}
-
static int qcom_edp_phy_com_resetsm_cntrl_v8(const struct qcom_edp *edp)
{
u32 val;
@@ -1079,6 +1115,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
.com_configure_pll = qcom_edp_com_configure_pll_v8,
.com_configure_ssc = qcom_edp_com_configure_ssc_v8,
.com_ldo_config = qcom_edp_ldo_config_v6,
+ .tx_res_config = qcom_edp_tx_res_config_default,
};
static struct qcom_edp_phy_cfg glymur_phy_cfg = {
@@ -1087,6 +1124,8 @@ static struct qcom_edp_phy_cfg glymur_phy_cfg = {
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg_v8,
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
.ver_ops = &qcom_edp_phy_ops_v8,
+ .phy_status_reg = DP_PHY_STATUS,
+ .tx2_tx3_lane_ctl = DP_PHY_TX2_TX3_LANE_CTL,
};
static int qcom_edp_phy_power_on(struct phy *phy)
@@ -1121,21 +1160,19 @@ static int qcom_edp_phy_power_on(struct phy *phy)
/* TX Lane configuration */
writel(0x05, edp->edp + DP_PHY_TX0_TX1_LANE_CTL);
- writel(0x05, edp->edp + DP_PHY_TX2_TX3_LANE_CTL);
+ writel(0x05, edp->edp + edp->cfg->tx2_tx3_lane_ctl);
/* TX-0 register configuration */
writel(0x03, edp->tx0 + TXn_TRANSCEIVER_BIAS_EN);
writel(0x0f, edp->tx0 + TXn_CLKBUF_ENABLE);
writel(0x03, edp->tx0 + TXn_RESET_TSYNC_EN);
writel(0x01, edp->tx0 + TXn_TRAN_DRVR_EMP_EN);
- writel(0x04, edp->tx0 + TXn_TX_BAND);
/* TX-1 register configuration */
writel(0x03, edp->tx1 + TXn_TRANSCEIVER_BIAS_EN);
writel(0x0f, edp->tx1 + TXn_CLKBUF_ENABLE);
writel(0x03, edp->tx1 + TXn_RESET_TSYNC_EN);
writel(0x01, edp->tx1 + TXn_TRAN_DRVR_EMP_EN);
- writel(0x04, edp->tx1 + TXn_TX_BAND);
ret = qcom_edp_set_vco_div(edp, &pixel_freq);
if (ret)
@@ -1159,13 +1196,9 @@ static int qcom_edp_phy_power_on(struct phy *phy)
writel(0x00, edp->tx1 + TXn_TX_POL_INV);
writel(0x10, edp->tx0 + TXn_TX_DRV_LVL_OFFSET);
writel(0x10, edp->tx1 + TXn_TX_DRV_LVL_OFFSET);
- writel(0x11, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX0);
- writel(0x11, edp->tx0 + TXn_RES_CODE_LANE_OFFSET_TX1);
- writel(0x11, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX0);
- writel(0x11, edp->tx1 + TXn_RES_CODE_LANE_OFFSET_TX1);
-
- writel(0x10, edp->tx0 + TXn_TX_EMP_POST1_LVL);
- writel(0x10, edp->tx1 + TXn_TX_EMP_POST1_LVL);
+ ret = edp->cfg->ver_ops->tx_res_config(edp);
+ if (ret)
+ return ret;
writel(0x1f, edp->tx0 + TXn_TX_DRV_LVL);
writel(0x1f, edp->tx1 + TXn_TX_DRV_LVL);
@@ -1177,7 +1210,7 @@ static int qcom_edp_phy_power_on(struct phy *phy)
cfg1 = 0x1;
} else if (edp->dp_opts.lanes == 2) {
bias0_en = 0x03;
- bias1_en = 0x00;
+ bias1_en = edp->cfg->bias1_en_2lane;
drvr0_en = 0x04;
drvr1_en = 0x07;
cfg1 = 0x3;
@@ -1200,7 +1233,7 @@ static int qcom_edp_phy_power_on(struct phy *phy)
writel(0x19, edp->edp + DP_PHY_CFG);
- ret = readl_poll_timeout(edp->edp + DP_PHY_STATUS,
+ ret = readl_poll_timeout(edp->edp + edp->cfg->phy_status_reg,
val, val & BIT(1), 500, 10000);
if (ret)
return ret;
--
2.34.1
next prev parent reply other threads:[~2026-11-16 13:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:16 [PATCH v3 00/11] Add Qualcomm Nord display and eDP PHY support Nabige Aala
2026-11-16 13:16 ` [PATCH v3 01/11] dt-bindings: phy: qcom,edp-phy: Add DP PHY compatible for Nord Nabige Aala
2026-11-16 13:16 ` [PATCH v3 02/11] dt-bindings: display: msm: dp-controller: Document Nord DisplayPort Controller Nabige Aala
2026-11-16 13:16 ` [PATCH v3 03/11] dt-bindings: display/msm: Document Nord MDSS Nabige Aala
2026-11-17 15:23 ` Rob Herring (Arm)
2026-11-16 13:16 ` [PATCH v3 04/11] dt-bindings: display/msm: qcom,sm8650-dpu: Add Qualcomm Nord Soc Nabige Aala
2026-11-16 13:16 ` [PATCH v3 05/11] drm/msm/dpu: Add support for DPU 12.1 on Nord Nabige Aala
2026-11-16 13:16 ` [PATCH v3 06/11] drm/msm/dpu: Fix DSI tear interrupts broken by adding INTF_9 and INTF_10 Nabige Aala
2026-11-16 13:16 ` [PATCH v3 07/11] drm/msm: mdss: Add support for MDSS on Nord Nabige Aala
2026-11-16 13:16 ` [PATCH v3 08/11] drm/msm/dp: Add support for DP controllers " Nabige Aala
2026-11-16 13:16 ` Nabige Aala [this message]
2026-11-16 13:16 ` [PATCH v3 10/11] phy: qcom: edp: Add Nord-specific QSERDES COM register header Nabige Aala
2026-11-16 13:16 ` [PATCH v3 11/11] phy: qcom: edp: Add Nord eDP/DP PHY support Nabige Aala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116-nord-drv-dt-v3-9-e3d3bf0e2c49@oss.qualcomm.com \
--to=nabige.aala@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mahadevan.p@oss.qualcomm.com \
--cc=mani@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_khsieh@quicinc.com \
--cc=ritesh.kumar@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=shengchao.guo@oss.qualcomm.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®