media: i2c: ov5693: Support control events
PATCH 1/1 media: i2c: ov5693: Support control events
The sensor subdev exposes controls but does not implement the control event operations, so VIDIOC_SUBSCRIBE_EVENT fails and v4l2-compliance reports:
fail: v4l2-test-controls.cpp(1128): subscribe event for control 'User Controls' failed test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
Add the standard control event subdev operations and set V4L2_SUBDEV_FL_HAS_EVENTS.
---
Tested on a Microsoft Surface Pro 9 (Intel Alder Lake, IPU6, OVTI5693) with media-committers next at d7e7bca71. v4l2-compliance 1.32.0 on the sensor subdev node: 45/46 without this patch, 46/46 with it.
drivers/media/i2c/ov5693.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/media/i2c/ov5693.c +9 -1
@@ -26,6 +26,7 @@#include <media/v4l2-cci.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> +#include <media/v4l2-event.h> #include <media/v4l2-fwnode.h> /* System Control */
@@ -1095,7 +1096,13 @@ static const struct v4l2_subdev_pad_ops ov5693_pad_ops = { .get_frame_interval = ov5693_get_frame_interval, }; +static const struct v4l2_subdev_core_ops ov5693_core_ops = { + .subscribe_event = v4l2_ctrl_subdev_subscribe_event, + .unsubscribe_event = v4l2_event_subdev_unsubscribe, +}; +static const struct v4l2_subdev_ops ov5693_ops = { + .core = &ov5693_core_ops, .video = &ov5693_video_ops, .pad = &ov5693_pad_ops, };
@@ -1336,7 +1343,8 @@ static int ov5693_probe(struct i2c_client *client)return dev_err_probe (&client->dev, ret,"Error fetching regulators\n" ); - ov5693->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + ov5693->sd.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE | +V4L2_SUBDEV_FL_HAS_EVENTS ; ov5693->pad.flags =MEDIA_PAD_FL_SOURCE ; ov5693->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ;
base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
Signature · 1 line
2.53.0
Hi Simon,
Quoted 3 lines · Simon Kruse
Tested on a Microsoft Surface Pro 9 (Intel Alder Lake, IPU6, OVTI5693) with media-committers next at
d7e7bca71. v4l2-compliance 1.32.0 on the sensor subdev node: 45/46 without this patch, 46/46 with it.
Same result on a second Surface Pro 9. With v4l2-compliance 1.26.1 on the sensor subdev the one failure is the same subscribe-event test:
without: 43/44 fail: subscribe event for control 'User Controls' failed with: 44/44 VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
The front camera still streams at 28.64 fps, as without the patch. This machine runs a 6.19-based build of the driver, and your patch applied to it with offsets only.
Fernando
Sakari Ailus
maintainerHi Simon,
Quoted 11 lines · Simon Kruse
The sensor subdev exposes controls but does not implement the control event operations, so
VIDIOC_SUBSCRIBE_EVENTfails and v4l2-compliance reports:fail: v4l2-test-controls.cpp(1128): subscribe event for control 'User Controls' failed test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
Add the standard control event subdev operations and set
V4L2_SUBDEV_FL_HAS_EVENTS.Signed-off-by Simon Kruse <[email protected]>
Could you instead move the driver to use sub-device state? See an example in commit e8a5b1df000e1a23c04dadbe99621441e0889f88 . You'll get control events as a bonus. :-)
Signature · 3 lines
Regards, Sakari Ailus
Hi Sakari,
Quoted 3 lines · Sakari Ailus
Could you instead move the driver to use sub-device state? See an example in commit
e8a5b1df000e1a23c04dadbe99621441e0889f88. You'll get control events as a bonus. :-)
Thanks, done. The conversion is posted as a new patch that replaces this one:
https://lore.kernel.org/all/[email protected]/
Regards,
Simon