[PATCH v2 1/1] drm/bridge: anx78xx: fix calculation of dp link rate
From: Tobias Schramm
Date: Sun Mar 08 2020 - 11:23:12 EST
commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
changed the link training logic to remove use of drm_dp_link helpers.
However the new logic stores the maximum link rate in a u8, overflowing
it.
This commit changes the logic to store the bw code directly, avoiding any
overflows.
Fixes: ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers")
Signed-off-by: Tobias Schramm <t.schramm@xxxxxxxxxxx>
---
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 41867be03751..0c6b049b5753 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -722,8 +722,7 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx)
if (err)
return err;
- dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd);
- dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
+ dpcd[0] = anx78xx->dpcd[DP_MAX_LINK_RATE];
err = regmap_write(anx78xx->map[I2C_IDX_TX_P0],
SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
if (err)
--
2.24.1