diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-09-06 05:34:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:58 -0400 |
commit | 9afb7377ef16a73d1ae7b089aa853e00a3facea8 (patch) | |
tree | 4b5935da7097240c194b5899e0bcd08388353c43 | |
parent | ac2b97b13e5627127b8e29dc0e1e1d7be03eaae4 (diff) |
V4L/DVB (8917): saa7134-empress: fix changing the capture standard for non-tuner inputs
When changing the standard the saa6752hs was not updated unless the input
was the TV tuner. The saa6752hs should be updated regardless of the input.
In addition the S_STD and G_STD ioctls for the mpeg video device didn't do
anything. This is now fixed: they behave just like S_STD and G_STD on the
video0 device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 25 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 10 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 42 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 3 |
4 files changed, 64 insertions, 16 deletions
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 946edf64dc28..9a8766a78a0c 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -303,15 +303,6 @@ static int empress_streamoff(struct file *file, void *priv, | |||
303 | return videobuf_streamoff(&dev->empress_tsq); | 303 | return videobuf_streamoff(&dev->empress_tsq); |
304 | } | 304 | } |
305 | 305 | ||
306 | static int saa7134_i2c_call_saa6752(struct saa7134_dev *dev, | ||
307 | unsigned int cmd, void *arg) | ||
308 | { | ||
309 | if (dev->mpeg_i2c_client == NULL) | ||
310 | return -EINVAL; | ||
311 | return dev->mpeg_i2c_client->driver->command(dev->mpeg_i2c_client, | ||
312 | cmd, arg); | ||
313 | } | ||
314 | |||
315 | static int empress_s_ext_ctrls(struct file *file, void *priv, | 306 | static int empress_s_ext_ctrls(struct file *file, void *priv, |
316 | struct v4l2_ext_controls *ctrls) | 307 | struct v4l2_ext_controls *ctrls) |
317 | { | 308 | { |
@@ -431,6 +422,20 @@ static int empress_g_chip_ident(struct file *file, void *fh, | |||
431 | return -EINVAL; | 422 | return -EINVAL; |
432 | } | 423 | } |
433 | 424 | ||
425 | static int empress_s_std(struct file *file, void *priv, v4l2_std_id *id) | ||
426 | { | ||
427 | struct saa7134_dev *dev = file->private_data; | ||
428 | |||
429 | return saa7134_s_std_internal(dev, NULL, id); | ||
430 | } | ||
431 | |||
432 | static int empress_g_std(struct file *file, void *priv, v4l2_std_id *id) | ||
433 | { | ||
434 | struct saa7134_dev *dev = file->private_data; | ||
435 | |||
436 | *id = dev->tvnorm->id; | ||
437 | return 0; | ||
438 | } | ||
434 | 439 | ||
435 | static const struct file_operations ts_fops = | 440 | static const struct file_operations ts_fops = |
436 | { | 441 | { |
@@ -465,6 +470,8 @@ static const struct v4l2_ioctl_ops ts_ioctl_ops = { | |||
465 | .vidioc_g_ctrl = empress_g_ctrl, | 470 | .vidioc_g_ctrl = empress_g_ctrl, |
466 | .vidioc_s_ctrl = empress_s_ctrl, | 471 | .vidioc_s_ctrl = empress_s_ctrl, |
467 | .vidioc_g_chip_ident = empress_g_chip_ident, | 472 | .vidioc_g_chip_ident = empress_g_chip_ident, |
473 | .vidioc_s_std = empress_s_std, | ||
474 | .vidioc_g_std = empress_g_std, | ||
468 | }; | 475 | }; |
469 | 476 | ||
470 | /* ----------------------------------------------------------- */ | 477 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 5f713e637683..b02965c52476 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -427,6 +427,16 @@ void saa7134_i2c_call_clients(struct saa7134_dev *dev, | |||
427 | i2c_clients_command(&dev->i2c_adap, cmd, arg); | 427 | i2c_clients_command(&dev->i2c_adap, cmd, arg); |
428 | } | 428 | } |
429 | 429 | ||
430 | int saa7134_i2c_call_saa6752(struct saa7134_dev *dev, | ||
431 | unsigned int cmd, void *arg) | ||
432 | { | ||
433 | if (dev->mpeg_i2c_client == NULL) | ||
434 | return -EINVAL; | ||
435 | return dev->mpeg_i2c_client->driver->command(dev->mpeg_i2c_client, | ||
436 | cmd, arg); | ||
437 | } | ||
438 | EXPORT_SYMBOL_GPL(saa7134_i2c_call_saa6752); | ||
439 | |||
430 | int saa7134_i2c_register(struct saa7134_dev *dev) | 440 | int saa7134_i2c_register(struct saa7134_dev *dev) |
431 | { | 441 | { |
432 | dev->i2c_adap = saa7134_adap_template; | 442 | dev->i2c_adap = saa7134_adap_template; |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 8fd31138f9ad..9aafd5844191 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -628,6 +628,9 @@ void saa7134_set_tvnorm_hw(struct saa7134_dev *dev) | |||
628 | 628 | ||
629 | if (card_in(dev, dev->ctl_input).tv) | 629 | if (card_in(dev, dev->ctl_input).tv) |
630 | saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); | 630 | saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); |
631 | /* Set the correct norm for the saa6752hs. This function | ||
632 | does nothing if there is no saa6752hs. */ | ||
633 | saa7134_i2c_call_saa6752(dev, VIDIOC_S_STD, &dev->tvnorm->id); | ||
631 | } | 634 | } |
632 | 635 | ||
633 | static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) | 636 | static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) |
@@ -1796,18 +1799,25 @@ static int saa7134_querycap(struct file *file, void *priv, | |||
1796 | return 0; | 1799 | return 0; |
1797 | } | 1800 | } |
1798 | 1801 | ||
1799 | static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | 1802 | int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id *id) |
1800 | { | 1803 | { |
1801 | struct saa7134_fh *fh = priv; | ||
1802 | struct saa7134_dev *dev = fh->dev; | ||
1803 | unsigned long flags; | 1804 | unsigned long flags; |
1804 | unsigned int i; | 1805 | unsigned int i; |
1805 | v4l2_std_id fixup; | 1806 | v4l2_std_id fixup; |
1806 | int err; | 1807 | int err; |
1807 | 1808 | ||
1808 | err = v4l2_prio_check(&dev->prio, &fh->prio); | 1809 | /* When called from the empress code fh == NULL. |
1809 | if (0 != err) | 1810 | That needs to be fixed somehow, but for now this is |
1810 | return err; | 1811 | good enough. */ |
1812 | if (fh) { | ||
1813 | err = v4l2_prio_check(&dev->prio, &fh->prio); | ||
1814 | if (0 != err) | ||
1815 | return err; | ||
1816 | } else if (res_locked(dev, RESOURCE_OVERLAY)) { | ||
1817 | /* Don't change the std from the mpeg device | ||
1818 | if overlay is active. */ | ||
1819 | return -EBUSY; | ||
1820 | } | ||
1811 | 1821 | ||
1812 | for (i = 0; i < TVNORMS; i++) | 1822 | for (i = 0; i < TVNORMS; i++) |
1813 | if (*id == tvnorms[i].id) | 1823 | if (*id == tvnorms[i].id) |
@@ -1840,7 +1850,7 @@ static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1840 | *id = tvnorms[i].id; | 1850 | *id = tvnorms[i].id; |
1841 | 1851 | ||
1842 | mutex_lock(&dev->lock); | 1852 | mutex_lock(&dev->lock); |
1843 | if (res_check(fh, RESOURCE_OVERLAY)) { | 1853 | if (fh && res_check(fh, RESOURCE_OVERLAY)) { |
1844 | spin_lock_irqsave(&dev->slock, flags); | 1854 | spin_lock_irqsave(&dev->slock, flags); |
1845 | stop_preview(dev, fh); | 1855 | stop_preview(dev, fh); |
1846 | spin_unlock_irqrestore(&dev->slock, flags); | 1856 | spin_unlock_irqrestore(&dev->slock, flags); |
@@ -1857,6 +1867,23 @@ static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1857 | mutex_unlock(&dev->lock); | 1867 | mutex_unlock(&dev->lock); |
1858 | return 0; | 1868 | return 0; |
1859 | } | 1869 | } |
1870 | EXPORT_SYMBOL_GPL(saa7134_s_std_internal); | ||
1871 | |||
1872 | static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | ||
1873 | { | ||
1874 | struct saa7134_fh *fh = priv; | ||
1875 | |||
1876 | return saa7134_s_std_internal(fh->dev, fh, id); | ||
1877 | } | ||
1878 | |||
1879 | static int saa7134_g_std(struct file *file, void *priv, v4l2_std_id *id) | ||
1880 | { | ||
1881 | struct saa7134_fh *fh = priv; | ||
1882 | struct saa7134_dev *dev = fh->dev; | ||
1883 | |||
1884 | *id = dev->tvnorm->id; | ||
1885 | return 0; | ||
1886 | } | ||
1860 | 1887 | ||
1861 | static int saa7134_cropcap(struct file *file, void *priv, | 1888 | static int saa7134_cropcap(struct file *file, void *priv, |
1862 | struct v4l2_cropcap *cap) | 1889 | struct v4l2_cropcap *cap) |
@@ -2397,6 +2424,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2397 | .vidioc_qbuf = saa7134_qbuf, | 2424 | .vidioc_qbuf = saa7134_qbuf, |
2398 | .vidioc_dqbuf = saa7134_dqbuf, | 2425 | .vidioc_dqbuf = saa7134_dqbuf, |
2399 | .vidioc_s_std = saa7134_s_std, | 2426 | .vidioc_s_std = saa7134_s_std, |
2427 | .vidioc_g_std = saa7134_g_std, | ||
2400 | .vidioc_enum_input = saa7134_enum_input, | 2428 | .vidioc_enum_input = saa7134_enum_input, |
2401 | .vidioc_g_input = saa7134_g_input, | 2429 | .vidioc_g_input = saa7134_g_input, |
2402 | .vidioc_s_input = saa7134_s_input, | 2430 | .vidioc_s_input = saa7134_s_input, |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index a1e0dad1267b..5e7fc731fab1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -662,6 +662,8 @@ int saa7134_i2c_register(struct saa7134_dev *dev); | |||
662 | int saa7134_i2c_unregister(struct saa7134_dev *dev); | 662 | int saa7134_i2c_unregister(struct saa7134_dev *dev); |
663 | void saa7134_i2c_call_clients(struct saa7134_dev *dev, | 663 | void saa7134_i2c_call_clients(struct saa7134_dev *dev, |
664 | unsigned int cmd, void *arg); | 664 | unsigned int cmd, void *arg); |
665 | int saa7134_i2c_call_saa6752(struct saa7134_dev *dev, | ||
666 | unsigned int cmd, void *arg); | ||
665 | 667 | ||
666 | 668 | ||
667 | /* ----------------------------------------------------------- */ | 669 | /* ----------------------------------------------------------- */ |
@@ -674,6 +676,7 @@ extern struct video_device saa7134_radio_template; | |||
674 | int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); | 676 | int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); |
675 | int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); | 677 | int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); |
676 | int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c); | 678 | int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c); |
679 | int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id *id); | ||
677 | 680 | ||
678 | int saa7134_videoport_init(struct saa7134_dev *dev); | 681 | int saa7134_videoport_init(struct saa7134_dev *dev); |
679 | void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); | 682 | void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); |