linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Yong Zhi <yong.zhi@intel.com>, Bingbu Cao <bingbu.cao@intel.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
Cc: Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH 7/7] media: ov5670: Add implementation for events
Date: Tue, 28 Sep 2021 21:10:33 +0000	[thread overview]
Message-ID: <20210928211033.2415162-8-ribalda@chromium.org> (raw)
In-Reply-To: <20210928211033.2415162-1-ribalda@chromium.org>

Use v4l2 control API helpers to support the events.

Fixes v4l2-compliance:

test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/i2c/ov5670.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 49189926afd67..251f459ab484a 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -7,6 +7,7 @@
 #include <linux/pm_runtime.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
 
 #define OV5670_REG_CHIP_ID		0x300a
@@ -2420,6 +2421,12 @@ static int ov5670_identify_module(struct ov5670 *ov5670)
 	return 0;
 }
 
+static const struct v4l2_subdev_core_ops ov5670_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 ov5670_video_ops = {
 	.s_stream = ov5670_set_stream,
 };
@@ -2436,6 +2443,7 @@ static const struct v4l2_subdev_sensor_ops ov5670_sensor_ops = {
 };
 
 static const struct v4l2_subdev_ops ov5670_subdev_ops = {
+	.core = &ov5670_core_ops,
 	.video = &ov5670_video_ops,
 	.pad = &ov5670_pad_ops,
 	.sensor = &ov5670_sensor_ops,
@@ -2489,7 +2497,8 @@ static int ov5670_probe(struct i2c_client *client)
 	}
 
 	ov5670->sd.internal_ops = &ov5670_internal_ops;
-	ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			    V4L2_SUBDEV_FL_HAS_EVENTS;
 	ov5670->sd.entity.ops = &ov5670_subdev_entity_ops;
 	ov5670->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
-- 
2.33.0.685.g46640cef36-goog


  parent reply	other threads:[~2021-09-28 21:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 21:10 [PATCH 0/7] media: ipu3 i2c: Fix v4l2-compliance issues Ricardo Ribalda
2021-09-28 21:10 ` [PATCH 1/7] media: ipu3-cio2: Check num_planes and sizes in queue_setup Ricardo Ribalda
2021-09-29  0:54   ` Bingbu Cao
2021-09-28 21:10 ` [PATCH 2/7] media: ipu3-cio2: Set valid initial format Ricardo Ribalda
2021-10-01  9:15   ` Sakari Ailus
2021-09-28 21:10 ` [PATCH 3/7] media: ipu3-cio2: imgu_fmt: Handle properly try Ricardo Ribalda
2021-09-28 21:10 ` [PATCH 4/7] media: ipu3-cio2: VIDIOC_QUERYCAP: Fix bus_info Ricardo Ribalda
2021-09-29  0:55   ` Bingbu Cao
2021-09-28 21:10 ` [PATCH 5/7] media: dw9714: Add implementation for events Ricardo Ribalda
2021-09-28 21:10 ` [PATCH 6/7] media: ov13858: " Ricardo Ribalda
2021-09-28 21:10 ` Ricardo Ribalda [this message]
2021-09-29  0:53 ` [PATCH 0/7] media: ipu3 i2c: Fix v4l2-compliance issues Bingbu Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210928211033.2415162-8-ribalda@chromium.org \
    --to=ribalda@chromium.org \
    --cc=bingbu.cao@intel.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).