Skip to content

Commit 32c4514

Browse files
dolcinisuperna9999
authored andcommitted
drm/bridge: tc358768: Fix DSI command tx
Wait for the command transmission to be completed in the DSI transfer function polling for the dc_start bit to go back to idle state after the transmission is started. This is documented in the datasheet and failures to do so lead to commands corruption. Fixes: ff1ca63 ("drm/bridge: Add tc358768 driver") Cc: stable@vger.kernel.org Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20240926141246.48282-1-francesco@dolcini.it Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240926141246.48282-1-francesco@dolcini.it
1 parent 93d1f41 commit 32c4514

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/gpu/drm/bridge/tc358768.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@
125125
#define TC358768_DSI_CONFW_MODE_CLR (6 << 29)
126126
#define TC358768_DSI_CONFW_ADDR_DSI_CONTROL (0x3 << 24)
127127

128+
/* TC358768_DSICMD_TX (0x0600) register */
129+
#define TC358768_DSI_CMDTX_DC_START BIT(0)
130+
128131
static const char * const tc358768_supplies[] = {
129132
"vddc", "vddmipi", "vddio"
130133
};
@@ -229,6 +232,21 @@ static void tc358768_update_bits(struct tc358768_priv *priv, u32 reg, u32 mask,
229232
tc358768_write(priv, reg, tmp);
230233
}
231234

235+
static void tc358768_dsicmd_tx(struct tc358768_priv *priv)
236+
{
237+
u32 val;
238+
239+
/* start transfer */
240+
tc358768_write(priv, TC358768_DSICMD_TX, TC358768_DSI_CMDTX_DC_START);
241+
if (priv->error)
242+
return;
243+
244+
/* wait transfer completion */
245+
priv->error = regmap_read_poll_timeout(priv->regmap, TC358768_DSICMD_TX, val,
246+
(val & TC358768_DSI_CMDTX_DC_START) == 0,
247+
100, 100000);
248+
}
249+
232250
static int tc358768_sw_reset(struct tc358768_priv *priv)
233251
{
234252
/* Assert Reset */
@@ -516,8 +534,7 @@ static ssize_t tc358768_dsi_host_transfer(struct mipi_dsi_host *host,
516534
}
517535
}
518536

519-
/* start transfer */
520-
tc358768_write(priv, TC358768_DSICMD_TX, 1);
537+
tc358768_dsicmd_tx(priv);
521538

522539
ret = tc358768_clear_error(priv);
523540
if (ret)

0 commit comments

Comments
 (0)