media: cx23885: Add i2c device analog tuner support
Hauppauge QuadHD/1265/5525 boards all use i2c device drivers and have tuner_type equal TUNER_ABSENT. This means additional support is required to enable the analog tuning capability, a case statement is used to identify these models. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
2be355a08e
commit
fbc9a49cf2
|
@ -639,8 +639,18 @@ static int vidioc_querycap(struct file *file, void *priv,
|
|||
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE |
|
||||
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
|
||||
V4L2_CAP_DEVICE_CAPS;
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
cap->capabilities |= V4L2_CAP_TUNER;
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
cap->capabilities |= V4L2_CAP_TUNER;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -886,8 +896,17 @@ static int vidioc_g_tuner(struct file *file, void *priv,
|
|||
{
|
||||
struct cx23885_dev *dev = video_drvdata(file);
|
||||
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (0 != t->index)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -902,8 +921,17 @@ static int vidioc_s_tuner(struct file *file, void *priv,
|
|||
{
|
||||
struct cx23885_dev *dev = video_drvdata(file);
|
||||
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (0 != t->index)
|
||||
return -EINVAL;
|
||||
/* Update the A/V core */
|
||||
|
@ -917,9 +945,17 @@ static int vidioc_g_frequency(struct file *file, void *priv,
|
|||
{
|
||||
struct cx23885_dev *dev = video_drvdata(file);
|
||||
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
f->type = V4L2_TUNER_ANALOG_TV;
|
||||
f->frequency = dev->freq;
|
||||
|
||||
|
@ -933,8 +969,17 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency
|
|||
struct v4l2_ctrl *mute;
|
||||
int old_mute_val = 1;
|
||||
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type == TUNER_ABSENT)
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
if (unlikely(f->tuner != 0))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1311,8 +1356,18 @@ int cx23885_video_register(struct cx23885_dev *dev)
|
|||
dev->video_dev->queue = &dev->vb2_vidq;
|
||||
dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
|
||||
V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE;
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
dev->video_dev->device_caps |= V4L2_CAP_TUNER;
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
dev->video_dev->device_caps |= V4L2_CAP_TUNER;
|
||||
}
|
||||
|
||||
err = video_register_device(dev->video_dev, VFL_TYPE_VIDEO,
|
||||
video_nr[dev->nr]);
|
||||
if (err < 0) {
|
||||
|
@ -1329,8 +1384,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
|
|||
dev->vbi_dev->queue = &dev->vb2_vbiq;
|
||||
dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
|
||||
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE;
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
switch (dev->board) { /* i2c device tuners */
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR1265_K4:
|
||||
case CX23885_BOARD_HAUPPAUGE_HVR5525:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_DVB:
|
||||
case CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC:
|
||||
dev->vbi_dev->device_caps |= V4L2_CAP_TUNER;
|
||||
break;
|
||||
default:
|
||||
if (dev->tuner_type != TUNER_ABSENT)
|
||||
dev->vbi_dev->device_caps |= V4L2_CAP_TUNER;
|
||||
}
|
||||
err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
|
||||
vbi_nr[dev->nr]);
|
||||
if (err < 0) {
|
||||
|
|
Loading…
Reference in New Issue