Am 09.05.26 um 05:22 schrieb Yongbang Shi:
From: Lin He <[email protected]>

In the past, the link cap is updated in link training at encoder enable
stage, but the hibmc_dp_mode_valid() is called before it, which will use
DP link's rate and lanes. So add the hibmc_dp_update_caps() in
hibmc_dp_update_caps() to avoid some potential risks.

Fixes: 607805abfb74 ("drm/hisilicon/hibmc: add dp mode valid check")
Signed-off-by: Lin He <[email protected]>
Signed-off-by: Yongbang Shi <[email protected]>

Acked-by: Thomas Zimmermann <[email protected]>

---
ChangeLog:
v1 -> v2:
   - fix the checkpatch.pl warning "Unknown commit ID 'e6c7c59da494'".
   - remove tag "Reviewed-by: Tao Tian <[email protected]>", witch will
     be given in public.
   - add 'drm-misc-fixes' in subject prefix.
---
  drivers/gpu/drm/hisilicon/hibmc/dp/dp_comm.h   | 1 +
  drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c   | 2 +-
  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c | 2 ++
  3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_comm.h 
b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_comm.h
index f9ee7ebfec55..f53dac256ee0 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_comm.h
+++ b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_comm.h
@@ -69,5 +69,6 @@ int hibmc_dp_link_training(struct hibmc_dp_dev *dp);
  int hibmc_dp_serdes_init(struct hibmc_dp_dev *dp);
  int hibmc_dp_serdes_rate_switch(u8 rate, struct hibmc_dp_dev *dp);
  int hibmc_dp_serdes_set_tx_cfg(struct hibmc_dp_dev *dp, u8 
train_set[HIBMC_DP_LANE_NUM_MAX]);
+void hibmc_dp_update_caps(struct hibmc_dp_dev *dp);
#endif
diff --git a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c 
b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c
index 0726cb5b736e..8c53f16db516 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c
@@ -325,7 +325,7 @@ static int hibmc_dp_link_downgrade_training_eq(struct 
hibmc_dp_dev *dp)
        return hibmc_dp_link_reduce_rate(dp);
  }
-static void hibmc_dp_update_caps(struct hibmc_dp_dev *dp)
+void hibmc_dp_update_caps(struct hibmc_dp_dev *dp)
  {
        dp->link.cap.link_rate = dp->dpcd[DP_MAX_LINK_RATE];
        if (dp->link.cap.link_rate > DP_LINK_BW_8_1 || !dp->link.cap.link_rate)
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
index 616821e3c933..35dff7bfbf76 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
@@ -41,6 +41,8 @@ static bool hibmc_dp_get_dpcd(struct hibmc_dp_dev *dp_dev)
        if (ret)
                return false;
+ hibmc_dp_update_caps(dp_dev);
+
        dp_dev->is_branch = drm_dp_is_branch(dp_dev->dpcd);
ret = drm_dp_read_desc(dp_dev->aux, &dp_dev->desc, dp_dev->is_branch);

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to