media: atomisp: gc0310: Implement internal_ops.init_state

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>
This commit is contained in:
Hans de Goede
2025-05-17 13:40:59 +02:00
committed by Mauro Carvalho Chehab
parent 1e29696182
commit 01027ffed9

View 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;