]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/rcar-du: dsi: Respect DSI mode flags
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Tue, 28 Oct 2025 23:28:18 +0000 (00:28 +0100)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Wed, 29 Oct 2025 09:32:11 +0000 (11:32 +0200)
Cache DSI mode flags in new mode_flags member of struct rcar_mipi_dsi .
Configure TXVMSETR register based on the content of DSI mode flags in
case the controller operates in video mode.

Rename TXVMSETR_H..BPEN_EN to TXVMSETR_H..BPEN and drop TXVMSETR_H..BPEN_DIS
which resolves to 0. Update TXVMSETR_VSEN in the same manner. Replace
TXVMSETR_SYNSEQ_PULSES with a code comment next to TXVMSETR_SYNSEQ_EVENTS
because TXVMSETR_SYNSEQ_PULSES resolves to 0.

Do not convert bits and bitfields to BIT() and GENMASK() yet, to be
consisten with the current style. Conversion to BIT() and GENMASK()
macros is done at the very end of this series in the last two patches.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Link: https://patch.msgid.link/20251028232959.109936-9-marek.vasut+renesas@mailbox.org
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi_regs.h

index f6427476feb72bf47a221c1013bb1a21224bbccc..78e512de7cf96e1c6e6979bc304b37ffbd11921d 100644 (file)
@@ -72,6 +72,7 @@ struct rcar_mipi_dsi {
        } clocks;
 
        enum mipi_dsi_pixel_format format;
+       unsigned long mode_flags;
        unsigned int num_data_lanes;
        unsigned int lanes;
 };
@@ -474,9 +475,19 @@ static void rcar_mipi_dsi_set_display_timing(struct rcar_mipi_dsi *dsi,
        }
 
        /* Configuration for Blanking sequence and Input Pixel */
-       setr = TXVMSETR_HSABPEN_EN | TXVMSETR_HBPBPEN_EN
-            | TXVMSETR_HFPBPEN_EN | TXVMSETR_SYNSEQ_PULSES
-            | TXVMSETR_PIXWDTH | TXVMSETR_VSTPM;
+       setr = TXVMSETR_PIXWDTH | TXVMSETR_VSTPM;
+
+       if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
+               if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))
+                       setr |= TXVMSETR_SYNSEQ_EVENTS;
+               if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HFP))
+                       setr |= TXVMSETR_HFPBPEN;
+               if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HBP))
+                       setr |= TXVMSETR_HBPBPEN;
+               if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HSA))
+                       setr |= TXVMSETR_HSABPEN;
+       }
+
        rcar_mipi_dsi_write(dsi, TXVMSETR, setr);
 
        /* Configuration for Video Parameters */
@@ -917,6 +928,7 @@ static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 
        dsi->lanes = device->lanes;
        dsi->format = device->format;
+       dsi->mode_flags = device->mode_flags;
 
        dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
                                                  1, 0);
index cfaa9b345308f71fcbb9255697baff28b9dc9950..75b0ae207a6405ae59c6702a81157ca6c91951a1 100644 (file)
  * Video Mode Register
  */
 #define TXVMSETR                       0x180
-#define TXVMSETR_SYNSEQ_PULSES         (0 << 16)
-#define TXVMSETR_SYNSEQ_EVENTS         (1 << 16)
+#define TXVMSETR_SYNSEQ_EVENTS         (1 << 16) /* 0:Pulses 1:Events */
 #define TXVMSETR_VSTPM                 (1 << 15)
 #define TXVMSETR_PIXWDTH_MASK          (7 << 8)
 #define TXVMSETR_PIXWDTH               (1 << 8) /* Only allowed value */
-#define TXVMSETR_VSEN_EN               (1 << 4)
-#define TXVMSETR_VSEN_DIS              (0 << 4)
-#define TXVMSETR_HFPBPEN_EN            (1 << 2)
-#define TXVMSETR_HFPBPEN_DIS           (0 << 2)
-#define TXVMSETR_HBPBPEN_EN            (1 << 1)
-#define TXVMSETR_HBPBPEN_DIS           (0 << 1)
-#define TXVMSETR_HSABPEN_EN            (1 << 0)
-#define TXVMSETR_HSABPEN_DIS           (0 << 0)
+#define TXVMSETR_VSEN                  (1 << 4)
+#define TXVMSETR_HFPBPEN               (1 << 2)
+#define TXVMSETR_HBPBPEN               (1 << 1)
+#define TXVMSETR_HSABPEN               (1 << 0)
 
 #define TXVMCR                         0x190
 #define TXVMCR_VFCLR                   (1 << 12)