3232#define DP_PHY_PD_CTL 0x001c
3333#define DP_PHY_MODE 0x0020
3434
35- #define DP_PHY_AUX_CFG0 0x0024
36- #define DP_PHY_AUX_CFG1 0x0028
37- #define DP_PHY_AUX_CFG2 0x002C
38- #define DP_PHY_AUX_CFG3 0x0030
39- #define DP_PHY_AUX_CFG4 0x0034
40- #define DP_PHY_AUX_CFG5 0x0038
41- #define DP_PHY_AUX_CFG6 0x003C
42- #define DP_PHY_AUX_CFG7 0x0040
43- #define DP_PHY_AUX_CFG8 0x0044
44- #define DP_PHY_AUX_CFG9 0x0048
35+ #define DP_AUX_CFG_SIZE 10
36+ #define DP_PHY_AUX_CFG (n ) (0x24 + (0x04 * (n)))
4537
4638#define DP_PHY_AUX_INTERRUPT_MASK 0x0058
4739
@@ -90,6 +82,7 @@ struct phy_ver_ops {
9082
9183struct qcom_edp_phy_cfg {
9284 bool is_edp ;
85+ const u8 * aux_cfg ;
9386 const struct qcom_edp_swing_pre_emph_cfg * swing_pre_emph_cfg ;
9487 const struct phy_ver_ops * ver_ops ;
9588};
@@ -186,11 +179,15 @@ static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
186179 .pre_emphasis_hbr3_hbr2 = & edp_pre_emp_hbr2_hbr3 ,
187180};
188181
182+ static const u8 edp_phy_aux_cfg_v4 [10 ] = {
183+ 0x00 , 0x13 , 0x24 , 0x00 , 0x0a , 0x26 , 0x0a , 0x03 , 0x37 , 0x03
184+ };
185+
189186static int qcom_edp_phy_init (struct phy * phy )
190187{
191188 struct qcom_edp * edp = phy_get_drvdata (phy );
189+ u8 aux_cfg [DP_AUX_CFG_SIZE ];
192190 int ret ;
193- u8 cfg8 ;
194191
195192 ret = regulator_bulk_enable (ARRAY_SIZE (edp -> supplies ), edp -> supplies );
196193 if (ret )
@@ -200,6 +197,8 @@ static int qcom_edp_phy_init(struct phy *phy)
200197 if (ret )
201198 goto out_disable_supplies ;
202199
200+ memcpy (aux_cfg , edp -> cfg -> aux_cfg , sizeof (aux_cfg ));
201+
203202 writel (DP_PHY_PD_CTL_PWRDN | DP_PHY_PD_CTL_AUX_PWRDN |
204203 DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN ,
205204 edp -> edp + DP_PHY_PD_CTL );
@@ -222,22 +221,12 @@ static int qcom_edp_phy_init(struct phy *phy)
222221 * even needed.
223222 */
224223 if (edp -> cfg -> swing_pre_emph_cfg && !edp -> is_edp )
225- cfg8 = 0xb7 ;
226- else
227- cfg8 = 0x37 ;
224+ aux_cfg [8 ] = 0xb7 ;
228225
229226 writel (0xfc , edp -> edp + DP_PHY_MODE );
230227
231- writel (0x00 , edp -> edp + DP_PHY_AUX_CFG0 );
232- writel (0x13 , edp -> edp + DP_PHY_AUX_CFG1 );
233- writel (0x24 , edp -> edp + DP_PHY_AUX_CFG2 );
234- writel (0x00 , edp -> edp + DP_PHY_AUX_CFG3 );
235- writel (0x0a , edp -> edp + DP_PHY_AUX_CFG4 );
236- writel (0x26 , edp -> edp + DP_PHY_AUX_CFG5 );
237- writel (0x0a , edp -> edp + DP_PHY_AUX_CFG6 );
238- writel (0x03 , edp -> edp + DP_PHY_AUX_CFG7 );
239- writel (cfg8 , edp -> edp + DP_PHY_AUX_CFG8 );
240- writel (0x03 , edp -> edp + DP_PHY_AUX_CFG9 );
228+ for (int i = 0 ; i < DP_AUX_CFG_SIZE ; i ++ )
229+ writel (aux_cfg [i ], edp -> edp + DP_PHY_AUX_CFG (i ));
241230
242231 writel (PHY_AUX_STOP_ERR_MASK | PHY_AUX_DEC_ERR_MASK |
243232 PHY_AUX_SYNC_ERR_MASK | PHY_AUX_ALIGN_ERR_MASK |
@@ -519,16 +508,19 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v4 = {
519508};
520509
521510static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
511+ .aux_cfg = edp_phy_aux_cfg_v4 ,
522512 .ver_ops = & qcom_edp_phy_ops_v4 ,
523513};
524514
525515static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
516+ .aux_cfg = edp_phy_aux_cfg_v4 ,
526517 .swing_pre_emph_cfg = & dp_phy_swing_pre_emph_cfg ,
527518 .ver_ops = & qcom_edp_phy_ops_v4 ,
528519};
529520
530521static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
531522 .is_edp = true,
523+ .aux_cfg = edp_phy_aux_cfg_v4 ,
532524 .swing_pre_emph_cfg = & edp_phy_swing_pre_emph_cfg ,
533525 .ver_ops = & qcom_edp_phy_ops_v4 ,
534526};
@@ -707,6 +699,7 @@ static const struct phy_ver_ops qcom_edp_phy_ops_v6 = {
707699};
708700
709701static struct qcom_edp_phy_cfg x1e80100_phy_cfg = {
702+ .aux_cfg = edp_phy_aux_cfg_v4 ,
710703 .swing_pre_emph_cfg = & dp_phy_swing_pre_emph_cfg ,
711704 .ver_ops = & qcom_edp_phy_ops_v6 ,
712705};
0 commit comments