On Sat May 17 13:40:59 2025 +0200, Hans de Goede wrote:
> Implement internal_ops.init_state to fill in the v4l2_mbus_framefmt
> struct in newly allocated sd-state structs.
> 
> Signed-off-by: Hans de Goede <ha...@kernel.org>
> Reviewed-by: Andy Shevchenko <a...@kernel.org>
> Link: https://lore.kernel.org/r/20250517114106.43494-17-ha...@kernel.org
> Signed-off-by: Mauro Carvalho Chehab <mchehab+hua...@kernel.org>

Patch committed.

Thanks,
Mauro Carvalho Chehab

 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

---

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index baf9355ade4d..e0a031574a84 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -596,6 +596,17 @@ static const struct v4l2_subdev_ops gc0310_ops = {
        .sensor = &gc0310_sensor_ops,
 };
 
+static int gc0310_init_state(struct v4l2_subdev *sd,
+                            struct v4l2_subdev_state *sd_state)
+{
+       gc0310_fill_format(v4l2_subdev_state_get_format(sd_state, 0));
+       return 0;
+}
+
+static const struct v4l2_subdev_internal_ops gc0310_internal_ops = {
+       .init_state = gc0310_init_state,
+};
+
 static int gc0310_init_controls(struct gc0310_device *sensor)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
@@ -762,6 +773,7 @@ static int gc0310_probe(struct i2c_client *client)
                return ret;
        }
 
+       sensor->sd.internal_ops = &gc0310_internal_ops;
        sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
        sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
        sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;

Reply via email to