Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v2] [media] tc358743: allow event subscription
@ 2015-07-17 15:06 Philipp Zabel
  2015-07-17 15:12 ` Hans Verkuil
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Zabel @ 2015-07-17 15:06 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mats Randgaard, linux-media, kernel, Philipp Zabel

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>
---
Changes since v1:
 - Make use of v4l2_subdev_notify_event, v4l2_src_change_event_subdev_subscribe,
   and v4l2_ctrl_subdev_subscribe_event.
---
 drivers/media/i2c/tc358743.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 0c3c8aa..0d31a4f 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -860,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)
@@ -1318,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)
@@ -1605,7 +1617,7 @@ static const struct v4l2_subdev_core_ops tc358743_core_ops = {
 	.s_register = tc358743_s_register,
 #endif
 	.interrupt_service_routine = tc358743_isr,
-	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.subscribe_event = tc358743_subscribe_event,
 	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [media] tc358743: allow event subscription
  2015-07-17 15:06 [PATCH v2] [media] tc358743: allow event subscription Philipp Zabel
@ 2015-07-17 15:12 ` Hans Verkuil
  2015-07-17 15:18   ` Philipp Zabel
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2015-07-17 15:12 UTC (permalink / raw)
  To: Philipp Zabel, Hans Verkuil; +Cc: Mats Randgaard, linux-media, kernel

On 07/17/2015 05:06 PM, Philipp Zabel wrote:
> This is useful to subscribe to HDMI hotplug events via the
> V4L2_CID_DV_RX_POWER_PRESENT control.

Very quick, but it doesn't apply. You need to combine the original
"[PATCH 5/5] [media] tc358743: allow event subscription" together with
this patch.

Regards,

	Hans

> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
> Changes since v1:
>  - Make use of v4l2_subdev_notify_event, v4l2_src_change_event_subdev_subscribe,
>    and v4l2_ctrl_subdev_subscribe_event.
> ---
>  drivers/media/i2c/tc358743.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
> index 0c3c8aa..0d31a4f 100644
> --- a/drivers/media/i2c/tc358743.c
> +++ b/drivers/media/i2c/tc358743.c
> @@ -860,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)
> @@ -1318,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)
> @@ -1605,7 +1617,7 @@ static const struct v4l2_subdev_core_ops tc358743_core_ops = {
>  	.s_register = tc358743_s_register,
>  #endif
>  	.interrupt_service_routine = tc358743_isr,
> -	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
> +	.subscribe_event = tc358743_subscribe_event,
>  	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
>  };
>  
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [media] tc358743: allow event subscription
  2015-07-17 15:12 ` Hans Verkuil
@ 2015-07-17 15:18   ` Philipp Zabel
  2015-07-17 15:36     ` Hans Verkuil
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Zabel @ 2015-07-17 15:18 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Hans Verkuil, Mats Randgaard, kernel, linux-media

Am Freitag, den 17.07.2015, 17:12 +0200 schrieb Hans Verkuil:
> On 07/17/2015 05:06 PM, Philipp Zabel wrote:
> > This is useful to subscribe to HDMI hotplug events via the
> > V4L2_CID_DV_RX_POWER_PRESENT control.
> 
> Very quick, but it doesn't apply. You need to combine the original
> "[PATCH 5/5] [media] tc358743: allow event subscription" together with
> this patch.

I clearly shouldn't be allowed to send patches today. I'll merge these
and then I'll take my hands off the keyboard.

regards
Philipp


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [media] tc358743: allow event subscription
  2015-07-17 15:18   ` Philipp Zabel
@ 2015-07-17 15:36     ` Hans Verkuil
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2015-07-17 15:36 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Hans Verkuil, Mats Randgaard, kernel, linux-media

On 07/17/2015 05:18 PM, Philipp Zabel wrote:
> Am Freitag, den 17.07.2015, 17:12 +0200 schrieb Hans Verkuil:
>> On 07/17/2015 05:06 PM, Philipp Zabel wrote:
>>> This is useful to subscribe to HDMI hotplug events via the
>>> V4L2_CID_DV_RX_POWER_PRESENT control.
>>
>> Very quick, but it doesn't apply. You need to combine the original
>> "[PATCH 5/5] [media] tc358743: allow event subscription" together with
>> this patch.
> 
> I clearly shouldn't be allowed to send patches today. I'll merge these
> and then I'll take my hands off the keyboard.

Thanks for the v3, I've reposted my pull request to include this patch as
well.

The weekend starts, so this is a pretty good time to take your hands off the
keyboard. In fact, I think I'll join you :-)

Regards,

	Hans

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-17 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17 15:06 [PATCH v2] [media] tc358743: allow event subscription Philipp Zabel
2015-07-17 15:12 ` Hans Verkuil
2015-07-17 15:18   ` Philipp Zabel
2015-07-17 15:36     ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox