aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-07-12 17:44:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-07-12 17:44:19 -0400
commit9f71963702764243d0835b07660ae505b66ca09f (patch)
treecb6b4d3ea8c796fe00d309601c7279aded078906 /drivers
parent293ffa8faa21bbc5e77d3f779d95c4146ee8f709 (diff)
parent5d9955f8a978c1992a0f9966d22c43471214d43b (diff)
Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: V4L/DVB: uvc: Fix multiple symbols definitions with UVC gadget and host drivers V4L/DVB: v4l: mem2mem_testdev: fix g_fmt NULL pointer dereference V4L/DVB: uvcvideo: Power line frequency control doesn't support GET_MIN/MAX/RES V4L/DVB: ivtv: Add delay to ensure the decoder always restarts with a blank screen V4L/DVB: Documentation: Add the Philips FQ1236 MK5 to video4linux/CARDLIST.tuner V4L/DVB: tveeprom: Add an entry for tuner code 168: a TCL M30WTP-4N-E tuner V4L/DVB: tuner: Add a definition for the Philips FQ1236 MK5 NTSC tuner V4L/DVB: OMAP_VOUT: fix: Module params were not working through bootargs V4L/DVB: OMAP_VOUT: fix: Replaced dma-sg with dma-contig V4L/DVB: OMAP_VOUT:Build FIX: Rebased against latest DSS2 changes
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/tuners/tuner-simple.c1
-rw-r--r--drivers/media/common/tuners/tuner-types.c16
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c3
-rw-r--r--drivers/media/video/mem2mem_testdev.c3
-rw-r--r--drivers/media/video/omap/Kconfig4
-rw-r--r--drivers/media/video/omap/Makefile4
-rw-r--r--drivers/media/video/omap/omap_vout.c81
-rw-r--r--drivers/media/video/tveeprom.c15
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c4
-rw-r--r--drivers/usb/gadget/f_uvc.c4
-rw-r--r--drivers/usb/gadget/uvc.h10
-rw-r--r--drivers/usb/gadget/uvc_queue.c153
-rw-r--r--drivers/usb/gadget/uvc_queue.h20
-rw-r--r--drivers/usb/gadget/uvc_v4l2.c2
-rw-r--r--drivers/usb/gadget/uvc_video.c6
-rw-r--r--drivers/usb/gadget/webcam.c4
16 files changed, 167 insertions, 163 deletions
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c
index 8abbcc5fcf95..8cf2ab609d5e 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -524,6 +524,7 @@ static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer)
524 buffer[3] = 0x39; 524 buffer[3] = 0x39;
525 break; 525 break;
526 case TUNER_PHILIPS_FQ1216LME_MK3: 526 case TUNER_PHILIPS_FQ1216LME_MK3:
527 case TUNER_PHILIPS_FQ1236_MK5:
527 tuner_err("This tuner doesn't have FM\n"); 528 tuner_err("This tuner doesn't have FM\n");
528 /* Set the low band for sanity, since it covers 88-108 MHz */ 529 /* Set the low band for sanity, since it covers 88-108 MHz */
529 buffer[3] = 0x01; 530 buffer[3] = 0x01;
diff --git a/drivers/media/common/tuners/tuner-types.c b/drivers/media/common/tuners/tuner-types.c
index d9aaaca620c9..58a513bcd747 100644
--- a/drivers/media/common/tuners/tuner-types.c
+++ b/drivers/media/common/tuners/tuner-types.c
@@ -1353,6 +1353,17 @@ static struct tuner_params tuner_sony_btf_pxn01z_params[] = {
1353 }, 1353 },
1354}; 1354};
1355 1355
1356/* ------------ TUNER_PHILIPS_FQ1236_MK5 - Philips NTSC ------------ */
1357
1358static struct tuner_params tuner_philips_fq1236_mk5_params[] = {
1359 {
1360 .type = TUNER_PARAM_TYPE_NTSC,
1361 .ranges = tuner_fm1236_mk3_ntsc_ranges,
1362 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges),
1363 .has_tda9887 = 1, /* TDA9885, no FM radio */
1364 },
1365};
1366
1356/* --------------------------------------------------------------------- */ 1367/* --------------------------------------------------------------------- */
1357 1368
1358struct tunertype tuners[] = { 1369struct tunertype tuners[] = {
@@ -1826,6 +1837,11 @@ struct tunertype tuners[] = {
1826 .params = tuner_sony_btf_pxn01z_params, 1837 .params = tuner_sony_btf_pxn01z_params,
1827 .count = ARRAY_SIZE(tuner_sony_btf_pxn01z_params), 1838 .count = ARRAY_SIZE(tuner_sony_btf_pxn01z_params),
1828 }, 1839 },
1840 [TUNER_PHILIPS_FQ1236_MK5] = { /* NTSC, TDA9885, no FM radio */
1841 .name = "Philips FQ1236 MK5",
1842 .params = tuner_philips_fq1236_mk5_params,
1843 .count = ARRAY_SIZE(tuner_philips_fq1236_mk5_params),
1844 },
1829}; 1845};
1830EXPORT_SYMBOL(tuners); 1846EXPORT_SYMBOL(tuners);
1831 1847
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 9ecacab4b89b..a937e2ff9b6e 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -912,6 +912,9 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts)
912 clear_bit(IVTV_F_S_STREAMING, &s->s_flags); 912 clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
913 ivtv_flush_queues(s); 913 ivtv_flush_queues(s);
914 914
915 /* decoder needs time to settle */
916 ivtv_msleep_timeout(40, 0);
917
915 /* decrement decoding */ 918 /* decrement decoding */
916 atomic_dec(&itv->decoding); 919 atomic_dec(&itv->decoding);
917 920
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c
index 554eaf140128..10ddeccc70eb 100644
--- a/drivers/media/video/mem2mem_testdev.c
+++ b/drivers/media/video/mem2mem_testdev.c
@@ -988,6 +988,9 @@ static int m2mtest_probe(struct platform_device *pdev)
988 goto err_m2m; 988 goto err_m2m;
989 } 989 }
990 990
991 q_data[V4L2_M2M_SRC].fmt = &formats[0];
992 q_data[V4L2_M2M_DST].fmt = &formats[0];
993
991 return 0; 994 return 0;
992 995
993err_m2m: 996err_m2m:
diff --git a/drivers/media/video/omap/Kconfig b/drivers/media/video/omap/Kconfig
index 97c53949ca89..e63233fd2aaa 100644
--- a/drivers/media/video/omap/Kconfig
+++ b/drivers/media/video/omap/Kconfig
@@ -1,8 +1,8 @@
1config VIDEO_OMAP2_VOUT 1config VIDEO_OMAP2_VOUT
2 tristate "OMAP2/OMAP3 V4L2-Display driver" 2 tristate "OMAP2/OMAP3 V4L2-Display driver"
3 depends on ARCH_OMAP24XX || ARCH_OMAP34XX 3 depends on ARCH_OMAP2 || ARCH_OMAP3
4 select VIDEOBUF_GEN 4 select VIDEOBUF_GEN
5 select VIDEOBUF_DMA_SG 5 select VIDEOBUF_DMA_CONTIG
6 select OMAP2_DSS 6 select OMAP2_DSS
7 select OMAP2_VRAM 7 select OMAP2_VRAM
8 select OMAP2_VRFB 8 select OMAP2_VRFB
diff --git a/drivers/media/video/omap/Makefile b/drivers/media/video/omap/Makefile
index b8bab00ad010..b28788070ae1 100644
--- a/drivers/media/video/omap/Makefile
+++ b/drivers/media/video/omap/Makefile
@@ -3,5 +3,5 @@
3# 3#
4 4
5# OMAP2/3 Display driver 5# OMAP2/3 Display driver
6omap-vout-mod-objs := omap_vout.o omap_voutlib.o 6omap-vout-y := omap_vout.o omap_voutlib.o
7obj-$(CONFIG_VIDEO_OMAP2_VOUT) += omap-vout-mod.o 7obj-$(CONFIG_VIDEO_OMAP2_VOUT) += omap-vout.o
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index e7db0554949a..929073e792c9 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -38,8 +38,9 @@
38#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <linux/videodev2.h> 40#include <linux/videodev2.h>
41#include <linux/slab.h>
41 42
42#include <media/videobuf-dma-sg.h> 43#include <media/videobuf-dma-contig.h>
43#include <media/v4l2-device.h> 44#include <media/v4l2-device.h>
44#include <media/v4l2-ioctl.h> 45#include <media/v4l2-ioctl.h>
45 46
@@ -1053,9 +1054,9 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1053 struct videobuf_buffer *vb, 1054 struct videobuf_buffer *vb,
1054 enum v4l2_field field) 1055 enum v4l2_field field)
1055{ 1056{
1057 dma_addr_t dmabuf;
1056 struct vid_vrfb_dma *tx; 1058 struct vid_vrfb_dma *tx;
1057 enum dss_rotation rotation; 1059 enum dss_rotation rotation;
1058 struct videobuf_dmabuf *dmabuf = NULL;
1059 struct omap_vout_device *vout = q->priv_data; 1060 struct omap_vout_device *vout = q->priv_data;
1060 u32 dest_frame_index = 0, src_element_index = 0; 1061 u32 dest_frame_index = 0, src_element_index = 0;
1061 u32 dest_element_index = 0, src_frame_index = 0; 1062 u32 dest_element_index = 0, src_frame_index = 0;
@@ -1074,24 +1075,17 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1074 if (V4L2_MEMORY_USERPTR == vb->memory) { 1075 if (V4L2_MEMORY_USERPTR == vb->memory) {
1075 if (0 == vb->baddr) 1076 if (0 == vb->baddr)
1076 return -EINVAL; 1077 return -EINVAL;
1077 /* Virtual address */
1078 /* priv points to struct videobuf_pci_sg_memory. But we went
1079 * pointer to videobuf_dmabuf, which is member of
1080 * videobuf_pci_sg_memory */
1081 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1082 dmabuf->vmalloc = (void *) vb->baddr;
1083
1084 /* Physical address */ 1078 /* Physical address */
1085 dmabuf->bus_addr = 1079 vout->queued_buf_addr[vb->i] = (u8 *)
1086 (dma_addr_t) omap_vout_uservirt_to_phys(vb->baddr); 1080 omap_vout_uservirt_to_phys(vb->baddr);
1081 } else {
1082 vout->queued_buf_addr[vb->i] = (u8 *)vout->buf_phy_addr[vb->i];
1087 } 1083 }
1088 1084
1089 if (!rotation_enabled(vout)) { 1085 if (!rotation_enabled(vout))
1090 dmabuf = videobuf_to_dma(q->bufs[vb->i]);
1091 vout->queued_buf_addr[vb->i] = (u8 *) dmabuf->bus_addr;
1092 return 0; 1086 return 0;
1093 } 1087
1094 dmabuf = videobuf_to_dma(q->bufs[vb->i]); 1088 dmabuf = vout->buf_phy_addr[vb->i];
1095 /* If rotation is enabled, copy input buffer into VRFB 1089 /* If rotation is enabled, copy input buffer into VRFB
1096 * memory space using DMA. We are copying input buffer 1090 * memory space using DMA. We are copying input buffer
1097 * into VRFB memory space of desired angle and DSS will 1091 * into VRFB memory space of desired angle and DSS will
@@ -1120,7 +1114,7 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
1120 tx->dev_id, 0x0); 1114 tx->dev_id, 0x0);
1121 /* src_port required only for OMAP1 */ 1115 /* src_port required only for OMAP1 */
1122 omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC, 1116 omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
1123 dmabuf->bus_addr, src_element_index, src_frame_index); 1117 dmabuf, src_element_index, src_frame_index);
1124 /*set dma source burst mode for VRFB */ 1118 /*set dma source burst mode for VRFB */
1125 omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16); 1119 omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16);
1126 rotation = calc_rotation(vout); 1120 rotation = calc_rotation(vout);
@@ -1211,7 +1205,6 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1211 void *pos; 1205 void *pos;
1212 unsigned long start = vma->vm_start; 1206 unsigned long start = vma->vm_start;
1213 unsigned long size = (vma->vm_end - vma->vm_start); 1207 unsigned long size = (vma->vm_end - vma->vm_start);
1214 struct videobuf_dmabuf *dmabuf = NULL;
1215 struct omap_vout_device *vout = file->private_data; 1208 struct omap_vout_device *vout = file->private_data;
1216 struct videobuf_queue *q = &vout->vbq; 1209 struct videobuf_queue *q = &vout->vbq;
1217 1210
@@ -1241,8 +1234,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
1241 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); 1234 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
1242 vma->vm_ops = &omap_vout_vm_ops; 1235 vma->vm_ops = &omap_vout_vm_ops;
1243 vma->vm_private_data = (void *) vout; 1236 vma->vm_private_data = (void *) vout;
1244 dmabuf = videobuf_to_dma(q->bufs[i]); 1237 pos = (void *)vout->buf_virt_addr[i];
1245 pos = dmabuf->vmalloc;
1246 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT; 1238 vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT;
1247 while (size > 0) { 1239 while (size > 0) {
1248 unsigned long pfn; 1240 unsigned long pfn;
@@ -1347,8 +1339,8 @@ static int omap_vout_open(struct file *file)
1347 video_vbq_ops.buf_queue = omap_vout_buffer_queue; 1339 video_vbq_ops.buf_queue = omap_vout_buffer_queue;
1348 spin_lock_init(&vout->vbq_lock); 1340 spin_lock_init(&vout->vbq_lock);
1349 1341
1350 videobuf_queue_sg_init(q, &video_vbq_ops, NULL, &vout->vbq_lock, 1342 videobuf_queue_dma_contig_init(q, &video_vbq_ops, q->dev,
1351 vout->type, V4L2_FIELD_NONE, 1343 &vout->vbq_lock, vout->type, V4L2_FIELD_NONE,
1352 sizeof(struct videobuf_buffer), vout); 1344 sizeof(struct videobuf_buffer), vout);
1353 1345
1354 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__); 1346 v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__);
@@ -1799,7 +1791,6 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1799 unsigned int i, num_buffers = 0; 1791 unsigned int i, num_buffers = 0;
1800 struct omap_vout_device *vout = fh; 1792 struct omap_vout_device *vout = fh;
1801 struct videobuf_queue *q = &vout->vbq; 1793 struct videobuf_queue *q = &vout->vbq;
1802 struct videobuf_dmabuf *dmabuf = NULL;
1803 1794
1804 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0)) 1795 if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0))
1805 return -EINVAL; 1796 return -EINVAL;
@@ -1825,8 +1816,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1825 num_buffers = (vout->vid == OMAP_VIDEO1) ? 1816 num_buffers = (vout->vid == OMAP_VIDEO1) ?
1826 video1_numbuffers : video2_numbuffers; 1817 video1_numbuffers : video2_numbuffers;
1827 for (i = num_buffers; i < vout->buffer_allocated; i++) { 1818 for (i = num_buffers; i < vout->buffer_allocated; i++) {
1828 dmabuf = videobuf_to_dma(q->bufs[i]); 1819 omap_vout_free_buffer(vout->buf_virt_addr[i],
1829 omap_vout_free_buffer((u32)dmabuf->vmalloc,
1830 vout->buffer_size); 1820 vout->buffer_size);
1831 vout->buf_virt_addr[i] = 0; 1821 vout->buf_virt_addr[i] = 0;
1832 vout->buf_phy_addr[i] = 0; 1822 vout->buf_phy_addr[i] = 0;
@@ -1855,12 +1845,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
1855 goto reqbuf_err; 1845 goto reqbuf_err;
1856 1846
1857 vout->buffer_allocated = req->count; 1847 vout->buffer_allocated = req->count;
1858 for (i = 0; i < req->count; i++) { 1848
1859 dmabuf = videobuf_to_dma(q->bufs[i]);
1860 dmabuf->vmalloc = (void *) vout->buf_virt_addr[i];
1861 dmabuf->bus_addr = (dma_addr_t) vout->buf_phy_addr[i];
1862 dmabuf->sglen = 1;
1863 }
1864reqbuf_err: 1849reqbuf_err:
1865 mutex_unlock(&vout->lock); 1850 mutex_unlock(&vout->lock);
1866 return ret; 1851 return ret;
@@ -2488,7 +2473,7 @@ static int omap_vout_remove(struct platform_device *pdev)
2488 2473
2489 for (k = 0; k < vid_dev->num_displays; k++) { 2474 for (k = 0; k < vid_dev->num_displays; k++) {
2490 if (vid_dev->displays[k]->state != OMAP_DSS_DISPLAY_DISABLED) 2475 if (vid_dev->displays[k]->state != OMAP_DSS_DISPLAY_DISABLED)
2491 vid_dev->displays[k]->disable(vid_dev->displays[k]); 2476 vid_dev->displays[k]->driver->disable(vid_dev->displays[k]);
2492 2477
2493 omap_dss_put_device(vid_dev->displays[k]); 2478 omap_dss_put_device(vid_dev->displays[k]);
2494 } 2479 }
@@ -2545,7 +2530,9 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2545 def_display = NULL; 2530 def_display = NULL;
2546 } 2531 }
2547 if (def_display) { 2532 if (def_display) {
2548 ret = def_display->enable(def_display); 2533 struct omap_dss_driver *dssdrv = def_display->driver;
2534
2535 ret = dssdrv->enable(def_display);
2549 if (ret) { 2536 if (ret) {
2550 /* Here we are not considering a error 2537 /* Here we are not considering a error
2551 * as display may be enabled by frame 2538 * as display may be enabled by frame
@@ -2559,21 +2546,21 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2559 if (def_display->caps & 2546 if (def_display->caps &
2560 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { 2547 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
2561#ifdef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE 2548#ifdef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE
2562 if (def_display->enable_te) 2549 if (dssdrv->enable_te)
2563 def_display->enable_te(def_display, 1); 2550 dssdrv->enable_te(def_display, 1);
2564 if (def_display->set_update_mode) 2551 if (dssdrv->set_update_mode)
2565 def_display->set_update_mode(def_display, 2552 dssdrv->set_update_mode(def_display,
2566 OMAP_DSS_UPDATE_AUTO); 2553 OMAP_DSS_UPDATE_AUTO);
2567#else /* MANUAL_UPDATE */ 2554#else /* MANUAL_UPDATE */
2568 if (def_display->enable_te) 2555 if (dssdrv->enable_te)
2569 def_display->enable_te(def_display, 0); 2556 dssdrv->enable_te(def_display, 0);
2570 if (def_display->set_update_mode) 2557 if (dssdrv->set_update_mode)
2571 def_display->set_update_mode(def_display, 2558 dssdrv->set_update_mode(def_display,
2572 OMAP_DSS_UPDATE_MANUAL); 2559 OMAP_DSS_UPDATE_MANUAL);
2573#endif 2560#endif
2574 } else { 2561 } else {
2575 if (def_display->set_update_mode) 2562 if (dssdrv->set_update_mode)
2576 def_display->set_update_mode(def_display, 2563 dssdrv->set_update_mode(def_display,
2577 OMAP_DSS_UPDATE_AUTO); 2564 OMAP_DSS_UPDATE_AUTO);
2578 } 2565 }
2579 } 2566 }
@@ -2592,8 +2579,8 @@ static int __init omap_vout_probe(struct platform_device *pdev)
2592 for (i = 0; i < vid_dev->num_displays; i++) { 2579 for (i = 0; i < vid_dev->num_displays; i++) {
2593 struct omap_dss_device *display = vid_dev->displays[i]; 2580 struct omap_dss_device *display = vid_dev->displays[i];
2594 2581
2595 if (display->update) 2582 if (display->driver->update)
2596 display->update(display, 0, 0, 2583 display->driver->update(display, 0, 0,
2597 display->panel.timings.x_res, 2584 display->panel.timings.x_res,
2598 display->panel.timings.y_res); 2585 display->panel.timings.y_res);
2599 } 2586 }
@@ -2608,8 +2595,8 @@ probe_err1:
2608 if (ovl->manager && ovl->manager->device) 2595 if (ovl->manager && ovl->manager->device)
2609 def_display = ovl->manager->device; 2596 def_display = ovl->manager->device;
2610 2597
2611 if (def_display) 2598 if (def_display && def_display->driver)
2612 def_display->disable(def_display); 2599 def_display->driver->disable(def_display);
2613 } 2600 }
2614probe_err0: 2601probe_err0:
2615 kfree(vid_dev); 2602 kfree(vid_dev);
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 0a877497b93f..07fabdd9b465 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -267,6 +267,21 @@ hauppauge_tuner[] =
267 { TUNER_ABSENT, "Xceive XC4000"}, 267 { TUNER_ABSENT, "Xceive XC4000"},
268 { TUNER_ABSENT, "Dibcom 7070"}, 268 { TUNER_ABSENT, "Dibcom 7070"},
269 { TUNER_PHILIPS_TDA8290, "NXP 18271C2"}, 269 { TUNER_PHILIPS_TDA8290, "NXP 18271C2"},
270 { TUNER_ABSENT, "unknown"},
271 { TUNER_ABSENT, "unknown"},
272 { TUNER_ABSENT, "unknown"},
273 { TUNER_ABSENT, "unknown"},
274 /* 160-169 */
275 { TUNER_ABSENT, "unknown"},
276 { TUNER_ABSENT, "unknown"},
277 { TUNER_ABSENT, "unknown"},
278 { TUNER_ABSENT, "unknown"},
279 { TUNER_ABSENT, "unknown"},
280 { TUNER_ABSENT, "unknown"},
281 { TUNER_ABSENT, "unknown"},
282 { TUNER_ABSENT, "unknown"},
283 { TUNER_PHILIPS_FQ1236_MK5, "TCL M30WTP-4N-E"},
284 { TUNER_ABSENT, "unknown"},
270}; 285};
271 286
272/* Use V4L2_IDENT_AMBIGUOUS for those audio 'chips' that are 287/* Use V4L2_IDENT_AMBIGUOUS for those audio 'chips' that are
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index aa0720af07a0..27a79f087b15 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -122,8 +122,8 @@ static struct uvc_control_info uvc_ctrls[] = {
122 .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL, 122 .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
123 .index = 10, 123 .index = 10,
124 .size = 1, 124 .size = 1,
125 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 125 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
126 | UVC_CONTROL_RESTORE, 126 | UVC_CONTROL_GET_DEF | UVC_CONTROL_RESTORE,
127 }, 127 },
128 { 128 {
129 .entity = UVC_GUID_UVC_PROCESSING, 129 .entity = UVC_GUID_UVC_PROCESSING,
diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c
index fc2611f8b326..dbe6db0184fd 100644
--- a/drivers/usb/gadget/f_uvc.c
+++ b/drivers/usb/gadget/f_uvc.c
@@ -28,7 +28,7 @@
28 28
29#include "uvc.h" 29#include "uvc.h"
30 30
31unsigned int uvc_trace_param; 31unsigned int uvc_gadget_trace_param;
32 32
33/* -------------------------------------------------------------------------- 33/* --------------------------------------------------------------------------
34 * Function descriptors 34 * Function descriptors
@@ -656,6 +656,6 @@ error:
656 return ret; 656 return ret;
657} 657}
658 658
659module_param_named(trace, uvc_trace_param, uint, S_IRUGO|S_IWUSR); 659module_param_named(trace, uvc_gadget_trace_param, uint, S_IRUGO|S_IWUSR);
660MODULE_PARM_DESC(trace, "Trace level bitmask"); 660MODULE_PARM_DESC(trace, "Trace level bitmask");
661 661
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h
index 0a705e63c936..e92454cddd7d 100644
--- a/drivers/usb/gadget/uvc.h
+++ b/drivers/usb/gadget/uvc.h
@@ -107,11 +107,11 @@ struct uvc_streaming_control {
107#define UVC_WARN_MINMAX 0 107#define UVC_WARN_MINMAX 0
108#define UVC_WARN_PROBE_DEF 1 108#define UVC_WARN_PROBE_DEF 1
109 109
110extern unsigned int uvc_trace_param; 110extern unsigned int uvc_gadget_trace_param;
111 111
112#define uvc_trace(flag, msg...) \ 112#define uvc_trace(flag, msg...) \
113 do { \ 113 do { \
114 if (uvc_trace_param & flag) \ 114 if (uvc_gadget_trace_param & flag) \
115 printk(KERN_DEBUG "uvcvideo: " msg); \ 115 printk(KERN_DEBUG "uvcvideo: " msg); \
116 } while (0) 116 } while (0)
117 117
@@ -220,16 +220,10 @@ struct uvc_file_handle
220#define to_uvc_file_handle(handle) \ 220#define to_uvc_file_handle(handle) \
221 container_of(handle, struct uvc_file_handle, vfh) 221 container_of(handle, struct uvc_file_handle, vfh)
222 222
223extern struct v4l2_file_operations uvc_v4l2_fops;
224
225/* ------------------------------------------------------------------------ 223/* ------------------------------------------------------------------------
226 * Functions 224 * Functions
227 */ 225 */
228 226
229extern int uvc_video_enable(struct uvc_video *video, int enable);
230extern int uvc_video_init(struct uvc_video *video);
231extern int uvc_video_pump(struct uvc_video *video);
232
233extern void uvc_endpoint_stream(struct uvc_device *dev); 227extern void uvc_endpoint_stream(struct uvc_device *dev);
234 228
235extern void uvc_function_connect(struct uvc_device *uvc); 229extern void uvc_function_connect(struct uvc_device *uvc);
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index 43891991bf21..f7395ac5dc17 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -78,7 +78,8 @@
78 * 78 *
79 */ 79 */
80 80
81void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) 81static void
82uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)
82{ 83{
83 mutex_init(&queue->mutex); 84 mutex_init(&queue->mutex);
84 spin_lock_init(&queue->irqlock); 85 spin_lock_init(&queue->irqlock);
@@ -88,6 +89,28 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)
88} 89}
89 90
90/* 91/*
92 * Free the video buffers.
93 *
94 * This function must be called with the queue lock held.
95 */
96static int uvc_free_buffers(struct uvc_video_queue *queue)
97{
98 unsigned int i;
99
100 for (i = 0; i < queue->count; ++i) {
101 if (queue->buffer[i].vma_use_count != 0)
102 return -EBUSY;
103 }
104
105 if (queue->count) {
106 vfree(queue->mem);
107 queue->count = 0;
108 }
109
110 return 0;
111}
112
113/*
91 * Allocate the video buffers. 114 * Allocate the video buffers.
92 * 115 *
93 * Pages are reserved to make sure they will not be swapped, as they will be 116 * Pages are reserved to make sure they will not be swapped, as they will be
@@ -95,8 +118,9 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type)
95 * 118 *
96 * Buffers will be individually mapped, so they must all be page aligned. 119 * Buffers will be individually mapped, so they must all be page aligned.
97 */ 120 */
98int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, 121static int
99 unsigned int buflength) 122uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers,
123 unsigned int buflength)
100{ 124{
101 unsigned int bufsize = PAGE_ALIGN(buflength); 125 unsigned int bufsize = PAGE_ALIGN(buflength);
102 unsigned int i; 126 unsigned int i;
@@ -150,28 +174,6 @@ done:
150 return ret; 174 return ret;
151} 175}
152 176
153/*
154 * Free the video buffers.
155 *
156 * This function must be called with the queue lock held.
157 */
158int uvc_free_buffers(struct uvc_video_queue *queue)
159{
160 unsigned int i;
161
162 for (i = 0; i < queue->count; ++i) {
163 if (queue->buffer[i].vma_use_count != 0)
164 return -EBUSY;
165 }
166
167 if (queue->count) {
168 vfree(queue->mem);
169 queue->count = 0;
170 }
171
172 return 0;
173}
174
175static void __uvc_query_buffer(struct uvc_buffer *buf, 177static void __uvc_query_buffer(struct uvc_buffer *buf,
176 struct v4l2_buffer *v4l2_buf) 178 struct v4l2_buffer *v4l2_buf)
177{ 179{
@@ -195,8 +197,8 @@ static void __uvc_query_buffer(struct uvc_buffer *buf,
195 } 197 }
196} 198}
197 199
198int uvc_query_buffer(struct uvc_video_queue *queue, 200static int
199 struct v4l2_buffer *v4l2_buf) 201uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf)
200{ 202{
201 int ret = 0; 203 int ret = 0;
202 204
@@ -217,8 +219,8 @@ done:
217 * Queue a video buffer. Attempting to queue a buffer that has already been 219 * Queue a video buffer. Attempting to queue a buffer that has already been
218 * queued will return -EINVAL. 220 * queued will return -EINVAL.
219 */ 221 */
220int uvc_queue_buffer(struct uvc_video_queue *queue, 222static int
221 struct v4l2_buffer *v4l2_buf) 223uvc_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf)
222{ 224{
223 struct uvc_buffer *buf; 225 struct uvc_buffer *buf;
224 unsigned long flags; 226 unsigned long flags;
@@ -298,8 +300,9 @@ static int uvc_queue_waiton(struct uvc_buffer *buf, int nonblocking)
298 * Dequeue a video buffer. If nonblocking is false, block until a buffer is 300 * Dequeue a video buffer. If nonblocking is false, block until a buffer is
299 * available. 301 * available.
300 */ 302 */
301int uvc_dequeue_buffer(struct uvc_video_queue *queue, 303static int
302 struct v4l2_buffer *v4l2_buf, int nonblocking) 304uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *v4l2_buf,
305 int nonblocking)
303{ 306{
304 struct uvc_buffer *buf; 307 struct uvc_buffer *buf;
305 int ret = 0; 308 int ret = 0;
@@ -359,8 +362,9 @@ done:
359 * This function implements video queue polling and is intended to be used by 362 * This function implements video queue polling and is intended to be used by
360 * the device poll handler. 363 * the device poll handler.
361 */ 364 */
362unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, 365static unsigned int
363 poll_table *wait) 366uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
367 poll_table *wait)
364{ 368{
365 struct uvc_buffer *buf; 369 struct uvc_buffer *buf;
366 unsigned int mask = 0; 370 unsigned int mask = 0;
@@ -407,7 +411,8 @@ static struct vm_operations_struct uvc_vm_ops = {
407 * This function implements video buffer memory mapping and is intended to be 411 * This function implements video buffer memory mapping and is intended to be
408 * used by the device mmap handler. 412 * used by the device mmap handler.
409 */ 413 */
410int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) 414static int
415uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma)
411{ 416{
412 struct uvc_buffer *uninitialized_var(buffer); 417 struct uvc_buffer *uninitialized_var(buffer);
413 struct page *page; 418 struct page *page;
@@ -458,6 +463,42 @@ done:
458} 463}
459 464
460/* 465/*
466 * Cancel the video buffers queue.
467 *
468 * Cancelling the queue marks all buffers on the irq queue as erroneous,
469 * wakes them up and removes them from the queue.
470 *
471 * If the disconnect parameter is set, further calls to uvc_queue_buffer will
472 * fail with -ENODEV.
473 *
474 * This function acquires the irq spinlock and can be called from interrupt
475 * context.
476 */
477static void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
478{
479 struct uvc_buffer *buf;
480 unsigned long flags;
481
482 spin_lock_irqsave(&queue->irqlock, flags);
483 while (!list_empty(&queue->irqqueue)) {
484 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
485 queue);
486 list_del(&buf->queue);
487 buf->state = UVC_BUF_STATE_ERROR;
488 wake_up(&buf->wait);
489 }
490 /* This must be protected by the irqlock spinlock to avoid race
491 * conditions between uvc_queue_buffer and the disconnection event that
492 * could result in an interruptible wait in uvc_dequeue_buffer. Do not
493 * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED
494 * state outside the queue code.
495 */
496 if (disconnect)
497 queue->flags |= UVC_QUEUE_DISCONNECTED;
498 spin_unlock_irqrestore(&queue->irqlock, flags);
499}
500
501/*
461 * Enable or disable the video buffers queue. 502 * Enable or disable the video buffers queue.
462 * 503 *
463 * The queue must be enabled before starting video acquisition and must be 504 * The queue must be enabled before starting video acquisition and must be
@@ -474,7 +515,7 @@ done:
474 * This function can't be called from interrupt context. Use 515 * This function can't be called from interrupt context. Use
475 * uvc_queue_cancel() instead. 516 * uvc_queue_cancel() instead.
476 */ 517 */
477int uvc_queue_enable(struct uvc_video_queue *queue, int enable) 518static int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
478{ 519{
479 unsigned int i; 520 unsigned int i;
480 int ret = 0; 521 int ret = 0;
@@ -503,44 +544,8 @@ done:
503 return ret; 544 return ret;
504} 545}
505 546
506/* 547static struct uvc_buffer *
507 * Cancel the video buffers queue. 548uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
508 *
509 * Cancelling the queue marks all buffers on the irq queue as erroneous,
510 * wakes them up and removes them from the queue.
511 *
512 * If the disconnect parameter is set, further calls to uvc_queue_buffer will
513 * fail with -ENODEV.
514 *
515 * This function acquires the irq spinlock and can be called from interrupt
516 * context.
517 */
518void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
519{
520 struct uvc_buffer *buf;
521 unsigned long flags;
522
523 spin_lock_irqsave(&queue->irqlock, flags);
524 while (!list_empty(&queue->irqqueue)) {
525 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
526 queue);
527 list_del(&buf->queue);
528 buf->state = UVC_BUF_STATE_ERROR;
529 wake_up(&buf->wait);
530 }
531 /* This must be protected by the irqlock spinlock to avoid race
532 * conditions between uvc_queue_buffer and the disconnection event that
533 * could result in an interruptible wait in uvc_dequeue_buffer. Do not
534 * blindly replace this logic by checking for the UVC_DEV_DISCONNECTED
535 * state outside the queue code.
536 */
537 if (disconnect)
538 queue->flags |= UVC_QUEUE_DISCONNECTED;
539 spin_unlock_irqrestore(&queue->irqlock, flags);
540}
541
542struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
543 struct uvc_buffer *buf)
544{ 549{
545 struct uvc_buffer *nextbuf; 550 struct uvc_buffer *nextbuf;
546 unsigned long flags; 551 unsigned long flags;
@@ -568,7 +573,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
568 return nextbuf; 573 return nextbuf;
569} 574}
570 575
571struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue) 576static struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue)
572{ 577{
573 struct uvc_buffer *buf = NULL; 578 struct uvc_buffer *buf = NULL;
574 579
diff --git a/drivers/usb/gadget/uvc_queue.h b/drivers/usb/gadget/uvc_queue.h
index 7f5a33fe7ae2..1812a8ecc5d0 100644
--- a/drivers/usb/gadget/uvc_queue.h
+++ b/drivers/usb/gadget/uvc_queue.h
@@ -58,30 +58,10 @@ struct uvc_video_queue {
58 struct list_head irqqueue; 58 struct list_head irqqueue;
59}; 59};
60 60
61extern void uvc_queue_init(struct uvc_video_queue *queue,
62 enum v4l2_buf_type type);
63extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
64 unsigned int nbuffers, unsigned int buflength);
65extern int uvc_free_buffers(struct uvc_video_queue *queue);
66extern int uvc_query_buffer(struct uvc_video_queue *queue,
67 struct v4l2_buffer *v4l2_buf);
68extern int uvc_queue_buffer(struct uvc_video_queue *queue,
69 struct v4l2_buffer *v4l2_buf);
70extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
71 struct v4l2_buffer *v4l2_buf, int nonblocking);
72extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);
73extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);
74extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
75 struct uvc_buffer *buf);
76extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue,
77 struct file *file, poll_table *wait);
78extern int uvc_queue_mmap(struct uvc_video_queue *queue,
79 struct vm_area_struct *vma);
80static inline int uvc_queue_streaming(struct uvc_video_queue *queue) 61static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
81{ 62{
82 return queue->flags & UVC_QUEUE_STREAMING; 63 return queue->flags & UVC_QUEUE_STREAMING;
83} 64}
84extern struct uvc_buffer *uvc_queue_head(struct uvc_video_queue *queue);
85 65
86#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
87 67
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index a7989f29837e..2dcffdac86d2 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -363,7 +363,7 @@ uvc_v4l2_poll(struct file *file, poll_table *wait)
363 return mask; 363 return mask;
364} 364}
365 365
366struct v4l2_file_operations uvc_v4l2_fops = { 366static struct v4l2_file_operations uvc_v4l2_fops = {
367 .owner = THIS_MODULE, 367 .owner = THIS_MODULE,
368 .open = uvc_v4l2_open, 368 .open = uvc_v4l2_open,
369 .release = uvc_v4l2_release, 369 .release = uvc_v4l2_release,
diff --git a/drivers/usb/gadget/uvc_video.c b/drivers/usb/gadget/uvc_video.c
index de8cbc46518d..b08f35438d70 100644
--- a/drivers/usb/gadget/uvc_video.c
+++ b/drivers/usb/gadget/uvc_video.c
@@ -271,7 +271,7 @@ error:
271 * This function fills the available USB requests (listed in req_free) with 271 * This function fills the available USB requests (listed in req_free) with
272 * video data from the queued buffers. 272 * video data from the queued buffers.
273 */ 273 */
274int 274static int
275uvc_video_pump(struct uvc_video *video) 275uvc_video_pump(struct uvc_video *video)
276{ 276{
277 struct usb_request *req; 277 struct usb_request *req;
@@ -328,7 +328,7 @@ uvc_video_pump(struct uvc_video *video)
328/* 328/*
329 * Enable or disable the video stream. 329 * Enable or disable the video stream.
330 */ 330 */
331int 331static int
332uvc_video_enable(struct uvc_video *video, int enable) 332uvc_video_enable(struct uvc_video *video, int enable)
333{ 333{
334 unsigned int i; 334 unsigned int i;
@@ -367,7 +367,7 @@ uvc_video_enable(struct uvc_video *video, int enable)
367/* 367/*
368 * Initialize the UVC video stream. 368 * Initialize the UVC video stream.
369 */ 369 */
370int 370static int
371uvc_video_init(struct uvc_video *video) 371uvc_video_init(struct uvc_video *video)
372{ 372{
373 INIT_LIST_HEAD(&video->req_free); 373 INIT_LIST_HEAD(&video->req_free);
diff --git a/drivers/usb/gadget/webcam.c b/drivers/usb/gadget/webcam.c
index 417fd6887698..f5f3030cc416 100644
--- a/drivers/usb/gadget/webcam.c
+++ b/drivers/usb/gadget/webcam.c
@@ -28,10 +28,10 @@
28#include "config.c" 28#include "config.c"
29#include "epautoconf.c" 29#include "epautoconf.c"
30 30
31#include "f_uvc.c"
32#include "uvc_queue.c" 31#include "uvc_queue.c"
33#include "uvc_v4l2.c"
34#include "uvc_video.c" 32#include "uvc_video.c"
33#include "uvc_v4l2.c"
34#include "f_uvc.c"
35 35
36/* -------------------------------------------------------------------------- 36/* --------------------------------------------------------------------------
37 * Device descriptor 37 * Device descriptor