diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-05-29 11:37:36 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-06-09 15:33:09 +0100 |
commit | a08183b8460e4800c186b754026b6fd937370871 (patch) | |
tree | 8e64aaab1874c58cff7561951dbc57e05fc9c897 /drivers/staging | |
parent | 04eca831605390071be83b87774e4987639e6331 (diff) | |
download | linux-a08183b8460e4800c186b754026b6fd937370871.tar.gz linux-a08183b8460e4800c186b754026b6fd937370871.tar.bz2 linux-a08183b8460e4800c186b754026b6fd937370871.zip |
media: atomisp: Pass MEDIA_BUS_FMT_* code when calling enum_frame_size pad-op
A sensor driver's enum_frame_size pad-op may return -EINVAL when
v4l2_subdev_frame_size_enum.code is not set to a supported
MEDIA_BUS_FMT_* code.
Make atomisp_init_sensor() get the sensor's MEDIA_BUS_FMT_* code and
pass this when calling the enum_frame_size pad-op.
Link: https://lore.kernel.org/r/20230529103741.11904-17-hdegoede@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_internal.h | 1 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 14d21c6e227d..9fded17a2c71 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -125,6 +125,7 @@ struct atomisp_input_subdev { unsigned int type; enum atomisp_camera_port port; + u32 code; /* MEDIA_BUS_FMT_* */ bool crop_support; struct v4l2_subdev *camera; /* Sensor rects for sensors which support crop */ diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 446297fef861..c5465b28a65d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -707,6 +707,7 @@ static int atomisp_enum_framesizes(struct file *file, void *priv, struct v4l2_subdev_frame_size_enum fse = { .index = fsize->index, .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .code = input->code, }; int ret; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 506f04ca92b1..3a2e15605919 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -933,12 +933,18 @@ v4l2_device_failed: static void atomisp_init_sensor(struct atomisp_input_subdev *input) { + struct v4l2_subdev_mbus_code_enum mbus_code_enum = { }; struct v4l2_subdev_state sd_state = { .pads = &input->pad_cfg, }; struct v4l2_subdev_selection sel = { }; int err; + mbus_code_enum.which = V4L2_SUBDEV_FORMAT_ACTIVE; + err = v4l2_subdev_call(input->camera, pad, enum_mbus_code, NULL, &mbus_code_enum); + if (!err) + input->code = mbus_code_enum.code; + sel.which = V4L2_SUBDEV_FORMAT_ACTIVE; sel.target = V4L2_SEL_TGT_NATIVE_SIZE; err = v4l2_subdev_call(input->camera, pad, get_selection, NULL, &sel); |