diff options
| author | Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> | 2026-02-26 16:37:37 +0300 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2026-03-11 03:05:36 +0300 |
| commit | d935219d19daf1d43d116e14c253a17bb23cd480 (patch) | |
| tree | 8362f80d2283ceb4de7ca3009d7de98bcf9a55be | |
| parent | a62d99ed89888d3446cab5b7bc1a8cea001190b8 (diff) | |
| download | linux-d935219d19daf1d43d116e14c253a17bb23cd480.tar.xz | |
media: i2c: og01a1b: Replace .open with .init_state internal ops
Instead of wiping the camera sensor subdevice initial state on every
open() syscall it would be better to set the initial state just once.
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
| -rw-r--r-- | drivers/media/i2c/og01a1b.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/media/i2c/og01a1b.c b/drivers/media/i2c/og01a1b.c index 6c788bd512e9..c0ab230940f8 100644 --- a/drivers/media/i2c/og01a1b.c +++ b/drivers/media/i2c/og01a1b.c @@ -746,10 +746,21 @@ static int og01a1b_enum_frame_size(struct v4l2_subdev *sd, return 0; } -static int og01a1b_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +static int og01a1b_init_state(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state) { - og01a1b_update_pad_format(&supported_modes[0], - v4l2_subdev_state_get_format(fh->state, 0)); + struct og01a1b *og01a1b = to_og01a1b(sd); + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_TRY, + .pad = 0, + .format = { + .width = og01a1b->cur_mode->width, + .height = og01a1b->cur_mode->height, + .code = MEDIA_BUS_FMT_Y10_1X10, + }, + }; + + og01a1b_set_format(sd, state, &fmt); return 0; } @@ -777,7 +788,7 @@ static const struct media_entity_operations og01a1b_subdev_entity_ops = { }; static const struct v4l2_subdev_internal_ops og01a1b_internal_ops = { - .open = og01a1b_open, + .init_state = og01a1b_init_state, }; static int og01a1b_identify_module(struct og01a1b *og01a1b) |
