aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-video.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-09-06 05:34:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:58 -0400
commit9afb7377ef16a73d1ae7b089aa853e00a3facea8 (patch)
tree4b5935da7097240c194b5899e0bcd08388353c43 /drivers/media/video/saa7134/saa7134-video.c
parentac2b97b13e5627127b8e29dc0e1e1d7be03eaae4 (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>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c42
1 files changed, 35 insertions, 7 deletions
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
633static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale) 636static 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
1799static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) 1802int 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}
1870EXPORT_SYMBOL_GPL(saa7134_s_std_internal);
1871
1872static 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
1879static 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
1861static int saa7134_cropcap(struct file *file, void *priv, 1888static 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,