All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: analogix-anx78xx: Fix drm_dp_link helper removal
@ 2019-11-30 14:51 Torsten Duwe
  2019-12-02 14:53 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Torsten Duwe @ 2019-11-30 14:51 UTC (permalink / raw)
  To: Thierry Reding, Daniel Vetter; +Cc: Maxime Ripard, dri-devel

drm_dp_link_rate_to_bw_code and ...bw_code_to_link_rate simply divide by
and multiply with 27000, respectively. Avoid an overflow in the u8 dpcd[0]
and the multiply+divide alltogether.

fixes: ff1e8fb68ea06027 ("analogix-anx78xx: Avoid drm_dp_link helpers")
Signed-off-by: Torsten Duwe <duwe@suse.de>
---
Has anybody actually tested ff1e8fb68ea06027 ? I copied that code in good
faith for the anx6345 and changed a few other things simultaneously, and
spent some time wondering why the panel stayed dark.

---
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 41867be03751..864423f59d66 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -722,10 +722,9 @@ 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]);
 	err = regmap_write(anx78xx->map[I2C_IDX_TX_P0],
-			   SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
+			   SP_DP_MAIN_LINK_BW_SET_REG,
+			   anx78xx->dpcd[DP_MAX_LINK_RATE]);
 	if (err)
 		return err;
 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-02 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-30 14:51 [PATCH] drm/bridge: analogix-anx78xx: Fix drm_dp_link helper removal Torsten Duwe
2019-12-02 14:53 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.