From 8bec19b707a5b2d268f11aff7a3d747a6b77bcf2 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 20 Nov 2024 13:58:08 +0000 Subject: [PATCH] drm: vc4: dsi: Handle the different command FIFO widths DSI0 and DSI1 have different widths for the command FIFO (24bit vs 32bit), but the driver was assuming the 32bit width of DSI1 in all cases. Handle the difference via the variant structure. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_dsi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 78f232656172b4..a00702418a8fe2 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -44,7 +44,6 @@ #define DSI_CMD_FIFO_DEPTH 16 #define DSI_PIX_FIFO_DEPTH 256 -#define DSI_PIX_FIFO_WIDTH 4 #define DSI0_CTRL 0x00 @@ -553,6 +552,7 @@ struct vc4_dsi_variant { unsigned int port; bool broken_axi_workaround; + unsigned int cmd_fifo_width; const char *debugfs_name; const struct debugfs_reg32 *regs; @@ -1235,9 +1235,9 @@ static ssize_t vc4_dsi_transfer(struct vc4_dsi *dsi, pix_fifo_len = 0; } else { cmd_fifo_len = (packet.payload_length % - DSI_PIX_FIFO_WIDTH); + dsi->variant->cmd_fifo_width); pix_fifo_len = ((packet.payload_length - cmd_fifo_len) / - DSI_PIX_FIFO_WIDTH); + dsi->variant->cmd_fifo_width); } WARN_ON_ONCE(pix_fifo_len >= DSI_PIX_FIFO_DEPTH); @@ -1516,6 +1516,7 @@ static const struct drm_encoder_funcs vc4_dsi_encoder_funcs = { static const struct vc4_dsi_variant bcm2711_dsi1_variant = { .port = 1, + .cmd_fifo_width = 4, .debugfs_name = "dsi1_regs", .regs = dsi1_regs, .nregs = ARRAY_SIZE(dsi1_regs), @@ -1523,6 +1524,7 @@ static const struct vc4_dsi_variant bcm2711_dsi1_variant = { static const struct vc4_dsi_variant bcm2835_dsi0_variant = { .port = 0, + .cmd_fifo_width = 3, .debugfs_name = "dsi0_regs", .regs = dsi0_regs, .nregs = ARRAY_SIZE(dsi0_regs), @@ -1530,6 +1532,7 @@ static const struct vc4_dsi_variant bcm2835_dsi0_variant = { static const struct vc4_dsi_variant bcm2835_dsi1_variant = { .port = 1, + .cmd_fifo_width = 4, .broken_axi_workaround = true, .debugfs_name = "dsi1_regs", .regs = dsi1_regs,