Commit 2cf4090f authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mauro Carvalho Chehab

[media] adv7842: Deliver resolution change events to userspace

Use the new v4l2_subdev_notify_event() helper function to deliver the
resolution change event to userspace via the v4l2 subdev event queue as
well as to the bridge driver using the callback notify mechanism.

This allows userspace applications to react to changes in resolution. This
is useful and often necessary for video pipelines where there is no direct
1-to-1 relationship between the subdevice converter and the video capture
device and hence it does not make sense to directly forward the event to
the video capture device node.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
[hans.verkuil@cisco.com: fix obvious mistake: v4l2_event_subdev_unsubscribe -> v4l2_ctrl_subdev_subscribe_event]
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 6f5bcfc3
...@@ -1981,8 +1981,7 @@ static int adv7842_s_routing(struct v4l2_subdev *sd, ...@@ -1981,8 +1981,7 @@ static int adv7842_s_routing(struct v4l2_subdev *sd,
select_input(sd, state->vid_std_select); select_input(sd, state->vid_std_select);
enable_input(sd); enable_input(sd);
v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, v4l2_subdev_notify_event(sd, &adv7842_ev_fmt);
(void *)&adv7842_ev_fmt);
return 0; return 0;
} }
...@@ -2215,8 +2214,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled) ...@@ -2215,8 +2214,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
"%s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, fmt_change_sdp = 0x%x\n", "%s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, fmt_change_sdp = 0x%x\n",
__func__, fmt_change_cp, fmt_change_digital, __func__, fmt_change_cp, fmt_change_digital,
fmt_change_sdp); fmt_change_sdp);
v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, v4l2_subdev_notify_event(sd, &adv7842_ev_fmt);
(void *)&adv7842_ev_fmt);
if (handled) if (handled)
*handled = true; *handled = true;
} }
...@@ -3006,6 +3004,20 @@ static long adv7842_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) ...@@ -3006,6 +3004,20 @@ static long adv7842_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
return -ENOTTY; return -ENOTTY;
} }
static int adv7842_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;
}
}
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static const struct v4l2_ctrl_ops adv7842_ctrl_ops = { static const struct v4l2_ctrl_ops adv7842_ctrl_ops = {
...@@ -3016,7 +3028,7 @@ static const struct v4l2_subdev_core_ops adv7842_core_ops = { ...@@ -3016,7 +3028,7 @@ static const struct v4l2_subdev_core_ops adv7842_core_ops = {
.log_status = adv7842_log_status, .log_status = adv7842_log_status,
.ioctl = adv7842_ioctl, .ioctl = adv7842_ioctl,
.interrupt_service_routine = adv7842_isr, .interrupt_service_routine = adv7842_isr,
.subscribe_event = v4l2_ctrl_subdev_subscribe_event, .subscribe_event = adv7842_subscribe_event,
.unsubscribe_event = v4l2_event_subdev_unsubscribe, .unsubscribe_event = v4l2_event_subdev_unsubscribe,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = adv7842_g_register, .g_register = adv7842_g_register,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment