media: v4l2-subdev: Add which field to struct v4l2_subdev_frame_interval
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 13 Dec 2023 15:00:05 +0000 (17:00 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 13 Dec 2023 15:52:35 +0000 (16:52 +0100)
commit805d4311a54a25d7347684fdf778c6239b190864
treeb95e9c7fb047331923522741aa4a4b5f7353faf6
parent287fe160834acdf9c44e5b73676180c6dbdedf76
media: v4l2-subdev: Add which field to struct v4l2_subdev_frame_interval

Due to a historical mishap, the v4l2_subdev_frame_interval structure
is the only part of the V4L2 subdev userspace API that doesn't contain a
'which' field. This prevents trying frame intervals using the subdev
'TRY' state mechanism.

Adding a 'which' field is simple as the structure has 8 reserved fields.
This would however break userspace as the field is currently set to 0,
corresponding to V4L2_SUBDEV_FORMAT_TRY, while the corresponding ioctls
currently operate on the 'ACTIVE' state. We thus need to add a new
subdev client cap, V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH, to
indicate that userspace is aware of this new field.

All drivers that implement the subdev .get_frame_interval() and
.set_frame_interval() operations are updated to return -EINVAL when
operating on the TRY state, preserving the current behaviour.

While at it, fix a bad copy&paste in the documentation of the struct
v4l2_subdev_frame_interval_enum 'which' field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
37 files changed:
Documentation/userspace-api/media/v4l/vidioc-subdev-g-client-cap.rst
Documentation/userspace-api/media/v4l/vidioc-subdev-g-frame-interval.rst
drivers/media/i2c/adv7180.c
drivers/media/i2c/alvium-csi2.c
drivers/media/i2c/et8ek8/et8ek8_driver.c
drivers/media/i2c/imx214.c
drivers/media/i2c/imx274.c
drivers/media/i2c/max9286.c
drivers/media/i2c/mt9m111.c
drivers/media/i2c/mt9m114.c
drivers/media/i2c/mt9v011.c
drivers/media/i2c/mt9v111.c
drivers/media/i2c/ov2680.c
drivers/media/i2c/ov5640.c
drivers/media/i2c/ov5648.c
drivers/media/i2c/ov5693.c
drivers/media/i2c/ov6650.c
drivers/media/i2c/ov7251.c
drivers/media/i2c/ov7670.c
drivers/media/i2c/ov772x.c
drivers/media/i2c/ov8865.c
drivers/media/i2c/ov9650.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/i2c/s5k5baf.c
drivers/media/i2c/thp7312.c
drivers/media/i2c/tvp514x.c
drivers/media/v4l2-core/v4l2-subdev.c
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
drivers/staging/media/imx/imx-ic-prp.c
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx-media-vdic.c
drivers/staging/media/tegra-video/csi.c
include/uapi/linux/v4l2-subdev.h