media: rp1: csi2: Fix missing reg writes
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Thu, 28 Sep 2023 07:42:22 +0000 (10:42 +0300)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:35:02 +0000 (11:35 +0000)
The driver has two places where it writes a register based on a
condition, and when that condition is false, the driver presumes that
the register has the reset value. This is not a good idea, so fix those
places to always write the register.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers/media/platform/raspberrypi/rp1_cfe/csi2.c

index c3847e9..69fdfa6 100644 (file)
@@ -253,6 +253,7 @@ void csi2_start_channel(struct csi2_device *csi2, unsigned int channel,
                 */
                set_field(&ctrl, 0x3ff, LC_MASK);
                set_field(&ctrl, 0x00, CH_MODE_MASK);
+               csi2_reg_write(csi2, CSI2_CH_FRAME_SIZE(channel), 0);
        }
 
        set_field(&ctrl, dt, DT_MASK);
@@ -277,8 +278,8 @@ void csi2_open_rx(struct csi2_device *csi2)
 {
        dphy_start(&csi2->dphy);
 
-       if (!csi2->multipacket_line)
-               csi2_reg_write(csi2, CSI2_CTRL, EOP_IS_EOL);
+       csi2_reg_write(csi2, CSI2_CTRL,
+                      csi2->multipacket_line ? 0 : EOP_IS_EOL);
 }
 
 void csi2_close_rx(struct csi2_device *csi2)