diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 17:03:59 -0400 |
commit | cf2fa66055d718ae13e62451bb546505f63906a2 (patch) | |
tree | e206d3f04e74a34e9aa88d21af6c26eea21d4121 /drivers/media/video/saa7134/saa7134-video.c | |
parent | 4501a466f28788485604ee42641d7a5fe7258d16 (diff) | |
parent | 57f51dbc45f65f7ee1e8c8f77200bb8000e3e271 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (313 commits)
V4L/DVB (9186): Added support for Prof 7300 DVB-S/S2 cards
V4L/DVB (9185): S2API: Ensure we have a reasonable ROLLOFF default
V4L/DVB (9184): cx24116: Change the default SNR units back to percentage by default.
V4L/DVB (9183): S2API: Return error of the caller provides 0 commands.
V4L/DVB (9182): S2API: Added support for DTV_HIERARCHY
V4L/DVB (9181): S2API: Add support fot DTV_GUARD_INTERVAL and DTV_TRANSMISSION_MODE
V4L/DVB (9180): S2API: Added support for DTV_CODE_RATE_HP/LP
V4L/DVB (9179): S2API: frontend.h cleanup
V4L/DVB (9178): cx24116: Add module parameter to return SNR as ESNO.
V4L/DVB (9177): S2API: Change _8PSK / _16APSK to PSK_8 and APSK_16
V4L/DVB (9176): Add support for DvbWorld USB cards with STV0288 demodulator.
V4L/DVB (9175): Remove NULL pointer in stb6000 driver.
V4L/DVB (9174): Allow custom inittab for ST STV0288 demodulator.
V4L/DVB (9173): S2API: Remove the hardcoded command limit during validation
V4L/DVB (9172): S2API: Bugfix related to DVB-S / DVB-S2 tuning for the legacy API.
V4L/DVB (9171): S2API: Stop an OOPS if illegal commands are dumped in S2API.
V4L/DVB (9170): cx24116: Sanity checking to data input via S2API to the cx24116 demod.
V4L/DVB (9169): uvcvideo: Support two new Bison Electronics webcams.
V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote
V4L/DVB: v4l2-dev: remove duplicated #include
...
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 68c268981861..02bb6747a39c 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) |
@@ -1330,6 +1333,8 @@ static int video_open(struct inode *inode, struct file *file) | |||
1330 | struct saa7134_fh *fh; | 1333 | struct saa7134_fh *fh; |
1331 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1334 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1332 | int radio = 0; | 1335 | int radio = 0; |
1336 | |||
1337 | lock_kernel(); | ||
1333 | list_for_each_entry(dev, &saa7134_devlist, devlist) { | 1338 | list_for_each_entry(dev, &saa7134_devlist, devlist) { |
1334 | if (dev->video_dev && (dev->video_dev->minor == minor)) | 1339 | if (dev->video_dev && (dev->video_dev->minor == minor)) |
1335 | goto found; | 1340 | goto found; |
@@ -1342,6 +1347,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
1342 | goto found; | 1347 | goto found; |
1343 | } | 1348 | } |
1344 | } | 1349 | } |
1350 | unlock_kernel(); | ||
1345 | return -ENODEV; | 1351 | return -ENODEV; |
1346 | found: | 1352 | found: |
1347 | 1353 | ||
@@ -1350,8 +1356,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
1350 | 1356 | ||
1351 | /* allocate + initialize per filehandle data */ | 1357 | /* allocate + initialize per filehandle data */ |
1352 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 1358 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
1353 | if (NULL == fh) | 1359 | if (NULL == fh) { |
1360 | unlock_kernel(); | ||
1354 | return -ENOMEM; | 1361 | return -ENOMEM; |
1362 | } | ||
1355 | file->private_data = fh; | 1363 | file->private_data = fh; |
1356 | fh->dev = dev; | 1364 | fh->dev = dev; |
1357 | fh->radio = radio; | 1365 | fh->radio = radio; |
@@ -1384,6 +1392,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
1384 | /* switch to video/vbi mode */ | 1392 | /* switch to video/vbi mode */ |
1385 | video_mux(dev,dev->ctl_input); | 1393 | video_mux(dev,dev->ctl_input); |
1386 | } | 1394 | } |
1395 | unlock_kernel(); | ||
1387 | return 0; | 1396 | return 0; |
1388 | } | 1397 | } |
1389 | 1398 | ||
@@ -1790,18 +1799,25 @@ static int saa7134_querycap(struct file *file, void *priv, | |||
1790 | return 0; | 1799 | return 0; |
1791 | } | 1800 | } |
1792 | 1801 | ||
1793 | 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) |
1794 | { | 1803 | { |
1795 | struct saa7134_fh *fh = priv; | ||
1796 | struct saa7134_dev *dev = fh->dev; | ||
1797 | unsigned long flags; | 1804 | unsigned long flags; |
1798 | unsigned int i; | 1805 | unsigned int i; |
1799 | v4l2_std_id fixup; | 1806 | v4l2_std_id fixup; |
1800 | int err; | 1807 | int err; |
1801 | 1808 | ||
1802 | err = v4l2_prio_check(&dev->prio, &fh->prio); | 1809 | /* When called from the empress code fh == NULL. |
1803 | if (0 != err) | 1810 | That needs to be fixed somehow, but for now this is |
1804 | 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 | } | ||
1805 | 1821 | ||
1806 | for (i = 0; i < TVNORMS; i++) | 1822 | for (i = 0; i < TVNORMS; i++) |
1807 | if (*id == tvnorms[i].id) | 1823 | if (*id == tvnorms[i].id) |
@@ -1834,7 +1850,7 @@ static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1834 | *id = tvnorms[i].id; | 1850 | *id = tvnorms[i].id; |
1835 | 1851 | ||
1836 | mutex_lock(&dev->lock); | 1852 | mutex_lock(&dev->lock); |
1837 | if (res_check(fh, RESOURCE_OVERLAY)) { | 1853 | if (fh && res_check(fh, RESOURCE_OVERLAY)) { |
1838 | spin_lock_irqsave(&dev->slock, flags); | 1854 | spin_lock_irqsave(&dev->slock, flags); |
1839 | stop_preview(dev, fh); | 1855 | stop_preview(dev, fh); |
1840 | spin_unlock_irqrestore(&dev->slock, flags); | 1856 | spin_unlock_irqrestore(&dev->slock, flags); |
@@ -1851,6 +1867,23 @@ static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1851 | mutex_unlock(&dev->lock); | 1867 | mutex_unlock(&dev->lock); |
1852 | return 0; | 1868 | return 0; |
1853 | } | 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 | } | ||
1854 | 1887 | ||
1855 | static int saa7134_cropcap(struct file *file, void *priv, | 1888 | static int saa7134_cropcap(struct file *file, void *priv, |
1856 | struct v4l2_cropcap *cap) | 1889 | struct v4l2_cropcap *cap) |
@@ -2077,18 +2110,6 @@ static int saa7134_enum_fmt_vid_overlay(struct file *file, void *priv, | |||
2077 | return 0; | 2110 | return 0; |
2078 | } | 2111 | } |
2079 | 2112 | ||
2080 | static int saa7134_enum_fmt_vbi_cap(struct file *file, void *priv, | ||
2081 | struct v4l2_fmtdesc *f) | ||
2082 | { | ||
2083 | if (0 != f->index) | ||
2084 | return -EINVAL; | ||
2085 | |||
2086 | f->pixelformat = V4L2_PIX_FMT_GREY; | ||
2087 | strcpy(f->description, "vbi data"); | ||
2088 | |||
2089 | return 0; | ||
2090 | } | ||
2091 | |||
2092 | static int saa7134_g_fbuf(struct file *file, void *f, | 2113 | static int saa7134_g_fbuf(struct file *file, void *f, |
2093 | struct v4l2_framebuffer *fb) | 2114 | struct v4l2_framebuffer *fb) |
2094 | { | 2115 | { |
@@ -2379,7 +2400,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2379 | .vidioc_g_fmt_vid_overlay = saa7134_g_fmt_vid_overlay, | 2400 | .vidioc_g_fmt_vid_overlay = saa7134_g_fmt_vid_overlay, |
2380 | .vidioc_try_fmt_vid_overlay = saa7134_try_fmt_vid_overlay, | 2401 | .vidioc_try_fmt_vid_overlay = saa7134_try_fmt_vid_overlay, |
2381 | .vidioc_s_fmt_vid_overlay = saa7134_s_fmt_vid_overlay, | 2402 | .vidioc_s_fmt_vid_overlay = saa7134_s_fmt_vid_overlay, |
2382 | .vidioc_enum_fmt_vbi_cap = saa7134_enum_fmt_vbi_cap, | ||
2383 | .vidioc_g_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, | 2403 | .vidioc_g_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, |
2384 | .vidioc_try_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, | 2404 | .vidioc_try_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, |
2385 | .vidioc_s_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, | 2405 | .vidioc_s_fmt_vbi_cap = saa7134_try_get_set_fmt_vbi_cap, |
@@ -2391,6 +2411,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2391 | .vidioc_qbuf = saa7134_qbuf, | 2411 | .vidioc_qbuf = saa7134_qbuf, |
2392 | .vidioc_dqbuf = saa7134_dqbuf, | 2412 | .vidioc_dqbuf = saa7134_dqbuf, |
2393 | .vidioc_s_std = saa7134_s_std, | 2413 | .vidioc_s_std = saa7134_s_std, |
2414 | .vidioc_g_std = saa7134_g_std, | ||
2394 | .vidioc_enum_input = saa7134_enum_input, | 2415 | .vidioc_enum_input = saa7134_enum_input, |
2395 | .vidioc_g_input = saa7134_g_input, | 2416 | .vidioc_g_input = saa7134_g_input, |
2396 | .vidioc_s_input = saa7134_s_input, | 2417 | .vidioc_s_input = saa7134_s_input, |