Skip to content

Commit 3011c36

Browse files
Yongxing Mouvinodkoul
authored andcommitted
phy: qcom: edp: Add eDP/DP mode switch support
The eDP PHY supports both eDP/DP modes, each requiring a different swing/pre-emphasis table. However, the driver currently uses a fixed static table for eDP programming rather than selecting the appropriate table based on the current mode. Add separate tables for eDP and DP modes, and select the appropriate table dynamically based on the current mode. Glymur's DP mode table differs from the other platforms, add a dedicated table for it. This also fixes the table mismatch for X1E80100 (eDP) and SA8775P (DP). Cc: stable@vger.kernel.org Fixes: 3f12bf1 ("phy: qcom: edp: Add support for eDP PHY on SA8775P") Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Yongxing Mou <yongxing.mou@oss.qualcomm.com> Link: https://patch.msgid.link/20260427-edp_phy-v5-2-3bb876824475@oss.qualcomm.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent fd67288 commit 3011c36

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

drivers/phy/qualcomm/phy-qcom-edp.c

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ struct qcom_edp_phy_cfg {
8787
bool is_edp;
8888
const u8 *aux_cfg;
8989
const u8 *vco_div_cfg;
90-
const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_cfg;
90+
const struct qcom_edp_swing_pre_emph_cfg *dp_swing_pre_emph_cfg;
91+
const struct qcom_edp_swing_pre_emph_cfg *edp_swing_pre_emph_cfg;
9192
const struct phy_ver_ops *ver_ops;
9293
};
9394

@@ -150,6 +151,20 @@ static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
150151
.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
151152
};
152153

154+
static const u8 dp_pre_emp_hbr_rbr_v8[4][4] = {
155+
{ 0x00, 0x0e, 0x15, 0x1a },
156+
{ 0x00, 0x0e, 0x15, 0xff },
157+
{ 0x00, 0x0e, 0xff, 0xff },
158+
{ 0x00, 0xff, 0xff, 0xff }
159+
};
160+
161+
static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg_v8 = {
162+
.swing_hbr_rbr = &dp_swing_hbr_rbr,
163+
.swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
164+
.pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr_v8,
165+
.pre_emphasis_hbr3_hbr2 = &dp_pre_emp_hbr2_hbr3,
166+
};
167+
153168
static const u8 edp_swing_hbr_rbr[4][4] = {
154169
{ 0x07, 0x0f, 0x16, 0x1f },
155170
{ 0x0d, 0x16, 0x1e, 0xff },
@@ -246,7 +261,7 @@ static int qcom_edp_phy_init(struct phy *phy)
246261
* when more information becomes available about why this is
247262
* even needed.
248263
*/
249-
if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
264+
if (edp->cfg->dp_swing_pre_emph_cfg && !edp->is_edp)
250265
aux_cfg[8] = 0xb7;
251266

252267
writel(0xfc, edp->edp + DP_PHY_MODE);
@@ -270,20 +285,22 @@ static int qcom_edp_phy_init(struct phy *phy)
270285

271286
static int qcom_edp_set_voltages(struct qcom_edp *edp, const struct phy_configure_opts_dp *dp_opts)
272287
{
273-
const struct qcom_edp_swing_pre_emph_cfg *cfg = edp->cfg->swing_pre_emph_cfg;
288+
const struct qcom_edp_swing_pre_emph_cfg *cfg;
274289
unsigned int v_level = 0;
275290
unsigned int p_level = 0;
276291
u8 ldo_config;
277292
u8 swing;
278293
u8 emph;
279294
int i;
280295

296+
if (edp->is_edp)
297+
cfg = edp->cfg->edp_swing_pre_emph_cfg;
298+
else
299+
cfg = edp->cfg->dp_swing_pre_emph_cfg;
300+
281301
if (!cfg)
282302
return 0;
283303

284-
if (edp->is_edp)
285-
cfg = &edp_phy_swing_pre_emph_cfg;
286-
287304
for (i = 0; i < dp_opts->lanes; i++) {
288305
v_level = max(v_level, dp_opts->voltage[i]);
289306
p_level = max(p_level, dp_opts->pre[i]);
@@ -543,7 +560,8 @@ static const struct qcom_edp_phy_cfg sa8775p_dp_phy_cfg = {
543560
.is_edp = false,
544561
.aux_cfg = edp_phy_aux_cfg_v5,
545562
.vco_div_cfg = edp_phy_vco_div_cfg_v4,
546-
.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
563+
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
564+
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
547565
.ver_ops = &qcom_edp_phy_ops_v4,
548566
};
549567

@@ -556,15 +574,17 @@ static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
556574
static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
557575
.aux_cfg = edp_phy_aux_cfg_v4,
558576
.vco_div_cfg = edp_phy_vco_div_cfg_v4,
559-
.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
577+
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
578+
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
560579
.ver_ops = &qcom_edp_phy_ops_v4,
561580
};
562581

563582
static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
564583
.is_edp = true,
565584
.aux_cfg = edp_phy_aux_cfg_v4,
566585
.vco_div_cfg = edp_phy_vco_div_cfg_v4,
567-
.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
586+
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
587+
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
568588
.ver_ops = &qcom_edp_phy_ops_v4,
569589
};
570590

@@ -745,7 +765,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
745765
static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
746766
.aux_cfg = edp_phy_aux_cfg_v4,
747767
.vco_div_cfg = edp_phy_vco_div_cfg_v4,
748-
.swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
768+
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
769+
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
749770
.ver_ops = &qcom_edp_phy_ops_v6,
750771
};
751772

@@ -924,7 +945,8 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v8 = {
924945
static struct qcom_edp_phy_cfg glymur_phy_cfg = {
925946
.aux_cfg = edp_phy_aux_cfg_v8,
926947
.vco_div_cfg = edp_phy_vco_div_cfg_v8,
927-
.swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
948+
.dp_swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg_v8,
949+
.edp_swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
928950
.ver_ops = &qcom_edp_phy_ops_v8,
929951
};
930952

@@ -942,7 +964,7 @@ static int qcom_edp_phy_power_on(struct phy *phy)
942964
if (ret)
943965
return ret;
944966

945-
if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
967+
if (edp->cfg->edp_swing_pre_emph_cfg && !edp->is_edp)
946968
ldo_config = 0x1;
947969

948970
writel(ldo_config, edp->tx0 + TXn_LDO_CONFIG);

0 commit comments

Comments
 (0)