]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: i2c: imx283: add support for non-continuous MIPI clock mode
authorMatthias Fend <matthias.fend@emfend.at>
Mon, 12 Jan 2026 14:59:28 +0000 (15:59 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 26 Mar 2026 13:33:07 +0000 (14:33 +0100)
Add support for selecting between continuous and non-continuous MIPI clock
mode.

Previously, the CSI-2 non-continuous clock endpoint flag was ignored and
the sensor was always configured for non-continuous clock mode. For
existing device tree nodes that do not have this property enabled, this
update will therefore change the actual clock mode.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/imx283.c

index 1be6164c2d15524690b738aa725a6708e84487d0..38ea1902f2c257a66dc39680bf970a3904e69c2c 100644 (file)
 #define IMX283_REG_PLSTMG02            CCI_REG8(0x36aa)
 #define   IMX283_PLSTMG02_VAL          0x00
 
+#define IMX283_REG_MIPI_CLK            CCI_REG8(0x3a43)
+#define   IMX283_MIPI_CLK_NONCONTINUOUS        BIT(0)
+
 #define IMX283_REG_EBD_X_OUT_SIZE      CCI_REG16_LE(0x3a54)
 
 /* Test pattern generator */
@@ -566,6 +569,7 @@ struct imx283 {
        struct v4l2_ctrl *hblank;
        struct v4l2_ctrl *vflip;
 
+       bool mipi_clk_noncontinuous;
        unsigned long link_freq_bitmap;
 
        u16 hmax;
@@ -989,6 +993,7 @@ static int imx283_set_pad_format(struct v4l2_subdev *sd,
 static int imx283_standby_cancel(struct imx283 *imx283)
 {
        unsigned int link_freq_idx;
+       u8 mipi_clk;
        int ret = 0;
 
        cci_write(imx283->cci, IMX283_REG_STANDBY,
@@ -1008,6 +1013,10 @@ static int imx283_standby_cancel(struct imx283 *imx283)
        /* Enable PLL */
        cci_write(imx283->cci, IMX283_REG_STBPL, IMX283_STBPL_NORMAL, &ret);
 
+       /* Configure MIPI clock mode */
+       mipi_clk = imx283->mipi_clk_noncontinuous ? IMX283_MIPI_CLK_NONCONTINUOUS : 0;
+       cci_write(imx283->cci, IMX283_REG_MIPI_CLK, mipi_clk, &ret);
+
        /* Configure the MIPI link speed */
        link_freq_idx = __ffs(imx283->link_freq_bitmap);
        cci_multi_reg_write(imx283->cci, link_freq_reglist[link_freq_idx].regs,
@@ -1431,6 +1440,9 @@ static int imx283_parse_endpoint(struct imx283 *imx283)
                goto done_endpoint_free;
        }
 
+       imx283->mipi_clk_noncontinuous =
+               bus_cfg.bus.mipi_csi2.flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
+
        ret = v4l2_link_freq_to_bitmap(imx283->dev, bus_cfg.link_frequencies,
                                       bus_cfg.nr_of_link_frequencies,
                                       link_frequencies, ARRAY_SIZE(link_frequencies),