Skip to contentSkip to conversation

phy: qcom: edp: Add DP/eDP switch for phys

PATCH Superseded Yongxing Mou 3 participants 16 messages Mar 2 – Apr 21

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover phy: qcom: edp: Add DP/eDP switch for phys

Currently the PHY selects the DP/eDP configuration tables in a fixed way, choosing the table when enable. This driver has known issues:
1. The selected table does not match the actual platform mode.
2. It cannot support both modes at the same time.

As discussed here[1], this series:
1. Cleans up duplicated and incorrect tables based on the HPG.
2. Fixes the LDO programming error in eDP mode.
3. Adds DP/eDP mode switching support.

Note: x1e80100/sa8775p/sc7280 have been tested, while glymur/sc8280xp have not been tested.

[1] https://lore.kernel.org/all/[email protected]/

---
Changes in v3:
- Rebase to next-20260224.[Dmitry]
- Only enable TX1 LDO when lane counts > 2.[Konrad]
- Link to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Combine the third patch with the first one.[Dmitry]
- Fix code formatting issues.[Konrad][Dmitry]
- Update the commit message description.[Dmitry][Konrad]
- Fix kodiak swing/pre_emp table values.[Konrad]

---
Yongxing Mou (2):
phy: qcom: edp: Add eDP/DP mode switch support
phy: qcom: edp: Add per-version LDO configuration callback

 drivers/phy/qualcomm/phy-qcom-edp.c | 176 ++++++++++++++++++++++++++----------
 1 file changed, 129 insertions(+), 47 deletions(-)

---
base-commit: 3ef088b0c5772a6f75634e54aa34f5fc0a2c041c
change-id: 20260205-edp_phy-1eca3ed074c0

Best regards,

Signature · 1 line
Yongxing Mou <[email protected]>
#1 lore raw

PATCH v3 1/2 phy: qcom: edp: Add eDP/DP mode switch support

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur
eDP mode(low vdiff):
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
 1 file changed, 53 insertions(+), 37 deletions(-)
drivers/phy/qualcomm/phy-qcom-edp.c +53 -37
index 7372de05a0b8..36998326bae6 100644
@@ -87,7 +87,8 @@ struct qcom_edp_phy_cfg {
 	bool is_edp;
 	const u8 *aux_cfg;
 	const u8 *vco_div_cfg;
-	const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_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;
 };
 
@@ -116,17 +117,17 @@ struct qcom_edp {
 };
 
 static const u8 dp_swing_hbr_rbr[4][4] = {
-	{ 0x08, 0x0f, 0x16, 0x1f },
+	{ 0x07, 0x0f, 0x16, 0x1f },
 	{ 0x11, 0x1e, 0x1f, 0xff },
 	{ 0x16, 0x1f, 0xff, 0xff },
 	{ 0x1f, 0xff, 0xff, 0xff }
 };
 
 static const u8 dp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x00, 0x0d, 0x14, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0x1a },
 	{ 0x00, 0x0e, 0x15, 0xff },
 	{ 0x00, 0x0e, 0xff, 0xff },
-	{ 0x03, 0xff, 0xff, 0xff }
+	{ 0x04, 0xff, 0xff, 0xff }
 };
 
 static const u8 dp_swing_hbr2_hbr3[4][4] = {
@@ -150,6 +151,20 @@ static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
 	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
 };
 
+static const u8 dp_pre_emp_hbr_rbr_v8[4][4] = {
+	{ 0x00, 0x0e, 0x15, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0xff },
+	{ 0x00, 0x0e, 0xff, 0xff },
+	{ 0x00, 0xff, 0xff, 0xff }
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg_v8 = {
+	.swing_hbr_rbr = &dp_swing_hbr_rbr,
+	.swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
+	.pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr_v8,
+	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
+};
+
 static const u8 edp_swing_hbr_rbr[4][4] = {
 	{ 0x07, 0x0f, 0x16, 0x1f },
 	{ 0x0d, 0x16, 0x1e, 0xff },
@@ -158,7 +173,7 @@ static const u8 edp_swing_hbr_rbr[4][4] = {
 };
 
 static const u8 edp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x05, 0x12, 0x17, 0x1d },
+	{ 0x05, 0x11, 0x17, 0x1d },
 	{ 0x05, 0x11, 0x18, 0xff },
 	{ 0x06, 0x11, 0xff, 0xff },
 	{ 0x00, 0xff, 0xff, 0xff }
@@ -172,10 +187,10 @@ static const u8 edp_swing_hbr2_hbr3[4][4] = {
 };
 
 static const u8 edp_pre_emp_hbr2_hbr3[4][4] = {
-	{ 0x08, 0x11, 0x17, 0x1b },
-	{ 0x00, 0x0c, 0x13, 0xff },
-	{ 0x05, 0x10, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+	{ 0x0c, 0x15, 0x19, 0x1e },
+	{ 0x0b, 0x15, 0x19, 0xff },
+	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x0d, 0xff, 0xff, 0xff }
 };
 
 static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
@@ -193,25 +208,25 @@ static const u8 edp_phy_vco_div_cfg_v4[4] = {
 	0x01, 0x01, 0x02, 0x00,
 };
 
-static const u8 edp_pre_emp_hbr_rbr_v5[4][4] = {
-	{ 0x05, 0x11, 0x17, 0x1d },
-	{ 0x05, 0x11, 0x18, 0xff },
-	{ 0x06, 0x11, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+static const u8 edp_swing_hbr2_hbr3_v3[4][4] = {
+	{ 0x06, 0x11, 0x16, 0x1b },
+	{ 0x0b, 0x19, 0x1f, 0xff },
+	{ 0x18, 0x1f, 0xff, 0xff },
+	{ 0x1f, 0xff, 0xff, 0xff }
 };
 
-static const u8 edp_pre_emp_hbr2_hbr3_v5[4][4] = {
+static const u8 edp_pre_emp_hbr2_hbr3_v3[4][4] = {
 	{ 0x0c, 0x15, 0x19, 0x1e },
-	{ 0x0b, 0x15, 0x19, 0xff },
-	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x09, 0x14, 0x19, 0xff },
+	{ 0x0f, 0x14, 0xff, 0xff },
 	{ 0x0d, 0xff, 0xff, 0xff }
 };
 
-static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v5 = {
+static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v3 = {
 	.swing_hbr_rbr = &edp_swing_hbr_rbr,
-	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3,
-	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr_v5,
-	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v5,
+	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3_v3,
+	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr,
+	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v3,
 };
 
 static const u8 edp_phy_aux_cfg_v5[DP_AUX_CFG_SIZE] = {
@@ -262,12 +277,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 	       DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
 	       edp->edp + DP_PHY_PD_CTL);
 
-	/*
-	 * TODO: Re-work the conditions around setting the cfg8 value
-	 * when more information becomes available about why this is
-	 * even needed.
-	 */
-	if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
+	if (!edp->is_edp)
 		aux_cfg[8] = 0xb7;
 
 	writel(0xfc, edp->edp + DP_PHY_MODE);
@@ -291,7 +301,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 
 static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configure_opts_dp *dp_opts)
 {
-	const struct qcom_edp_swing_pre_emph_cfg *cfg = edp->cfg->swing_pre_emph_cfg;
+	const struct qcom_edp_swing_pre_emph_cfg *cfg;
 	unsigned int v_level = 0;
 	unsigned int p_level = 0;
 	u8 ldo_config;
@@ -299,11 +309,10 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
 	u8 emph;
 	int i;
 
-	if (!cfg)
-		return 0;
-
 	if (edp->is_edp)
-		cfg = &edp_phy_swing_pre_emph_cfg;
+		cfg = edp->cfg->edp_swing_pre_emph_cfg;
+	else
+		cfg = edp->cfg->dp_swing_pre_emph_cfg;
 
 	for (i = 0; i < dp_opts->lanes; i++) {
 		v_level = max(v_level, dp_opts->voltage[i]);
@@ -564,20 +573,24 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
 	.is_edp = false,
 	.aux_cfg = edp_phy_aux_cfg_v5,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
 };
 
 static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
+	.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_v4,
 };
 
 static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
 };
 
@@ -585,7 +598,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
 	.is_edp = true,
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_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,
 };
 
@@ -766,7 +780,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
 };
 
@@ -945,7 +960,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
 static struct qcom_edp_phy_cfg glymur_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v8,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v8,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
 };
 
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 229 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur
eDP mode(low vdiff):
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
  drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
  1 file changed, 53 insertions(+), 37 deletions(-)
drivers/phy/qualcomm/phy-qcom-edp.c +51 -36
index 7372de05a0b8..36998326bae6 100644
@@ -87,7 +87,8 @@ struct qcom_edp_phy_cfg {
  	bool is_edp;
  	const u8 *aux_cfg;
  	const u8 *vco_div_cfg;
-	const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_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;
  };
 
@@ -116,17 +117,17 @@ struct qcom_edp {
  };
 
  static const u8 dp_swing_hbr_rbr[4][4] = {
-	{ 0x08, 0x0f, 0x16, 0x1f },
+	{ 0x07, 0x0f, 0x16, 0x1f },
  	{ 0x11, 0x1e, 0x1f, 0xff },
  	{ 0x16, 0x1f, 0xff, 0xff },
  	{ 0x1f, 0xff, 0xff, 0xff }
  };
 
  static const u8 dp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x00, 0x0d, 0x14, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0x1a },
  	{ 0x00, 0x0e, 0x15, 0xff },
  	{ 0x00, 0x0e, 0xff, 0xff },
-	{ 0x03, 0xff, 0xff, 0xff }
+	{ 0x04, 0xff, 0xff, 0xff }
  };
 
  static const u8 dp_swing_hbr2_hbr3[4][4] = {
@@ -150,6 +151,20 @@ static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
  	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
  };
 
+static const u8 dp_pre_emp_hbr_rbr_v8[4][4] = {
+	{ 0x00, 0x0e, 0x15, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0xff },
+	{ 0x00, 0x0e, 0xff, 0xff },
+	{ 0x00, 0xff, 0xff, 0xff }
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg_v8 = {
+	.swing_hbr_rbr = &dp_swing_hbr_rbr,
+	.swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
+	.pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr_v8,
+	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
+};
+
  static const u8 edp_swing_hbr_rbr[4][4] = {
  	{ 0x07, 0x0f, 0x16, 0x1f },
  	{ 0x0d, 0x16, 0x1e, 0xff },
@@ -158,7 +173,7 @@ static const u8 edp_swing_hbr_rbr[4][4] = {
  };
 
  static const u8 edp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x05, 0x12, 0x17, 0x1d },
+	{ 0x05, 0x11, 0x17, 0x1d },
  	{ 0x05, 0x11, 0x18, 0xff },
  	{ 0x06, 0x11, 0xff, 0xff },
  	{ 0x00, 0xff, 0xff, 0xff }
@@ -172,10 +187,10 @@ static const u8 edp_swing_hbr2_hbr3[4][4] = {
  };
 
  static const u8 edp_pre_emp_hbr2_hbr3[4][4] = {
-	{ 0x08, 0x11, 0x17, 0x1b },
-	{ 0x00, 0x0c, 0x13, 0xff },
-	{ 0x05, 0x10, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+	{ 0x0c, 0x15, 0x19, 0x1e },
+	{ 0x0b, 0x15, 0x19, 0xff },
+	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x0d, 0xff, 0xff, 0xff }
  };
 
  static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
@@ -193,25 +208,25 @@ static const u8 edp_phy_vco_div_cfg_v4[4] = {
  	0x01, 0x01, 0x02, 0x00,
  };
 
-static const u8 edp_pre_emp_hbr_rbr_v5[4][4] = {
-	{ 0x05, 0x11, 0x17, 0x1d },
-	{ 0x05, 0x11, 0x18, 0xff },
-	{ 0x06, 0x11, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+static const u8 edp_swing_hbr2_hbr3_v3[4][4] = {
+	{ 0x06, 0x11, 0x16, 0x1b },
+	{ 0x0b, 0x19, 0x1f, 0xff },
+	{ 0x18, 0x1f, 0xff, 0xff },
+	{ 0x1f, 0xff, 0xff, 0xff }
  };
 
-static const u8 edp_pre_emp_hbr2_hbr3_v5[4][4] = {
+static const u8 edp_pre_emp_hbr2_hbr3_v3[4][4] = {
  	{ 0x0c, 0x15, 0x19, 0x1e },
-	{ 0x0b, 0x15, 0x19, 0xff },
-	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x09, 0x14, 0x19, 0xff },
+	{ 0x0f, 0x14, 0xff, 0xff },
  	{ 0x0d, 0xff, 0xff, 0xff }
  };
 
-static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v5 = {
+static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v3 = {
  	.swing_hbr_rbr = &edp_swing_hbr_rbr,
-	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3,
-	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr_v5,
-	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v5,
+	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3_v3,
+	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr,
+	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v3,
  };
 
  static const u8 edp_phy_aux_cfg_v5[DP_AUX_CFG_SIZE] = {
@@ -262,12 +277,7 @@ static int qcom_edp_phy_init(struct phy *phy)
  	       DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
  	       edp->edp + DP_PHY_PD_CTL);
 
-	/*
-	 * TODO: Re-work the conditions around setting the cfg8 value
-	 * when more information becomes available about why this is
-	 * even needed.
-	 */
-	if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
+	if (!edp->is_edp)
  		aux_cfg[8] = 0xb7;
 
  	writel(0xfc, edp->edp + DP_PHY_MODE);
@@ -291,7 +301,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 
  static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configure_opts_dp *dp_opts)
  {
-	const struct qcom_edp_swing_pre_emph_cfg *cfg = edp->cfg->swing_pre_emph_cfg;
+	const struct qcom_edp_swing_pre_emph_cfg *cfg;
  	unsigned int v_level = 0;
  	unsigned int p_level = 0;
  	u8 ldo_config;
@@ -299,11 +309,10 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
  	u8 emph;
  	int i;
 
-	if (!cfg)
-		return 0;
-
  	if (edp->is_edp)
-		cfg = &edp_phy_swing_pre_emph_cfg;
+		cfg = edp->cfg->edp_swing_pre_emph_cfg;
+	else
+		cfg = edp->cfg->dp_swing_pre_emph_cfg;
 
  	for (i = 0; i < dp_opts->lanes; i++) {
  		v_level = max(v_level, dp_opts->voltage[i]);
@@ -564,20 +573,24 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
  	.is_edp = false,
  	.aux_cfg = edp_phy_aux_cfg_v5,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
  };
 
  static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
+	.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_v4,
  };
 
  static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
  };
 
@@ -585,7 +598,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
  	.is_edp = true,
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_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,
  };
 
@@ -766,7 +780,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
  static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
  };
 

drivers/phy/qualcomm/phy-qcom-edp.c static const struct phy_ver_ops qcom_edp_phy_ops_v8 = { · line 967

Quoted 9 lines
drivers/phy/qualcomm/phy-qcom-edp.c +2 -1
@@ -945,7 +960,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
  static struct qcom_edp_phy_cfg glymur_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v8,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v8,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
  };
 

Hi, maintanier, just a gentle ping on this patch in case it slipped through. Thanks!

#3 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

In reply to Yongxing Mou
Quoted 6 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Quoted 8 lines

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur

eDP mode(low vdiff):

Separate question: should we extend phy_configure_dp_opts with the low/high vdiff? Is there a point in providing the ability to toggle between low vdiff and high vdiff?

Quoted 2 lines
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280

I understand your wish to perform all the changes in a single patch, but there is one problem with that. Consider this patch regresses one of the platforms (I'm looking at Kodiak and SC8180X as they get the biggest set of changes). It would be almost impossible to separate, which particular change caused the regression. I'd suggest splitting this patch into a set of more atomic changes. E.g. the AUX_CFG8 is definitely a separate change. Writing swing / pre_emph tables on Kodiak and SC8180X is a separate change (or two). Switching each of the platforms to the corrected set of tables ideally also should come as a separate change, so that in case of a regression the issue would be easier to identify.

Quoted 31 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
 1 file changed, 53 insertions(+), 37 deletions(-)
drivers/phy/qualcomm/phy-qcom-edp.c +3 -2
index 7372de05a0b8..36998326bae6 100644
@@ -87,7 +87,8 @@ struct qcom_edp_phy_cfg {
 	bool is_edp;
 	const u8 *aux_cfg;
 	const u8 *vco_div_cfg;
-	const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_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;
 };
 
@@ -116,17 +117,17 @@ struct qcom_edp {
 };
 
 static const u8 dp_swing_hbr_rbr[4][4] = {
-	{ 0x08, 0x0f, 0x16, 0x1f },
+	{ 0x07, 0x0f, 0x16, 0x1f },
 	{ 0x11, 0x1e, 0x1f, 0xff },
 	{ 0x16, 0x1f, 0xff, 0xff },
 	{ 0x1f, 0xff, 0xff, 0xff }

drivers/phy/qualcomm/phy-qcom-edp.c struct qcom_edp { · line 131

Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-edp.c +2 -2
 };
 
 static const u8 dp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x00, 0x0d, 0x14, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0x1a },
 	{ 0x00, 0x0e, 0x15, 0xff },
 	{ 0x00, 0x0e, 0xff, 0xff },
-	{ 0x03, 0xff, 0xff, 0xff }
+	{ 0x04, 0xff, 0xff, 0xff }
 };

I've checked, at least this table doesn't match SC8180X configuration.

Quoted 24 lines
drivers/phy/qualcomm/phy-qcom-edp.c +14 -0
 static const u8 dp_swing_hbr2_hbr3[4][4] = {
@@ -150,6 +151,20 @@ static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
 	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
 };
 
+static const u8 dp_pre_emp_hbr_rbr_v8[4][4] = {
+	{ 0x00, 0x0e, 0x15, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0xff },
+	{ 0x00, 0x0e, 0xff, 0xff },
+	{ 0x00, 0xff, 0xff, 0xff }
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg_v8 = {
+	.swing_hbr_rbr = &dp_swing_hbr_rbr,
+	.swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
+	.pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr_v8,
+	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
+};
+
 static const u8 edp_swing_hbr_rbr[4][4] = {
 	{ 0x07, 0x0f, 0x16, 0x1f },
 	{ 0x0d, 0x16, 0x1e, 0xff },

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr_rbr[4][4] = { · line 176

Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-edp.c +1 -1
@@ -158,7 +173,7 @@ static const u8 edp_swing_hbr_rbr[4][4] = {
 };
 
 static const u8 edp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x05, 0x12, 0x17, 0x1d },
+	{ 0x05, 0x11, 0x17, 0x1d },

This was changed only for Kodiak. For SC8180X, I assume, we should be using the older table.

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr2_hbr3[4][4] = { · line 189

Quoted 7 lines
drivers/phy/qualcomm/phy-qcom-edp.c +0 -0
 	{ 0x05, 0x11, 0x18, 0xff },
 	{ 0x06, 0x11, 0xff, 0xff },
 	{ 0x00, 0xff, 0xff, 0xff }
@@ -172,10 +187,10 @@ static const u8 edp_swing_hbr2_hbr3[4][4] = {
 };
 
 static const u8 edp_pre_emp_hbr2_hbr3[4][4] = {

I think it becomes worth adding version to the "generic" tables. They are not that generic anyway.

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr2_hbr3[4][4] = { · line 193

Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-edp.c +4 -4
-	{ 0x08, 0x11, 0x17, 0x1b },
-	{ 0x00, 0x0c, 0x13, 0xff },
-	{ 0x05, 0x10, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+	{ 0x0c, 0x15, 0x19, 0x1e },
+	{ 0x0b, 0x15, 0x19, 0xff },
+	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x0d, 0xff, 0xff, 0xff }

Current table indeed doesn't match the swing table. Please take care about the SC8180X differences (I think, it will need separate set of tables).

Quoted 43 lines
drivers/phy/qualcomm/phy-qcom-edp.c +12 -12
 };
 
 static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
@@ -193,25 +208,25 @@ static const u8 edp_phy_vco_div_cfg_v4[4] = {
 	0x01, 0x01, 0x02, 0x00,
 };
 
-static const u8 edp_pre_emp_hbr_rbr_v5[4][4] = {
-	{ 0x05, 0x11, 0x17, 0x1d },
-	{ 0x05, 0x11, 0x18, 0xff },
-	{ 0x06, 0x11, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+static const u8 edp_swing_hbr2_hbr3_v3[4][4] = {
+	{ 0x06, 0x11, 0x16, 0x1b },
+	{ 0x0b, 0x19, 0x1f, 0xff },
+	{ 0x18, 0x1f, 0xff, 0xff },
+	{ 0x1f, 0xff, 0xff, 0xff }
 };
 
-static const u8 edp_pre_emp_hbr2_hbr3_v5[4][4] = {
+static const u8 edp_pre_emp_hbr2_hbr3_v3[4][4] = {
 	{ 0x0c, 0x15, 0x19, 0x1e },
-	{ 0x0b, 0x15, 0x19, 0xff },
-	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x09, 0x14, 0x19, 0xff },
+	{ 0x0f, 0x14, 0xff, 0xff },
 	{ 0x0d, 0xff, 0xff, 0xff }
 };
 
-static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v5 = {
+static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v3 = {
 	.swing_hbr_rbr = &edp_swing_hbr_rbr,
-	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3,
-	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr_v5,
-	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v5,
+	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3_v3,
+	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr,
+	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v3,
 };
 
 static const u8 edp_phy_aux_cfg_v5[DP_AUX_CFG_SIZE] = {
@@ -262,12 +277,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 	       DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,

drivers/phy/qualcomm/phy-qcom-edp.c static int qcom_edp_phy_init(struct phy *phy) · line 281

Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-edp.c +1 -6
 	       edp->edp + DP_PHY_PD_CTL);
 
-	/*
-	 * TODO: Re-work the conditions around setting the cfg8 value
-	 * when more information becomes available about why this is
-	 * even needed.
-	 */
-	if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
+	if (!edp->is_edp)
 		aux_cfg[8] = 0xb7;

This is a separate fix, as it changes the aux_cfg[8] value for Kodiak and SC8180X.

Quoted 54 lines
drivers/phy/qualcomm/phy-qcom-edp.c +10 -7
 	writel(0xfc, edp->edp + DP_PHY_MODE);
@@ -291,7 +301,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 
 static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configure_opts_dp *dp_opts)
 {
-	const struct qcom_edp_swing_pre_emph_cfg *cfg = edp->cfg->swing_pre_emph_cfg;
+	const struct qcom_edp_swing_pre_emph_cfg *cfg;
 	unsigned int v_level = 0;
 	unsigned int p_level = 0;
 	u8 ldo_config;
@@ -299,11 +309,10 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
 	u8 emph;
 	int i;
 
-	if (!cfg)
-		return 0;
-
 	if (edp->is_edp)
-		cfg = &edp_phy_swing_pre_emph_cfg;
+		cfg = edp->cfg->edp_swing_pre_emph_cfg;
+	else
+		cfg = edp->cfg->dp_swing_pre_emph_cfg;
 
 	for (i = 0; i < dp_opts->lanes; i++) {
 		v_level = max(v_level, dp_opts->voltage[i]);
@@ -564,20 +573,24 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
 	.is_edp = false,
 	.aux_cfg = edp_phy_aux_cfg_v5,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
 };
 
 static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
+	.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_v4,
 };
 
 static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
 };
 

drivers/phy/qualcomm/phy-qcom-edp.c static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = { · line 602

Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-edp.c +2 -1
@@ -585,7 +598,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
 	.is_edp = true,
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
+	.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
+	.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,

Ok, we are going to continue using eDP table because of is_edp = true.

Quoted 32 lines
drivers/phy/qualcomm/phy-qcom-edp.c +4 -2
 	.ver_ops = &qcom_edp_phy_ops_v4,
 };
 
@@ -766,7 +780,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v4,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
 };
 
@@ -945,7 +960,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
 static struct qcom_edp_phy_cfg glymur_phy_cfg = {
 	.aux_cfg = edp_phy_aux_cfg_v8,
 	.vco_div_cfg = edp_phy_vco_div_cfg_v8,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
 };
 
Signature · 8 lines
-- 
2.43.0


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 16 lines · Dmitry Baryshkov
Quoted 6 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Quoted 8 lines

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur

eDP mode(low vdiff):

Quoted 4 lines

Separate question: should we extend phy_configure_dp_opts with the low/high vdiff? Is there a point in providing the ability to toggle between low vdiff and high vdiff?

Emm ,i haven't found any platform using high vdiff so far, and I'm not clear in which cases switching between low and high vdiff would be needed.

Quoted 14 lines
Quoted 2 lines
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280

I understand your wish to perform all the changes in a single patch, but there is one problem with that. Consider this patch regresses one of the platforms (I'm looking at Kodiak and SC8180X as they get the biggest set of changes). It would be almost impossible to separate, which particular change caused the regression. I'd suggest splitting this patch into a set of more atomic changes. E.g. the AUX_CFG8 is definitely a separate change. Writing swing / pre_emph tables on Kodiak and SC8180X is a separate change (or two). Switching each of the platforms to the corrected set of tables ideally also should come as a separate change, so that in case of a regression the issue would be easier to identify.

Thank for point this, will separate the change.
I mostly overlooked SC8180X here, since I assumed it shares the same PHY as SC7280. However, they are using different PHY sub‑versions. Will add proper support for it in the next version.

Quoted 33 lines
Quoted 33 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
  drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
  1 file changed, 53 insertions(+), 37 deletions(-)
drivers/phy/qualcomm/phy-qcom-edp.c +3 -2
index 7372de05a0b8..36998326bae6 100644
@@ -87,7 +87,8 @@ struct qcom_edp_phy_cfg {
  	bool is_edp;
  	const u8 *aux_cfg;
  	const u8 *vco_div_cfg;
-	const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_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;
  };
 
@@ -116,17 +117,17 @@ struct qcom_edp {
  };
 
  static const u8 dp_swing_hbr_rbr[4][4] = {
-	{ 0x08, 0x0f, 0x16, 0x1f },
+	{ 0x07, 0x0f, 0x16, 0x1f },
  	{ 0x11, 0x1e, 0x1f, 0xff },
  	{ 0x16, 0x1f, 0xff, 0xff },
  	{ 0x1f, 0xff, 0xff, 0xff }
  };
 
Quoted 11 lines

drivers/phy/qualcomm/phy-qcom-edp.c struct qcom_edp { · line 131

Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-edp.c +2 -2
  static const u8 dp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x00, 0x0d, 0x14, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0x1a },
  	{ 0x00, 0x0e, 0x15, 0xff },
  	{ 0x00, 0x0e, 0xff, 0xff },
-	{ 0x03, 0xff, 0xff, 0xff }
+	{ 0x04, 0xff, 0xff, 0xff }
  };

I've checked, at least this table doesn't match SC8180X configuration.

Got it.

Quoted 26 lines
Quoted 26 lines
drivers/phy/qualcomm/phy-qcom-edp.c +14 -0
  static const u8 dp_swing_hbr2_hbr3[4][4] = {
@@ -150,6 +151,20 @@ static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
  	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
  };
 
+static const u8 dp_pre_emp_hbr_rbr_v8[4][4] = {
+	{ 0x00, 0x0e, 0x15, 0x1a },
+	{ 0x00, 0x0e, 0x15, 0xff },
+	{ 0x00, 0x0e, 0xff, 0xff },
+	{ 0x00, 0xff, 0xff, 0xff }
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg_v8 = {
+	.swing_hbr_rbr = &dp_swing_hbr_rbr,
+	.swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
+	.pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr_v8,
+	.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
+};
+
  static const u8 edp_swing_hbr_rbr[4][4] = {
  	{ 0x07, 0x0f, 0x16, 0x1f },
  	{ 0x0d, 0x16, 0x1e, 0xff },
@@ -158,7 +173,7 @@ static const u8 edp_swing_hbr_rbr[4][4] = {
  };
 
Quoted 7 lines

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr_rbr[4][4] = { · line 176

Quoted 3 lines
drivers/phy/qualcomm/phy-qcom-edp.c +1 -1
  static const u8 edp_pre_emp_hbr_rbr[4][4] = {
-	{ 0x05, 0x12, 0x17, 0x1d },
+	{ 0x05, 0x11, 0x17, 0x1d },

This was changed only for Kodiak. For SC8180X, I assume, we should be using the older table.

Emm, for SC8180X, eDP low VDIFF (High HBR) only S1 (250mV) P0-0dB Emphasis Settings "0x08" different from other "generic" tables which is "0x0B".

Quoted 11 lines

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr2_hbr3[4][4] = { · line 189

Quoted 7 lines
drivers/phy/qualcomm/phy-qcom-edp.c +0 -0
  	{ 0x05, 0x11, 0x18, 0xff },
  	{ 0x06, 0x11, 0xff, 0xff },
  	{ 0x00, 0xff, 0xff, 0xff }
@@ -172,10 +187,10 @@ static const u8 edp_swing_hbr2_hbr3[4][4] = {
  };
 
  static const u8 edp_pre_emp_hbr2_hbr3[4][4] = {

I think it becomes worth adding version to the "generic" tables. They are not that generic anyway.

Got it. SC8180X here need a different table..

Quoted 4 lines
Quoted 4 lines
drivers/phy/qualcomm/phy-qcom-edp.c +0 -4
-	{ 0x08, 0x11, 0x17, 0x1b },
-	{ 0x00, 0x0c, 0x13, 0xff },
-	{ 0x05, 0x10, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
Quoted 9 lines

drivers/phy/qualcomm/phy-qcom-edp.c static const u8 edp_swing_hbr2_hbr3[4][4] = { · line 193

Quoted 4 lines
drivers/phy/qualcomm/phy-qcom-edp.c +4 -0
+	{ 0x0c, 0x15, 0x19, 0x1e },
+	{ 0x0b, 0x15, 0x19, 0xff },
+	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x0d, 0xff, 0xff, 0xff }

Current table indeed doesn't match the swing table. Please take care about the SC8180X differences (I think, it will need separate set of tables).

Got it.

Quoted 45 lines
Quoted 45 lines
drivers/phy/qualcomm/phy-qcom-edp.c +12 -12
  };
 
  static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
@@ -193,25 +208,25 @@ static const u8 edp_phy_vco_div_cfg_v4[4] = {
  	0x01, 0x01, 0x02, 0x00,
  };
 
-static const u8 edp_pre_emp_hbr_rbr_v5[4][4] = {
-	{ 0x05, 0x11, 0x17, 0x1d },
-	{ 0x05, 0x11, 0x18, 0xff },
-	{ 0x06, 0x11, 0xff, 0xff },
-	{ 0x00, 0xff, 0xff, 0xff }
+static const u8 edp_swing_hbr2_hbr3_v3[4][4] = {
+	{ 0x06, 0x11, 0x16, 0x1b },
+	{ 0x0b, 0x19, 0x1f, 0xff },
+	{ 0x18, 0x1f, 0xff, 0xff },
+	{ 0x1f, 0xff, 0xff, 0xff }
  };
 
-static const u8 edp_pre_emp_hbr2_hbr3_v5[4][4] = {
+static const u8 edp_pre_emp_hbr2_hbr3_v3[4][4] = {
  	{ 0x0c, 0x15, 0x19, 0x1e },
-	{ 0x0b, 0x15, 0x19, 0xff },
-	{ 0x0e, 0x14, 0xff, 0xff },
+	{ 0x09, 0x14, 0x19, 0xff },
+	{ 0x0f, 0x14, 0xff, 0xff },
  	{ 0x0d, 0xff, 0xff, 0xff }
  };
 
-static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v5 = {
+static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg_v3 = {
  	.swing_hbr_rbr = &edp_swing_hbr_rbr,
-	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3,
-	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr_v5,
-	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v5,
+	.swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3_v3,
+	.pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr,
+	.pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3_v3,
  };
 
  static const u8 edp_phy_aux_cfg_v5[DP_AUX_CFG_SIZE] = {
@@ -262,12 +277,7 @@ static int qcom_edp_phy_init(struct phy *phy)
  	       DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
  	       edp->edp + DP_PHY_PD_CTL);
 
Quoted 12 lines

drivers/phy/qualcomm/phy-qcom-edp.c static int qcom_edp_phy_init(struct phy *phy) · line 281

Quoted 8 lines
drivers/phy/qualcomm/phy-qcom-edp.c +1 -6
-	/*
-	 * TODO: Re-work the conditions around setting the cfg8 value
-	 * when more information becomes available about why this is
-	 * even needed.
-	 */
-	if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
+	if (!edp->is_edp)
  		aux_cfg[8] = 0xb7;

This is a separate fix, as it changes the aux_cfg[8] value for Kodiak and SC8180X.

Got it.

Quoted 96 lines
Quoted 54 lines
drivers/phy/qualcomm/phy-qcom-edp.c +10 -7
  	writel(0xfc, edp->edp + DP_PHY_MODE);
@@ -291,7 +301,7 @@ static int qcom_edp_phy_init(struct phy *phy)
 
  static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configure_opts_dp *dp_opts)
  {
-	const struct qcom_edp_swing_pre_emph_cfg *cfg = edp->cfg->swing_pre_emph_cfg;
+	const struct qcom_edp_swing_pre_emph_cfg *cfg;
  	unsigned int v_level = 0;
  	unsigned int p_level = 0;
  	u8 ldo_config;
@@ -299,11 +309,10 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
  	u8 emph;
  	int i;
 
-	if (!cfg)
-		return 0;
-
  	if (edp->is_edp)
-		cfg = &edp_phy_swing_pre_emph_cfg;
+		cfg = edp->cfg->edp_swing_pre_emph_cfg;
+	else
+		cfg = edp->cfg->dp_swing_pre_emph_cfg;
 
  	for (i = 0; i < dp_opts->lanes; i++) {
  		v_level = max(v_level, dp_opts->voltage[i]);
@@ -564,20 +573,24 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
  	.is_edp = false,
  	.aux_cfg = edp_phy_aux_cfg_v5,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
  };
 
  static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
+	.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_v4,
  };
 
  static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
  };
 

drivers/phy/qualcomm/phy-qcom-edp.c static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = { · line 602

Quoted 6 lines
drivers/phy/qualcomm/phy-qcom-edp.c +2 -1
@@ -585,7 +598,8 @@ static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
  	.is_edp = true,
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
+	.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
+	.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,

Ok, we are going to continue using eDP table because of is_edp = true.

Quoted 32 lines
drivers/phy/qualcomm/phy-qcom-edp.c +4 -2
  	.ver_ops = &qcom_edp_phy_ops_v4,
  };
 
@@ -766,7 +780,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
  static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v4,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
-	.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_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,
  };
 
@@ -945,7 +960,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
  static struct qcom_edp_phy_cfg glymur_phy_cfg = {
  	.aux_cfg = edp_phy_aux_cfg_v8,
  	.vco_div_cfg = edp_phy_vco_div_cfg_v8,
-	.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg_v5,
+	.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,
  };
 
Signature · 8 lines
-- 
2.43.0


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#5 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 19 lines · Yongxing Mou
Quoted 16 lines · Dmitry Baryshkov
Quoted 14 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur

eDP mode(low vdiff):

Quoted 6 lines
Quoted 4 lines

Separate question: should we extend phy_configure_dp_opts with the low/high vdiff? Is there a point in providing the ability to toggle between low vdiff and high vdiff?

Emm ,i haven't found any platform using high vdiff so far, and I'm not clear in which cases switching between low and high vdiff would be needed.

From my (maybe incorrect) understanding of eDP B.3, the high vs low vdiff selection should be based on the cable length.

Quoted 15 lines
Quoted 4 lines
Quoted 3 lines
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Quoted 11 lines

I understand your wish to perform all the changes in a single patch, but there is one problem with that. Consider this patch regresses one of the platforms (I'm looking at Kodiak and SC8180X as they get the biggest set of changes). It would be almost impossible to separate, which particular change caused the regression. I'd suggest splitting this patch into a set of more atomic changes. E.g. the AUX_CFG8 is definitely a separate change. Writing swing / pre_emph tables on Kodiak and SC8180X is a separate change (or two). Switching each of the platforms to the corrected set of tables ideally also should come as a separate change, so that in case of a regression the issue would be easier to identify.

Quoted 4 lines

Thank for point this, will separate the change.
I mostly overlooked SC8180X here, since I assumed it shares the same PHY as SC7280. However, they are using different PHY sub‑versions. Will add proper support for it in the next version.

Thanks!

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
  drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
  1 file changed, 53 insertions(+), 37 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 24 lines · Dmitry Baryshkov
Quoted 23 lines · Yongxing Mou
Quoted 20 lines · Dmitry Baryshkov
Quoted 6 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Quoted 8 lines

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur

eDP mode(low vdiff):

Separate question: should we extend phy_configure_dp_opts with the low/high vdiff? Is there a point in providing the ability to toggle between low vdiff and high vdiff?

Quoted 6 lines
Quoted 2 lines

Emm ,i haven't found any platform using high vdiff so far, and I'm not clear in which cases switching between low and high vdiff would be needed.

From my (maybe incorrect) understanding of eDP B.3, the high vs low
vdiff selection should be based on the cable length.

Thanks for the explanation. Maybe we can add this when we really need it.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280

I understand your wish to perform all the changes in a single patch, but there is one problem with that. Consider this patch regresses one of the platforms (I'm looking at Kodiak and SC8180X as they get the biggest set of changes). It would be almost impossible to separate, which particular change caused the regression. I'd suggest splitting this patch into a set of more atomic changes. E.g. the AUX_CFG8 is definitely a separate change. Writing swing / pre_emph tables on Kodiak and SC8180X is a separate change (or two). Switching each of the platforms to the corrected set of tables ideally also should come as a separate change, so that in case of a regression the issue would be easier to identify.

Quoted 7 lines
Quoted 4 lines

Thank for point this, will separate the change.
I mostly overlooked SC8180X here, since I assumed it shares the same PHY as SC7280. However, they are using different PHY sub‑versions. Will add proper support for it in the next version.

Thanks!

Emm, one more question.. Based on Konard's comments, should I split this patch, and send a new revision, or post a new SC8180X patch on top of these two existing patches?

Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
   drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
   1 file changed, 53 insertions(+), 37 deletions(-)
#7 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 54 lines · Yongxing Mou
Quoted 24 lines · Dmitry Baryshkov
Quoted 23 lines · Yongxing Mou
Quoted 20 lines · Dmitry Baryshkov
Quoted 6 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Quoted 8 lines

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur

eDP mode(low vdiff):

Separate question: should we extend phy_configure_dp_opts with the low/high vdiff? Is there a point in providing the ability to toggle between low vdiff and high vdiff?

Quoted 6 lines
Quoted 2 lines

Emm ,i haven't found any platform using high vdiff so far, and I'm not clear in which cases switching between low and high vdiff would be needed.

From my (maybe incorrect) understanding of eDP B.3, the high vs low
vdiff selection should be based on the cable length.

Thanks for the explanation. Maybe we can add this when we really need it.

Quoted 20 lines
Quoted 19 lines
Quoted 4 lines
Quoted 3 lines
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Quoted 11 lines

I understand your wish to perform all the changes in a single patch, but there is one problem with that. Consider this patch regresses one of the platforms (I'm looking at Kodiak and SC8180X as they get the biggest set of changes). It would be almost impossible to separate, which particular change caused the regression. I'd suggest splitting this patch into a set of more atomic changes. E.g. the AUX_CFG8 is definitely a separate change. Writing swing / pre_emph tables on Kodiak and SC8180X is a separate change (or two). Switching each of the platforms to the corrected set of tables ideally also should come as a separate change, so that in case of a regression the issue would be easier to identify.

Thank for point this, will separate the change.
I mostly overlooked SC8180X here, since I assumed it shares the same PHY as SC7280. However, they are using different PHY sub‑versions. Will add proper support for it in the next version.

Quoted 5 lines
Quoted 2 lines

Thanks!

Emm, one more question.. Based on Konard's comments, should I split this patch, and send a new revision, or post a new SC8180X patch on top of these two existing patches?

Please split this commit into logical chunks, as I wrote before. SC8180X would be one of those patches.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
   drivers/phy/qualcomm/phy-qcom-edp.c | 90 ++++++++++++++++++++++---------------
   1 file changed, 53 insertions(+), 37 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v3 1/2
#8 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

In reply to Yongxing Mou
Quoted 17 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur
eDP mode(low vdiff):
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Quoted 4 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

I went through everything and all the sequences are OK.

SC8180X will need changes, but it's already incorrect so this doesn't necessarily affect it

Thanks!

Konrad

#9 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 25 lines · Konrad Dybcio
Quoted 17 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:

	-sa8775p/sc7280/sc8280xp/x1e80100
	-glymur
eDP mode(low vdiff):
	-glymur/sa8775p/sc8280xp/x1e80100
	-sc7280
Quoted 4 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

I went through everything and all the sequences are OK.

Quoted 8 lines

SC8180X will need changes, but it's already incorrect so this doesn't necessarily affect it

Thanks!

Konrad

Thanks here.. I didn’t notice before that SC8180X is different from SC7280, and will correct it in the next version.

#10 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 31 lines · Yongxing Mou
Quoted 28 lines · Konrad Dybcio
Quoted 17 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:
    -sa8775p/sc7280/sc8280xp/x1e80100
    -glymur
eDP mode(low vdiff):
    -glymur/sa8775p/sc8280xp/x1e80100
    -sc7280

Quoted 4 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

I went through everything and all the sequences are OK.

SC8180X will need changes, but it's already incorrect so this doesn't necessarily affect it

Quoted 6 lines
Quoted 5 lines

Thanks!

Konrad

Thanks here.. I didn’t notice before that SC8180X is different from SC7280, and will correct it in the next version.

Please make it another patch on top of these two, so that we don't have to re-validate the existing diff

Konrad

#11 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 36 lines · Konrad Dybcio
Quoted 35 lines · Yongxing Mou
Quoted 32 lines · Konrad Dybcio
Quoted 17 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:
    -sa8775p/sc7280/sc8280xp/x1e80100
    -glymur
eDP mode(low vdiff):
    -glymur/sa8775p/sc8280xp/x1e80100
    -sc7280

Quoted 4 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

I went through everything and all the sequences are OK.

SC8180X will need changes, but it's already incorrect so this doesn't necessarily affect it

Thanks!

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Konrad

Thanks here.. I didn’t notice before that SC8180X is different from SC7280, and will correct it in the next version.

Please make it another patch on top of these two, so that we don't have to re-validate the existing diff

Konrad

Thanks very much for the validating this patch. Could you sync with Dmitry how i post next patch?... He suggest me to splite this patch...

#12 lore raw

Re: [PATCH v3 1/2] phy: qcom: edp: Add eDP/DP mode switch support

Quoted 39 lines · Yongxing Mou
Quoted 36 lines · Konrad Dybcio
Quoted 35 lines · Yongxing Mou
Quoted 32 lines · Konrad Dybcio
Quoted 17 lines · Yongxing Mou

The eDP PHY supports both eDP&DP modes, each requires a different table. The current driver doesn't fully support every combo PHY mode and use either the eDP or DP table when enable the platform. In addition, some platforms mismatch between the mode and the table where DP mode uses the eDP table or eDP mode use the DP table.

Clean up and correct the tables for currently supported platforms based on the HPG specification.

Here lists the tables can be reused across current platforms. DP mode:
     -sa8775p/sc7280/sc8280xp/x1e80100
     -glymur
eDP mode(low vdiff):
     -glymur/sa8775p/sc8280xp/x1e80100
     -sc7280

Quoted 4 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

I went through everything and all the sequences are OK.

SC8180X will need changes, but it's already incorrect so this doesn't necessarily affect it

Thanks!

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Konrad

Thanks here.. I didn’t notice before that SC8180X is different from SC7280, and will correct it in the next version.

Please make it another patch on top of these two, so that we don't have to re-validate the existing diff

Konrad

Thanks very much for the validating this patch. Could you sync with Dmitry how i post next patch?... He suggest me to splite this patch...

Eh I guess he's right.. I think the following approach should be fine:

- take your current change
- split it up into smaller pieces (so that the resulting diff is the same)
- add a 8180 fixup on top

Konrad

#13 lore raw

PATCH v3 2/2 phy: qcom: edp: Add per-version LDO configuration callback

In reply to Yongxing Mou

For eDP low Vdiff, the LDO setting depends on the PHY version, instead of being a simple 0x0 or 0x01. Introduce the com_ldo_config callback to correct LDO setting accroding to the HPG.

Since SC7280 uses different LDO settings than SA8775P/SC8280XP, introduce qcom_edp_phy_ops_v3 to keep the LDO setting correct.

Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 86 ++++++++++++++++++++++++++++++++-----
 1 file changed, 76 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-edp.c +76 -10
index 36998326bae6..d29e548fce9d 100644
@@ -81,6 +81,7 @@ struct phy_ver_ops {
 	int (*com_clk_fwd_cfg)(const struct qcom_edp *edp);
 	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);
 };
 
 struct qcom_edp_phy_cfg {
@@ -304,7 +305,7 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
 	const struct qcom_edp_swing_pre_emph_cfg *cfg;
 	unsigned int v_level = 0;
 	unsigned int p_level = 0;
-	u8 ldo_config;
+	int ret;
 	u8 swing;
 	u8 emph;
 	int i;
@@ -330,13 +331,13 @@ static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configur
 	if (swing == 0xff || emph == 0xff)
 		return -EINVAL;
 
-	ldo_config = edp->is_edp ? 0x0 : 0x1;
+	ret = edp->cfg->ver_ops->com_ldo_config(edp);
+	if (ret)
+		return ret;
 
-	writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);
 	writel(swing, edp->tx0 + TXn_TX_DRV_LVL);
 	writel(emph, edp->tx0 + TXn_TX_EMP_POST1_LVL);
 
-	writel(ldo_config, edp->tx1 + TXn_LDO_CONFIG);
 	writel(swing, edp->tx1 + TXn_TX_DRV_LVL);
 	writel(emph, edp->tx1 + TXn_TX_EMP_POST1_LVL);
 
@@ -560,6 +561,52 @@ static int qcom_edp_com_configure_pll_v4(const struct qcom_edp *edp)
 	return 0;
 }
 
+static int qcom_edp_ldo_config_v3(const struct qcom_edp *edp)
+{
+	const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts;
+	u32 ldo_config;
+
+	if (!edp->is_edp)
+		ldo_config = 0x0;
+	else if (dp_opts->link_rate <= 2700)
+		ldo_config = 0x81;
+	else
+		ldo_config = 0x41;
+
+	writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);
+	writel(dp_opts->lanes > 2 ? ldo_config : 0x00, edp->tx1 + TXn_LDO_CONFIG);
+
+	return 0;
+}
+
+static int qcom_edp_ldo_config_v4(const struct qcom_edp *edp)
+{
+	const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts;
+	u32 ldo_config;
+
+	if (!edp->is_edp)
+		ldo_config = 0x0;
+	else if (dp_opts->link_rate <= 2700)
+		ldo_config = 0xc1;
+	else
+		ldo_config = 0x81;
+
+	writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);
+	writel(dp_opts->lanes > 2 ? ldo_config : 0x00, edp->tx1 + TXn_LDO_CONFIG);
+
+	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,
+	.com_bias_en_clkbuflr	= qcom_edp_com_bias_en_clkbuflr_v4,
+	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_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_v3,
+};
+
 static const struct phy_ver_ops qcom_edp_phy_ops_v4 = {
 	.com_power_on		= qcom_edp_phy_power_on_v4,
 	.com_resetsm_cntrl	= qcom_edp_phy_com_resetsm_cntrl_v4,
@@ -567,6 +614,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v4 = {
 	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_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,
 };
 
 static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
@@ -583,7 +631,7 @@ static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
 	.vco_div_cfg = edp_phy_vco_div_cfg_v4,
 	.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_v4,
+	.ver_ops = &qcom_edp_phy_ops_v3,
 };
 
 static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
@@ -768,6 +816,24 @@ static int qcom_edp_com_configure_pll_v6(const struct qcom_edp *edp)
 	return 0;
 }
 
+static int qcom_edp_ldo_config_v6(const struct qcom_edp *edp)
+{
+	const struct phy_configure_opts_dp *dp_opts = &edp->dp_opts;
+	u32 ldo_config;
+
+	if (!edp->is_edp)
+		ldo_config = 0x0;
+	else if (dp_opts->link_rate <= 2700)
+		ldo_config = 0x51;
+	else
+		ldo_config = 0x91;
+
+	writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);
+	writel(dp_opts->lanes > 2 ? ldo_config : 0x00, edp->tx1 + TXn_LDO_CONFIG);
+
+	return 0;
+}
+
 static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 	.com_power_on		= qcom_edp_phy_power_on_v6,
 	.com_resetsm_cntrl	= qcom_edp_phy_com_resetsm_cntrl_v6,
@@ -775,6 +841,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
 	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_v4,
 	.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,
 };
 
 static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
@@ -955,6 +1022,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
 	.com_clk_fwd_cfg	= qcom_edp_com_clk_fwd_cfg_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,
 };
 
 static struct qcom_edp_phy_cfg glymur_phy_cfg = {
@@ -970,7 +1038,6 @@ static int qcom_edp_phy_power_on(struct phy *phy)
 	const struct qcom_edp *edp = phy_get_drvdata(phy);
 	u32 bias0_en, drvr0_en, bias1_en, drvr1_en;
 	unsigned long pixel_freq;
-	u8 ldo_config = 0x0;
 	int ret;
 	u32 val;
 	u8 cfg1;
@@ -979,11 +1046,10 @@ static int qcom_edp_phy_power_on(struct phy *phy)
 	if (ret)
 		return ret;
 
-	if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
-		ldo_config = 0x1;
+	ret = edp->cfg->ver_ops->com_ldo_config(edp);
+	if (ret)
+		return ret;
 
-	writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);
-	writel(ldo_config, edp->tx1 + TXn_LDO_CONFIG);
 	writel(0x00, edp->tx0 + TXn_LANE_MODE_1);
 	writel(0x00, edp->tx1 + TXn_LANE_MODE_1);
 
Signature · 1 line
2.43.0
Reviewed-by Tested-by on v3 2/2
#14 lore raw

Re: [PATCH v3 2/2] phy: qcom: edp: Add per-version LDO configuration callback

Quoted 11 lines · Yongxing Mou

For eDP low Vdiff, the LDO setting depends on the PHY version, instead of being a simple 0x0 or 0x01. Introduce the com_ldo_config callback to correct LDO setting accroding to the HPG.

Since SC7280 uses different LDO settings than SA8775P/SC8280XP, introduce qcom_edp_phy_ops_v3 to keep the LDO setting correct.

Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")

---

Konrad

Reviewed-by on v3 2/2
#15 lore raw

Re: [PATCH v3 2/2] phy: qcom: edp: Add per-version LDO configuration callback

In reply to Yongxing Mou
Quoted 6 lines · Yongxing Mou

For eDP low Vdiff, the LDO setting depends on the PHY version, instead of being a simple 0x0 or 0x01. Introduce the com_ldo_config callback to correct LDO setting accroding to the HPG.

Since SC7280 uses different LDO settings than SA8775P/SC8280XP, introduce qcom_edp_phy_ops_v3 to keep the LDO setting correct.

Please mention that this also uses low vdiff for eDP.

With that in place:

Quoted 7 lines
Fixes f199223cb490 ("phy: qcom: Introduce new eDP PHY driver")
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 86 ++++++++++++++++++++++++++++++++-----
 1 file changed, 76 insertions(+), 10 deletions(-)
Signature · 2 lines
With best wishes
Dmitry