1fdd8c46624622ddc00630b2a26618155bb9e132
[openwrt/staging/jow.git] /
1 From 418b65e7035604266a598945beebdc30f6d58458 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 16 Feb 2023 00:29:53 +0200
4 Subject: [PATCH] media: i2c: imx290: Add V4L2_SUBDEV_FL_HAS_EVENTS and
5 subscribe hooks
6
7 Should be upstream commit 5f9dee39ab55
8
9 Any V4L2 subdevice that implements controls and declares
10 V4L2_SUBDEV_FL_HAS_DEVNODE should also declare V4L2_SUBDEV_FL_HAS_EVENTS
11 and implement subscribe_event and unsubscribe_event hooks.
12
13 This driver didn't and would therefore fail v4l2-compliance
14 testing.
15
16 Add the relevant hooks.
17
18 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
20 Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
21 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
22 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
23 ---
24 drivers/media/i2c/imx290.c | 10 +++++++++-
25 1 file changed, 9 insertions(+), 1 deletion(-)
26
27 --- a/drivers/media/i2c/imx290.c
28 +++ b/drivers/media/i2c/imx290.c
29 @@ -23,6 +23,7 @@
30 #include <media/media-entity.h>
31 #include <media/v4l2-ctrls.h>
32 #include <media/v4l2-device.h>
33 +#include <media/v4l2-event.h>
34 #include <media/v4l2-fwnode.h>
35 #include <media/v4l2-subdev.h>
36
37 @@ -998,6 +999,11 @@ static int imx290_entity_init_cfg(struct
38 return 0;
39 }
40
41 +static const struct v4l2_subdev_core_ops imx290_core_ops = {
42 + .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
43 + .unsubscribe_event = v4l2_event_subdev_unsubscribe,
44 +};
45 +
46 static const struct v4l2_subdev_video_ops imx290_video_ops = {
47 .s_stream = imx290_set_stream,
48 };
49 @@ -1012,6 +1018,7 @@ static const struct v4l2_subdev_pad_ops
50 };
51
52 static const struct v4l2_subdev_ops imx290_subdev_ops = {
53 + .core = &imx290_core_ops,
54 .video = &imx290_video_ops,
55 .pad = &imx290_pad_ops,
56 };
57 @@ -1030,7 +1037,8 @@ static int imx290_subdev_init(struct imx
58 imx290->current_mode = &imx290_modes_ptr(imx290)[0];
59
60 v4l2_i2c_subdev_init(&imx290->sd, client, &imx290_subdev_ops);
61 - imx290->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
62 + imx290->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
63 + V4L2_SUBDEV_FL_HAS_EVENTS;
64 imx290->sd.dev = imx290->dev;
65 imx290->sd.entity.ops = &imx290_subdev_entity_ops;
66 imx290->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;