Skip to contentSkip to conversation

media: i2c: max96714/max96717

PATCH New Tommaso Merciai 1 participant 3 messages Sep 12, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover media: i2c: max96714/max96717

Hi All,
This patchset add missing HAS_EVENTS flags to max96714/max96717 drivers.

"If HAS_DEVNODE is set, and there are controls, then HAS_EVENTS must be set and you have to be able to (un)subscribe to events. Because the controls can be exposed to userspace via a v4l-subdevX device, and userspace has to be able to subscribe to control events so that it is notified when the control changes value."

References:
- https://www.spinics.net/lists/linux-media/msg220721.html

Regards,
Tommaso

Tommaso Merciai (2):
media: i2c: max96714: add HAS_EVENTS support
media: i2c: max96717: add HAS_EVENTS support

 drivers/media/i2c/max96714.c | 6 +++++-
 drivers/media/i2c/max96717.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 media: i2c: max96714: add HAS_EVENTS support

Controls can be exposed to userspace via a v4l-subdevX device, and userspace has to be able to subscribe to control events so that it is notified when the control changes value.
Add missing HAS_EVENTS support: flag and .(un)subscribe_event().

---
Changes Since v1:
- Add missing .(un)subscribe_event() as suggested by LPinchart
- Fix commit body and commit msg

 drivers/media/i2c/max96714.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/i2c/max96714.c +5 -1
index 159753b13777..2257b6b807ea 100644
@@ -17,6 +17,7 @@
 
 #include <media/v4l2-cci.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 
@@ -488,6 +489,8 @@ static int max96714_log_status(struct v4l2_subdev *sd)
 
 static const struct v4l2_subdev_core_ops max96714_subdev_core_ops = {
 	.log_status = max96714_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops max96714_video_ops = {
@@ -602,7 +605,8 @@ static int max96714_create_subdev(struct max96714_priv *priv)
 		goto err_free_ctrl;
 	}
 
-	priv->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
+	priv->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			  V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_STREAMS;
 	priv->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
 	priv->sd.entity.ops = &max96714_entity_ops;
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 media: i2c: max96717: add HAS_EVENTS support

In reply to Tommaso Merciai

Controls can be exposed to userspace via a v4l-subdevX device, and userspace has to be able to subscribe to control events so that it is notified when the control changes value.
Add missing HAS_EVENTS support: flag and .(un)subscribe_event().

---
Changes Since v1:
- Add missing .(un)subscribe_event() as suggested by LPinchart
- Fix commit body and commit msg

 drivers/media/i2c/max96717.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/i2c/max96717.c +5 -1
index 4e85b8eb1e77..755e27271b1b 100644
@@ -17,6 +17,7 @@
 
 #include <media/v4l2-cci.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 
@@ -576,6 +577,8 @@ static const struct v4l2_subdev_pad_ops max96717_pad_ops = {
 
 static const struct v4l2_subdev_core_ops max96717_subdev_core_ops = {
 	.log_status = max96717_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_internal_ops max96717_internal_ops = {
@@ -689,7 +692,8 @@ static int max96717_subdev_init(struct max96717_priv *priv)
 		goto err_free_ctrl;
 	}
 
-	priv->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_STREAMS;
+	priv->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			  V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_STREAMS;
 	priv->sd.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
 	priv->sd.entity.ops = &max96717_entity_ops;
 
Signature · 1 line
2.34.1