Commit fbc9a49c authored by Brad Love's avatar Brad Love Committed by Mauro Carvalho Chehab

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: default avatarBrad Love <brad@nextdimension.cc>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 2be355a0
...@@ -639,8 +639,18 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -639,8 +639,18 @@ static int vidioc_querycap(struct file *file, void *priv,
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE |
V4L2_CAP_DEVICE_CAPS; V4L2_CAP_DEVICE_CAPS;
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) if (dev->tuner_type != TUNER_ABSENT)
cap->capabilities |= V4L2_CAP_TUNER; cap->capabilities |= V4L2_CAP_TUNER;
break;
}
return 0; return 0;
} }
...@@ -886,8 +896,17 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -886,8 +896,17 @@ static int vidioc_g_tuner(struct file *file, void *priv,
{ {
struct cx23885_dev *dev = video_drvdata(file); struct cx23885_dev *dev = video_drvdata(file);
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) if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL; return -EINVAL;
break;
}
if (0 != t->index) if (0 != t->index)
return -EINVAL; return -EINVAL;
...@@ -902,8 +921,17 @@ static int vidioc_s_tuner(struct file *file, void *priv, ...@@ -902,8 +921,17 @@ static int vidioc_s_tuner(struct file *file, void *priv,
{ {
struct cx23885_dev *dev = video_drvdata(file); struct cx23885_dev *dev = video_drvdata(file);
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) if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL; return -EINVAL;
break;
}
if (0 != t->index) if (0 != t->index)
return -EINVAL; return -EINVAL;
/* Update the A/V core */ /* Update the A/V core */
...@@ -917,9 +945,17 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -917,9 +945,17 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{ {
struct cx23885_dev *dev = video_drvdata(file); struct cx23885_dev *dev = video_drvdata(file);
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) if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL; return -EINVAL;
break;
}
f->type = V4L2_TUNER_ANALOG_TV; f->type = V4L2_TUNER_ANALOG_TV;
f->frequency = dev->freq; f->frequency = dev->freq;
...@@ -933,8 +969,17 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency ...@@ -933,8 +969,17 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency
struct v4l2_ctrl *mute; struct v4l2_ctrl *mute;
int old_mute_val = 1; int old_mute_val = 1;
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) if (dev->tuner_type == TUNER_ABSENT)
return -EINVAL; return -EINVAL;
break;
}
if (unlikely(f->tuner != 0)) if (unlikely(f->tuner != 0))
return -EINVAL; return -EINVAL;
...@@ -1311,8 +1356,18 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1311,8 +1356,18 @@ int cx23885_video_register(struct cx23885_dev *dev)
dev->video_dev->queue = &dev->vb2_vidq; dev->video_dev->queue = &dev->vb2_vidq;
dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | dev->video_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE; V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE;
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) if (dev->tuner_type != TUNER_ABSENT)
dev->video_dev->device_caps |= V4L2_CAP_TUNER; dev->video_dev->device_caps |= V4L2_CAP_TUNER;
}
err = video_register_device(dev->video_dev, VFL_TYPE_VIDEO, err = video_register_device(dev->video_dev, VFL_TYPE_VIDEO,
video_nr[dev->nr]); video_nr[dev->nr]);
if (err < 0) { if (err < 0) {
...@@ -1329,8 +1384,17 @@ int cx23885_video_register(struct cx23885_dev *dev) ...@@ -1329,8 +1384,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
dev->vbi_dev->queue = &dev->vb2_vbiq; dev->vbi_dev->queue = &dev->vb2_vbiq;
dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | dev->vbi_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING |
V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE; V4L2_CAP_AUDIO | V4L2_CAP_VBI_CAPTURE;
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) if (dev->tuner_type != TUNER_ABSENT)
dev->vbi_dev->device_caps |= V4L2_CAP_TUNER; dev->vbi_dev->device_caps |= V4L2_CAP_TUNER;
}
err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
vbi_nr[dev->nr]); vbi_nr[dev->nr]);
if (err < 0) { if (err < 0) {
......
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