]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: i2c: vd55g1: Setup sensor external clock before patching
authorBenjamin Mugnier <benjamin.mugnier@foss.st.com>
Wed, 11 Jun 2025 08:48:32 +0000 (10:48 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Mon, 30 Jun 2025 07:06:21 +0000 (09:06 +0200)
Proper clock configuration is required to advance through FSM states.
Prior than this having a different clock value than default sensor's
value was used (12 MHz) could prevent the sensor from booting.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/i2c/vd55g1.c

index 336dc3c85ac9e695f22aa524e0df6138dc76e45c..dec6e3e231d54a742bdd08ff2a506c152bb89429 100644 (file)
@@ -1038,8 +1038,6 @@ static int vd55g1_enable_streams(struct v4l2_subdev *sd,
        if (ret < 0)
                return ret;
 
-       vd55g1_write(sensor, VD55G1_REG_EXT_CLOCK, sensor->xclk_freq, &ret);
-
        /* Configure output */
        vd55g1_write(sensor, VD55G1_REG_MIPI_DATA_RATE,
                     sensor->mipi_rate, &ret);
@@ -1613,6 +1611,9 @@ static int vd55g1_power_on(struct device *dev)
                goto disable_clock;
        }
 
+       /* Setup clock now to advance through system FSM states */
+       vd55g1_write(sensor, VD55G1_REG_EXT_CLOCK, sensor->xclk_freq, &ret);
+
        ret = vd55g1_patch(sensor);
        if (ret) {
                dev_err(dev, "Sensor patch failed %d\n", ret);