summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorPhilipp Zabel2015-07-17 17:26:45 +0200
committerMauro Carvalho Chehab2015-07-22 16:27:38 +0200
commit1140f919f807b6d5a259ecfca88022da0e5340cb (patch)
tree8be99a9be12ccb98c9cbe5cab5bd3248cf036874 /drivers/media/i2c
parent[media] tc358743: add direct interrupt handling (diff)
downloadkernel-qcow2-linux-1140f919f807b6d5a259ecfca88022da0e5340cb.tar.gz
kernel-qcow2-linux-1140f919f807b6d5a259ecfca88022da0e5340cb.tar.xz
kernel-qcow2-linux-1140f919f807b6d5a259ecfca88022da0e5340cb.zip
[media] tc358743: allow event subscription
This is useful to subscribe to HDMI hotplug events via the V4L2_CID_DV_RX_POWER_PRESENT control. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/tc358743.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 934f6e17e06d..d0dd83d7a38e 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -40,6 +40,7 @@
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
#include <media/v4l2-of.h>
#include <media/tc358743.h>
@@ -859,8 +860,7 @@ static void tc358743_format_change(struct v4l2_subdev *sd)
&timings, false);
}
- v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
- (void *)&tc358743_ev_fmt);
+ v4l2_subdev_notify_event(sd, &tc358743_ev_fmt);
}
static void tc358743_init_interrupts(struct v4l2_subdev *sd)
@@ -1317,6 +1317,19 @@ static irqreturn_t tc358743_irq_handler(int irq, void *dev_id)
return handled ? IRQ_HANDLED : IRQ_NONE;
}
+static int tc358743_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
+ struct v4l2_event_subscription *sub)
+{
+ switch (sub->type) {
+ case V4L2_EVENT_SOURCE_CHANGE:
+ return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
+ case V4L2_EVENT_CTRL:
+ return v4l2_ctrl_subdev_subscribe_event(sd, fh, sub);
+ default:
+ return -EINVAL;
+ }
+}
+
/* --------------- VIDEO OPS --------------- */
static int tc358743_g_input_status(struct v4l2_subdev *sd, u32 *status)
@@ -1604,6 +1617,8 @@ static const struct v4l2_subdev_core_ops tc358743_core_ops = {
.s_register = tc358743_s_register,
#endif
.interrupt_service_routine = tc358743_isr,
+ .subscribe_event = tc358743_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
};
static const struct v4l2_subdev_video_ops tc358743_video_ops = {