From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Tianshu Qiu <tian.shu.qiu@intel.com>, Bingbu Cao <bingbu.cao@intel.com>
Subject: [PATCH 1/1] media: ov2740: Add event support for controls
Date: Thu, 2 May 2024 13:02:40 +0300 [thread overview]
Message-ID: <20240502100240.1585378-1-sakari.ailus@linux.intel.com> (raw)
The driver supports controls. Therefore, add support for control events.
This makes the driver pass v4l2-compliance, too.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/ov2740.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index 57906df7be4e..3e3f958db256 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -13,6 +13,7 @@
#include <linux/regmap.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#define OV2740_LINK_FREQ_360MHZ 360000000ULL
@@ -1100,7 +1101,13 @@ static const struct v4l2_subdev_pad_ops ov2740_pad_ops = {
.enum_frame_size = ov2740_enum_frame_size,
};
+static const struct v4l2_subdev_core_ops ov2740_core_ops = {
+ .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
static const struct v4l2_subdev_ops ov2740_subdev_ops = {
+ .core = &ov2740_core_ops,
.video = &ov2740_video_ops,
.pad = &ov2740_pad_ops,
};
@@ -1364,7 +1371,8 @@ static int ov2740_probe(struct i2c_client *client)
}
ov2740->sd.state_lock = ov2740->ctrl_handler.lock;
- ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ ov2740->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
ov2740->sd.entity.ops = &ov2740_subdev_entity_ops;
ov2740->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
ov2740->pad.flags = MEDIA_PAD_FL_SOURCE;
--
2.39.2
next reply other threads:[~2024-05-02 10:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 10:02 Sakari Ailus [this message]
2024-05-06 3:07 ` [PATCH 1/1] media: ov2740: Add event support for controls 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=20240502100240.1585378-1-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=tian.shu.qiu@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 read-only IMAP folder(s) and NNTP newsgroup(s).