aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-03-22 12:32:20 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-25 14:10:02 -0400
commite1cf6587d5ba2085d7e5eae064b1adde5d07f801 (patch)
tree9535dbce97a8070319de3ec2593c29cfd5d036c3 /drivers/media/usb
parent59e0548453bc24077e32748857e754d4bda2ab73 (diff)
[media] au0828: frequency handling fixes
- define an initial frequency - return an error if g_frequency is called for an invalid tuner index - get the clamped frequency value after setting it: i.e. the tuner driver may clamp the given frequency to a valid frequency range and ctrl_freq should get that actual clamped frequency. - remove obsolete tuner type checks (done by the core). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/au0828/au0828-video.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index ba90ffb3d921..8562cca80b36 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1542,7 +1542,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1542 struct au0828_fh *fh = priv; 1542 struct au0828_fh *fh = priv;
1543 struct au0828_dev *dev = fh->dev; 1543 struct au0828_dev *dev = fh->dev;
1544 1544
1545 freq->type = V4L2_TUNER_ANALOG_TV; 1545 if (freq->tuner != 0)
1546 return -EINVAL;
1546 freq->frequency = dev->ctrl_freq; 1547 freq->frequency = dev->ctrl_freq;
1547 return 0; 1548 return 0;
1548} 1549}
@@ -1552,13 +1553,10 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1552{ 1553{
1553 struct au0828_fh *fh = priv; 1554 struct au0828_fh *fh = priv;
1554 struct au0828_dev *dev = fh->dev; 1555 struct au0828_dev *dev = fh->dev;
1556 struct v4l2_frequency new_freq = *freq;
1555 1557
1556 if (freq->tuner != 0) 1558 if (freq->tuner != 0)
1557 return -EINVAL; 1559 return -EINVAL;
1558 if (freq->type != V4L2_TUNER_ANALOG_TV)
1559 return -EINVAL;
1560
1561 dev->ctrl_freq = freq->frequency;
1562 1560
1563 if (dev->dvb.frontend && dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl) 1561 if (dev->dvb.frontend && dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl)
1564 dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl(dev->dvb.frontend, 1); 1562 dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl(dev->dvb.frontend, 1);
@@ -1573,6 +1571,9 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1573 } 1571 }
1574 1572
1575 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, freq); 1573 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, freq);
1574 /* Get the actual set (and possibly clamped) frequency */
1575 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, &new_freq);
1576 dev->ctrl_freq = new_freq.frequency;
1576 1577
1577 if (dev->dvb.frontend && dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl) 1578 if (dev->dvb.frontend && dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl)
1578 dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl(dev->dvb.frontend, 0); 1579 dev->dvb.frontend->ops.analog_ops.i2c_gate_ctrl(dev->dvb.frontend, 0);
@@ -1976,6 +1977,7 @@ int au0828_analog_register(struct au0828_dev *dev,
1976 dev->frame_size = dev->field_size << 1; 1977 dev->frame_size = dev->field_size << 1;
1977 dev->bytesperline = dev->width << 1; 1978 dev->bytesperline = dev->width << 1;
1978 dev->ctrl_ainput = 0; 1979 dev->ctrl_ainput = 0;
1980 dev->ctrl_freq = 960;
1979 1981
1980 /* allocate and fill v4l2 video struct */ 1982 /* allocate and fill v4l2 video struct */
1981 dev->vdev = video_device_alloc(); 1983 dev->vdev = video_device_alloc();