Re: [PATCH v3 10/10] drm/bridge: tc358775: Configure hs_rate and lp_rate

2024-02-12 Thread Michael Walle
On Sun Feb 11, 2024 at 10:51 AM CET, Tony Lindgren wrote:
> The hs_rate and lp_rate may be used by the dsi host for timing
> calculations. The tc358775 has a maximum bit rate of 1 Gbps/lane,
> tc358765 has maximurate of 800 Mbps per lane.
>
> Signed-off-by: Tony Lindgren 
Reviewed-by: Michael Walle 

-michael


[PATCH v3 10/10] drm/bridge: tc358775: Configure hs_rate and lp_rate

2024-02-11 Thread Tony Lindgren
The hs_rate and lp_rate may be used by the dsi host for timing
calculations. The tc358775 has a maximum bit rate of 1 Gbps/lane,
tc358765 has maximurate of 800 Mbps per lane.

Signed-off-by: Tony Lindgren 
---
 drivers/gpu/drm/bridge/tc358775.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/bridge/tc358775.c 
b/drivers/gpu/drm/bridge/tc358775.c
--- a/drivers/gpu/drm/bridge/tc358775.c
+++ b/drivers/gpu/drm/bridge/tc358775.c
@@ -637,6 +637,19 @@ static int tc_attach_host(struct tc_data *tc)
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
  MIPI_DSI_MODE_LPM;
 
+   /*
+* The hs_rate and lp_rate are data rate values. The HS mode is
+* differential, while the LP mode is single ended. As the HS mode
+* uses DDR, the DSI clock frequency is half the hs_rate. The 10 Mbs
+* data rate for LP mode is not specified in the bridge data sheet,
+* but seems to be part of the MIPI DSI spec.
+*/
+   if (tc->type == TC358765)
+   dsi->hs_rate = 8;
+   else
+   dsi->hs_rate = 10;
+   dsi->lp_rate = 1000;
+
ret = devm_mipi_dsi_attach(dev, dsi);
if (ret < 0) {
dev_err(dev, "failed to attach dsi to host\n");
-- 
2.43.0