diff mbox series

media: i2c: imx219: Declare that the driver can create events

Message ID 20201116132244.30081-1-dafna.hirschfeld@collabora.com (mailing list archive)
State New
Headers show
Series media: i2c: imx219: Declare that the driver can create events | expand

Commit Message

Dafna Hirschfeld Nov. 16, 2020, 1:22 p.m. UTC
The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
generate events. It can create events from the ctrl handler, therefore
this is required.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
This patch fixes compliance issues found in imx219:

fail: v4l2-test-controls.cpp(830): failed to find event for control 'Exposure'
    test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

 drivers/media/i2c/imx219.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Nov. 16, 2020, 2:30 p.m. UTC | #1
Hi Dave,

Thank you for the patch.

On Mon, Nov 16, 2020 at 02:22:44PM +0100, Dafna Hirschfeld wrote:
> The flag V4L2_SUBDEV_FL_HAS_EVENTS is required if the subdev can
> generate events. It can create events from the ctrl handler, therefore
> this is required.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

We should probably revisit this in the V4L2 core, as all subdevs that
handle controls can generate events, it shouldn't need to be manually
implemented in each of them.

> ---
> This patch fixes compliance issues found in imx219:
> 
> fail: v4l2-test-controls.cpp(830): failed to find event for control 'Exposure'
>     test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
> 
>  drivers/media/i2c/imx219.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index ef2b1a6a0f4a..ba1c5e59ddf4 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -1503,7 +1503,8 @@ static int imx219_probe(struct i2c_client *client)
>  
>  	/* Initialize subdev */
>  	imx219->sd.internal_ops = &imx219_internal_ops;
> -	imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> +	imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
> +			    V4L2_SUBDEV_FL_HAS_EVENTS;
>  	imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>  
>  	/* Initialize source pad */
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index ef2b1a6a0f4a..ba1c5e59ddf4 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1503,7 +1503,8 @@  static int imx219_probe(struct i2c_client *client)
 
 	/* Initialize subdev */
 	imx219->sd.internal_ops = &imx219_internal_ops;
-	imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			    V4L2_SUBDEV_FL_HAS_EVENTS;
 	imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
 	/* Initialize source pad */