summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hansg@kernel.org>2025-05-17 13:41:01 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-07-08 08:43:31 +0200
commit0f8b9632fa87eab457171198e1de8430536cace4 (patch)
tree356c1c3ecc1b6bf0f4feeeec772ee2064278841d
parente0e182ad80e90149d6d73e709d004a640bdce3ae (diff)
media: atomisp: gc0310: Switch to using sd.active_state fmt
Stop having a v4l2_mbus_framefmt mode.fmt driver-data member to store the fmt for the active-state, instead use sd.active_state fmt. This also removes the need for gc0310_get_pad_format() since v4l2_subdev_state_get_format() now will return the correct v4l2_mbus_framefmt for all whence values. Instead of switching gc0310_set_fmt() from gc0310_get_pad_format() to v4l2_subdev_state_get_format() just drop it entirely since there is only 1 fixed mode. Otherwise the new gc0310_set_fmt() would be 100% the same as v4l2_subdev_get_fmt() after this. Signed-off-by: Hans de Goede <hansg@kernel.org> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20250517114106.43494-19-hansg@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--drivers/staging/media/atomisp/i2c/atomisp-gc0310.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index f4b302d5eead..44e834c608f4 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -91,10 +91,6 @@ struct gc0310_device {
struct gpio_desc *reset;
struct gpio_desc *powerdown;
- struct gc0310_mode {
- struct v4l2_mbus_framefmt fmt;
- } mode;
-
struct gc0310_ctrls {
struct v4l2_ctrl_handler handler;
struct v4l2_ctrl *exposure;
@@ -355,17 +351,6 @@ static const struct v4l2_ctrl_ops ctrl_ops = {
.s_ctrl = gc0310_s_ctrl,
};
-static struct v4l2_mbus_framefmt *
-gc0310_get_pad_format(struct gc0310_device *sensor,
- struct v4l2_subdev_state *state,
- unsigned int pad, enum v4l2_subdev_format_whence which)
-{
- if (which == V4L2_SUBDEV_FORMAT_TRY)
- return v4l2_subdev_state_get_format(state, pad);
-
- return &sensor->mode.fmt;
-}
-
/* The GC0310 currently only supports 1 fixed fmt */
static void gc0310_fill_format(struct v4l2_mbus_framefmt *fmt)
{
@@ -376,20 +361,6 @@ static void gc0310_fill_format(struct v4l2_mbus_framefmt *fmt)
fmt->code = MEDIA_BUS_FMT_SGRBG8_1X8;
}
-static int gc0310_set_fmt(struct v4l2_subdev *sd,
- struct v4l2_subdev_state *sd_state,
- struct v4l2_subdev_format *format)
-{
- struct gc0310_device *sensor = to_gc0310_sensor(sd);
- struct v4l2_mbus_framefmt *fmt;
-
- fmt = gc0310_get_pad_format(sensor, sd_state, format->pad, format->which);
- gc0310_fill_format(fmt);
-
- format->format = *fmt;
- return 0;
-}
-
static int gc0310_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_selection *sel)
@@ -570,7 +541,7 @@ static const struct v4l2_subdev_pad_ops gc0310_pad_ops = {
.enum_mbus_code = gc0310_enum_mbus_code,
.enum_frame_size = gc0310_enum_frame_size,
.get_fmt = v4l2_subdev_get_fmt,
- .set_fmt = gc0310_set_fmt,
+ .set_fmt = v4l2_subdev_get_fmt, /* Only 1 fixed mode supported */
.get_selection = gc0310_get_selection,
.set_selection = gc0310_get_selection,
.get_frame_interval = gc0310_get_frame_interval,
@@ -744,7 +715,6 @@ static int gc0310_probe(struct i2c_client *client)
}
v4l2_i2c_subdev_init(&sensor->sd, client, &gc0310_ops);
- gc0310_fill_format(&sensor->mode.fmt);
sensor->regmap = devm_cci_regmap_init_i2c(client, 8);
if (IS_ERR(sensor->regmap))