diff mbox series

[1/1] media: ov2740: Add event support for controls

Message ID 20240502100240.1585378-1-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/1] media: ov2740: Add event support for controls | expand

Commit Message

Sakari Ailus May 2, 2024, 10:02 a.m. UTC
The driver supports controls. Therefore, add support for control events.
This makes the driver pass v4l2-compliance, too.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ov2740.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Bingbu Cao May 6, 2024, 3:07 a.m. UTC | #1
Sakari,

Thanks for the patch.

On 5/2/24 6:02 PM, Sakari Ailus wrote:
> The driver supports controls. Therefore, add support for control events.
> This makes the driver pass v4l2-compliance, too.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/i2c/ov2740.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
> index 57906df7be4e..3e3f958db256 100644
> --- a/drivers/media/i2c/ov2740.c
> +++ b/drivers/media/i2c/ov2740.c
> @@ -13,6 +13,7 @@
>  #include <linux/regmap.h>
>  #include <media/v4l2-ctrls.h>
>  #include <media/v4l2-device.h>
> +#include <media/v4l2-event.h>
>  #include <media/v4l2-fwnode.h>
>  
>  #define OV2740_LINK_FREQ_360MHZ		360000000ULL
> @@ -1100,7 +1101,13 @@ static const struct v4l2_subdev_pad_ops ov2740_pad_ops = {
>  	.enum_frame_size = ov2740_enum_frame_size,
>  };
>  
> +static const struct v4l2_subdev_core_ops ov2740_core_ops = {
> +	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
> +	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
> +};
> +
>  static const struct v4l2_subdev_ops ov2740_subdev_ops = {
> +	.core = &ov2740_core_ops,
>  	.video = &ov2740_video_ops,
>  	.pad = &ov2740_pad_ops,
>  };
> @@ -1364,7 +1371,8 @@ static int ov2740_probe(struct i2c_client *client)
>  	}
>  
>  	ov2740->sd.state_lock = ov2740->ctrl_handler.lock;
> -	ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> +	ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
> +		V4L2_SUBDEV_FL_HAS_EVENTS;
>  	ov2740->sd.entity.ops = &ov2740_subdev_entity_ops;
>  	ov2740->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>  	ov2740->pad.flags = MEDIA_PAD_FL_SOURCE;
> 

Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index 57906df7be4e..3e3f958db256 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -13,6 +13,7 @@ 
 #include <linux/regmap.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
 
 #define OV2740_LINK_FREQ_360MHZ		360000000ULL
@@ -1100,7 +1101,13 @@  static const struct v4l2_subdev_pad_ops ov2740_pad_ops = {
 	.enum_frame_size = ov2740_enum_frame_size,
 };
 
+static const struct v4l2_subdev_core_ops ov2740_core_ops = {
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
 static const struct v4l2_subdev_ops ov2740_subdev_ops = {
+	.core = &ov2740_core_ops,
 	.video = &ov2740_video_ops,
 	.pad = &ov2740_pad_ops,
 };
@@ -1364,7 +1371,8 @@  static int ov2740_probe(struct i2c_client *client)
 	}
 
 	ov2740->sd.state_lock = ov2740->ctrl_handler.lock;
-	ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+		V4L2_SUBDEV_FL_HAS_EVENTS;
 	ov2740->sd.entity.ops = &ov2740_subdev_entity_ops;
 	ov2740->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ov2740->pad.flags = MEDIA_PAD_FL_SOURCE;