diff mbox

[RFCv6,04/10] pvrusb2: fix g/s_tuner support.

Message ID 3cc586adf9fd70cb319bc3bcad1e7b20c13faab0.1308035134.git.hans.verkuil@cisco.com (mailing list archive)
State Accepted
Headers show

Commit Message

Hans Verkuil June 14, 2011, 7:14 a.m. UTC
From: Hans Verkuil <hans.verkuil@cisco.com>

The tuner-core subdev requires that the type field of v4l2_tuner is
filled in correctly. This is done in v4l2-ioctl.c, but pvrusb2 doesn't
use that yet, so we have to do it manually based on whether the current
input is radio or not.

Tested with my pvrusb2.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/video/pvrusb2/pvrusb2-hdw.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Mike Isely June 19, 2011, 9:13 p.m. UTC | #1
I understand that this patch would not have been need had the pvrusb2 
driver been using videodev_ioctl2.  This is a situation that I'm going 
to (finally) remedy ASAP.  In the mean time...

Acked-By: Mike Isely <isely@pobox.com>

  -Mike


On Tue, 14 Jun 2011, Hans Verkuil wrote:

> From: Hans Verkuil <hans.verkuil@cisco.com>
> 
> The tuner-core subdev requires that the type field of v4l2_tuner is
> filled in correctly. This is done in v4l2-ioctl.c, but pvrusb2 doesn't
> use that yet, so we have to do it manually based on whether the current
> input is radio or not.
> 
> Tested with my pvrusb2.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
>  drivers/media/video/pvrusb2/pvrusb2-hdw.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> index 9d0dd08..e98d382 100644
> --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> @@ -3046,6 +3046,8 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
>  	if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) {
>  		struct v4l2_tuner vt;
>  		memset(&vt, 0, sizeof(vt));
> +		vt.type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
> +			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
>  		vt.audmode = hdw->audiomode_val;
>  		v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt);
>  	}
> @@ -5171,6 +5173,8 @@ void pvr2_hdw_status_poll(struct pvr2_hdw *hdw)
>  {
>  	struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
>  	memset(vtp, 0, sizeof(*vtp));
> +	vtp->type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
> +		V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
>  	hdw->tuner_signal_stale = 0;
>  	/* Note: There apparently is no replacement for VIDIOC_CROPCAP
>  	   using v4l2-subdev - therefore we can't support that AT ALL right
>
diff mbox

Patch

diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 9d0dd08..e98d382 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3046,6 +3046,8 @@  static void pvr2_subdev_update(struct pvr2_hdw *hdw)
 	if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) {
 		struct v4l2_tuner vt;
 		memset(&vt, 0, sizeof(vt));
+		vt.type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
+			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 		vt.audmode = hdw->audiomode_val;
 		v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt);
 	}
@@ -5171,6 +5173,8 @@  void pvr2_hdw_status_poll(struct pvr2_hdw *hdw)
 {
 	struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
 	memset(vtp, 0, sizeof(*vtp));
+	vtp->type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
+		V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 	hdw->tuner_signal_stale = 0;
 	/* Note: There apparently is no replacement for VIDIOC_CROPCAP
 	   using v4l2-subdev - therefore we can't support that AT ALL right