linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vimc: fix control event handling
@ 2018-02-02 13:00 Hans Verkuil
  2018-03-01 13:02 ` Helen Koike
  0 siblings, 1 reply; 2+ messages in thread
From: Hans Verkuil @ 2018-02-02 13:00 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Helen Koike

The sensor subdev didn't handle control events. Add support for this.
Found with v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c
index 9d63c84a9876..617415c224fe 100644
--- a/drivers/media/platform/vimc/vimc-common.c
+++ b/drivers/media/platform/vimc/vimc-common.c
@@ -434,7 +434,9 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved,
 	v4l2_set_subdevdata(sd, ved);

 	/* Expose this subdev to user space */
-	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	if (sd->ctrl_handler)
+		sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS;

 	/* Initialize the media entity */
 	ret = media_entity_pads_init(&sd->entity, num_pads, ved->pads);
diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c
index 457e211514c6..54184cd9e0ff 100644
--- a/drivers/media/platform/vimc/vimc-sensor.c
+++ b/drivers/media/platform/vimc/vimc-sensor.c
@@ -23,6 +23,7 @@
 #include <linux/v4l2-mediabus.h>
 #include <linux/vmalloc.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-subdev.h>
 #include <media/tpg/v4l2-tpg.h>

@@ -284,11 +285,18 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable)
 	return 0;
 }

+static struct v4l2_subdev_core_ops vimc_sen_core_ops = {
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
 static const struct v4l2_subdev_video_ops vimc_sen_video_ops = {
 	.s_stream = vimc_sen_s_stream,
 };

 static const struct v4l2_subdev_ops vimc_sen_ops = {
+	.core = &vimc_sen_core_ops,
 	.pad = &vimc_sen_pad_ops,
 	.video = &vimc_sen_video_ops,
 };

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] vimc: fix control event handling
  2018-02-02 13:00 [PATCH] vimc: fix control event handling Hans Verkuil
@ 2018-03-01 13:02 ` Helen Koike
  0 siblings, 0 replies; 2+ messages in thread
From: Helen Koike @ 2018-03-01 13:02 UTC (permalink / raw)
  To: Hans Verkuil, Linux Media Mailing List

Hi Hans,

Thanks for the patch

On 02/02/2018 11:00 AM, Hans Verkuil wrote:
> The sensor subdev didn't handle control events. Add support for this.
> Found with v4l2-compliance.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Acked-by: Helen Koike <helen.koike@collabora.com>

> ---
> diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c
> index 9d63c84a9876..617415c224fe 100644
> --- a/drivers/media/platform/vimc/vimc-common.c
> +++ b/drivers/media/platform/vimc/vimc-common.c
> @@ -434,7 +434,9 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved,
>   	v4l2_set_subdevdata(sd, ved);
> 
>   	/* Expose this subdev to user space */
> -	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> +	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> +	if (sd->ctrl_handler)
> +		sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
> 
>   	/* Initialize the media entity */
>   	ret = media_entity_pads_init(&sd->entity, num_pads, ved->pads);
> diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c
> index 457e211514c6..54184cd9e0ff 100644
> --- a/drivers/media/platform/vimc/vimc-sensor.c
> +++ b/drivers/media/platform/vimc/vimc-sensor.c
> @@ -23,6 +23,7 @@
>   #include <linux/v4l2-mediabus.h>
>   #include <linux/vmalloc.h>
>   #include <media/v4l2-ctrls.h>
> +#include <media/v4l2-event.h>
>   #include <media/v4l2-subdev.h>
>   #include <media/tpg/v4l2-tpg.h>
> 
> @@ -284,11 +285,18 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable)
>   	return 0;
>   }
> 
> +static struct v4l2_subdev_core_ops vimc_sen_core_ops = {
> +	.log_status = v4l2_ctrl_subdev_log_status,
> +	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
> +	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
> +};
> +
>   static const struct v4l2_subdev_video_ops vimc_sen_video_ops = {
>   	.s_stream = vimc_sen_s_stream,
>   };
> 
>   static const struct v4l2_subdev_ops vimc_sen_ops = {
> +	.core = &vimc_sen_core_ops,
>   	.pad = &vimc_sen_pad_ops,
>   	.video = &vimc_sen_video_ops,
>   };
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-01 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 13:00 [PATCH] vimc: fix control event handling Hans Verkuil
2018-03-01 13:02 ` Helen Koike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).