]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: atomisp: gc0310: Implement internal_ops.init_state
authorHans de Goede <hansg@kernel.org>
Sat, 17 May 2025 11:40:59 +0000 (13:40 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 8 Jul 2025 06:43:31 +0000 (08:43 +0200)
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 <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-17-hansg@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c

index baf9355ade4da6df38836c2a27701c2b73aa3c70..e0a031574a84f1cbe33b50a160e7e8240c065ada 100644 (file)
@@ -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;