media: renesas: vsp1: Implement control events
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 18 Mar 2026 23:59:06 +0000 (01:59 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 25 Mar 2026 09:25:49 +0000 (10:25 +0100)
The V4L2 API requires drivers that expose controls to implement control
notification events. This is enforced by v4l2-compliance. Add event
handling to the VSP1 entities that create controls to fix the compliance
failures.

Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # HiHope RZ/G2M
Link: https://patch.msgid.link/20260318235907.831556-13-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/renesas/vsp1/vsp1_brx.c
drivers/media/platform/renesas/vsp1/vsp1_clu.c
drivers/media/platform/renesas/vsp1/vsp1_entity.c
drivers/media/platform/renesas/vsp1/vsp1_entity.h
drivers/media/platform/renesas/vsp1/vsp1_histo.c
drivers/media/platform/renesas/vsp1/vsp1_lut.c
drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
drivers/media/platform/renesas/vsp1/vsp1_sru.c

index 911359f..b1a2c68 100644 (file)
@@ -269,6 +269,7 @@ static const struct v4l2_subdev_pad_ops brx_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops brx_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &brx_pad_ops,
 };
 
index a56c038..04c466c 100644 (file)
@@ -130,6 +130,7 @@ static const struct v4l2_subdev_pad_ops clu_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops clu_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &clu_pad_ops,
 };
 
index 892a2ad..839b75b 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <media/media-entity.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-subdev.h>
 
 #include "vsp1.h"
@@ -396,6 +397,11 @@ static const struct v4l2_subdev_internal_ops vsp1_entity_internal_ops = {
        .init_state = vsp1_entity_init_state,
 };
 
+const struct v4l2_subdev_core_ops vsp1_entity_core_ops = {
+       .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+       .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
 /* -----------------------------------------------------------------------------
  * Media Operations
  */
@@ -639,6 +645,9 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
        subdev->entity.ops = &vsp1->media_ops;
        subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
+       if (ops->core == &vsp1_entity_core_ops)
+               subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
+
        snprintf(subdev->name, sizeof(subdev->name), "%s %s",
                 dev_name(vsp1->dev), name);
 
index 88daf83..c0c1fe7 100644 (file)
@@ -143,6 +143,8 @@ static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
        return container_of(subdev, struct vsp1_entity, subdev);
 }
 
+extern const struct v4l2_subdev_core_ops vsp1_entity_core_ops;
+
 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
                     const char *name, unsigned int num_pads,
                     const struct v4l2_subdev_ops *ops, u32 function);
index 79da56c..3f87a2c 100644 (file)
@@ -424,6 +424,7 @@ static const struct v4l2_subdev_pad_ops histo_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops histo_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &histo_pad_ops,
 };
 
index 2ec4d59..94bdedc 100644 (file)
@@ -106,6 +106,7 @@ static const struct v4l2_subdev_pad_ops lut_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops lut_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &lut_pad_ops,
 };
 
index c9e6fb9..c72518b 100644 (file)
@@ -357,6 +357,7 @@ static const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops = {
 };
 
 const struct v4l2_subdev_ops vsp1_rwpf_subdev_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &vsp1_rwpf_pad_ops,
 };
 
index 37fd36d..94149da 100644 (file)
@@ -252,6 +252,7 @@ static const struct v4l2_subdev_pad_ops sru_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops sru_ops = {
+       .core   = &vsp1_entity_core_ops,
        .pad    = &sru_pad_ops,
 };