diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-18 18:49:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-18 18:49:47 -0500 |
commit | 20ef0f1ad0035cd7acc6cbcbc018b2dcd891e274 (patch) | |
tree | f98facca9df16f65590140f6b56c767bb8b6954c | |
parent | 9960c90c0cb9652f69ce794c7bf99bb3acf23552 (diff) | |
parent | 6165894fb6293072848e5699f3fcbe88b7c60815 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (59 commits)
V4L/DVB (7219): zoran: Fix namespace conflicts with Zoran 'GPIO_MAX' enum
V4L/DVB (7205): tuner-xc2028 depends on FW_LOADER
V4L/DVB (7201): cx88-mpeg: Fix race condition in variable access
V4L/DVB (7200): Fix FM firmware loading
V4L/DVB (7198): V4L, include ioctl.h in videodev headers
V4L/DVB (7197): bttv: Fix overlay divide error
V4L/DVB (7195): xc5000: fix build error when built as module
V4L/DVB (7194): cx88-mpeg: Allow concurrent access to cx88-mpeg devices
V4L/DVB (7193): tveeprom: Add proper tuner mapping for hauppauge eeprom id 133
V4L/DVB (7192): Adds support for Genius TVGo A11MCE
V4L/DVB (7189): autosuspend support
V4L/DVB (7188): radio-si470x version 1.0.6
V4L/DVB (7186): tda10086: make the 22kHz tone for DISEQC a config option
V4L/DVB (7183): radio-si470x: fix build warning
V4L/DVB (7180): em28xx: add URB_NO_TRANSFER_DMA_MAP, since urb->transfer_dma is set
V4L/DVB (7179): Allow more than one em28xx board
V4L/DVB (7164): em28xx-alsa: Add a missing mutex
V4L/DVB (7163): em28xx: makes audio settings more stable
V4L/DVB (7162): em28xx: Fix endian and returns the correct values
V4L/DVB (7161): em28xx: Fix printing debug values higher than 127
...
61 files changed, 1456 insertions, 926 deletions
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 6a8469f2bcae..f40e09296f30 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -8,7 +8,7 @@ | |||
8 | 7 -> Leadtek Winfast USB II (em2800) | 8 | 7 -> Leadtek Winfast USB II (em2800) |
9 | 8 -> Kworld USB2800 (em2800) | 9 | 8 -> Kworld USB2800 (em2800) |
10 | 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] | 10 | 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] |
11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] | 11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500,2040:6502] |
12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] | 12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] |
13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) | 13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) |
14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] | 14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 5d3b6b4d2515..0424901ebc78 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -92,9 +92,9 @@ | |||
92 | 91 -> AVerMedia A169 B [1461:7360] | 92 | 91 -> AVerMedia A169 B [1461:7360] |
93 | 92 -> AVerMedia A169 B1 [1461:6360] | 93 | 92 -> AVerMedia A169 B1 [1461:6360] |
94 | 93 -> Medion 7134 Bridge #2 [16be:0005] | 94 | 93 -> Medion 7134 Bridge #2 [16be:0005] |
95 | 94 -> LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB [5168:3306,5168:3502,4e42:3502] | 95 | 94 -> LifeView FlyDVB-T Hybrid Cardbus/MSI TV @nywhere A/D NB [5168:3306,5168:3502,5168:3307,4e42:3502] |
96 | 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] | 96 | 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] |
97 | 96 -> Medion Md8800 Quadro [16be:0007,16be:0008] | 97 | 96 -> Medion Md8800 Quadro [16be:0007,16be:0008,16be:000d] |
98 | 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300] | 98 | 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300] |
99 | 98 -> Proteus Pro 2309 [0919:2003] | 99 | 98 -> Proteus Pro 2309 [0919:2003] |
100 | 99 -> AVerMedia TV Hybrid A16AR [1461:2c00] | 100 | 99 -> AVerMedia TV Hybrid A16AR [1461:2c00] |
@@ -129,3 +129,5 @@ | |||
129 | 128 -> Beholder BeholdTV Columbus TVFM [0000:5201] | 129 | 128 -> Beholder BeholdTV Columbus TVFM [0000:5201] |
130 | 129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] | 130 | 129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] |
131 | 130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193] | 131 | 130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193] |
132 | 131 -> Twinhan Hybrid DTV-DVB 3056 PCI [1822:0022] | ||
133 | 132 -> Genius TVGO AM11MCE | ||
diff --git a/Documentation/video4linux/zr364xx.txt b/Documentation/video4linux/zr364xx.txt index 4d9a0c33f2fd..5c81e3ae6458 100644 --- a/Documentation/video4linux/zr364xx.txt +++ b/Documentation/video4linux/zr364xx.txt | |||
@@ -25,7 +25,7 @@ modprobe zr364xx debug=X mode=Y | |||
25 | - debug : set to 1 to enable verbose debug messages | 25 | - debug : set to 1 to enable verbose debug messages |
26 | - mode : 0 = 320x240, 1 = 160x120, 2 = 640x480 | 26 | - mode : 0 = 320x240, 1 = 160x120, 2 = 640x480 |
27 | You can then use the camera with V4L2 compatible applications, for example Ekiga. | 27 | You can then use the camera with V4L2 compatible applications, for example Ekiga. |
28 | To capture a single image, try this: dd if=/dev/video0 of=test.jpg bs=1 count=1 | 28 | To capture a single image, try this: dd if=/dev/video0 of=test.jpg bs=1M count=1 |
29 | 29 | ||
30 | links : | 30 | links : |
31 | http://mxhaard.free.fr/ (support for many others cams including some Aiptek PocketDV) | 31 | http://mxhaard.free.fr/ (support for many others cams including some Aiptek PocketDV) |
@@ -63,3 +63,5 @@ Vendor Product Distributor Model | |||
63 | 0x06d6 0x0034 Trust Powerc@m 750 | 63 | 0x06d6 0x0034 Trust Powerc@m 750 |
64 | 0x0a17 0x0062 Pentax Optio 50L | 64 | 0x0a17 0x0062 Pentax Optio 50L |
65 | 0x06d6 0x003b Trust Powerc@m 970Z | 65 | 0x06d6 0x003b Trust Powerc@m 970Z |
66 | 0x0a17 0x004e Pentax Optio 50 | ||
67 | 0x041e 0x405d Creative DiVi CAM 516 | ||
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 8f4a45346de7..11950698a2e7 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -25,11 +25,16 @@ config VIDEO_DEV | |||
25 | To compile this driver as a module, choose M here: the | 25 | To compile this driver as a module, choose M here: the |
26 | module will be called videodev. | 26 | module will be called videodev. |
27 | 27 | ||
28 | config VIDEO_V4L2_COMMON | ||
29 | tristate | ||
30 | depends on (I2C || I2C=n) && VIDEO_DEV | ||
31 | default (I2C || I2C=n) && VIDEO_DEV | ||
32 | |||
28 | config VIDEO_V4L1 | 33 | config VIDEO_V4L1 |
29 | bool "Enable Video For Linux API 1 (DEPRECATED)" | 34 | bool "Enable Video For Linux API 1 (DEPRECATED)" |
30 | depends on VIDEO_DEV | 35 | depends on VIDEO_DEV && VIDEO_V4L2_COMMON |
36 | default VIDEO_DEV && VIDEO_V4L2_COMMON | ||
31 | select VIDEO_V4L1_COMPAT | 37 | select VIDEO_V4L1_COMPAT |
32 | default y | ||
33 | ---help--- | 38 | ---help--- |
34 | Enables a compatibility API used by most V4L2 devices to allow | 39 | Enables a compatibility API used by most V4L2 devices to allow |
35 | its usage with legacy applications that supports only V4L1 api. | 40 | its usage with legacy applications that supports only V4L1 api. |
@@ -39,7 +44,7 @@ config VIDEO_V4L1 | |||
39 | config VIDEO_V4L1_COMPAT | 44 | config VIDEO_V4L1_COMPAT |
40 | bool "Enable Video For Linux API 1 compatible Layer" | 45 | bool "Enable Video For Linux API 1 compatible Layer" |
41 | depends on VIDEO_DEV | 46 | depends on VIDEO_DEV |
42 | default y | 47 | default VIDEO_DEV |
43 | ---help--- | 48 | ---help--- |
44 | This api were developed to be used at Kernel 2.2 and 2.4, but | 49 | This api were developed to be used at Kernel 2.2 and 2.4, but |
45 | lacks support for several video standards. There are several | 50 | lacks support for several video standards. There are several |
@@ -55,8 +60,8 @@ config VIDEO_V4L1_COMPAT | |||
55 | 60 | ||
56 | config VIDEO_V4L2 | 61 | config VIDEO_V4L2 |
57 | bool | 62 | bool |
58 | depends on VIDEO_DEV | 63 | depends on VIDEO_DEV && VIDEO_V4L2_COMMON |
59 | default y | 64 | default VIDEO_DEV && VIDEO_V4L2_COMMON |
60 | 65 | ||
61 | source "drivers/media/video/Kconfig" | 66 | source "drivers/media/video/Kconfig" |
62 | 67 | ||
@@ -93,7 +98,7 @@ if VIDEO_TUNER_CUSTOMIZE | |||
93 | 98 | ||
94 | config TUNER_XC2028 | 99 | config TUNER_XC2028 |
95 | tristate "XCeive xc2028/xc3028 tuners" | 100 | tristate "XCeive xc2028/xc3028 tuners" |
96 | depends on I2C | 101 | depends on I2C && FW_LOADER |
97 | default m if VIDEO_TUNER_CUSTOMIZE | 102 | default m if VIDEO_TUNER_CUSTOMIZE |
98 | help | 103 | help |
99 | Say Y here to include support for the xc2028/xc3028 tuners. | 104 | Say Y here to include support for the xc2028/xc3028 tuners. |
@@ -180,7 +185,6 @@ config VIDEO_TVEEPROM | |||
180 | 185 | ||
181 | config DAB | 186 | config DAB |
182 | boolean "DAB adapters" | 187 | boolean "DAB adapters" |
183 | default y | ||
184 | ---help--- | 188 | ---help--- |
185 | Allow selecting support for for Digital Audio Broadcasting (DAB) | 189 | Allow selecting support for for Digital Audio Broadcasting (DAB) |
186 | Receiver adapters. | 190 | Receiver adapters. |
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index 06ca75911b7f..769c6f8142d2 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -4,6 +4,6 @@ config VIDEO_SAA7146 | |||
4 | 4 | ||
5 | config VIDEO_SAA7146_VV | 5 | config VIDEO_SAA7146_VV |
6 | tristate | 6 | tristate |
7 | depends on VIDEO_DEV | 7 | depends on VIDEO_V4L2 |
8 | select VIDEOBUF_DMA_SG | 8 | select VIDEOBUF_DMA_SG |
9 | select VIDEO_SAA7146 | 9 | select VIDEO_SAA7146 |
diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index a4a937c90534..2ab5a120470d 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c | |||
@@ -1987,3 +1987,49 @@ IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE] = { | |||
1987 | }; | 1987 | }; |
1988 | 1988 | ||
1989 | EXPORT_SYMBOL_GPL(ir_codes_behold); | 1989 | EXPORT_SYMBOL_GPL(ir_codes_behold); |
1990 | |||
1991 | /* | ||
1992 | * Remote control for the Genius TVGO A11MCE | ||
1993 | * Adrian Pardini <pardo.bsso@gmail.com> | ||
1994 | */ | ||
1995 | IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE] = { | ||
1996 | /* Keys 0 to 9 */ | ||
1997 | [0x48] = KEY_0, | ||
1998 | [0x09] = KEY_1, | ||
1999 | [0x1d] = KEY_2, | ||
2000 | [0x1f] = KEY_3, | ||
2001 | [0x19] = KEY_4, | ||
2002 | [0x1b] = KEY_5, | ||
2003 | [0x11] = KEY_6, | ||
2004 | [0x17] = KEY_7, | ||
2005 | [0x12] = KEY_8, | ||
2006 | [0x16] = KEY_9, | ||
2007 | |||
2008 | [0x54] = KEY_RECORD, /* recording */ | ||
2009 | [0x06] = KEY_MUTE, /* mute */ | ||
2010 | [0x10] = KEY_POWER, | ||
2011 | [0x40] = KEY_LAST, /* recall */ | ||
2012 | [0x4c] = KEY_CHANNELUP, /* channel / program + */ | ||
2013 | [0x00] = KEY_CHANNELDOWN, /* channel / program - */ | ||
2014 | [0x0d] = KEY_VOLUMEUP, | ||
2015 | [0x15] = KEY_VOLUMEDOWN, | ||
2016 | [0x4d] = KEY_OK, /* also labeled as Pause */ | ||
2017 | [0x1c] = KEY_ZOOM, /* full screen and Stop*/ | ||
2018 | [0x02] = KEY_MODE, /* AV Source or Rewind*/ | ||
2019 | [0x04] = KEY_LIST, /* -/-- */ | ||
2020 | /* small arrows above numbers */ | ||
2021 | [0x1a] = KEY_NEXT, /* also Fast Forward */ | ||
2022 | [0x0e] = KEY_PREVIOUS, /* also Rewind */ | ||
2023 | /* these are in a rather non standard layout and have | ||
2024 | an alternate name written */ | ||
2025 | [0x1e] = KEY_UP, /* Video Setting */ | ||
2026 | [0x0a] = KEY_DOWN, /* Video Default */ | ||
2027 | [0x05] = KEY_LEFT, /* Snapshot */ | ||
2028 | [0x0c] = KEY_RIGHT, /* Hide Panel */ | ||
2029 | /* Four buttons without label */ | ||
2030 | [0x49] = KEY_RED, | ||
2031 | [0x0b] = KEY_GREEN, | ||
2032 | [0x13] = KEY_YELLOW, | ||
2033 | [0x50] = KEY_BLUE, | ||
2034 | }; | ||
2035 | EXPORT_SYMBOL_GPL(ir_codes_genius_tvgo_a11mce); | ||
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index c32dda973e92..bfbd5a841ebf 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -413,7 +413,6 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file) | |||
413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? | 413 | V4L2_FIELD_SEQ_TB, // FIXME: does this really work? |
414 | sizeof(struct saa7146_buf), | 414 | sizeof(struct saa7146_buf), |
415 | file); | 415 | file); |
416 | mutex_init(&fh->vbi_q.lock); | ||
417 | 416 | ||
418 | init_timer(&fh->vbi_read_timeout); | 417 | init_timer(&fh->vbi_read_timeout); |
419 | fh->vbi_read_timeout.function = vbi_read_timeout; | 418 | fh->vbi_read_timeout.function = vbi_read_timeout; |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index c31ab480d8e1..66fdbd0e6a6d 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1417,8 +1417,6 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1417 | sizeof(struct saa7146_buf), | 1417 | sizeof(struct saa7146_buf), |
1418 | file); | 1418 | file); |
1419 | 1419 | ||
1420 | mutex_init(&fh->video_q.lock); | ||
1421 | |||
1422 | return 0; | 1420 | return 0; |
1423 | } | 1421 | } |
1424 | 1422 | ||
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c index c7bbb40223f5..56d8fab688bb 100644 --- a/drivers/media/dvb/bt8xx/bt878.c +++ b/drivers/media/dvb/bt8xx/bt878.c | |||
@@ -75,7 +75,11 @@ EXPORT_SYMBOL(bt878); | |||
75 | #if defined(dprintk) | 75 | #if defined(dprintk) |
76 | #undef dprintk | 76 | #undef dprintk |
77 | #endif | 77 | #endif |
78 | #define dprintk if(bt878_debug) printk | 78 | #define dprintk(fmt, arg...) \ |
79 | do { \ | ||
80 | if (bt878_debug) \ | ||
81 | printk(KERN_DEBUG fmt, ##arg); \ | ||
82 | } while (0) | ||
79 | 83 | ||
80 | static void bt878_mem_free(struct bt878 *bt) | 84 | static void bt878_mem_free(struct bt878 *bt) |
81 | { | 85 | { |
@@ -154,7 +158,7 @@ static int bt878_make_risc(struct bt878 *bt) | |||
154 | } | 158 | } |
155 | 159 | ||
156 | if (bt->line_count > 255) { | 160 | if (bt->line_count > 255) { |
157 | printk("bt878: buffer size error!\n"); | 161 | printk(KERN_ERR "bt878: buffer size error!\n"); |
158 | return -EINVAL; | 162 | return -EINVAL; |
159 | } | 163 | } |
160 | return 0; | 164 | return 0; |
@@ -285,7 +289,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id) | |||
285 | 289 | ||
286 | if (astat & (BT878_ASCERR | BT878_AOCERR)) { | 290 | if (astat & (BT878_ASCERR | BT878_AOCERR)) { |
287 | if (bt878_verbose) { | 291 | if (bt878_verbose) { |
288 | printk("bt878(%d): irq%s%s risc_pc=%08x\n", | 292 | printk(KERN_INFO |
293 | "bt878(%d): irq%s%s risc_pc=%08x\n", | ||
289 | bt->nr, | 294 | bt->nr, |
290 | (astat & BT878_ASCERR) ? " SCERR" : | 295 | (astat & BT878_ASCERR) ? " SCERR" : |
291 | "", | 296 | "", |
@@ -295,8 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id) | |||
295 | } | 300 | } |
296 | if (astat & (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) { | 301 | if (astat & (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) { |
297 | if (bt878_verbose) { | 302 | if (bt878_verbose) { |
298 | printk | 303 | printk(KERN_INFO |
299 | ("bt878(%d): irq%s%s%s risc_pc=%08x\n", | 304 | "bt878(%d): irq%s%s%s risc_pc=%08x\n", |
300 | bt->nr, | 305 | bt->nr, |
301 | (astat & BT878_APABORT) ? " PABORT" : | 306 | (astat & BT878_APABORT) ? " PABORT" : |
302 | "", | 307 | "", |
@@ -308,8 +313,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id) | |||
308 | } | 313 | } |
309 | if (astat & (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) { | 314 | if (astat & (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) { |
310 | if (bt878_verbose) { | 315 | if (bt878_verbose) { |
311 | printk | 316 | printk(KERN_INFO |
312 | ("bt878(%d): irq%s%s%s risc_pc=%08x\n", | 317 | "bt878(%d): irq%s%s%s risc_pc=%08x\n", |
313 | bt->nr, | 318 | bt->nr, |
314 | (astat & BT878_AFDSR) ? " FDSR" : "", | 319 | (astat & BT878_AFDSR) ? " FDSR" : "", |
315 | (astat & BT878_AFTRGT) ? " FTRGT" : | 320 | (astat & BT878_AFTRGT) ? " FTRGT" : |
@@ -510,7 +515,7 @@ static int __devinit bt878_probe(struct pci_dev *dev, | |||
510 | */ | 515 | */ |
511 | 516 | ||
512 | if ((result = bt878_mem_alloc(bt))) { | 517 | if ((result = bt878_mem_alloc(bt))) { |
513 | printk("bt878: failed to allocate memory!\n"); | 518 | printk(KERN_ERR "bt878: failed to allocate memory!\n"); |
514 | goto fail2; | 519 | goto fail2; |
515 | } | 520 | } |
516 | 521 | ||
@@ -536,7 +541,7 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev) | |||
536 | struct bt878 *bt = pci_get_drvdata(pci_dev); | 541 | struct bt878 *bt = pci_get_drvdata(pci_dev); |
537 | 542 | ||
538 | if (bt878_verbose) | 543 | if (bt878_verbose) |
539 | printk("bt878(%d): unloading\n", bt->nr); | 544 | printk(KERN_INFO "bt878(%d): unloading\n", bt->nr); |
540 | 545 | ||
541 | /* turn off all capturing, DMA and IRQs */ | 546 | /* turn off all capturing, DMA and IRQs */ |
542 | btand(~0x13, BT878_AGPIO_DMA_CTL); | 547 | btand(~0x13, BT878_AGPIO_DMA_CTL); |
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c index 88dc4367a2e3..3b9da9c25c6e 100644 --- a/drivers/media/dvb/dvb-usb/ttusb2.c +++ b/drivers/media/dvb/dvb-usb/ttusb2.c | |||
@@ -144,6 +144,7 @@ static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
144 | static struct tda10086_config tda10086_config = { | 144 | static struct tda10086_config tda10086_config = { |
145 | .demod_address = 0x0e, | 145 | .demod_address = 0x0e, |
146 | .invert = 0, | 146 | .invert = 0, |
147 | .diseqc_tone = 1, | ||
147 | }; | 148 | }; |
148 | 149 | ||
149 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) | 150 | static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 9d26ace65151..0d2b69a99ad4 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -106,9 +106,12 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask, | |||
106 | static int tda10086_init(struct dvb_frontend* fe) | 106 | static int tda10086_init(struct dvb_frontend* fe) |
107 | { | 107 | { |
108 | struct tda10086_state* state = fe->demodulator_priv; | 108 | struct tda10086_state* state = fe->demodulator_priv; |
109 | u8 t22k_off = 0x80; | ||
109 | 110 | ||
110 | dprintk ("%s\n", __FUNCTION__); | 111 | dprintk ("%s\n", __FUNCTION__); |
111 | 112 | ||
113 | if (state->config->diseqc_tone) | ||
114 | t22k_off = 0; | ||
112 | // reset | 115 | // reset |
113 | tda10086_write_byte(state, 0x00, 0x00); | 116 | tda10086_write_byte(state, 0x00, 0x00); |
114 | msleep(10); | 117 | msleep(10); |
@@ -158,7 +161,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
158 | tda10086_write_byte(state, 0x3d, 0x80); | 161 | tda10086_write_byte(state, 0x3d, 0x80); |
159 | 162 | ||
160 | // setup SEC | 163 | // setup SEC |
161 | tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone | 164 | tda10086_write_byte(state, 0x36, t22k_off); // all SEC off, 22k tone |
162 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency | 165 | tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency |
163 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } | 166 | tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } |
164 | 167 | ||
@@ -180,16 +183,20 @@ static void tda10086_diseqc_wait(struct tda10086_state *state) | |||
180 | static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) | 183 | static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) |
181 | { | 184 | { |
182 | struct tda10086_state* state = fe->demodulator_priv; | 185 | struct tda10086_state* state = fe->demodulator_priv; |
186 | u8 t22k_off = 0x80; | ||
183 | 187 | ||
184 | dprintk ("%s\n", __FUNCTION__); | 188 | dprintk ("%s\n", __FUNCTION__); |
185 | 189 | ||
190 | if (state->config->diseqc_tone) | ||
191 | t22k_off = 0; | ||
192 | |||
186 | switch (tone) { | 193 | switch (tone) { |
187 | case SEC_TONE_OFF: | 194 | case SEC_TONE_OFF: |
188 | tda10086_write_byte(state, 0x36, 0x80); | 195 | tda10086_write_byte(state, 0x36, t22k_off); |
189 | break; | 196 | break; |
190 | 197 | ||
191 | case SEC_TONE_ON: | 198 | case SEC_TONE_ON: |
192 | tda10086_write_byte(state, 0x36, 0x81); | 199 | tda10086_write_byte(state, 0x36, 0x01 + t22k_off); |
193 | break; | 200 | break; |
194 | } | 201 | } |
195 | 202 | ||
@@ -202,9 +209,13 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, | |||
202 | struct tda10086_state* state = fe->demodulator_priv; | 209 | struct tda10086_state* state = fe->demodulator_priv; |
203 | int i; | 210 | int i; |
204 | u8 oldval; | 211 | u8 oldval; |
212 | u8 t22k_off = 0x80; | ||
205 | 213 | ||
206 | dprintk ("%s\n", __FUNCTION__); | 214 | dprintk ("%s\n", __FUNCTION__); |
207 | 215 | ||
216 | if (state->config->diseqc_tone) | ||
217 | t22k_off = 0; | ||
218 | |||
208 | if (cmd->msg_len > 6) | 219 | if (cmd->msg_len > 6) |
209 | return -EINVAL; | 220 | return -EINVAL; |
210 | oldval = tda10086_read_byte(state, 0x36); | 221 | oldval = tda10086_read_byte(state, 0x36); |
@@ -212,7 +223,8 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, | |||
212 | for(i=0; i< cmd->msg_len; i++) { | 223 | for(i=0; i< cmd->msg_len; i++) { |
213 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); | 224 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); |
214 | } | 225 | } |
215 | tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4)); | 226 | tda10086_write_byte(state, 0x36, (0x08 + t22k_off) |
227 | | ((cmd->msg_len - 1) << 4)); | ||
216 | 228 | ||
217 | tda10086_diseqc_wait(state); | 229 | tda10086_diseqc_wait(state); |
218 | 230 | ||
@@ -225,16 +237,20 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic | |||
225 | { | 237 | { |
226 | struct tda10086_state* state = fe->demodulator_priv; | 238 | struct tda10086_state* state = fe->demodulator_priv; |
227 | u8 oldval = tda10086_read_byte(state, 0x36); | 239 | u8 oldval = tda10086_read_byte(state, 0x36); |
240 | u8 t22k_off = 0x80; | ||
228 | 241 | ||
229 | dprintk ("%s\n", __FUNCTION__); | 242 | dprintk ("%s\n", __FUNCTION__); |
230 | 243 | ||
244 | if (state->config->diseqc_tone) | ||
245 | t22k_off = 0; | ||
246 | |||
231 | switch(minicmd) { | 247 | switch(minicmd) { |
232 | case SEC_MINI_A: | 248 | case SEC_MINI_A: |
233 | tda10086_write_byte(state, 0x36, 0x84); | 249 | tda10086_write_byte(state, 0x36, 0x04 + t22k_off); |
234 | break; | 250 | break; |
235 | 251 | ||
236 | case SEC_MINI_B: | 252 | case SEC_MINI_B: |
237 | tda10086_write_byte(state, 0x36, 0x86); | 253 | tda10086_write_byte(state, 0x36, 0x06 + t22k_off); |
238 | break; | 254 | break; |
239 | } | 255 | } |
240 | 256 | ||
diff --git a/drivers/media/dvb/frontends/tda10086.h b/drivers/media/dvb/frontends/tda10086.h index ed584a8f4a89..eeceaeee78ff 100644 --- a/drivers/media/dvb/frontends/tda10086.h +++ b/drivers/media/dvb/frontends/tda10086.h | |||
@@ -33,6 +33,9 @@ struct tda10086_config | |||
33 | 33 | ||
34 | /* does the "inversion" need inverted? */ | 34 | /* does the "inversion" need inverted? */ |
35 | u8 invert; | 35 | u8 invert; |
36 | |||
37 | /* do we need the diseqc signal with carrier? */ | ||
38 | u8 diseqc_tone; | ||
36 | }; | 39 | }; |
37 | 40 | ||
38 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) | 41 | #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) |
diff --git a/drivers/media/dvb/frontends/tda18271-common.c b/drivers/media/dvb/frontends/tda18271-common.c index cebb6b90b7e0..bca570990613 100644 --- a/drivers/media/dvb/frontends/tda18271-common.c +++ b/drivers/media/dvb/frontends/tda18271-common.c | |||
@@ -171,7 +171,7 @@ int tda18271_read_extended(struct dvb_frontend *fe) | |||
171 | if (ret != 2) | 171 | if (ret != 2) |
172 | tda_err("ERROR: i2c_transfer returned: %d\n", ret); | 172 | tda_err("ERROR: i2c_transfer returned: %d\n", ret); |
173 | 173 | ||
174 | for (i = 0; i <= TDA18271_NUM_REGS; i++) { | 174 | for (i = 0; i < TDA18271_NUM_REGS; i++) { |
175 | /* don't update write-only registers */ | 175 | /* don't update write-only registers */ |
176 | if ((i != R_EB9) && | 176 | if ((i != R_EB9) && |
177 | (i != R_EB16) && | 177 | (i != R_EB16) && |
diff --git a/drivers/media/dvb/frontends/xc5000.h b/drivers/media/dvb/frontends/xc5000.h index e0e84562aed1..32a5f1c86a16 100644 --- a/drivers/media/dvb/frontends/xc5000.h +++ b/drivers/media/dvb/frontends/xc5000.h | |||
@@ -45,7 +45,8 @@ struct xc5000_config { | |||
45 | /* xc5000 callback command */ | 45 | /* xc5000 callback command */ |
46 | #define XC5000_TUNER_RESET 0 | 46 | #define XC5000_TUNER_RESET 0 |
47 | 47 | ||
48 | #if defined(CONFIG_DVB_TUNER_XC5000) || defined(CONFIG_DVB_TUNER_XC5000_MODULE) | 48 | #if defined(CONFIG_DVB_TUNER_XC5000) || \ |
49 | (defined(CONFIG_DVB_TUNER_XC5000_MODULE) && defined(MODULE)) | ||
49 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, | 50 | extern struct dvb_frontend* xc5000_attach(struct dvb_frontend *fe, |
50 | struct i2c_adapter *i2c, | 51 | struct i2c_adapter *i2c, |
51 | struct xc5000_config *cfg); | 52 | struct xc5000_config *cfg); |
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c index aef6e36d7c5c..3e6b650fbb81 100644 --- a/drivers/media/dvb/ttpci/av7110_av.c +++ b/drivers/media/dvb/ttpci/av7110_av.c | |||
@@ -966,6 +966,7 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x | |||
966 | static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) | 966 | static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) |
967 | { | 967 | { |
968 | int i, n; | 968 | int i, n; |
969 | int progressive = 0; | ||
969 | 970 | ||
970 | dprintk(2, "av7110:%p, \n", av7110); | 971 | dprintk(2, "av7110:%p, \n", av7110); |
971 | 972 | ||
@@ -974,6 +975,14 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len | |||
974 | return -EBUSY; | 975 | return -EBUSY; |
975 | } | 976 | } |
976 | 977 | ||
978 | for (i = 0; i < len - 5; i++) { | ||
979 | /* get progressive flag from picture extension */ | ||
980 | if (buf[i] == 0x00 && buf[i+1] == 0x00 && | ||
981 | buf[i+2] == 0x01 && (unsigned char)buf[i+3] == 0xb5 && | ||
982 | (buf[i+4] & 0xf0) == 0x10) | ||
983 | progressive = buf[i+5] & 0x08; | ||
984 | } | ||
985 | |||
977 | /* setting n always > 1, fixes problems when playing stillframes | 986 | /* setting n always > 1, fixes problems when playing stillframes |
978 | consisting of I- and P-Frames */ | 987 | consisting of I- and P-Frames */ |
979 | n = MIN_IFRAME / len + 1; | 988 | n = MIN_IFRAME / len + 1; |
@@ -985,7 +994,11 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len | |||
985 | dvb_play(av7110, buf, len, 0, 1); | 994 | dvb_play(av7110, buf, len, 0, 1); |
986 | 995 | ||
987 | av7110_ipack_flush(&av7110->ipack[1]); | 996 | av7110_ipack_flush(&av7110->ipack[1]); |
988 | return 0; | 997 | |
998 | if (progressive) | ||
999 | return vidcom(av7110, AV_VIDEO_CMD_FREEZE, 1); | ||
1000 | else | ||
1001 | return 0; | ||
989 | } | 1002 | } |
990 | 1003 | ||
991 | 1004 | ||
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 3439c9864f67..2d64d557b977 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c | |||
@@ -896,6 +896,7 @@ static u8 read_pwm(struct budget_av *budget_av) | |||
896 | #define SUBID_DVBS_CINERGY1200 0x1154 | 896 | #define SUBID_DVBS_CINERGY1200 0x1154 |
897 | #define SUBID_DVBS_CYNERGY1200N 0x1155 | 897 | #define SUBID_DVBS_CYNERGY1200N 0x1155 |
898 | #define SUBID_DVBS_TV_STAR 0x0014 | 898 | #define SUBID_DVBS_TV_STAR 0x0014 |
899 | #define SUBID_DVBS_TV_STAR_PLUS_X4 0x0015 | ||
899 | #define SUBID_DVBS_TV_STAR_CI 0x0016 | 900 | #define SUBID_DVBS_TV_STAR_CI 0x0016 |
900 | #define SUBID_DVBS_EASYWATCH_1 0x001a | 901 | #define SUBID_DVBS_EASYWATCH_1 0x001a |
901 | #define SUBID_DVBS_EASYWATCH_2 0x001b | 902 | #define SUBID_DVBS_EASYWATCH_2 0x001b |
@@ -910,6 +911,7 @@ static u8 read_pwm(struct budget_av *budget_av) | |||
910 | #define SUBID_DVBC_CINERGY1200 0x1156 | 911 | #define SUBID_DVBC_CINERGY1200 0x1156 |
911 | #define SUBID_DVBC_CINERGY1200_MK3 0x1176 | 912 | #define SUBID_DVBC_CINERGY1200_MK3 0x1176 |
912 | 913 | ||
914 | #define SUBID_DVBT_EASYWATCH 0x003a | ||
913 | #define SUBID_DVBT_KNC1_PLUS 0x0031 | 915 | #define SUBID_DVBT_KNC1_PLUS 0x0031 |
914 | #define SUBID_DVBT_KNC1 0x0030 | 916 | #define SUBID_DVBT_KNC1 0x0030 |
915 | #define SUBID_DVBT_CINERGY1200 0x1157 | 917 | #define SUBID_DVBT_CINERGY1200 0x1157 |
@@ -957,6 +959,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
957 | break; | 959 | break; |
958 | 960 | ||
959 | case SUBID_DVBS_TV_STAR: | 961 | case SUBID_DVBS_TV_STAR: |
962 | case SUBID_DVBS_TV_STAR_PLUS_X4: | ||
960 | case SUBID_DVBS_TV_STAR_CI: | 963 | case SUBID_DVBS_TV_STAR_CI: |
961 | case SUBID_DVBS_CYNERGY1200N: | 964 | case SUBID_DVBS_CYNERGY1200N: |
962 | case SUBID_DVBS_EASYWATCH: | 965 | case SUBID_DVBS_EASYWATCH: |
@@ -1018,6 +1021,7 @@ static void frontend_init(struct budget_av *budget_av) | |||
1018 | } | 1021 | } |
1019 | break; | 1022 | break; |
1020 | 1023 | ||
1024 | case SUBID_DVBT_EASYWATCH: | ||
1021 | case SUBID_DVBT_KNC1: | 1025 | case SUBID_DVBT_KNC1: |
1022 | case SUBID_DVBT_KNC1_PLUS: | 1026 | case SUBID_DVBT_KNC1_PLUS: |
1023 | case SUBID_DVBT_CINERGY1200: | 1027 | case SUBID_DVBT_CINERGY1200: |
@@ -1248,7 +1252,9 @@ MAKE_BUDGET_INFO(satewpls1, "Satelco EasyWatch DVB-S light", BUDGET_KNC1S); | |||
1248 | MAKE_BUDGET_INFO(satewps, "Satelco EasyWatch DVB-S", BUDGET_KNC1S); | 1252 | MAKE_BUDGET_INFO(satewps, "Satelco EasyWatch DVB-S", BUDGET_KNC1S); |
1249 | MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); | 1253 | MAKE_BUDGET_INFO(satewplc, "Satelco EasyWatch DVB-C", BUDGET_KNC1CP); |
1250 | MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3); | 1254 | MAKE_BUDGET_INFO(satewcmk3, "Satelco EasyWatch DVB-C MK3", BUDGET_KNC1C_MK3); |
1255 | MAKE_BUDGET_INFO(satewt, "Satelco EasyWatch DVB-T", BUDGET_KNC1T); | ||
1251 | MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); | 1256 | MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP); |
1257 | MAKE_BUDGET_INFO(knc1spx4, "KNC1 DVB-S Plus X4", BUDGET_KNC1SP); | ||
1252 | MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); | 1258 | MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); |
1253 | MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3); | 1259 | MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3); |
1254 | MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3); | 1260 | MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3); |
@@ -1266,12 +1272,14 @@ static struct pci_device_id pci_tbl[] = { | |||
1266 | MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), | 1272 | MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011), |
1267 | MAKE_EXTENSION_PCI(knc1sp, 0x1894, 0x0011), | 1273 | MAKE_EXTENSION_PCI(knc1sp, 0x1894, 0x0011), |
1268 | MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014), | 1274 | MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014), |
1275 | MAKE_EXTENSION_PCI(knc1spx4, 0x1894, 0x0015), | ||
1269 | MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016), | 1276 | MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016), |
1270 | MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), | 1277 | MAKE_EXTENSION_PCI(satewpls, 0x1894, 0x001e), |
1271 | MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), | 1278 | MAKE_EXTENSION_PCI(satewpls1, 0x1894, 0x001a), |
1272 | MAKE_EXTENSION_PCI(satewps, 0x1894, 0x001b), | 1279 | MAKE_EXTENSION_PCI(satewps, 0x1894, 0x001b), |
1273 | MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), | 1280 | MAKE_EXTENSION_PCI(satewplc, 0x1894, 0x002a), |
1274 | MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c), | 1281 | MAKE_EXTENSION_PCI(satewcmk3, 0x1894, 0x002c), |
1282 | MAKE_EXTENSION_PCI(satewt, 0x1894, 0x003a), | ||
1275 | MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), | 1283 | MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), |
1276 | MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), | 1284 | MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), |
1277 | MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022), | 1285 | MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022), |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 9268a82bada6..14b00f57b5de 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -351,6 +351,7 @@ static struct s5h1420_config s5h1420_config = { | |||
351 | static struct tda10086_config tda10086_config = { | 351 | static struct tda10086_config tda10086_config = { |
352 | .demod_address = 0x0e, | 352 | .demod_address = 0x0e, |
353 | .invert = 0, | 353 | .invert = 0, |
354 | .diseqc_tone = 1, | ||
354 | }; | 355 | }; |
355 | 356 | ||
356 | static u8 read_pwm(struct budget* budget) | 357 | static u8 read_pwm(struct budget* budget) |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 8d5214f18cf0..1b41b3f77cf9 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -4,12 +4,12 @@ | |||
4 | 4 | ||
5 | menuconfig RADIO_ADAPTERS | 5 | menuconfig RADIO_ADAPTERS |
6 | bool "Radio Adapters" | 6 | bool "Radio Adapters" |
7 | depends on VIDEO_DEV | 7 | depends on VIDEO_V4L2 |
8 | default y | 8 | default y |
9 | ---help--- | 9 | ---help--- |
10 | Say Y here to enable selecting AM/FM radio adapters. | 10 | Say Y here to enable selecting AM/FM radio adapters. |
11 | 11 | ||
12 | if RADIO_ADAPTERS && VIDEO_DEV | 12 | if RADIO_ADAPTERS && VIDEO_V4L2 |
13 | 13 | ||
14 | config RADIO_CADET | 14 | config RADIO_CADET |
15 | tristate "ADS Cadet AM/FM Tuner" | 15 | tristate "ADS Cadet AM/FM Tuner" |
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 3118bdab3183..53e114857377 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -361,6 +361,7 @@ static int __init fmi_init(void) | |||
361 | } | 361 | } |
362 | if (!request_region(io, 2, "radio-sf16fmi")) { | 362 | if (!request_region(io, 2, "radio-sf16fmi")) { |
363 | printk(KERN_ERR "radio-sf16fmi: port 0x%x already in use\n", io); | 363 | printk(KERN_ERR "radio-sf16fmi: port 0x%x already in use\n", io); |
364 | pnp_device_detach(dev); | ||
364 | return -EBUSY; | 365 | return -EBUSY; |
365 | } | 366 | } |
366 | 367 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index f7c8b000404f..ebc5fbbc38bb 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -470,9 +470,8 @@ static int __init fmr2_init(void) | |||
470 | 470 | ||
471 | mutex_init(&lock); | 471 | mutex_init(&lock); |
472 | 472 | ||
473 | if (request_region(io, 2, "sf16fmr2")) | 473 | if (!request_region(io, 2, "sf16fmr2")) { |
474 | { | 474 | printk(KERN_ERR "radio-sf16fmr2: request_region failed!\n"); |
475 | printk(KERN_ERR "fmr2: port 0x%x already in use\n", io); | ||
476 | return -EBUSY; | 475 | return -EBUSY; |
477 | } | 476 | } |
478 | 477 | ||
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 8e4bd4769048..649f14d2c013 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -62,6 +62,29 @@ | |||
62 | * - code cleaned of unnecessary rds_commands | 62 | * - code cleaned of unnecessary rds_commands |
63 | * - USB Vendor/Product ID for ADS/Tech FM Radio Receiver verified | 63 | * - USB Vendor/Product ID for ADS/Tech FM Radio Receiver verified |
64 | * (thanks to Guillaume RAMOUSSE) | 64 | * (thanks to Guillaume RAMOUSSE) |
65 | * 2008-01-27 Tobias Lorenz <tobias.lorenz@gmx.net> | ||
66 | * Version 1.0.5 | ||
67 | * - number of seek_retries changed to tune_timeout | ||
68 | * - fixed problem with incomplete tune operations by own buffers | ||
69 | * - optimization of variables and printf types | ||
70 | * - improved error logging | ||
71 | * 2008-01-31 Tobias Lorenz <tobias.lorenz@gmx.net> | ||
72 | * Oliver Neukum <oliver@neukum.org> | ||
73 | * Version 1.0.6 | ||
74 | * - fixed coverity checker warnings in *_usb_driver_disconnect | ||
75 | * - probe()/open() race by correct ordering in probe() | ||
76 | * - DMA coherency rules by separate allocation of all buffers | ||
77 | * - use of endianness macros | ||
78 | * - abuse of spinlock, replaced by mutex | ||
79 | * - racy handling of timer in disconnect, | ||
80 | * replaced by delayed_work | ||
81 | * - racy interruptible_sleep_on(), | ||
82 | * replaced with wait_event_interruptible() | ||
83 | * - handle signals in read() | ||
84 | * 2008-02-08 Tobias Lorenz <tobias.lorenz@gmx.net> | ||
85 | * Oliver Neukum <oliver@neukum.org> | ||
86 | * Version 1.0.7 | ||
87 | * - usb autosuspend support | ||
65 | * | 88 | * |
66 | * ToDo: | 89 | * ToDo: |
67 | * - add seeking support | 90 | * - add seeking support |
@@ -74,9 +97,10 @@ | |||
74 | /* driver definitions */ | 97 | /* driver definitions */ |
75 | #define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>" | 98 | #define DRIVER_AUTHOR "Tobias Lorenz <tobias.lorenz@gmx.net>" |
76 | #define DRIVER_NAME "radio-si470x" | 99 | #define DRIVER_NAME "radio-si470x" |
77 | #define DRIVER_VERSION KERNEL_VERSION(1, 0, 4) | 100 | #define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 6) |
78 | #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" | 101 | #define DRIVER_CARD "Silicon Labs Si470x FM Radio Receiver" |
79 | #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers" | 102 | #define DRIVER_DESC "USB radio driver for Si470x FM Radio Receivers" |
103 | #define DRIVER_VERSION "1.0.6" | ||
80 | 104 | ||
81 | 105 | ||
82 | /* kernel includes */ | 106 | /* kernel includes */ |
@@ -89,8 +113,10 @@ | |||
89 | #include <linux/hid.h> | 113 | #include <linux/hid.h> |
90 | #include <linux/version.h> | 114 | #include <linux/version.h> |
91 | #include <linux/videodev2.h> | 115 | #include <linux/videodev2.h> |
116 | #include <linux/mutex.h> | ||
92 | #include <media/v4l2-common.h> | 117 | #include <media/v4l2-common.h> |
93 | #include <media/rds.h> | 118 | #include <media/rds.h> |
119 | #include <asm/unaligned.h> | ||
94 | 120 | ||
95 | 121 | ||
96 | /* USB Device ID List */ | 122 | /* USB Device ID List */ |
@@ -119,56 +145,56 @@ MODULE_PARM_DESC(radio_nr, "Radio Nr"); | |||
119 | /* 0: 200 kHz (USA, Australia) */ | 145 | /* 0: 200 kHz (USA, Australia) */ |
120 | /* 1: 100 kHz (Europe, Japan) */ | 146 | /* 1: 100 kHz (Europe, Japan) */ |
121 | /* 2: 50 kHz */ | 147 | /* 2: 50 kHz */ |
122 | static int space = 2; | 148 | static unsigned short space = 2; |
123 | module_param(space, int, 0); | 149 | module_param(space, ushort, 0); |
124 | MODULE_PARM_DESC(radio_nr, "Spacing: 0=200kHz 1=100kHz *2=50kHz*"); | 150 | MODULE_PARM_DESC(radio_nr, "Spacing: 0=200kHz 1=100kHz *2=50kHz*"); |
125 | 151 | ||
126 | /* Bottom of Band (MHz) */ | 152 | /* Bottom of Band (MHz) */ |
127 | /* 0: 87.5 - 108 MHz (USA, Europe)*/ | 153 | /* 0: 87.5 - 108 MHz (USA, Europe)*/ |
128 | /* 1: 76 - 108 MHz (Japan wide band) */ | 154 | /* 1: 76 - 108 MHz (Japan wide band) */ |
129 | /* 2: 76 - 90 MHz (Japan) */ | 155 | /* 2: 76 - 90 MHz (Japan) */ |
130 | static int band = 1; | 156 | static unsigned short band = 1; |
131 | module_param(band, int, 0); | 157 | module_param(band, ushort, 0); |
132 | MODULE_PARM_DESC(radio_nr, "Band: 0=87.5..108MHz *1=76..108MHz* 2=76..90MHz"); | 158 | MODULE_PARM_DESC(radio_nr, "Band: 0=87.5..108MHz *1=76..108MHz* 2=76..90MHz"); |
133 | 159 | ||
134 | /* De-emphasis */ | 160 | /* De-emphasis */ |
135 | /* 0: 75 us (USA) */ | 161 | /* 0: 75 us (USA) */ |
136 | /* 1: 50 us (Europe, Australia, Japan) */ | 162 | /* 1: 50 us (Europe, Australia, Japan) */ |
137 | static int de = 1; | 163 | static unsigned short de = 1; |
138 | module_param(de, int, 0); | 164 | module_param(de, ushort, 0); |
139 | MODULE_PARM_DESC(radio_nr, "De-emphasis: 0=75us *1=50us*"); | 165 | MODULE_PARM_DESC(radio_nr, "De-emphasis: 0=75us *1=50us*"); |
140 | 166 | ||
141 | /* USB timeout */ | 167 | /* USB timeout */ |
142 | static int usb_timeout = 500; | 168 | static unsigned int usb_timeout = 500; |
143 | module_param(usb_timeout, int, 0); | 169 | module_param(usb_timeout, uint, 0); |
144 | MODULE_PARM_DESC(usb_timeout, "USB timeout (ms): *500*"); | 170 | MODULE_PARM_DESC(usb_timeout, "USB timeout (ms): *500*"); |
145 | 171 | ||
146 | /* Seek retries */ | 172 | /* Tune timeout */ |
147 | static int seek_retries = 100; | 173 | static unsigned int tune_timeout = 3000; |
148 | module_param(seek_retries, int, 0); | 174 | module_param(tune_timeout, uint, 0); |
149 | MODULE_PARM_DESC(seek_retries, "Seek retries: *100*"); | 175 | MODULE_PARM_DESC(tune_timeout, "Tune timeout: *3000*"); |
150 | 176 | ||
151 | /* RDS buffer blocks */ | 177 | /* RDS buffer blocks */ |
152 | static int rds_buf = 100; | 178 | static unsigned int rds_buf = 100; |
153 | module_param(rds_buf, int, 0); | 179 | module_param(rds_buf, uint, 0); |
154 | MODULE_PARM_DESC(rds_buf, "RDS buffer entries: *100*"); | 180 | MODULE_PARM_DESC(rds_buf, "RDS buffer entries: *100*"); |
155 | 181 | ||
156 | /* RDS maximum block errors */ | 182 | /* RDS maximum block errors */ |
157 | static int max_rds_errors = 1; | 183 | static unsigned short max_rds_errors = 1; |
158 | /* 0 means 0 errors requiring correction */ | 184 | /* 0 means 0 errors requiring correction */ |
159 | /* 1 means 1-2 errors requiring correction (used by original USBRadio.exe) */ | 185 | /* 1 means 1-2 errors requiring correction (used by original USBRadio.exe) */ |
160 | /* 2 means 3-5 errors requiring correction */ | 186 | /* 2 means 3-5 errors requiring correction */ |
161 | /* 3 means 6+ errors or errors in checkword, correction not possible */ | 187 | /* 3 means 6+ errors or errors in checkword, correction not possible */ |
162 | module_param(max_rds_errors, int, 0); | 188 | module_param(max_rds_errors, ushort, 0); |
163 | MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*"); | 189 | MODULE_PARM_DESC(max_rds_errors, "RDS maximum block errors: *1*"); |
164 | 190 | ||
165 | /* RDS poll frequency */ | 191 | /* RDS poll frequency */ |
166 | static int rds_poll_time = 40; | 192 | static unsigned int rds_poll_time = 40; |
167 | /* 40 is used by the original USBRadio.exe */ | 193 | /* 40 is used by the original USBRadio.exe */ |
168 | /* 50 is used by radio-cadet */ | 194 | /* 50 is used by radio-cadet */ |
169 | /* 75 should be okay */ | 195 | /* 75 should be okay */ |
170 | /* 80 is the usual RDS receive interval */ | 196 | /* 80 is the usual RDS receive interval */ |
171 | module_param(rds_poll_time, int, 0); | 197 | module_param(rds_poll_time, uint, 0); |
172 | MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*"); | 198 | MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*"); |
173 | 199 | ||
174 | 200 | ||
@@ -393,22 +419,19 @@ MODULE_PARM_DESC(rds_poll_time, "RDS poll time (ms): *40*"); | |||
393 | struct si470x_device { | 419 | struct si470x_device { |
394 | /* reference to USB and video device */ | 420 | /* reference to USB and video device */ |
395 | struct usb_device *usbdev; | 421 | struct usb_device *usbdev; |
422 | struct usb_interface *intf; | ||
396 | struct video_device *videodev; | 423 | struct video_device *videodev; |
397 | 424 | ||
398 | /* are these really necessary ? */ | 425 | /* driver management */ |
399 | int users; | 426 | unsigned int users; |
400 | |||
401 | /* report buffer (maximum 64 bytes) */ | ||
402 | unsigned char buf[64]; | ||
403 | 427 | ||
404 | /* Silabs internal registers (0..15) */ | 428 | /* Silabs internal registers (0..15) */ |
405 | unsigned short registers[RADIO_REGISTER_NUM]; | 429 | unsigned short registers[RADIO_REGISTER_NUM]; |
406 | 430 | ||
407 | /* RDS receive buffer */ | 431 | /* RDS receive buffer */ |
408 | struct work_struct work; | 432 | struct delayed_work work; |
409 | wait_queue_head_t read_queue; | 433 | wait_queue_head_t read_queue; |
410 | struct timer_list timer; | 434 | struct mutex lock; /* buffer locking */ |
411 | spinlock_t lock; /* buffer locking */ | ||
412 | unsigned char *buffer; /* size is always multiple of three */ | 435 | unsigned char *buffer; /* size is always multiple of three */ |
413 | unsigned int buf_size; | 436 | unsigned int buf_size; |
414 | unsigned int rd_index; | 437 | unsigned int rd_index; |
@@ -434,28 +457,46 @@ struct si470x_device { | |||
434 | /* | 457 | /* |
435 | * si470x_get_report - receive a HID report | 458 | * si470x_get_report - receive a HID report |
436 | */ | 459 | */ |
437 | static int si470x_get_report(struct si470x_device *radio, int size) | 460 | static int si470x_get_report(struct si470x_device *radio, void *buf, int size) |
438 | { | 461 | { |
439 | return usb_control_msg(radio->usbdev, | 462 | unsigned char *report = (unsigned char *) buf; |
463 | int retval; | ||
464 | |||
465 | retval = usb_control_msg(radio->usbdev, | ||
440 | usb_rcvctrlpipe(radio->usbdev, 0), | 466 | usb_rcvctrlpipe(radio->usbdev, 0), |
441 | HID_REQ_GET_REPORT, | 467 | HID_REQ_GET_REPORT, |
442 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 468 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, |
443 | radio->buf[0], 2, | 469 | report[0], 2, |
444 | radio->buf, size, usb_timeout); | 470 | buf, size, usb_timeout); |
471 | if (retval < 0) | ||
472 | printk(KERN_WARNING DRIVER_NAME | ||
473 | ": si470x_get_report: usb_control_msg returned %d\n", | ||
474 | retval); | ||
475 | |||
476 | return retval; | ||
445 | } | 477 | } |
446 | 478 | ||
447 | 479 | ||
448 | /* | 480 | /* |
449 | * si470x_set_report - send a HID report | 481 | * si470x_set_report - send a HID report |
450 | */ | 482 | */ |
451 | static int si470x_set_report(struct si470x_device *radio, int size) | 483 | static int si470x_set_report(struct si470x_device *radio, void *buf, int size) |
452 | { | 484 | { |
453 | return usb_control_msg(radio->usbdev, | 485 | unsigned char *report = (unsigned char *) buf; |
486 | int retval; | ||
487 | |||
488 | retval = usb_control_msg(radio->usbdev, | ||
454 | usb_sndctrlpipe(radio->usbdev, 0), | 489 | usb_sndctrlpipe(radio->usbdev, 0), |
455 | HID_REQ_SET_REPORT, | 490 | HID_REQ_SET_REPORT, |
456 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, | 491 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, |
457 | radio->buf[0], 2, | 492 | report[0], 2, |
458 | radio->buf, size, usb_timeout); | 493 | buf, size, usb_timeout); |
494 | if (retval < 0) | ||
495 | printk(KERN_WARNING DRIVER_NAME | ||
496 | ": si470x_set_report: usb_control_msg returned %d\n", | ||
497 | retval); | ||
498 | |||
499 | return retval; | ||
459 | } | 500 | } |
460 | 501 | ||
461 | 502 | ||
@@ -464,13 +505,16 @@ static int si470x_set_report(struct si470x_device *radio, int size) | |||
464 | */ | 505 | */ |
465 | static int si470x_get_register(struct si470x_device *radio, int regnr) | 506 | static int si470x_get_register(struct si470x_device *radio, int regnr) |
466 | { | 507 | { |
508 | unsigned char buf[REGISTER_REPORT_SIZE]; | ||
467 | int retval; | 509 | int retval; |
468 | 510 | ||
469 | radio->buf[0] = REGISTER_REPORT(regnr); | 511 | buf[0] = REGISTER_REPORT(regnr); |
512 | |||
513 | retval = si470x_get_report(radio, (void *) &buf, sizeof(buf)); | ||
470 | 514 | ||
471 | retval = si470x_get_report(radio, REGISTER_REPORT_SIZE); | ||
472 | if (retval >= 0) | 515 | if (retval >= 0) |
473 | radio->registers[regnr] = (radio->buf[1] << 8) | radio->buf[2]; | 516 | radio->registers[regnr] = be16_to_cpu(get_unaligned( |
517 | (unsigned short *) &buf[1])); | ||
474 | 518 | ||
475 | return (retval < 0) ? -EINVAL : 0; | 519 | return (retval < 0) ? -EINVAL : 0; |
476 | } | 520 | } |
@@ -481,13 +525,14 @@ static int si470x_get_register(struct si470x_device *radio, int regnr) | |||
481 | */ | 525 | */ |
482 | static int si470x_set_register(struct si470x_device *radio, int regnr) | 526 | static int si470x_set_register(struct si470x_device *radio, int regnr) |
483 | { | 527 | { |
528 | unsigned char buf[REGISTER_REPORT_SIZE]; | ||
484 | int retval; | 529 | int retval; |
485 | 530 | ||
486 | radio->buf[0] = REGISTER_REPORT(regnr); | 531 | buf[0] = REGISTER_REPORT(regnr); |
487 | radio->buf[1] = (radio->registers[regnr] & 0xff00) >> 8; | 532 | put_unaligned(cpu_to_be16(radio->registers[regnr]), |
488 | radio->buf[2] = (radio->registers[regnr] & 0x00ff); | 533 | (unsigned short *) &buf[1]); |
489 | 534 | ||
490 | retval = si470x_set_report(radio, REGISTER_REPORT_SIZE); | 535 | retval = si470x_set_report(radio, (void *) &buf, sizeof(buf)); |
491 | 536 | ||
492 | return (retval < 0) ? -EINVAL : 0; | 537 | return (retval < 0) ? -EINVAL : 0; |
493 | } | 538 | } |
@@ -498,18 +543,19 @@ static int si470x_set_register(struct si470x_device *radio, int regnr) | |||
498 | */ | 543 | */ |
499 | static int si470x_get_all_registers(struct si470x_device *radio) | 544 | static int si470x_get_all_registers(struct si470x_device *radio) |
500 | { | 545 | { |
546 | unsigned char buf[ENTIRE_REPORT_SIZE]; | ||
501 | int retval; | 547 | int retval; |
502 | int regnr; | 548 | unsigned char regnr; |
503 | 549 | ||
504 | radio->buf[0] = ENTIRE_REPORT; | 550 | buf[0] = ENTIRE_REPORT; |
505 | 551 | ||
506 | retval = si470x_get_report(radio, ENTIRE_REPORT_SIZE); | 552 | retval = si470x_get_report(radio, (void *) &buf, sizeof(buf)); |
507 | 553 | ||
508 | if (retval >= 0) | 554 | if (retval >= 0) |
509 | for (regnr = 0; regnr < RADIO_REGISTER_NUM; regnr++) | 555 | for (regnr = 0; regnr < RADIO_REGISTER_NUM; regnr++) |
510 | radio->registers[regnr] = | 556 | radio->registers[regnr] = be16_to_cpu(get_unaligned( |
511 | (radio->buf[regnr * RADIO_REGISTER_SIZE + 1] << 8) | | 557 | (unsigned short *) |
512 | radio->buf[regnr * RADIO_REGISTER_SIZE + 2]; | 558 | &buf[regnr * RADIO_REGISTER_SIZE + 1])); |
513 | 559 | ||
514 | return (retval < 0) ? -EINVAL : 0; | 560 | return (retval < 0) ? -EINVAL : 0; |
515 | } | 561 | } |
@@ -520,21 +566,28 @@ static int si470x_get_all_registers(struct si470x_device *radio) | |||
520 | */ | 566 | */ |
521 | static int si470x_get_rds_registers(struct si470x_device *radio) | 567 | static int si470x_get_rds_registers(struct si470x_device *radio) |
522 | { | 568 | { |
569 | unsigned char buf[RDS_REPORT_SIZE]; | ||
523 | int retval; | 570 | int retval; |
524 | int regnr; | ||
525 | int size; | 571 | int size; |
572 | unsigned char regnr; | ||
526 | 573 | ||
527 | radio->buf[0] = RDS_REPORT; | 574 | buf[0] = RDS_REPORT; |
528 | 575 | ||
529 | retval = usb_interrupt_msg(radio->usbdev, | 576 | retval = usb_interrupt_msg(radio->usbdev, |
530 | usb_rcvctrlpipe(radio->usbdev, 1), | 577 | usb_rcvintpipe(radio->usbdev, 1), |
531 | radio->buf, RDS_REPORT_SIZE, &size, usb_timeout); | 578 | (void *) &buf, sizeof(buf), &size, usb_timeout); |
579 | if (size != sizeof(buf)) | ||
580 | printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_register: " | ||
581 | "return size differs: %d != %zu\n", size, sizeof(buf)); | ||
582 | if (retval < 0) | ||
583 | printk(KERN_WARNING DRIVER_NAME ": si470x_get_rds_registers: " | ||
584 | "usb_interrupt_msg returned %d\n", retval); | ||
532 | 585 | ||
533 | if (retval >= 0) | 586 | if (retval >= 0) |
534 | for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++) | 587 | for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++) |
535 | radio->registers[STATUSRSSI + regnr] = | 588 | radio->registers[STATUSRSSI + regnr] = |
536 | (radio->buf[regnr * RADIO_REGISTER_SIZE + 1] << 8) | | 589 | be16_to_cpu(get_unaligned((unsigned short *) |
537 | radio->buf[regnr * RADIO_REGISTER_SIZE + 2]; | 590 | &buf[regnr * RADIO_REGISTER_SIZE + 1])); |
538 | 591 | ||
539 | return (retval < 0) ? -EINVAL : 0; | 592 | return (retval < 0) ? -EINVAL : 0; |
540 | } | 593 | } |
@@ -543,9 +596,11 @@ static int si470x_get_rds_registers(struct si470x_device *radio) | |||
543 | /* | 596 | /* |
544 | * si470x_set_chan - set the channel | 597 | * si470x_set_chan - set the channel |
545 | */ | 598 | */ |
546 | static int si470x_set_chan(struct si470x_device *radio, int chan) | 599 | static int si470x_set_chan(struct si470x_device *radio, unsigned short chan) |
547 | { | 600 | { |
548 | int retval, i; | 601 | int retval; |
602 | unsigned long timeout; | ||
603 | bool timed_out = 0; | ||
549 | 604 | ||
550 | /* start tuning */ | 605 | /* start tuning */ |
551 | radio->registers[CHANNEL] &= ~CHANNEL_CHAN; | 606 | radio->registers[CHANNEL] &= ~CHANNEL_CHAN; |
@@ -555,16 +610,17 @@ static int si470x_set_chan(struct si470x_device *radio, int chan) | |||
555 | return retval; | 610 | return retval; |
556 | 611 | ||
557 | /* wait till seek operation has completed */ | 612 | /* wait till seek operation has completed */ |
558 | i = 0; | 613 | timeout = jiffies + msecs_to_jiffies(tune_timeout); |
559 | do { | 614 | do { |
560 | retval = si470x_get_register(radio, STATUSRSSI); | 615 | retval = si470x_get_register(radio, STATUSRSSI); |
561 | if (retval < 0) | 616 | if (retval < 0) |
562 | return retval; | 617 | return retval; |
563 | } while ((radio->registers[STATUSRSSI] & STATUSRSSI_STC) && | 618 | timed_out = time_after(jiffies, timeout); |
564 | (++i < seek_retries)); | 619 | } while (((radio->registers[STATUSRSSI] & STATUSRSSI_STC) == 0) && |
565 | if (i >= seek_retries) | 620 | (!timed_out)); |
621 | if (timed_out) | ||
566 | printk(KERN_WARNING DRIVER_NAME | 622 | printk(KERN_WARNING DRIVER_NAME |
567 | ": seek does not finish after %d tries\n", i); | 623 | ": seek does not finish after %u ms\n", tune_timeout); |
568 | 624 | ||
569 | /* stop tuning */ | 625 | /* stop tuning */ |
570 | radio->registers[CHANNEL] &= ~CHANNEL_TUNE; | 626 | radio->registers[CHANNEL] &= ~CHANNEL_TUNE; |
@@ -575,9 +631,10 @@ static int si470x_set_chan(struct si470x_device *radio, int chan) | |||
575 | /* | 631 | /* |
576 | * si470x_get_freq - get the frequency | 632 | * si470x_get_freq - get the frequency |
577 | */ | 633 | */ |
578 | static int si470x_get_freq(struct si470x_device *radio) | 634 | static unsigned int si470x_get_freq(struct si470x_device *radio) |
579 | { | 635 | { |
580 | int spacing, band_bottom, chan, freq; | 636 | unsigned int spacing, band_bottom, freq; |
637 | unsigned short chan; | ||
581 | int retval; | 638 | int retval; |
582 | 639 | ||
583 | /* Spacing (kHz) */ | 640 | /* Spacing (kHz) */ |
@@ -616,9 +673,10 @@ static int si470x_get_freq(struct si470x_device *radio) | |||
616 | /* | 673 | /* |
617 | * si470x_set_freq - set the frequency | 674 | * si470x_set_freq - set the frequency |
618 | */ | 675 | */ |
619 | static int si470x_set_freq(struct si470x_device *radio, int freq) | 676 | static int si470x_set_freq(struct si470x_device *radio, unsigned int freq) |
620 | { | 677 | { |
621 | int spacing, band_bottom, chan; | 678 | unsigned int spacing, band_bottom; |
679 | unsigned short chan; | ||
622 | 680 | ||
623 | /* Spacing (kHz) */ | 681 | /* Spacing (kHz) */ |
624 | switch (space) { | 682 | switch (space) { |
@@ -709,9 +767,17 @@ static int si470x_stop(struct si470x_device *radio) | |||
709 | */ | 767 | */ |
710 | static int si470x_rds_on(struct si470x_device *radio) | 768 | static int si470x_rds_on(struct si470x_device *radio) |
711 | { | 769 | { |
770 | int retval; | ||
771 | |||
712 | /* sysconfig 1 */ | 772 | /* sysconfig 1 */ |
773 | mutex_lock(&radio->lock); | ||
713 | radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS; | 774 | radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDS; |
714 | return si470x_set_register(radio, SYSCONFIG1); | 775 | retval = si470x_set_register(radio, SYSCONFIG1); |
776 | if (retval < 0) | ||
777 | radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_RDS; | ||
778 | mutex_unlock(&radio->lock); | ||
779 | |||
780 | return retval; | ||
715 | } | 781 | } |
716 | 782 | ||
717 | 783 | ||
@@ -725,11 +791,10 @@ static int si470x_rds_on(struct si470x_device *radio) | |||
725 | */ | 791 | */ |
726 | static void si470x_rds(struct si470x_device *radio) | 792 | static void si470x_rds(struct si470x_device *radio) |
727 | { | 793 | { |
728 | unsigned char tmpbuf[3]; | ||
729 | unsigned char blocknum; | 794 | unsigned char blocknum; |
730 | unsigned char bler; /* rds block errors */ | 795 | unsigned short bler; /* rds block errors */ |
731 | unsigned short rds; | 796 | unsigned short rds; |
732 | unsigned int i; | 797 | unsigned char tmpbuf[3]; |
733 | 798 | ||
734 | /* get rds blocks */ | 799 | /* get rds blocks */ |
735 | if (si470x_get_rds_registers(radio) < 0) | 800 | if (si470x_get_rds_registers(radio) < 0) |
@@ -743,63 +808,58 @@ static void si470x_rds(struct si470x_device *radio) | |||
743 | return; | 808 | return; |
744 | } | 809 | } |
745 | 810 | ||
746 | /* copy four RDS blocks to internal buffer */ | 811 | /* copy all four RDS blocks to internal buffer */ |
747 | if (spin_trylock(&radio->lock)) { | 812 | mutex_lock(&radio->lock); |
748 | /* process each rds block */ | 813 | for (blocknum = 0; blocknum < 4; blocknum++) { |
749 | for (blocknum = 0; blocknum < 4; blocknum++) { | 814 | switch (blocknum) { |
750 | switch (blocknum) { | 815 | default: |
751 | default: | 816 | bler = (radio->registers[STATUSRSSI] & |
752 | bler = (radio->registers[STATUSRSSI] & | 817 | STATUSRSSI_BLERA) >> 9; |
753 | STATUSRSSI_BLERA) >> 9; | 818 | rds = radio->registers[RDSA]; |
754 | rds = radio->registers[RDSA]; | 819 | break; |
755 | break; | 820 | case 1: |
756 | case 1: | 821 | bler = (radio->registers[READCHAN] & |
757 | bler = (radio->registers[READCHAN] & | 822 | READCHAN_BLERB) >> 14; |
758 | READCHAN_BLERB) >> 14; | 823 | rds = radio->registers[RDSB]; |
759 | rds = radio->registers[RDSB]; | 824 | break; |
760 | break; | 825 | case 2: |
761 | case 2: | 826 | bler = (radio->registers[READCHAN] & |
762 | bler = (radio->registers[READCHAN] & | 827 | READCHAN_BLERC) >> 12; |
763 | READCHAN_BLERC) >> 12; | 828 | rds = radio->registers[RDSC]; |
764 | rds = radio->registers[RDSC]; | 829 | break; |
765 | break; | 830 | case 3: |
766 | case 3: | 831 | bler = (radio->registers[READCHAN] & |
767 | bler = (radio->registers[READCHAN] & | 832 | READCHAN_BLERD) >> 10; |
768 | READCHAN_BLERD) >> 10; | 833 | rds = radio->registers[RDSD]; |
769 | rds = radio->registers[RDSD]; | 834 | break; |
770 | break; | 835 | }; |
771 | }; | 836 | |
772 | 837 | /* Fill the V4L2 RDS buffer */ | |
773 | /* Fill the V4L2 RDS buffer */ | 838 | put_unaligned(cpu_to_le16(rds), (unsigned short *) &tmpbuf); |
774 | tmpbuf[0] = rds & 0x00ff; /* LSB */ | 839 | tmpbuf[2] = blocknum; /* offset name */ |
775 | tmpbuf[1] = (rds & 0xff00) >> 8;/* MSB */ | 840 | tmpbuf[2] |= blocknum << 3; /* received offset */ |
776 | tmpbuf[2] = blocknum; /* offset name */ | 841 | if (bler > max_rds_errors) |
777 | tmpbuf[2] |= blocknum << 3; /* received offset */ | 842 | tmpbuf[2] |= 0x80; /* uncorrectable errors */ |
778 | if (bler > max_rds_errors) | 843 | else if (bler > 0) |
779 | tmpbuf[2] |= 0x80; /* uncorrectable errors */ | 844 | tmpbuf[2] |= 0x40; /* corrected error(s) */ |
780 | else if (bler > 0) | 845 | |
781 | tmpbuf[2] |= 0x40; /* corrected error(s) */ | 846 | /* copy RDS block to internal buffer */ |
782 | 847 | memcpy(&radio->buffer[radio->wr_index], &tmpbuf, 3); | |
783 | /* copy RDS block to internal buffer */ | 848 | radio->wr_index += 3; |
784 | for (i = 0; i < 3; i++) { | 849 | |
785 | radio->buffer[radio->wr_index] = tmpbuf[i]; | 850 | /* wrap write pointer */ |
786 | radio->wr_index++; | 851 | if (radio->wr_index >= radio->buf_size) |
787 | } | 852 | radio->wr_index = 0; |
788 | 853 | ||
789 | /* wrap write pointer */ | 854 | /* check for overflow */ |
790 | if (radio->wr_index >= radio->buf_size) | 855 | if (radio->wr_index == radio->rd_index) { |
791 | radio->wr_index = 0; | 856 | /* increment and wrap read pointer */ |
792 | 857 | radio->rd_index += 3; | |
793 | /* check for overflow */ | 858 | if (radio->rd_index >= radio->buf_size) |
794 | if (radio->wr_index == radio->rd_index) { | 859 | radio->rd_index = 0; |
795 | /* increment and wrap read pointer */ | ||
796 | radio->rd_index += 3; | ||
797 | if (radio->rd_index >= radio->buf_size) | ||
798 | radio->rd_index = 0; | ||
799 | } | ||
800 | } | 860 | } |
801 | spin_unlock(&radio->lock); | ||
802 | } | 861 | } |
862 | mutex_unlock(&radio->lock); | ||
803 | 863 | ||
804 | /* wake up read queue */ | 864 | /* wake up read queue */ |
805 | if (radio->wr_index != radio->rd_index) | 865 | if (radio->wr_index != radio->rd_index) |
@@ -808,29 +868,18 @@ static void si470x_rds(struct si470x_device *radio) | |||
808 | 868 | ||
809 | 869 | ||
810 | /* | 870 | /* |
811 | * si470x_timer - rds timer function | ||
812 | */ | ||
813 | static void si470x_timer(unsigned long data) | ||
814 | { | ||
815 | struct si470x_device *radio = (struct si470x_device *) data; | ||
816 | |||
817 | schedule_work(&radio->work); | ||
818 | } | ||
819 | |||
820 | |||
821 | /* | ||
822 | * si470x_work - rds work function | 871 | * si470x_work - rds work function |
823 | */ | 872 | */ |
824 | static void si470x_work(struct work_struct *work) | 873 | static void si470x_work(struct work_struct *work) |
825 | { | 874 | { |
826 | struct si470x_device *radio = container_of(work, struct si470x_device, | 875 | struct si470x_device *radio = container_of(work, struct si470x_device, |
827 | work); | 876 | work.work); |
828 | 877 | ||
829 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) | 878 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) |
830 | return; | 879 | return; |
831 | 880 | ||
832 | si470x_rds(radio); | 881 | si470x_rds(radio); |
833 | mod_timer(&radio->timer, jiffies + msecs_to_jiffies(rds_poll_time)); | 882 | schedule_delayed_work(&radio->work, msecs_to_jiffies(rds_poll_time)); |
834 | } | 883 | } |
835 | 884 | ||
836 | 885 | ||
@@ -852,44 +901,44 @@ static ssize_t si470x_fops_read(struct file *file, char __user *buf, | |||
852 | /* switch on rds reception */ | 901 | /* switch on rds reception */ |
853 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { | 902 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { |
854 | si470x_rds_on(radio); | 903 | si470x_rds_on(radio); |
855 | schedule_work(&radio->work); | 904 | schedule_delayed_work(&radio->work, |
905 | msecs_to_jiffies(rds_poll_time)); | ||
856 | } | 906 | } |
857 | 907 | ||
858 | /* block if no new data available */ | 908 | /* block if no new data available */ |
859 | while (radio->wr_index == radio->rd_index) { | 909 | while (radio->wr_index == radio->rd_index) { |
860 | if (file->f_flags & O_NONBLOCK) | 910 | if (file->f_flags & O_NONBLOCK) |
861 | return -EWOULDBLOCK; | 911 | return -EWOULDBLOCK; |
862 | interruptible_sleep_on(&radio->read_queue); | 912 | if (wait_event_interruptible(radio->read_queue, |
913 | radio->wr_index != radio->rd_index) < 0) | ||
914 | return -EINTR; | ||
863 | } | 915 | } |
864 | 916 | ||
865 | /* calculate block count from byte count */ | 917 | /* calculate block count from byte count */ |
866 | count /= 3; | 918 | count /= 3; |
867 | 919 | ||
868 | /* copy RDS block out of internal buffer and to user buffer */ | 920 | /* copy RDS block out of internal buffer and to user buffer */ |
869 | if (spin_trylock(&radio->lock)) { | 921 | mutex_lock(&radio->lock); |
870 | while (block_count < count) { | 922 | while (block_count < count) { |
871 | if (radio->rd_index == radio->wr_index) | 923 | if (radio->rd_index == radio->wr_index) |
872 | break; | 924 | break; |
873 | 925 | ||
874 | /* always transfer rds complete blocks */ | 926 | /* always transfer rds complete blocks */ |
875 | if (copy_to_user(buf, | 927 | if (copy_to_user(buf, &radio->buffer[radio->rd_index], 3)) |
876 | &radio->buffer[radio->rd_index], 3)) | 928 | /* retval = -EFAULT; */ |
877 | /* retval = -EFAULT; */ | 929 | break; |
878 | break; | 930 | |
879 | 931 | /* increment and wrap read pointer */ | |
880 | /* increment and wrap read pointer */ | 932 | radio->rd_index += 3; |
881 | radio->rd_index += 3; | 933 | if (radio->rd_index >= radio->buf_size) |
882 | if (radio->rd_index >= radio->buf_size) | 934 | radio->rd_index = 0; |
883 | radio->rd_index = 0; | 935 | |
884 | 936 | /* increment counters */ | |
885 | /* increment counters */ | 937 | block_count++; |
886 | block_count++; | 938 | buf += 3; |
887 | buf += 3; | 939 | retval += 3; |
888 | retval += 3; | ||
889 | } | ||
890 | |||
891 | spin_unlock(&radio->lock); | ||
892 | } | 940 | } |
941 | mutex_unlock(&radio->lock); | ||
893 | 942 | ||
894 | return retval; | 943 | return retval; |
895 | } | 944 | } |
@@ -906,7 +955,8 @@ static unsigned int si470x_fops_poll(struct file *file, | |||
906 | /* switch on rds reception */ | 955 | /* switch on rds reception */ |
907 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { | 956 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) { |
908 | si470x_rds_on(radio); | 957 | si470x_rds_on(radio); |
909 | schedule_work(&radio->work); | 958 | schedule_delayed_work(&radio->work, |
959 | msecs_to_jiffies(rds_poll_time)); | ||
910 | } | 960 | } |
911 | 961 | ||
912 | poll_wait(file, &radio->read_queue, pts); | 962 | poll_wait(file, &radio->read_queue, pts); |
@@ -924,10 +974,22 @@ static unsigned int si470x_fops_poll(struct file *file, | |||
924 | static int si470x_fops_open(struct inode *inode, struct file *file) | 974 | static int si470x_fops_open(struct inode *inode, struct file *file) |
925 | { | 975 | { |
926 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 976 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
977 | int retval; | ||
927 | 978 | ||
928 | radio->users++; | 979 | radio->users++; |
929 | if (radio->users == 1) | 980 | |
930 | return si470x_start(radio); | 981 | retval = usb_autopm_get_interface(radio->intf); |
982 | if (retval < 0) { | ||
983 | radio->users--; | ||
984 | return -EIO; | ||
985 | } | ||
986 | |||
987 | if (radio->users == 1) { | ||
988 | retval = si470x_start(radio); | ||
989 | if (retval < 0) | ||
990 | usb_autopm_put_interface(radio->intf); | ||
991 | return retval; | ||
992 | } | ||
931 | 993 | ||
932 | return 0; | 994 | return 0; |
933 | } | 995 | } |
@@ -939,6 +1001,7 @@ static int si470x_fops_open(struct inode *inode, struct file *file) | |||
939 | static int si470x_fops_release(struct inode *inode, struct file *file) | 1001 | static int si470x_fops_release(struct inode *inode, struct file *file) |
940 | { | 1002 | { |
941 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1003 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1004 | int retval; | ||
942 | 1005 | ||
943 | if (!radio) | 1006 | if (!radio) |
944 | return -ENODEV; | 1007 | return -ENODEV; |
@@ -946,13 +1009,14 @@ static int si470x_fops_release(struct inode *inode, struct file *file) | |||
946 | radio->users--; | 1009 | radio->users--; |
947 | if (radio->users == 0) { | 1010 | if (radio->users == 0) { |
948 | /* stop rds reception */ | 1011 | /* stop rds reception */ |
949 | del_timer_sync(&radio->timer); | 1012 | cancel_delayed_work_sync(&radio->work); |
950 | flush_scheduled_work(); | ||
951 | 1013 | ||
952 | /* cancel read processes */ | 1014 | /* cancel read processes */ |
953 | wake_up_interruptible(&radio->read_queue); | 1015 | wake_up_interruptible(&radio->read_queue); |
954 | 1016 | ||
955 | return si470x_stop(radio); | 1017 | retval = si470x_stop(radio); |
1018 | usb_autopm_put_interface(radio->intf); | ||
1019 | return retval; | ||
956 | } | 1020 | } |
957 | 1021 | ||
958 | return 0; | 1022 | return 0; |
@@ -1030,7 +1094,7 @@ static int si470x_vidioc_querycap(struct file *file, void *priv, | |||
1030 | strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); | 1094 | strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); |
1031 | strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); | 1095 | strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); |
1032 | sprintf(capability->bus_info, "USB"); | 1096 | sprintf(capability->bus_info, "USB"); |
1033 | capability->version = DRIVER_VERSION; | 1097 | capability->version = DRIVER_KERNEL_VERSION; |
1034 | capability->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; | 1098 | capability->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; |
1035 | 1099 | ||
1036 | return 0; | 1100 | return 0; |
@@ -1067,16 +1131,21 @@ static int si470x_vidioc_s_input(struct file *filp, void *priv, unsigned int i) | |||
1067 | static int si470x_vidioc_queryctrl(struct file *file, void *priv, | 1131 | static int si470x_vidioc_queryctrl(struct file *file, void *priv, |
1068 | struct v4l2_queryctrl *qc) | 1132 | struct v4l2_queryctrl *qc) |
1069 | { | 1133 | { |
1070 | int i; | 1134 | unsigned char i; |
1135 | int retval = -EINVAL; | ||
1071 | 1136 | ||
1072 | for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { | 1137 | for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { |
1073 | if (qc->id && qc->id == si470x_v4l2_queryctrl[i].id) { | 1138 | if (qc->id && qc->id == si470x_v4l2_queryctrl[i].id) { |
1074 | memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); | 1139 | memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); |
1075 | return 0; | 1140 | retval = 0; |
1141 | break; | ||
1076 | } | 1142 | } |
1077 | } | 1143 | } |
1144 | if (retval < 0) | ||
1145 | printk(KERN_WARNING DRIVER_NAME | ||
1146 | ": query control failed with %d\n", retval); | ||
1078 | 1147 | ||
1079 | return -EINVAL; | 1148 | return retval; |
1080 | } | 1149 | } |
1081 | 1150 | ||
1082 | 1151 | ||
@@ -1110,21 +1179,29 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv, | |||
1110 | struct v4l2_control *ctrl) | 1179 | struct v4l2_control *ctrl) |
1111 | { | 1180 | { |
1112 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1181 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1182 | int retval; | ||
1113 | 1183 | ||
1114 | switch (ctrl->id) { | 1184 | switch (ctrl->id) { |
1115 | case V4L2_CID_AUDIO_VOLUME: | 1185 | case V4L2_CID_AUDIO_VOLUME: |
1116 | radio->registers[SYSCONFIG2] &= ~SYSCONFIG2_VOLUME; | 1186 | radio->registers[SYSCONFIG2] &= ~SYSCONFIG2_VOLUME; |
1117 | radio->registers[SYSCONFIG2] |= ctrl->value; | 1187 | radio->registers[SYSCONFIG2] |= ctrl->value; |
1118 | return si470x_set_register(radio, SYSCONFIG2); | 1188 | retval = si470x_set_register(radio, SYSCONFIG2); |
1189 | break; | ||
1119 | case V4L2_CID_AUDIO_MUTE: | 1190 | case V4L2_CID_AUDIO_MUTE: |
1120 | if (ctrl->value == 1) | 1191 | if (ctrl->value == 1) |
1121 | radio->registers[POWERCFG] &= ~POWERCFG_DMUTE; | 1192 | radio->registers[POWERCFG] &= ~POWERCFG_DMUTE; |
1122 | else | 1193 | else |
1123 | radio->registers[POWERCFG] |= POWERCFG_DMUTE; | 1194 | radio->registers[POWERCFG] |= POWERCFG_DMUTE; |
1124 | return si470x_set_register(radio, POWERCFG); | 1195 | retval = si470x_set_register(radio, POWERCFG); |
1196 | break; | ||
1197 | default: | ||
1198 | retval = -EINVAL; | ||
1125 | } | 1199 | } |
1200 | if (retval < 0) | ||
1201 | printk(KERN_WARNING DRIVER_NAME | ||
1202 | ": set control failed with %d\n", retval); | ||
1126 | 1203 | ||
1127 | return -EINVAL; | 1204 | return retval; |
1128 | } | 1205 | } |
1129 | 1206 | ||
1130 | 1207 | ||
@@ -1163,8 +1240,8 @@ static int si470x_vidioc_s_audio(struct file *file, void *priv, | |||
1163 | static int si470x_vidioc_g_tuner(struct file *file, void *priv, | 1240 | static int si470x_vidioc_g_tuner(struct file *file, void *priv, |
1164 | struct v4l2_tuner *tuner) | 1241 | struct v4l2_tuner *tuner) |
1165 | { | 1242 | { |
1166 | int retval; | ||
1167 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1243 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1244 | int retval; | ||
1168 | 1245 | ||
1169 | if (tuner->index > 0) | 1246 | if (tuner->index > 0) |
1170 | return -EINVAL; | 1247 | return -EINVAL; |
@@ -1220,6 +1297,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv, | |||
1220 | struct v4l2_tuner *tuner) | 1297 | struct v4l2_tuner *tuner) |
1221 | { | 1298 | { |
1222 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1299 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1300 | int retval; | ||
1223 | 1301 | ||
1224 | if (tuner->index > 0) | 1302 | if (tuner->index > 0) |
1225 | return -EINVAL; | 1303 | return -EINVAL; |
@@ -1229,7 +1307,12 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv, | |||
1229 | else | 1307 | else |
1230 | radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */ | 1308 | radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */ |
1231 | 1309 | ||
1232 | return si470x_set_register(radio, POWERCFG); | 1310 | retval = si470x_set_register(radio, POWERCFG); |
1311 | if (retval < 0) | ||
1312 | printk(KERN_WARNING DRIVER_NAME | ||
1313 | ": set tuner failed with %d\n", retval); | ||
1314 | |||
1315 | return retval; | ||
1233 | } | 1316 | } |
1234 | 1317 | ||
1235 | 1318 | ||
@@ -1255,11 +1338,17 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv, | |||
1255 | struct v4l2_frequency *freq) | 1338 | struct v4l2_frequency *freq) |
1256 | { | 1339 | { |
1257 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); | 1340 | struct si470x_device *radio = video_get_drvdata(video_devdata(file)); |
1341 | int retval; | ||
1258 | 1342 | ||
1259 | if (freq->type != V4L2_TUNER_RADIO) | 1343 | if (freq->type != V4L2_TUNER_RADIO) |
1260 | return -EINVAL; | 1344 | return -EINVAL; |
1261 | 1345 | ||
1262 | return si470x_set_freq(radio, freq->frequency); | 1346 | retval = si470x_set_freq(radio, freq->frequency); |
1347 | if (retval < 0) | ||
1348 | printk(KERN_WARNING DRIVER_NAME | ||
1349 | ": set frequency failed with %d\n", retval); | ||
1350 | |||
1351 | return 0; | ||
1263 | } | 1352 | } |
1264 | 1353 | ||
1265 | 1354 | ||
@@ -1299,71 +1388,116 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1299 | const struct usb_device_id *id) | 1388 | const struct usb_device_id *id) |
1300 | { | 1389 | { |
1301 | struct si470x_device *radio; | 1390 | struct si470x_device *radio; |
1391 | int retval = -ENOMEM; | ||
1302 | 1392 | ||
1303 | /* memory and interface allocations */ | 1393 | /* private data allocation */ |
1304 | radio = kmalloc(sizeof(struct si470x_device), GFP_KERNEL); | 1394 | radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL); |
1305 | if (!radio) | 1395 | if (!radio) |
1306 | return -ENOMEM; | 1396 | goto err_initial; |
1397 | |||
1398 | /* video device allocation */ | ||
1307 | radio->videodev = video_device_alloc(); | 1399 | radio->videodev = video_device_alloc(); |
1308 | if (!radio->videodev) { | 1400 | if (!radio->videodev) |
1309 | kfree(radio); | 1401 | goto err_radio; |
1310 | return -ENOMEM; | 1402 | |
1311 | } | 1403 | /* initial configuration */ |
1312 | memcpy(radio->videodev, &si470x_viddev_template, | 1404 | memcpy(radio->videodev, &si470x_viddev_template, |
1313 | sizeof(si470x_viddev_template)); | 1405 | sizeof(si470x_viddev_template)); |
1314 | radio->users = 0; | 1406 | radio->users = 0; |
1315 | radio->usbdev = interface_to_usbdev(intf); | 1407 | radio->usbdev = interface_to_usbdev(intf); |
1408 | radio->intf = intf; | ||
1409 | mutex_init(&radio->lock); | ||
1316 | video_set_drvdata(radio->videodev, radio); | 1410 | video_set_drvdata(radio->videodev, radio); |
1317 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) { | ||
1318 | printk(KERN_WARNING DRIVER_NAME | ||
1319 | ": Could not register video device\n"); | ||
1320 | video_device_release(radio->videodev); | ||
1321 | kfree(radio); | ||
1322 | return -EIO; | ||
1323 | } | ||
1324 | usb_set_intfdata(intf, radio); | ||
1325 | 1411 | ||
1326 | /* show some infos about the specific device */ | 1412 | /* show some infos about the specific device */ |
1327 | if (si470x_get_all_registers(radio) < 0) { | 1413 | retval = -EIO; |
1328 | video_device_release(radio->videodev); | 1414 | if (si470x_get_all_registers(radio) < 0) |
1329 | kfree(radio); | 1415 | goto err_all; |
1330 | return -EIO; | 1416 | printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n", |
1331 | } | ||
1332 | printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4x ChipID=0x%4.4x\n", | ||
1333 | radio->registers[DEVICEID], radio->registers[CHIPID]); | 1417 | radio->registers[DEVICEID], radio->registers[CHIPID]); |
1334 | 1418 | ||
1335 | /* check if firmware is current */ | 1419 | /* check if firmware is current */ |
1336 | if ((radio->registers[CHIPID] & CHIPID_FIRMWARE) | 1420 | if ((radio->registers[CHIPID] & CHIPID_FIRMWARE) |
1337 | < RADIO_SW_VERSION_CURRENT) | 1421 | < RADIO_SW_VERSION_CURRENT) { |
1422 | printk(KERN_WARNING DRIVER_NAME | ||
1423 | ": This driver is known to work with " | ||
1424 | "firmware version %hu,\n", RADIO_SW_VERSION_CURRENT); | ||
1425 | printk(KERN_WARNING DRIVER_NAME | ||
1426 | ": but the device has firmware version %hu.\n", | ||
1427 | radio->registers[CHIPID] & CHIPID_FIRMWARE); | ||
1428 | printk(KERN_WARNING DRIVER_NAME | ||
1429 | ": If you have some trouble using this driver,\n"); | ||
1338 | printk(KERN_WARNING DRIVER_NAME | 1430 | printk(KERN_WARNING DRIVER_NAME |
1339 | ": This driver is known to work with chip version %d, " | 1431 | ": please report to V4L ML at " |
1340 | "but the device has firmware %d.\n" | 1432 | "video4linux-list@redhat.com\n"); |
1341 | DRIVER_NAME | 1433 | } |
1342 | "If you have some trouble using this driver, please " | ||
1343 | "report to V4L ML at video4linux-list@redhat.com\n", | ||
1344 | radio->registers[CHIPID] & CHIPID_FIRMWARE, | ||
1345 | RADIO_SW_VERSION_CURRENT); | ||
1346 | 1434 | ||
1347 | /* set initial frequency */ | 1435 | /* set initial frequency */ |
1348 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ | 1436 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ |
1349 | 1437 | ||
1350 | /* rds initialization */ | 1438 | /* rds buffer allocation */ |
1351 | radio->buf_size = rds_buf * 3; | 1439 | radio->buf_size = rds_buf * 3; |
1352 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); | 1440 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); |
1353 | if (!radio->buffer) { | 1441 | if (!radio->buffer) |
1354 | video_device_release(radio->videodev); | 1442 | goto err_all; |
1355 | kfree(radio); | 1443 | |
1356 | return -ENOMEM; | 1444 | /* rds buffer configuration */ |
1357 | } | ||
1358 | radio->wr_index = 0; | 1445 | radio->wr_index = 0; |
1359 | radio->rd_index = 0; | 1446 | radio->rd_index = 0; |
1360 | init_waitqueue_head(&radio->read_queue); | 1447 | init_waitqueue_head(&radio->read_queue); |
1361 | 1448 | ||
1362 | /* prepare polling via eventd */ | 1449 | /* prepare rds work function */ |
1363 | INIT_WORK(&radio->work, si470x_work); | 1450 | INIT_DELAYED_WORK(&radio->work, si470x_work); |
1364 | init_timer(&radio->timer); | 1451 | |
1365 | radio->timer.function = si470x_timer; | 1452 | /* register video device */ |
1366 | radio->timer.data = (unsigned long) radio; | 1453 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) { |
1454 | printk(KERN_WARNING DRIVER_NAME | ||
1455 | ": Could not register video device\n"); | ||
1456 | goto err_all; | ||
1457 | } | ||
1458 | usb_set_intfdata(intf, radio); | ||
1459 | |||
1460 | return 0; | ||
1461 | err_all: | ||
1462 | video_device_release(radio->videodev); | ||
1463 | kfree(radio->buffer); | ||
1464 | err_radio: | ||
1465 | kfree(radio); | ||
1466 | err_initial: | ||
1467 | return retval; | ||
1468 | } | ||
1469 | |||
1470 | |||
1471 | /* | ||
1472 | * si470x_usb_driver_suspend - suspend the device | ||
1473 | */ | ||
1474 | static int si470x_usb_driver_suspend(struct usb_interface *intf, | ||
1475 | pm_message_t message) | ||
1476 | { | ||
1477 | struct si470x_device *radio = usb_get_intfdata(intf); | ||
1478 | |||
1479 | printk(KERN_INFO DRIVER_NAME ": suspending now...\n"); | ||
1480 | |||
1481 | cancel_delayed_work_sync(&radio->work); | ||
1482 | |||
1483 | return 0; | ||
1484 | } | ||
1485 | |||
1486 | |||
1487 | /* | ||
1488 | * si470x_usb_driver_resume - resume the device | ||
1489 | */ | ||
1490 | static int si470x_usb_driver_resume(struct usb_interface *intf) | ||
1491 | { | ||
1492 | struct si470x_device *radio = usb_get_intfdata(intf); | ||
1493 | |||
1494 | printk(KERN_INFO DRIVER_NAME ": resuming now...\n"); | ||
1495 | |||
1496 | mutex_lock(&radio->lock); | ||
1497 | if (radio->users && radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) | ||
1498 | schedule_delayed_work(&radio->work, | ||
1499 | msecs_to_jiffies(rds_poll_time)); | ||
1500 | mutex_unlock(&radio->lock); | ||
1367 | 1501 | ||
1368 | return 0; | 1502 | return 0; |
1369 | } | 1503 | } |
@@ -1376,15 +1510,11 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf) | |||
1376 | { | 1510 | { |
1377 | struct si470x_device *radio = usb_get_intfdata(intf); | 1511 | struct si470x_device *radio = usb_get_intfdata(intf); |
1378 | 1512 | ||
1379 | del_timer_sync(&radio->timer); | 1513 | cancel_delayed_work_sync(&radio->work); |
1380 | flush_scheduled_work(); | ||
1381 | |||
1382 | usb_set_intfdata(intf, NULL); | 1514 | usb_set_intfdata(intf, NULL); |
1383 | if (radio) { | 1515 | video_unregister_device(radio->videodev); |
1384 | video_unregister_device(radio->videodev); | 1516 | kfree(radio->buffer); |
1385 | kfree(radio->buffer); | 1517 | kfree(radio); |
1386 | kfree(radio); | ||
1387 | } | ||
1388 | } | 1518 | } |
1389 | 1519 | ||
1390 | 1520 | ||
@@ -1392,10 +1522,13 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf) | |||
1392 | * si470x_usb_driver - usb driver interface | 1522 | * si470x_usb_driver - usb driver interface |
1393 | */ | 1523 | */ |
1394 | static struct usb_driver si470x_usb_driver = { | 1524 | static struct usb_driver si470x_usb_driver = { |
1395 | .name = DRIVER_NAME, | 1525 | .name = DRIVER_NAME, |
1396 | .probe = si470x_usb_driver_probe, | 1526 | .probe = si470x_usb_driver_probe, |
1397 | .disconnect = si470x_usb_driver_disconnect, | 1527 | .disconnect = si470x_usb_driver_disconnect, |
1398 | .id_table = si470x_usb_driver_id_table, | 1528 | .suspend = si470x_usb_driver_suspend, |
1529 | .resume = si470x_usb_driver_resume, | ||
1530 | .id_table = si470x_usb_driver_id_table, | ||
1531 | .supports_autosuspend = 1, | ||
1399 | }; | 1532 | }; |
1400 | 1533 | ||
1401 | 1534 | ||
@@ -1409,7 +1542,7 @@ static struct usb_driver si470x_usb_driver = { | |||
1409 | */ | 1542 | */ |
1410 | static int __init si470x_module_init(void) | 1543 | static int __init si470x_module_init(void) |
1411 | { | 1544 | { |
1412 | printk(KERN_INFO DRIVER_DESC "\n"); | 1545 | printk(KERN_INFO DRIVER_DESC ", Version " DRIVER_VERSION "\n"); |
1413 | return usb_register(&si470x_usb_driver); | 1546 | return usb_register(&si470x_usb_driver); |
1414 | } | 1547 | } |
1415 | 1548 | ||
@@ -1429,4 +1562,4 @@ module_exit(si470x_module_exit); | |||
1429 | MODULE_LICENSE("GPL"); | 1562 | MODULE_LICENSE("GPL"); |
1430 | MODULE_AUTHOR(DRIVER_AUTHOR); | 1563 | MODULE_AUTHOR(DRIVER_AUTHOR); |
1431 | MODULE_DESCRIPTION(DRIVER_DESC); | 1564 | MODULE_DESCRIPTION(DRIVER_DESC); |
1432 | MODULE_VERSION("1.0.4"); | 1565 | MODULE_VERSION(DRIVER_VERSION); |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index a2e8987a6195..37072a21d8c9 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -4,14 +4,14 @@ | |||
4 | 4 | ||
5 | menuconfig VIDEO_CAPTURE_DRIVERS | 5 | menuconfig VIDEO_CAPTURE_DRIVERS |
6 | bool "Video capture adapters" | 6 | bool "Video capture adapters" |
7 | depends on VIDEO_DEV | 7 | depends on VIDEO_V4L2 |
8 | default y | 8 | default y |
9 | ---help--- | 9 | ---help--- |
10 | Say Y here to enable selecting the video adapters for | 10 | Say Y here to enable selecting the video adapters for |
11 | webcams, analog TV, and hybrid analog/digital TV. | 11 | webcams, analog TV, and hybrid analog/digital TV. |
12 | Some of those devices also supports FM radio. | 12 | Some of those devices also supports FM radio. |
13 | 13 | ||
14 | if VIDEO_CAPTURE_DRIVERS && VIDEO_DEV | 14 | if VIDEO_CAPTURE_DRIVERS && VIDEO_V4L2 |
15 | 15 | ||
16 | config VIDEO_ADV_DEBUG | 16 | config VIDEO_ADV_DEBUG |
17 | bool "Enable advanced debug functionality" | 17 | bool "Enable advanced debug functionality" |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 850b8c6f4577..3f209b32eeac 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -10,8 +10,9 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o | |||
10 | 10 | ||
11 | stkwebcam-objs := stk-webcam.o stk-sensor.o | 11 | stkwebcam-objs := stk-webcam.o stk-sensor.o |
12 | 12 | ||
13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o \ | 13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o |
14 | v4l2-int-device.o | 14 | |
15 | obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o | ||
15 | 16 | ||
16 | ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | 17 | ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) |
17 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o | 18 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 907dc62c1783..5404fcc5276d 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2354,8 +2354,8 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2354 | BUG(); | 2354 | BUG(); |
2355 | } | 2355 | } |
2356 | 2356 | ||
2357 | mutex_lock(&fh->cap.lock); | 2357 | mutex_lock(&fh->cap.vb_lock); |
2358 | kfree(fh->ov.clips); | 2358 | kfree(fh->ov.clips); |
2359 | fh->ov.clips = clips; | 2359 | fh->ov.clips = clips; |
2360 | fh->ov.nclips = n; | 2360 | fh->ov.nclips = n; |
2361 | 2361 | ||
@@ -2376,7 +2376,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2376 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2376 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2377 | retval = bttv_switch_overlay(btv,fh,new); | 2377 | retval = bttv_switch_overlay(btv,fh,new); |
2378 | } | 2378 | } |
2379 | mutex_unlock(&fh->cap.lock); | 2379 | mutex_unlock(&fh->cap.vb_lock); |
2380 | return retval; | 2380 | return retval; |
2381 | } | 2381 | } |
2382 | 2382 | ||
@@ -2576,7 +2576,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv, | |||
2576 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2576 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
2577 | 2577 | ||
2578 | /* update our state informations */ | 2578 | /* update our state informations */ |
2579 | mutex_lock(&fh->cap.lock); | 2579 | mutex_lock(&fh->cap.vb_lock); |
2580 | fh->fmt = fmt; | 2580 | fh->fmt = fmt; |
2581 | fh->cap.field = f->fmt.pix.field; | 2581 | fh->cap.field = f->fmt.pix.field; |
2582 | fh->cap.last = V4L2_FIELD_NONE; | 2582 | fh->cap.last = V4L2_FIELD_NONE; |
@@ -2585,7 +2585,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv, | |||
2585 | btv->init.fmt = fmt; | 2585 | btv->init.fmt = fmt; |
2586 | btv->init.width = f->fmt.pix.width; | 2586 | btv->init.width = f->fmt.pix.width; |
2587 | btv->init.height = f->fmt.pix.height; | 2587 | btv->init.height = f->fmt.pix.height; |
2588 | mutex_unlock(&fh->cap.lock); | 2588 | mutex_unlock(&fh->cap.vb_lock); |
2589 | 2589 | ||
2590 | return 0; | 2590 | return 0; |
2591 | } | 2591 | } |
@@ -2611,11 +2611,11 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2611 | unsigned int i; | 2611 | unsigned int i; |
2612 | struct bttv_fh *fh = priv; | 2612 | struct bttv_fh *fh = priv; |
2613 | 2613 | ||
2614 | mutex_lock(&fh->cap.lock); | 2614 | mutex_lock(&fh->cap.vb_lock); |
2615 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2615 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2616 | V4L2_MEMORY_MMAP); | 2616 | V4L2_MEMORY_MMAP); |
2617 | if (retval < 0) { | 2617 | if (retval < 0) { |
2618 | mutex_unlock(&fh->cap.lock); | 2618 | mutex_unlock(&fh->cap.vb_lock); |
2619 | return retval; | 2619 | return retval; |
2620 | } | 2620 | } |
2621 | 2621 | ||
@@ -2627,7 +2627,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2627 | for (i = 0; i < gbuffers; i++) | 2627 | for (i = 0; i < gbuffers; i++) |
2628 | mbuf->offsets[i] = i * gbufsize; | 2628 | mbuf->offsets[i] = i * gbufsize; |
2629 | 2629 | ||
2630 | mutex_unlock(&fh->cap.lock); | 2630 | mutex_unlock(&fh->cap.vb_lock); |
2631 | return 0; | 2631 | return 0; |
2632 | } | 2632 | } |
2633 | #endif | 2633 | #endif |
@@ -2756,10 +2756,11 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2756 | if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY)) | 2756 | if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY)) |
2757 | return -EBUSY; | 2757 | return -EBUSY; |
2758 | 2758 | ||
2759 | mutex_lock(&fh->cap.lock); | 2759 | mutex_lock(&fh->cap.vb_lock); |
2760 | if (on) { | 2760 | if (on) { |
2761 | fh->ov.tvnorm = btv->tvnorm; | 2761 | fh->ov.tvnorm = btv->tvnorm; |
2762 | new = videobuf_pci_alloc(sizeof(*new)); | 2762 | new = videobuf_pci_alloc(sizeof(*new)); |
2763 | new->crop = btv->crop[!!fh->do_crop].rect; | ||
2763 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2764 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2764 | } else { | 2765 | } else { |
2765 | new = NULL; | 2766 | new = NULL; |
@@ -2767,7 +2768,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2767 | 2768 | ||
2768 | /* switch over */ | 2769 | /* switch over */ |
2769 | retval = bttv_switch_overlay(btv, fh, new); | 2770 | retval = bttv_switch_overlay(btv, fh, new); |
2770 | mutex_unlock(&fh->cap.lock); | 2771 | mutex_unlock(&fh->cap.vb_lock); |
2771 | return retval; | 2772 | return retval; |
2772 | } | 2773 | } |
2773 | 2774 | ||
@@ -2806,7 +2807,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2806 | } | 2807 | } |
2807 | 2808 | ||
2808 | /* ok, accept it */ | 2809 | /* ok, accept it */ |
2809 | mutex_lock(&fh->cap.lock); | 2810 | mutex_lock(&fh->cap.vb_lock); |
2810 | btv->fbuf.base = fb->base; | 2811 | btv->fbuf.base = fb->base; |
2811 | btv->fbuf.fmt.width = fb->fmt.width; | 2812 | btv->fbuf.fmt.width = fb->fmt.width; |
2812 | btv->fbuf.fmt.height = fb->fmt.height; | 2813 | btv->fbuf.fmt.height = fb->fmt.height; |
@@ -2838,7 +2839,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2838 | retval = bttv_switch_overlay(btv, fh, new); | 2839 | retval = bttv_switch_overlay(btv, fh, new); |
2839 | } | 2840 | } |
2840 | } | 2841 | } |
2841 | mutex_unlock(&fh->cap.lock); | 2842 | mutex_unlock(&fh->cap.vb_lock); |
2842 | return retval; | 2843 | return retval; |
2843 | } | 2844 | } |
2844 | 2845 | ||
@@ -3090,7 +3091,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3090 | 3091 | ||
3091 | fh->do_crop = 1; | 3092 | fh->do_crop = 1; |
3092 | 3093 | ||
3093 | mutex_lock(&fh->cap.lock); | 3094 | mutex_lock(&fh->cap.vb_lock); |
3094 | 3095 | ||
3095 | if (fh->width < c.min_scaled_width) { | 3096 | if (fh->width < c.min_scaled_width) { |
3096 | fh->width = c.min_scaled_width; | 3097 | fh->width = c.min_scaled_width; |
@@ -3108,7 +3109,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3108 | btv->init.height = c.max_scaled_height; | 3109 | btv->init.height = c.max_scaled_height; |
3109 | } | 3110 | } |
3110 | 3111 | ||
3111 | mutex_unlock(&fh->cap.lock); | 3112 | mutex_unlock(&fh->cap.vb_lock); |
3112 | 3113 | ||
3113 | return 0; | 3114 | return 0; |
3114 | } | 3115 | } |
@@ -3177,30 +3178,25 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3177 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); | 3178 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); |
3178 | } else { | 3179 | } else { |
3179 | /* read() capture */ | 3180 | /* read() capture */ |
3180 | mutex_lock(&fh->cap.lock); | 3181 | mutex_lock(&fh->cap.vb_lock); |
3181 | if (NULL == fh->cap.read_buf) { | 3182 | if (NULL == fh->cap.read_buf) { |
3182 | /* need to capture a new frame */ | 3183 | /* need to capture a new frame */ |
3183 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) { | 3184 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) |
3184 | mutex_unlock(&fh->cap.lock); | 3185 | goto err; |
3185 | return POLLERR; | ||
3186 | } | ||
3187 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); | 3186 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); |
3188 | if (NULL == fh->cap.read_buf) { | 3187 | if (NULL == fh->cap.read_buf) |
3189 | mutex_unlock(&fh->cap.lock); | 3188 | goto err; |
3190 | return POLLERR; | ||
3191 | } | ||
3192 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 3189 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
3193 | field = videobuf_next_field(&fh->cap); | 3190 | field = videobuf_next_field(&fh->cap); |
3194 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { | 3191 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { |
3195 | kfree (fh->cap.read_buf); | 3192 | kfree (fh->cap.read_buf); |
3196 | fh->cap.read_buf = NULL; | 3193 | fh->cap.read_buf = NULL; |
3197 | mutex_unlock(&fh->cap.lock); | 3194 | goto err; |
3198 | return POLLERR; | ||
3199 | } | 3195 | } |
3200 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); | 3196 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); |
3201 | fh->cap.read_off = 0; | 3197 | fh->cap.read_off = 0; |
3202 | } | 3198 | } |
3203 | mutex_unlock(&fh->cap.lock); | 3199 | mutex_unlock(&fh->cap.vb_lock); |
3204 | buf = (struct bttv_buffer*)fh->cap.read_buf; | 3200 | buf = (struct bttv_buffer*)fh->cap.read_buf; |
3205 | } | 3201 | } |
3206 | 3202 | ||
@@ -3209,6 +3205,9 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3209 | buf->vb.state == VIDEOBUF_ERROR) | 3205 | buf->vb.state == VIDEOBUF_ERROR) |
3210 | return POLLIN|POLLRDNORM; | 3206 | return POLLIN|POLLRDNORM; |
3211 | return 0; | 3207 | return 0; |
3208 | err: | ||
3209 | mutex_unlock(&fh->cap.vb_lock); | ||
3210 | return POLLERR; | ||
3212 | } | 3211 | } |
3213 | 3212 | ||
3214 | static int bttv_open(struct inode *inode, struct file *file) | 3213 | static int bttv_open(struct inode *inode, struct file *file) |
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 1f0cc79e2a33..75fa82c7c735 100644 --- a/drivers/media/video/bt8xx/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c | |||
@@ -352,13 +352,13 @@ int bttv_s_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt) | |||
352 | because vbi_fmt.end counts field lines times two. */ | 352 | because vbi_fmt.end counts field lines times two. */ |
353 | end = max(frt->fmt.vbi.start[0], start1) * 2 + 2; | 353 | end = max(frt->fmt.vbi.start[0], start1) * 2 + 2; |
354 | 354 | ||
355 | mutex_lock(&fh->vbi.lock); | 355 | mutex_lock(&fh->vbi.vb_lock); |
356 | 356 | ||
357 | fh->vbi_fmt.fmt = frt->fmt.vbi; | 357 | fh->vbi_fmt.fmt = frt->fmt.vbi; |
358 | fh->vbi_fmt.tvnorm = tvnorm; | 358 | fh->vbi_fmt.tvnorm = tvnorm; |
359 | fh->vbi_fmt.end = end; | 359 | fh->vbi_fmt.end = end; |
360 | 360 | ||
361 | mutex_unlock(&fh->vbi.lock); | 361 | mutex_unlock(&fh->vbi.vb_lock); |
362 | 362 | ||
363 | rc = 0; | 363 | rc = 0; |
364 | 364 | ||
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 0aedbeaf94cd..e357f415db06 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -609,13 +609,19 @@ static int cx8802_request_acquire(struct cx8802_driver *drv) | |||
609 | struct cx88_core *core = drv->core; | 609 | struct cx88_core *core = drv->core; |
610 | 610 | ||
611 | /* Fail a request for hardware if the device is busy. */ | 611 | /* Fail a request for hardware if the device is busy. */ |
612 | if (core->active_type_id != CX88_BOARD_NONE) | 612 | if (core->active_type_id != CX88_BOARD_NONE && |
613 | core->active_type_id != drv->type_id) | ||
613 | return -EBUSY; | 614 | return -EBUSY; |
614 | 615 | ||
615 | if (drv->advise_acquire) | 616 | if (drv->advise_acquire) |
616 | { | 617 | { |
617 | core->active_type_id = drv->type_id; | 618 | mutex_lock(&drv->core->lock); |
618 | drv->advise_acquire(drv); | 619 | core->active_ref++; |
620 | if (core->active_type_id == CX88_BOARD_NONE) { | ||
621 | core->active_type_id = drv->type_id; | ||
622 | drv->advise_acquire(drv); | ||
623 | } | ||
624 | mutex_unlock(&drv->core->lock); | ||
619 | 625 | ||
620 | mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); | 626 | mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); |
621 | } | 627 | } |
@@ -628,12 +634,14 @@ static int cx8802_request_release(struct cx8802_driver *drv) | |||
628 | { | 634 | { |
629 | struct cx88_core *core = drv->core; | 635 | struct cx88_core *core = drv->core; |
630 | 636 | ||
631 | if (drv->advise_release) | 637 | mutex_lock(&drv->core->lock); |
638 | if (drv->advise_release && --core->active_ref == 0) | ||
632 | { | 639 | { |
633 | drv->advise_release(drv); | 640 | drv->advise_release(drv); |
634 | core->active_type_id = CX88_BOARD_NONE; | 641 | core->active_type_id = CX88_BOARD_NONE; |
635 | mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); | 642 | mpeg_dbg(1,"%s() Post release GPIO=%x\n", __FUNCTION__, cx_read(MO_GP0_IO)); |
636 | } | 643 | } |
644 | mutex_unlock(&drv->core->lock); | ||
637 | 645 | ||
638 | return 0; | 646 | return 0; |
639 | } | 647 | } |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 4e823f2a539a..37e6d2e4002f 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -336,6 +336,7 @@ struct cx88_core { | |||
336 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ | 336 | /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ |
337 | struct cx8802_dev *dvbdev; | 337 | struct cx8802_dev *dvbdev; |
338 | enum cx88_board_type active_type_id; | 338 | enum cx88_board_type active_type_id; |
339 | int active_ref; | ||
339 | }; | 340 | }; |
340 | 341 | ||
341 | struct cx8800_dev; | 342 | struct cx8800_dev; |
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 941357c4f3f5..8c67f678266a 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <sound/driver.h> | ||
39 | #include <sound/core.h> | 38 | #include <sound/core.h> |
40 | #include <sound/pcm.h> | 39 | #include <sound/pcm.h> |
41 | #include <sound/pcm_params.h> | 40 | #include <sound/pcm_params.h> |
@@ -270,8 +269,11 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) | |||
270 | dprintk("opening device and trying to acquire exclusive lock\n"); | 269 | dprintk("opening device and trying to acquire exclusive lock\n"); |
271 | 270 | ||
272 | /* Sets volume, mute, etc */ | 271 | /* Sets volume, mute, etc */ |
272 | |||
273 | dev->mute = 0; | 273 | dev->mute = 0; |
274 | mutex_lock(&dev->lock); | ||
274 | ret = em28xx_audio_analog_set(dev); | 275 | ret = em28xx_audio_analog_set(dev); |
276 | mutex_unlock(&dev->lock); | ||
275 | if (ret < 0) | 277 | if (ret < 0) |
276 | goto err; | 278 | goto err; |
277 | 279 | ||
@@ -303,7 +305,9 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) | |||
303 | dprintk("closing device\n"); | 305 | dprintk("closing device\n"); |
304 | 306 | ||
305 | dev->mute = 1; | 307 | dev->mute = 1; |
308 | mutex_lock(&dev->lock); | ||
306 | em28xx_audio_analog_set(dev); | 309 | em28xx_audio_analog_set(dev); |
310 | mutex_unlock(&dev->lock); | ||
307 | 311 | ||
308 | if (dev->adev->users == 0 && dev->adev->shutdown == 1) { | 312 | if (dev->adev->users == 0 && dev->adev->shutdown == 1) { |
309 | dprintk("audio users: %d\n", dev->adev->users); | 313 | dprintk("audio users: %d\n", dev->adev->users); |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 2159d0160df2..aae7753fef11 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -393,15 +393,15 @@ struct em28xx_board em28xx_boards[] = { | |||
393 | .input = { { | 393 | .input = { { |
394 | .type = EM28XX_VMUX_TELEVISION, | 394 | .type = EM28XX_VMUX_TELEVISION, |
395 | .vmux = SAA7115_COMPOSITE2, | 395 | .vmux = SAA7115_COMPOSITE2, |
396 | .amux = 1, | 396 | .amux = EM28XX_AMUX_LINE_IN, |
397 | }, { | 397 | }, { |
398 | .type = EM28XX_VMUX_COMPOSITE1, | 398 | .type = EM28XX_VMUX_COMPOSITE1, |
399 | .vmux = SAA7115_COMPOSITE0, | 399 | .vmux = SAA7115_COMPOSITE0, |
400 | .amux = 1, | 400 | .amux = EM28XX_AMUX_LINE_IN, |
401 | }, { | 401 | }, { |
402 | .type = EM28XX_VMUX_SVIDEO, | 402 | .type = EM28XX_VMUX_SVIDEO, |
403 | .vmux = SAA7115_SVIDEO3, | 403 | .vmux = SAA7115_SVIDEO3, |
404 | .amux = 1, | 404 | .amux = EM28XX_AMUX_LINE_IN, |
405 | } }, | 405 | } }, |
406 | }, | 406 | }, |
407 | }; | 407 | }; |
@@ -441,6 +441,8 @@ struct usb_device_id em28xx_id_table [] = { | |||
441 | .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, | 441 | .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, |
442 | { USB_DEVICE(0x2040, 0x6500), | 442 | { USB_DEVICE(0x2040, 0x6500), |
443 | .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, | 443 | .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, |
444 | { USB_DEVICE(0x2040, 0x6502), | ||
445 | .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, | ||
444 | { USB_DEVICE(0x2040, 0x6513), | 446 | { USB_DEVICE(0x2040, 0x6513), |
445 | .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, | 447 | .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, |
446 | { USB_DEVICE(0x0ccd, 0x0042), | 448 | { USB_DEVICE(0x0ccd, 0x0042), |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index f6b78357f0e5..7d1537cab867 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -72,7 +72,8 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count) | |||
72 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ | 72 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ |
73 | void *buff = NULL; | 73 | void *buff = NULL; |
74 | u32 i; | 74 | u32 i; |
75 | em28xx_coredbg("requested %i buffers with size %zi", count, imagesize); | 75 | em28xx_coredbg("requested %i buffers with size %zi\n", |
76 | count, imagesize); | ||
76 | if (count > EM28XX_NUM_FRAMES) | 77 | if (count > EM28XX_NUM_FRAMES) |
77 | count = EM28XX_NUM_FRAMES; | 78 | count = EM28XX_NUM_FRAMES; |
78 | 79 | ||
@@ -150,7 +151,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, | |||
150 | if (reg_debug){ | 151 | if (reg_debug){ |
151 | printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); | 152 | printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); |
152 | for (byte = 0; byte < len; byte++) { | 153 | for (byte = 0; byte < len; byte++) { |
153 | printk(" %02x", buf[byte]); | 154 | printk(" %02x", (unsigned char)buf[byte]); |
154 | } | 155 | } |
155 | printk("\n"); | 156 | printk("\n"); |
156 | } | 157 | } |
@@ -177,7 +178,8 @@ int em28xx_read_reg_req(struct em28xx *dev, u8 req, u16 reg) | |||
177 | 0x0000, reg, &val, 1, HZ); | 178 | 0x0000, reg, &val, 1, HZ); |
178 | 179 | ||
179 | if (reg_debug) | 180 | if (reg_debug) |
180 | printk(ret < 0 ? " failed!\n" : "%02x\n", val); | 181 | printk(ret < 0 ? " failed!\n" : |
182 | "%02x\n", (unsigned char) val); | ||
181 | 183 | ||
182 | if (ret < 0) | 184 | if (ret < 0) |
183 | return ret; | 185 | return ret; |
@@ -237,7 +239,7 @@ int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len) | |||
237 | * sets only some bits (specified by bitmask) of a register, by first reading | 239 | * sets only some bits (specified by bitmask) of a register, by first reading |
238 | * the actual value | 240 | * the actual value |
239 | */ | 241 | */ |
240 | int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, | 242 | static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, |
241 | u8 bitmask) | 243 | u8 bitmask) |
242 | { | 244 | { |
243 | int oldval; | 245 | int oldval; |
@@ -254,26 +256,31 @@ int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, | |||
254 | */ | 256 | */ |
255 | static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) | 257 | static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) |
256 | { | 258 | { |
257 | int ret; | 259 | int ret, i; |
258 | u8 addr = reg & 0x7f; | 260 | u8 addr = reg & 0x7f; |
259 | if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0) | 261 | if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0) |
260 | return ret; | 262 | return ret; |
261 | if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) | 263 | if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0) |
262 | return ret; | 264 | return ret; |
263 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) | 265 | |
264 | return ret; | 266 | /* Wait up to 50 ms for AC97 command to complete */ |
265 | else if (((u8) ret) & 0x01) { | 267 | for (i = 0; i < 10; i++) { |
266 | em28xx_warn ("AC97 command still being executed: not handled properly!\n"); | 268 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) |
269 | return ret; | ||
270 | if (!((u8) ret) & 0x01) | ||
271 | return 0; | ||
272 | msleep(5); | ||
267 | } | 273 | } |
274 | em28xx_warn ("AC97 command still being executed: not handled properly!\n"); | ||
268 | return 0; | 275 | return 0; |
269 | } | 276 | } |
270 | 277 | ||
271 | int em28xx_set_audio_source(struct em28xx *dev) | 278 | static int em28xx_set_audio_source(struct em28xx *dev) |
272 | { | 279 | { |
273 | static char *enable = "\x08\x08"; | 280 | static char *enable = "\x08\x08"; |
274 | static char *disable = "\x08\x88"; | 281 | static char *disable = "\x08\x88"; |
275 | char *video = enable, *line = disable; | 282 | char *video = enable, *line = disable; |
276 | int ret, no_ac97; | 283 | int ret; |
277 | u8 input; | 284 | u8 input; |
278 | 285 | ||
279 | if (dev->is_em2800) { | 286 | if (dev->is_em2800) { |
@@ -293,11 +300,9 @@ int em28xx_set_audio_source(struct em28xx *dev) | |||
293 | switch (dev->ctl_ainput) { | 300 | switch (dev->ctl_ainput) { |
294 | case EM28XX_AMUX_VIDEO: | 301 | case EM28XX_AMUX_VIDEO: |
295 | input = EM28XX_AUDIO_SRC_TUNER; | 302 | input = EM28XX_AUDIO_SRC_TUNER; |
296 | no_ac97 = 1; | ||
297 | break; | 303 | break; |
298 | case EM28XX_AMUX_LINE_IN: | 304 | case EM28XX_AMUX_LINE_IN: |
299 | input = EM28XX_AUDIO_SRC_LINE; | 305 | input = EM28XX_AUDIO_SRC_LINE; |
300 | no_ac97 = 1; | ||
301 | break; | 306 | break; |
302 | case EM28XX_AMUX_AC97_VIDEO: | 307 | case EM28XX_AMUX_AC97_VIDEO: |
303 | input = EM28XX_AUDIO_SRC_LINE; | 308 | input = EM28XX_AUDIO_SRC_LINE; |
@@ -313,12 +318,11 @@ int em28xx_set_audio_source(struct em28xx *dev) | |||
313 | ret = em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); | 318 | ret = em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); |
314 | if (ret < 0) | 319 | if (ret < 0) |
315 | return ret; | 320 | return ret; |
321 | msleep(5); | ||
316 | 322 | ||
317 | if (no_ac97) | 323 | /* Sets AC97 mixer registers |
318 | return 0; | 324 | This is seems to be needed, even for non-ac97 configs |
319 | 325 | */ | |
320 | /* Sets AC97 mixer registers */ | ||
321 | |||
322 | ret = em28xx_write_ac97(dev, VIDEO_AC97, video); | 326 | ret = em28xx_write_ac97(dev, VIDEO_AC97, video); |
323 | if (ret < 0) | 327 | if (ret < 0) |
324 | return ret; | 328 | return ret; |
@@ -337,9 +341,10 @@ int em28xx_audio_analog_set(struct em28xx *dev) | |||
337 | s[0] |= 0x1f - dev->volume; | 341 | s[0] |= 0x1f - dev->volume; |
338 | s[1] |= 0x1f - dev->volume; | 342 | s[1] |= 0x1f - dev->volume; |
339 | 343 | ||
340 | if (dev->mute) | 344 | /* Mute */ |
341 | s[1] |= 0x80; | 345 | s[1] |= 0x80; |
342 | ret = em28xx_write_ac97(dev, MASTER_AC97, s); | 346 | ret = em28xx_write_ac97(dev, MASTER_AC97, s); |
347 | |||
343 | if (ret < 0) | 348 | if (ret < 0) |
344 | return ret; | 349 | return ret; |
345 | 350 | ||
@@ -357,6 +362,11 @@ int em28xx_audio_analog_set(struct em28xx *dev) | |||
357 | /* Selects the proper audio input */ | 362 | /* Selects the proper audio input */ |
358 | ret = em28xx_set_audio_source(dev); | 363 | ret = em28xx_set_audio_source(dev); |
359 | 364 | ||
365 | /* Unmute device */ | ||
366 | if (!dev->mute) | ||
367 | s[1] &= ~0x80; | ||
368 | ret = em28xx_write_ac97(dev, MASTER_AC97, s); | ||
369 | |||
360 | return ret; | 370 | return ret; |
361 | } | 371 | } |
362 | EXPORT_SYMBOL_GPL(em28xx_audio_analog_set); | 372 | EXPORT_SYMBOL_GPL(em28xx_audio_analog_set); |
@@ -667,7 +677,7 @@ static void em28xx_isocIrq(struct urb *urb) | |||
667 | continue; | 677 | continue; |
668 | } | 678 | } |
669 | if (urb->iso_frame_desc[i].actual_length > | 679 | if (urb->iso_frame_desc[i].actual_length > |
670 | dev->max_pkt_size) { | 680 | urb->iso_frame_desc[i].length) { |
671 | em28xx_isocdbg("packet bigger than packet size"); | 681 | em28xx_isocdbg("packet bigger than packet size"); |
672 | continue; | 682 | continue; |
673 | } | 683 | } |
@@ -713,8 +723,11 @@ void em28xx_uninit_isoc(struct em28xx *dev) | |||
713 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { | 723 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { |
714 | if (dev->urb[i]) { | 724 | if (dev->urb[i]) { |
715 | usb_kill_urb(dev->urb[i]); | 725 | usb_kill_urb(dev->urb[i]); |
716 | if (dev->transfer_buffer[i]){ | 726 | if (dev->transfer_buffer[i]) { |
717 | usb_buffer_free(dev->udev,(EM28XX_NUM_PACKETS*dev->max_pkt_size),dev->transfer_buffer[i],dev->urb[i]->transfer_dma); | 727 | usb_buffer_free(dev->udev, |
728 | dev->urb[i]->transfer_buffer_length, | ||
729 | dev->transfer_buffer[i], | ||
730 | dev->urb[i]->transfer_dma); | ||
718 | } | 731 | } |
719 | usb_free_urb(dev->urb[i]); | 732 | usb_free_urb(dev->urb[i]); |
720 | } | 733 | } |
@@ -732,7 +745,10 @@ int em28xx_init_isoc(struct em28xx *dev) | |||
732 | { | 745 | { |
733 | /* change interface to 3 which allows the biggest packet sizes */ | 746 | /* change interface to 3 which allows the biggest packet sizes */ |
734 | int i, errCode; | 747 | int i, errCode; |
735 | const int sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size; | 748 | int sb_size; |
749 | |||
750 | em28xx_set_alternate(dev); | ||
751 | sb_size = EM28XX_NUM_PACKETS * dev->max_pkt_size; | ||
736 | 752 | ||
737 | /* reset streaming vars */ | 753 | /* reset streaming vars */ |
738 | dev->frame_current = NULL; | 754 | dev->frame_current = NULL; |
@@ -741,7 +757,7 @@ int em28xx_init_isoc(struct em28xx *dev) | |||
741 | /* allocate urbs */ | 757 | /* allocate urbs */ |
742 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { | 758 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { |
743 | struct urb *urb; | 759 | struct urb *urb; |
744 | int j, k; | 760 | int j; |
745 | /* allocate transfer buffer */ | 761 | /* allocate transfer buffer */ |
746 | urb = usb_alloc_urb(EM28XX_NUM_PACKETS, GFP_KERNEL); | 762 | urb = usb_alloc_urb(EM28XX_NUM_PACKETS, GFP_KERNEL); |
747 | if (!urb){ | 763 | if (!urb){ |
@@ -749,7 +765,9 @@ int em28xx_init_isoc(struct em28xx *dev) | |||
749 | em28xx_uninit_isoc(dev); | 765 | em28xx_uninit_isoc(dev); |
750 | return -ENOMEM; | 766 | return -ENOMEM; |
751 | } | 767 | } |
752 | dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, GFP_KERNEL,&urb->transfer_dma); | 768 | dev->transfer_buffer[i] = usb_buffer_alloc(dev->udev, sb_size, |
769 | GFP_KERNEL, | ||
770 | &urb->transfer_dma); | ||
753 | if (!dev->transfer_buffer[i]) { | 771 | if (!dev->transfer_buffer[i]) { |
754 | em28xx_errdev | 772 | em28xx_errdev |
755 | ("unable to allocate %i bytes for transfer buffer %i\n", | 773 | ("unable to allocate %i bytes for transfer buffer %i\n", |
@@ -762,22 +780,22 @@ int em28xx_init_isoc(struct em28xx *dev) | |||
762 | urb->dev = dev->udev; | 780 | urb->dev = dev->udev; |
763 | urb->context = dev; | 781 | urb->context = dev; |
764 | urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); | 782 | urb->pipe = usb_rcvisocpipe(dev->udev, 0x82); |
765 | urb->transfer_flags = URB_ISO_ASAP; | 783 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
766 | urb->interval = 1; | 784 | urb->interval = 1; |
767 | urb->transfer_buffer = dev->transfer_buffer[i]; | 785 | urb->transfer_buffer = dev->transfer_buffer[i]; |
768 | urb->complete = em28xx_isocIrq; | 786 | urb->complete = em28xx_isocIrq; |
769 | urb->number_of_packets = EM28XX_NUM_PACKETS; | 787 | urb->number_of_packets = EM28XX_NUM_PACKETS; |
770 | urb->transfer_buffer_length = sb_size; | 788 | urb->transfer_buffer_length = sb_size; |
771 | for (j = k = 0; j < EM28XX_NUM_PACKETS; | 789 | for (j = 0; j < EM28XX_NUM_PACKETS; j++) { |
772 | j++, k += dev->max_pkt_size) { | 790 | urb->iso_frame_desc[j].offset = j * dev->max_pkt_size; |
773 | urb->iso_frame_desc[j].offset = k; | 791 | urb->iso_frame_desc[j].length = dev->max_pkt_size; |
774 | urb->iso_frame_desc[j].length = | ||
775 | dev->max_pkt_size; | ||
776 | } | 792 | } |
777 | dev->urb[i] = urb; | 793 | dev->urb[i] = urb; |
778 | } | 794 | } |
779 | 795 | ||
780 | /* submit urbs */ | 796 | /* submit urbs */ |
797 | em28xx_coredbg("Submitting %d urbs of %d packets (%d each)\n", | ||
798 | EM28XX_NUM_BUFS, EM28XX_NUM_PACKETS, dev->max_pkt_size); | ||
781 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { | 799 | for (i = 0; i < EM28XX_NUM_BUFS; i++) { |
782 | errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL); | 800 | errCode = usb_submit_urb(dev->urb[i], GFP_KERNEL); |
783 | if (errCode) { | 801 | if (errCode) { |
@@ -794,22 +812,31 @@ int em28xx_init_isoc(struct em28xx *dev) | |||
794 | int em28xx_set_alternate(struct em28xx *dev) | 812 | int em28xx_set_alternate(struct em28xx *dev) |
795 | { | 813 | { |
796 | int errCode, prev_alt = dev->alt; | 814 | int errCode, prev_alt = dev->alt; |
797 | dev->alt = alt; | 815 | int i; |
798 | if (dev->alt == 0) { | 816 | unsigned int min_pkt_size = dev->bytesperline+4; |
799 | int i; | 817 | |
800 | for(i=0;i< dev->num_alt; i++) | 818 | /* When image size is bigger than a ceirtain value, |
801 | if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->alt]) | 819 | the frame size should be increased, otherwise, only |
802 | dev->alt=i; | 820 | green screen will be received. |
803 | } | 821 | */ |
822 | if (dev->frame_size > 720*240*2) | ||
823 | min_pkt_size *= 2; | ||
824 | |||
825 | for (i = 0; i < dev->num_alt; i++) | ||
826 | if (dev->alt_max_pkt_size[i] >= min_pkt_size) | ||
827 | break; | ||
828 | dev->alt = i; | ||
804 | 829 | ||
805 | if (dev->alt != prev_alt) { | 830 | if (dev->alt != prev_alt) { |
831 | em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n", | ||
832 | min_pkt_size, dev->alt); | ||
806 | dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; | 833 | dev->max_pkt_size = dev->alt_max_pkt_size[dev->alt]; |
807 | em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n", dev->alt, | 834 | em28xx_coredbg("setting alternate %d with wMaxPacketSize=%u\n", |
808 | dev->max_pkt_size); | 835 | dev->alt, dev->max_pkt_size); |
809 | errCode = usb_set_interface(dev->udev, 0, dev->alt); | 836 | errCode = usb_set_interface(dev->udev, 0, dev->alt); |
810 | if (errCode < 0) { | 837 | if (errCode < 0) { |
811 | em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", | 838 | em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", |
812 | dev->alt, errCode); | 839 | dev->alt, errCode); |
813 | return errCode; | 840 | return errCode; |
814 | } | 841 | } |
815 | } | 842 | } |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index a0c334672488..4abe6701a770 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -189,7 +189,7 @@ static void video_mux(struct em28xx *dev, int index) | |||
189 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); | 189 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); |
190 | } | 190 | } |
191 | 191 | ||
192 | em28xx_set_audio_source(dev); | 192 | em28xx_audio_analog_set(dev); |
193 | } | 193 | } |
194 | 194 | ||
195 | /* Usage lock check functions */ | 195 | /* Usage lock check functions */ |
@@ -830,6 +830,63 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
830 | return 0; | 830 | return 0; |
831 | } | 831 | } |
832 | 832 | ||
833 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
834 | static int em28xx_reg_len(int reg) | ||
835 | { | ||
836 | switch (reg) { | ||
837 | case AC97LSB_REG: | ||
838 | case HSCALELOW_REG: | ||
839 | case VSCALELOW_REG: | ||
840 | return 2; | ||
841 | default: | ||
842 | return 1; | ||
843 | } | ||
844 | } | ||
845 | |||
846 | static int vidioc_g_register(struct file *file, void *priv, | ||
847 | struct v4l2_register *reg) | ||
848 | { | ||
849 | struct em28xx_fh *fh = priv; | ||
850 | struct em28xx *dev = fh->dev; | ||
851 | int ret; | ||
852 | |||
853 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) | ||
854 | return -EINVAL; | ||
855 | |||
856 | if (em28xx_reg_len(reg->reg) == 1) { | ||
857 | ret = em28xx_read_reg(dev, reg->reg); | ||
858 | if (ret < 0) | ||
859 | return ret; | ||
860 | |||
861 | reg->val = ret; | ||
862 | } else { | ||
863 | u64 val = 0; | ||
864 | ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, | ||
865 | reg->reg, (char *)&val, 2); | ||
866 | if (ret < 0) | ||
867 | return ret; | ||
868 | |||
869 | reg->val = cpu_to_le64((__u64)val); | ||
870 | } | ||
871 | |||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | static int vidioc_s_register(struct file *file, void *priv, | ||
876 | struct v4l2_register *reg) | ||
877 | { | ||
878 | struct em28xx_fh *fh = priv; | ||
879 | struct em28xx *dev = fh->dev; | ||
880 | u64 buf; | ||
881 | |||
882 | buf = le64_to_cpu((__u64)reg->val); | ||
883 | |||
884 | return em28xx_write_regs(dev, reg->reg, (char *)&buf, | ||
885 | em28xx_reg_len(reg->reg)); | ||
886 | } | ||
887 | #endif | ||
888 | |||
889 | |||
833 | static int vidioc_cropcap(struct file *file, void *priv, | 890 | static int vidioc_cropcap(struct file *file, void *priv, |
834 | struct v4l2_cropcap *cc) | 891 | struct v4l2_cropcap *cc) |
835 | { | 892 | { |
@@ -1295,8 +1352,6 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1295 | filp->private_data = fh; | 1352 | filp->private_data = fh; |
1296 | 1353 | ||
1297 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { | 1354 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { |
1298 | em28xx_set_alternate(dev); | ||
1299 | |||
1300 | dev->width = norm_maxw(dev); | 1355 | dev->width = norm_maxw(dev); |
1301 | dev->height = norm_maxh(dev); | 1356 | dev->height = norm_maxh(dev); |
1302 | dev->frame_size = dev->width * dev->height * 2; | 1357 | dev->frame_size = dev->width * dev->height * 2; |
@@ -1305,6 +1360,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) | |||
1305 | dev->hscale = 0; | 1360 | dev->hscale = 0; |
1306 | dev->vscale = 0; | 1361 | dev->vscale = 0; |
1307 | 1362 | ||
1363 | em28xx_set_alternate(dev); | ||
1308 | em28xx_capture_start(dev, 1); | 1364 | em28xx_capture_start(dev, 1); |
1309 | em28xx_resolution_set(dev); | 1365 | em28xx_resolution_set(dev); |
1310 | 1366 | ||
@@ -1730,6 +1786,10 @@ static const struct video_device em28xx_video_template = { | |||
1730 | .vidioc_s_tuner = vidioc_s_tuner, | 1786 | .vidioc_s_tuner = vidioc_s_tuner, |
1731 | .vidioc_g_frequency = vidioc_g_frequency, | 1787 | .vidioc_g_frequency = vidioc_g_frequency, |
1732 | .vidioc_s_frequency = vidioc_s_frequency, | 1788 | .vidioc_s_frequency = vidioc_s_frequency, |
1789 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1790 | .vidioc_g_register = vidioc_g_register, | ||
1791 | .vidioc_s_register = vidioc_s_register, | ||
1792 | #endif | ||
1733 | 1793 | ||
1734 | .tvnorms = V4L2_STD_ALL, | 1794 | .tvnorms = V4L2_STD_ALL, |
1735 | .current_norm = V4L2_STD_PAL, | 1795 | .current_norm = V4L2_STD_PAL, |
@@ -1752,6 +1812,10 @@ static struct video_device em28xx_radio_template = { | |||
1752 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1812 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1753 | .vidioc_g_frequency = vidioc_g_frequency, | 1813 | .vidioc_g_frequency = vidioc_g_frequency, |
1754 | .vidioc_s_frequency = vidioc_s_frequency, | 1814 | .vidioc_s_frequency = vidioc_s_frequency, |
1815 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1816 | .vidioc_g_register = vidioc_g_register, | ||
1817 | .vidioc_s_register = vidioc_s_register, | ||
1818 | #endif | ||
1755 | }; | 1819 | }; |
1756 | 1820 | ||
1757 | /******************************** usb interface *****************************************/ | 1821 | /******************************** usb interface *****************************************/ |
@@ -1796,10 +1860,10 @@ void em28xx_unregister_extension(struct em28xx_ops *ops) | |||
1796 | } | 1860 | } |
1797 | EXPORT_SYMBOL(em28xx_unregister_extension); | 1861 | EXPORT_SYMBOL(em28xx_unregister_extension); |
1798 | 1862 | ||
1799 | struct video_device *em28xx_vdev_init(struct em28xx *dev, | 1863 | static struct video_device *em28xx_vdev_init(struct em28xx *dev, |
1800 | const struct video_device *template, | 1864 | const struct video_device *template, |
1801 | const int type, | 1865 | const int type, |
1802 | const char *type_name) | 1866 | const char *type_name) |
1803 | { | 1867 | { |
1804 | struct video_device *vfd; | 1868 | struct video_device *vfd; |
1805 | 1869 | ||
@@ -2064,6 +2128,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
2064 | snprintf(dev->name, 29, "em28xx #%d", nr); | 2128 | snprintf(dev->name, 29, "em28xx #%d", nr); |
2065 | dev->devno = nr; | 2129 | dev->devno = nr; |
2066 | dev->model = id->driver_info; | 2130 | dev->model = id->driver_info; |
2131 | dev->alt = -1; | ||
2067 | 2132 | ||
2068 | /* Checks if audio is provided by some interface */ | 2133 | /* Checks if audio is provided by some interface */ |
2069 | for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { | 2134 | for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index f3bad0c1c517..04e0e48ecabe 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define UNSET -1 | 33 | #define UNSET -1 |
34 | 34 | ||
35 | /* maximum number of em28xx boards */ | 35 | /* maximum number of em28xx boards */ |
36 | #define EM28XX_MAXBOARDS 1 /*FIXME: should be bigger */ | 36 | #define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */ |
37 | 37 | ||
38 | /* maximum number of frames that can be queued */ | 38 | /* maximum number of frames that can be queued */ |
39 | #define EM28XX_NUM_FRAMES 5 | 39 | #define EM28XX_NUM_FRAMES 5 |
@@ -345,9 +345,6 @@ int em28xx_read_reg(struct em28xx *dev, u16 reg); | |||
345 | int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | 345 | int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, |
346 | int len); | 346 | int len); |
347 | int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); | 347 | int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); |
348 | int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, | ||
349 | u8 bitmask); | ||
350 | int em28xx_set_audio_source(struct em28xx *dev); | ||
351 | int em28xx_audio_analog_set(struct em28xx *dev); | 348 | int em28xx_audio_analog_set(struct em28xx *dev); |
352 | 349 | ||
353 | int em28xx_colorlevels_set_default(struct em28xx *dev); | 350 | int em28xx_colorlevels_set_default(struct em28xx *dev); |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 7d7f383b404f..262830da08c8 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -928,27 +928,38 @@ struct saa7134_board saa7134_boards[] = { | |||
928 | .tuner_addr = ADDR_UNSET, | 928 | .tuner_addr = ADDR_UNSET, |
929 | .radio_addr = ADDR_UNSET, | 929 | .radio_addr = ADDR_UNSET, |
930 | .tda9887_conf = TDA9887_PRESENT, | 930 | .tda9887_conf = TDA9887_PRESENT, |
931 | .gpiomask = 0x03, | ||
931 | .inputs = {{ | 932 | .inputs = {{ |
932 | .name = name_tv, | 933 | .name = name_tv, |
933 | .vmux = 1, | 934 | .vmux = 1, |
934 | .amux = TV, | 935 | .amux = TV, |
935 | .tv = 1, | 936 | .tv = 1, |
936 | },{ | 937 | .gpio = 0x00, |
938 | }, { | ||
937 | .name = name_comp1, | 939 | .name = name_comp1, |
938 | .vmux = 0, | ||
939 | .amux = LINE2, | ||
940 | },{ | ||
941 | .name = name_comp2, | ||
942 | .vmux = 3, | 940 | .vmux = 3, |
943 | .amux = LINE2, | 941 | .amux = LINE1, |
944 | },{ | 942 | .gpio = 0x02, |
943 | }, { | ||
944 | .name = name_comp2, | ||
945 | .vmux = 0, | ||
946 | .amux = LINE1, | ||
947 | .gpio = 0x02, | ||
948 | }, { | ||
945 | .name = name_svideo, | 949 | .name = name_svideo, |
946 | .vmux = 8, | 950 | .vmux = 8, |
947 | .amux = LINE2, | 951 | .amux = LINE1, |
948 | }}, | 952 | .gpio = 0x02, |
953 | } }, | ||
949 | .radio = { | 954 | .radio = { |
950 | .name = name_radio, | 955 | .name = name_radio, |
951 | .amux = LINE2, | 956 | .amux = LINE1, |
957 | .gpio = 0x01, | ||
958 | }, | ||
959 | .mute = { | ||
960 | .name = name_mute, | ||
961 | .amux = TV, | ||
962 | .gpio = 0x00, | ||
952 | }, | 963 | }, |
953 | }, | 964 | }, |
954 | [SAA7134_BOARD_BMK_MPEX_TUNER] = { | 965 | [SAA7134_BOARD_BMK_MPEX_TUNER] = { |
@@ -3912,6 +3923,74 @@ struct saa7134_board saa7134_boards[] = { | |||
3912 | }, | 3923 | }, |
3913 | .mpeg = SAA7134_MPEG_EMPRESS, | 3924 | .mpeg = SAA7134_MPEG_EMPRESS, |
3914 | }, | 3925 | }, |
3926 | [SAA7134_BOARD_TWINHAN_DTV_DVB_3056] = { | ||
3927 | .name = "Twinhan Hybrid DTV-DVB 3056 PCI", | ||
3928 | .audio_clock = 0x00187de7, | ||
3929 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
3930 | .radio_type = UNSET, | ||
3931 | .tuner_addr = ADDR_UNSET, | ||
3932 | .radio_addr = ADDR_UNSET, | ||
3933 | .tuner_config = 2, | ||
3934 | .mpeg = SAA7134_MPEG_DVB, | ||
3935 | .gpiomask = 0x0200000, | ||
3936 | .inputs = {{ | ||
3937 | .name = name_tv, | ||
3938 | .vmux = 1, | ||
3939 | .amux = TV, | ||
3940 | .tv = 1, | ||
3941 | }, { | ||
3942 | .name = name_comp1, | ||
3943 | .vmux = 3, | ||
3944 | .amux = LINE1, | ||
3945 | }, { | ||
3946 | .name = name_svideo, | ||
3947 | .vmux = 8, /* untested */ | ||
3948 | .amux = LINE1, | ||
3949 | } }, | ||
3950 | .radio = { | ||
3951 | .name = name_radio, | ||
3952 | .amux = TV, | ||
3953 | .gpio = 0x0200000, | ||
3954 | }, | ||
3955 | }, | ||
3956 | [SAA7134_BOARD_GENIUS_TVGO_A11MCE] = { | ||
3957 | /* Adrian Pardini <pardo.bsso@gmail.com> */ | ||
3958 | .name = "Genius TVGO AM11MCE", | ||
3959 | .audio_clock = 0x00200000, | ||
3960 | .tuner_type = TUNER_TNF_5335MF, | ||
3961 | .radio_type = UNSET, | ||
3962 | .tuner_addr = ADDR_UNSET, | ||
3963 | .radio_addr = ADDR_UNSET, | ||
3964 | .gpiomask = 0xf000, | ||
3965 | .inputs = {{ | ||
3966 | .name = name_tv_mono, | ||
3967 | .vmux = 1, | ||
3968 | .amux = LINE2, | ||
3969 | .gpio = 0x0000, | ||
3970 | .tv = 1, | ||
3971 | }, { | ||
3972 | .name = name_comp1, | ||
3973 | .vmux = 3, | ||
3974 | .amux = LINE1, | ||
3975 | .gpio = 0x2000, | ||
3976 | .tv = 1 | ||
3977 | }, { | ||
3978 | .name = name_svideo, | ||
3979 | .vmux = 8, | ||
3980 | .amux = LINE1, | ||
3981 | .gpio = 0x2000, | ||
3982 | } }, | ||
3983 | .radio = { | ||
3984 | .name = name_radio, | ||
3985 | .amux = LINE2, | ||
3986 | .gpio = 0x1000, | ||
3987 | }, | ||
3988 | .mute = { | ||
3989 | .name = name_mute, | ||
3990 | .amux = LINE2, | ||
3991 | .gpio = 0x6000, | ||
3992 | }, | ||
3993 | }, | ||
3915 | }; | 3994 | }; |
3916 | 3995 | ||
3917 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 3996 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
@@ -4511,6 +4590,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
4511 | },{ | 4590 | },{ |
4512 | .vendor = PCI_VENDOR_ID_PHILIPS, | 4591 | .vendor = PCI_VENDOR_ID_PHILIPS, |
4513 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 4592 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
4593 | .subvendor = 0x5168, | ||
4594 | .subdevice = 0x3307, /* FlyDVB-T Hybrid Mini PCI */ | ||
4595 | .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS, | ||
4596 | }, { | ||
4597 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
4598 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
4514 | .subvendor = 0x16be, | 4599 | .subvendor = 0x16be, |
4515 | .subdevice = 0x0007, | 4600 | .subdevice = 0x0007, |
4516 | .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, | 4601 | .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, |
@@ -4523,6 +4608,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
4523 | },{ | 4608 | },{ |
4524 | .vendor = PCI_VENDOR_ID_PHILIPS, | 4609 | .vendor = PCI_VENDOR_ID_PHILIPS, |
4525 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 4610 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
4611 | .subvendor = 0x16be, | ||
4612 | .subdevice = 0x000d, /* triple CTX948_V1.1.1 */ | ||
4613 | .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, | ||
4614 | }, { | ||
4615 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
4616 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
4526 | .subvendor = 0x1461, | 4617 | .subvendor = 0x1461, |
4527 | .subdevice = 0x2c05, | 4618 | .subdevice = 0x2c05, |
4528 | .driver_data = SAA7134_BOARD_AVERMEDIA_777, | 4619 | .driver_data = SAA7134_BOARD_AVERMEDIA_777, |
@@ -4843,7 +4934,13 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
4843 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 4934 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
4844 | .subvendor = 0x4e42, | 4935 | .subvendor = 0x4e42, |
4845 | .subdevice = 0x3502, | 4936 | .subdevice = 0x3502, |
4846 | .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS | 4937 | .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS, |
4938 | }, { | ||
4939 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
4940 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
4941 | .subvendor = 0x1822, /*Twinhan Technology Co. Ltd*/ | ||
4942 | .subdevice = 0x0022, | ||
4943 | .driver_data = SAA7134_BOARD_TWINHAN_DTV_DVB_3056, | ||
4847 | },{ | 4944 | },{ |
4848 | /* --- boards without eeprom + subsystem ID --- */ | 4945 | /* --- boards without eeprom + subsystem ID --- */ |
4849 | .vendor = PCI_VENDOR_ID_PHILIPS, | 4946 | .vendor = PCI_VENDOR_ID_PHILIPS, |
@@ -4995,6 +5092,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
4995 | case SAA7134_BOARD_BEHOLD_409: | 5092 | case SAA7134_BOARD_BEHOLD_409: |
4996 | case SAA7134_BOARD_BEHOLD_505FM: | 5093 | case SAA7134_BOARD_BEHOLD_505FM: |
4997 | case SAA7134_BOARD_BEHOLD_507_9FM: | 5094 | case SAA7134_BOARD_BEHOLD_507_9FM: |
5095 | case SAA7134_BOARD_GENIUS_TVGO_A11MCE: | ||
4998 | dev->has_remote = SAA7134_REMOTE_GPIO; | 5096 | dev->has_remote = SAA7134_REMOTE_GPIO; |
4999 | break; | 5097 | break; |
5000 | case SAA7134_BOARD_FLYDVBS_LR300: | 5098 | case SAA7134_BOARD_FLYDVBS_LR300: |
@@ -5232,7 +5330,8 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
5232 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: | 5330 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
5233 | case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: | 5331 | case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: |
5234 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: | 5332 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: |
5235 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: | 5333 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: |
5334 | case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: | ||
5236 | /* this is a hybrid board, initialize to analog mode | 5335 | /* this is a hybrid board, initialize to analog mode |
5237 | * and configure firmware eeprom address | 5336 | * and configure firmware eeprom address |
5238 | */ | 5337 | */ |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index a9ca5730826f..ea2be9eceeb8 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -779,6 +779,21 @@ static struct tda1004x_config avermedia_super_007_config = { | |||
779 | .request_firmware = philips_tda1004x_request_firmware | 779 | .request_firmware = philips_tda1004x_request_firmware |
780 | }; | 780 | }; |
781 | 781 | ||
782 | static struct tda1004x_config twinhan_dtv_dvb_3056_config = { | ||
783 | .demod_address = 0x08, | ||
784 | .invert = 1, | ||
785 | .invert_oclk = 0, | ||
786 | .xtal_freq = TDA10046_XTAL_16M, | ||
787 | .agc_config = TDA10046_AGC_TDA827X, | ||
788 | .gpio_config = TDA10046_GP01_I, | ||
789 | .if_freq = TDA10046_FREQ_045, | ||
790 | .i2c_gate = 0x42, | ||
791 | .tuner_address = 0x61, | ||
792 | .tuner_config = 2, | ||
793 | .antenna_switch = 1, | ||
794 | .request_firmware = philips_tda1004x_request_firmware | ||
795 | }; | ||
796 | |||
782 | /* ------------------------------------------------------------------ | 797 | /* ------------------------------------------------------------------ |
783 | * special case: this card uses saa713x GPIO22 for the mode switch | 798 | * special case: this card uses saa713x GPIO22 for the mode switch |
784 | */ | 799 | */ |
@@ -826,6 +841,7 @@ static struct tda1004x_config ads_tech_duo_config = { | |||
826 | static struct tda10086_config flydvbs = { | 841 | static struct tda10086_config flydvbs = { |
827 | .demod_address = 0x0e, | 842 | .demod_address = 0x0e, |
828 | .invert = 0, | 843 | .invert = 0, |
844 | .diseqc_tone = 0, | ||
829 | }; | 845 | }; |
830 | 846 | ||
831 | /* ================================================================== | 847 | /* ================================================================== |
@@ -940,9 +956,9 @@ static int dvb_init(struct saa7134_dev *dev) | |||
940 | configure_tda827x_fe(dev, &tda827x_lifeview_config); | 956 | configure_tda827x_fe(dev, &tda827x_lifeview_config); |
941 | break; | 957 | break; |
942 | case SAA7134_BOARD_FLYDVB_TRIO: | 958 | case SAA7134_BOARD_FLYDVB_TRIO: |
943 | if(! use_frontend) { //terrestrial | 959 | if(! use_frontend) { /* terrestrial */ |
944 | configure_tda827x_fe(dev, &lifeview_trio_config); | 960 | configure_tda827x_fe(dev, &lifeview_trio_config); |
945 | } else { //satellite | 961 | } else { /* satellite */ |
946 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); | 962 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
947 | if (dev->dvb.frontend) { | 963 | if (dev->dvb.frontend) { |
948 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, | 964 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, |
@@ -1007,8 +1023,9 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1007 | } | 1023 | } |
1008 | break; | 1024 | break; |
1009 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: | 1025 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
1010 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, | 1026 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
1011 | &dev->i2c_adap); | 1027 | &medion_cardbus, |
1028 | &dev->i2c_adap); | ||
1012 | if (dev->dvb.frontend) { | 1029 | if (dev->dvb.frontend) { |
1013 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | 1030 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
1014 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | 1031 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
@@ -1044,6 +1061,9 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1044 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: | 1061 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: |
1045 | configure_tda827x_fe(dev, &avermedia_super_007_config); | 1062 | configure_tda827x_fe(dev, &avermedia_super_007_config); |
1046 | break; | 1063 | break; |
1064 | case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: | ||
1065 | configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config); | ||
1066 | break; | ||
1047 | default: | 1067 | default: |
1048 | wprintk("Huh? unknown DVB card?\n"); | 1068 | wprintk("Huh? unknown DVB card?\n"); |
1049 | break; | 1069 | break; |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index b1b01fa86720..3d2ec30de227 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -87,7 +87,7 @@ static int ts_open(struct inode *inode, struct file *file) | |||
87 | 87 | ||
88 | dprintk("open minor=%d\n",minor); | 88 | dprintk("open minor=%d\n",minor); |
89 | err = -EBUSY; | 89 | err = -EBUSY; |
90 | if (!mutex_trylock(&dev->empress_tsq.lock)) | 90 | if (!mutex_trylock(&dev->empress_tsq.vb_lock)) |
91 | goto done; | 91 | goto done; |
92 | if (dev->empress_users) | 92 | if (dev->empress_users) |
93 | goto done_up; | 93 | goto done_up; |
@@ -101,7 +101,7 @@ static int ts_open(struct inode *inode, struct file *file) | |||
101 | err = 0; | 101 | err = 0; |
102 | 102 | ||
103 | done_up: | 103 | done_up: |
104 | mutex_unlock(&dev->empress_tsq.lock); | 104 | mutex_unlock(&dev->empress_tsq.vb_lock); |
105 | done: | 105 | done: |
106 | return err; | 106 | return err; |
107 | } | 107 | } |
@@ -110,7 +110,6 @@ static int ts_release(struct inode *inode, struct file *file) | |||
110 | { | 110 | { |
111 | struct saa7134_dev *dev = file->private_data; | 111 | struct saa7134_dev *dev = file->private_data; |
112 | 112 | ||
113 | mutex_lock(&dev->empress_tsq.lock); | ||
114 | videobuf_stop(&dev->empress_tsq); | 113 | videobuf_stop(&dev->empress_tsq); |
115 | videobuf_mmap_free(&dev->empress_tsq); | 114 | videobuf_mmap_free(&dev->empress_tsq); |
116 | dev->empress_users--; | 115 | dev->empress_users--; |
@@ -122,7 +121,6 @@ static int ts_release(struct inode *inode, struct file *file) | |||
122 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, | 121 | saa_writeb(SAA7134_AUDIO_MUTE_CTRL, |
123 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); | 122 | saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); |
124 | 123 | ||
125 | mutex_unlock(&dev->empress_tsq.lock); | ||
126 | return 0; | 124 | return 0; |
127 | } | 125 | } |
128 | 126 | ||
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 0db955c2d9b9..b4188819782f 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -406,6 +406,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
406 | mask_keyup = 0x8000000; | 406 | mask_keyup = 0x8000000; |
407 | polling = 50; //ms | 407 | polling = 50; //ms |
408 | break; | 408 | break; |
409 | case SAA7134_BOARD_GENIUS_TVGO_A11MCE: | ||
410 | ir_codes = ir_codes_genius_tvgo_a11mce; | ||
411 | mask_keycode = 0xff; | ||
412 | mask_keydown = 0xf00000; | ||
413 | polling = 50; /* ms */ | ||
414 | break; | ||
409 | } | 415 | } |
410 | if (NULL == ir_codes) { | 416 | if (NULL == ir_codes) { |
411 | printk("%s: Oops: IR config error [card=%d]\n", | 417 | printk("%s: Oops: IR config error [card=%d]\n", |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 1184d359e848..39c41ad97d0e 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1414,21 +1414,17 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1414 | if (!list_empty(&fh->cap.stream)) | 1414 | if (!list_empty(&fh->cap.stream)) |
1415 | buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); | 1415 | buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); |
1416 | } else { | 1416 | } else { |
1417 | mutex_lock(&fh->cap.lock); | 1417 | mutex_lock(&fh->cap.vb_lock); |
1418 | if (UNSET == fh->cap.read_off) { | 1418 | if (UNSET == fh->cap.read_off) { |
1419 | /* need to capture a new frame */ | 1419 | /* need to capture a new frame */ |
1420 | if (res_locked(fh->dev,RESOURCE_VIDEO)) { | 1420 | if (res_locked(fh->dev,RESOURCE_VIDEO)) |
1421 | mutex_unlock(&fh->cap.lock); | 1421 | goto err; |
1422 | return POLLERR; | 1422 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) |
1423 | } | 1423 | goto err; |
1424 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) { | ||
1425 | mutex_unlock(&fh->cap.lock); | ||
1426 | return POLLERR; | ||
1427 | } | ||
1428 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); | 1424 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); |
1429 | fh->cap.read_off = 0; | 1425 | fh->cap.read_off = 0; |
1430 | } | 1426 | } |
1431 | mutex_unlock(&fh->cap.lock); | 1427 | mutex_unlock(&fh->cap.vb_lock); |
1432 | buf = fh->cap.read_buf; | 1428 | buf = fh->cap.read_buf; |
1433 | } | 1429 | } |
1434 | 1430 | ||
@@ -1440,6 +1436,10 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1440 | buf->state == VIDEOBUF_ERROR) | 1436 | buf->state == VIDEOBUF_ERROR) |
1441 | return POLLIN|POLLRDNORM; | 1437 | return POLLIN|POLLRDNORM; |
1442 | return 0; | 1438 | return 0; |
1439 | |||
1440 | err: | ||
1441 | mutex_unlock(&fh->cap.vb_lock); | ||
1442 | return POLLERR; | ||
1443 | } | 1443 | } |
1444 | 1444 | ||
1445 | static int video_release(struct inode *inode, struct file *file) | 1445 | static int video_release(struct inode *inode, struct file *file) |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index b88ca995fafb..f940d0254798 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -252,6 +252,8 @@ struct saa7134_format { | |||
252 | #define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128 | 252 | #define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128 |
253 | #define SAA7134_BOARD_BEHOLD_607_9FM 129 | 253 | #define SAA7134_BOARD_BEHOLD_607_9FM 129 |
254 | #define SAA7134_BOARD_BEHOLD_M6 130 | 254 | #define SAA7134_BOARD_BEHOLD_M6 130 |
255 | #define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131 | ||
256 | #define SAA7134_BOARD_GENIUS_TVGO_A11MCE 132 | ||
255 | 257 | ||
256 | #define SAA7134_MAXBOARDS 8 | 258 | #define SAA7134_MAXBOARDS 8 |
257 | #define SAA7134_INPUT_MAX 8 | 259 | #define SAA7134_INPUT_MAX 8 |
diff --git a/drivers/media/video/stk-sensor.c b/drivers/media/video/stk-sensor.c index 4a9a0b62efa3..e546b014d7ad 100644 --- a/drivers/media/video/stk-sensor.c +++ b/drivers/media/video/stk-sensor.c | |||
@@ -225,7 +225,7 @@ | |||
225 | 225 | ||
226 | 226 | ||
227 | /* Returns 0 if OK */ | 227 | /* Returns 0 if OK */ |
228 | int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val) | 228 | static int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val) |
229 | { | 229 | { |
230 | int i = 0; | 230 | int i = 0; |
231 | int tmpval = 0; | 231 | int tmpval = 0; |
@@ -250,7 +250,7 @@ int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val) | |||
250 | return 0; | 250 | return 0; |
251 | } | 251 | } |
252 | 252 | ||
253 | int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val) | 253 | static int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val) |
254 | { | 254 | { |
255 | int i = 0; | 255 | int i = 0; |
256 | int tmpval = 0; | 256 | int tmpval = 0; |
@@ -380,7 +380,7 @@ int stk_sensor_init(struct stk_camera *dev) | |||
380 | STK_ERROR("Strange error reading sensor ID\n"); | 380 | STK_ERROR("Strange error reading sensor ID\n"); |
381 | return -ENODEV; | 381 | return -ENODEV; |
382 | } | 382 | } |
383 | if (idh != 0x7F || idl != 0xA2) { | 383 | if (idh != 0x7f || idl != 0xa2) { |
384 | STK_ERROR("Huh? you don't have a sensor from ovt\n"); | 384 | STK_ERROR("Huh? you don't have a sensor from ovt\n"); |
385 | return -ENODEV; | 385 | return -ENODEV; |
386 | } | 386 | } |
@@ -409,6 +409,19 @@ static struct regval ov_fmt_uyvy[] = { | |||
409 | {REG_COM15, COM15_R00FF }, | 409 | {REG_COM15, COM15_R00FF }, |
410 | {0xff, 0xff}, /* END MARKER */ | 410 | {0xff, 0xff}, /* END MARKER */ |
411 | }; | 411 | }; |
412 | /* V4L2_PIX_FMT_YUYV */ | ||
413 | static struct regval ov_fmt_yuyv[] = { | ||
414 | {REG_TSLB, 0 }, | ||
415 | { 0x4f, 0x80 }, /* "matrix coefficient 1" */ | ||
416 | { 0x50, 0x80 }, /* "matrix coefficient 2" */ | ||
417 | { 0x51, 0 }, /* vb */ | ||
418 | { 0x52, 0x22 }, /* "matrix coefficient 4" */ | ||
419 | { 0x53, 0x5e }, /* "matrix coefficient 5" */ | ||
420 | { 0x54, 0x80 }, /* "matrix coefficient 6" */ | ||
421 | {REG_COM13, COM13_UVSAT|COM13_CMATRIX}, | ||
422 | {REG_COM15, COM15_R00FF }, | ||
423 | {0xff, 0xff}, /* END MARKER */ | ||
424 | }; | ||
412 | 425 | ||
413 | /* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */ | 426 | /* V4L2_PIX_FMT_RGB565X rrrrrggg gggbbbbb */ |
414 | static struct regval ov_fmt_rgbr[] = { | 427 | static struct regval ov_fmt_rgbr[] = { |
@@ -519,6 +532,10 @@ int stk_sensor_configure(struct stk_camera *dev) | |||
519 | com7 |= COM7_YUV; | 532 | com7 |= COM7_YUV; |
520 | rv = ov_fmt_uyvy; | 533 | rv = ov_fmt_uyvy; |
521 | break; | 534 | break; |
535 | case V4L2_PIX_FMT_YUYV: | ||
536 | com7 |= COM7_YUV; | ||
537 | rv = ov_fmt_yuyv; | ||
538 | break; | ||
522 | case V4L2_PIX_FMT_RGB565: | 539 | case V4L2_PIX_FMT_RGB565: |
523 | com7 |= COM7_RGB; | 540 | com7 |= COM7_RGB; |
524 | rv = ov_fmt_rgbp; | 541 | rv = ov_fmt_rgbp; |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index d37e5e2594b4..ceba45ad0294 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -63,7 +63,7 @@ static struct usb_device_id stkwebcam_table[] = { | |||
63 | }; | 63 | }; |
64 | MODULE_DEVICE_TABLE(usb, stkwebcam_table); | 64 | MODULE_DEVICE_TABLE(usb, stkwebcam_table); |
65 | 65 | ||
66 | void stk_camera_cleanup(struct kref *kref) | 66 | static void stk_camera_cleanup(struct kref *kref) |
67 | { | 67 | { |
68 | struct stk_camera *dev = to_stk_camera(kref); | 68 | struct stk_camera *dev = to_stk_camera(kref); |
69 | 69 | ||
@@ -682,6 +682,7 @@ static int v4l_stk_open(struct inode *inode, struct file *fp) | |||
682 | return -ENXIO; | 682 | return -ENXIO; |
683 | fp->private_data = vdev; | 683 | fp->private_data = vdev; |
684 | kref_get(&dev->kref); | 684 | kref_get(&dev->kref); |
685 | usb_autopm_get_interface(dev->interface); | ||
685 | 686 | ||
686 | return 0; | 687 | return 0; |
687 | } | 688 | } |
@@ -703,6 +704,7 @@ static int v4l_stk_release(struct inode *inode, struct file *fp) | |||
703 | } | 704 | } |
704 | 705 | ||
705 | if (dev->owner != fp) { | 706 | if (dev->owner != fp) { |
707 | usb_autopm_put_interface(dev->interface); | ||
706 | kref_put(&dev->kref, stk_camera_cleanup); | 708 | kref_put(&dev->kref, stk_camera_cleanup); |
707 | return 0; | 709 | return 0; |
708 | } | 710 | } |
@@ -713,6 +715,7 @@ static int v4l_stk_release(struct inode *inode, struct file *fp) | |||
713 | 715 | ||
714 | dev->owner = NULL; | 716 | dev->owner = NULL; |
715 | 717 | ||
718 | usb_autopm_put_interface(dev->interface); | ||
716 | kref_put(&dev->kref, stk_camera_cleanup); | 719 | kref_put(&dev->kref, stk_camera_cleanup); |
717 | 720 | ||
718 | return 0; | 721 | return 0; |
@@ -993,6 +996,10 @@ static int stk_vidioc_enum_fmt_cap(struct file *filp, | |||
993 | fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8; | 996 | fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8; |
994 | strcpy(fmtd->description, "Raw bayer"); | 997 | strcpy(fmtd->description, "Raw bayer"); |
995 | break; | 998 | break; |
999 | case 4: | ||
1000 | fmtd->pixelformat = V4L2_PIX_FMT_YUYV; | ||
1001 | strcpy(fmtd->description, "yuv4:2:2"); | ||
1002 | break; | ||
996 | default: | 1003 | default: |
997 | return -EINVAL; | 1004 | return -EINVAL; |
998 | } | 1005 | } |
@@ -1048,6 +1055,7 @@ static int stk_vidioc_try_fmt_cap(struct file *filp, | |||
1048 | case V4L2_PIX_FMT_RGB565: | 1055 | case V4L2_PIX_FMT_RGB565: |
1049 | case V4L2_PIX_FMT_RGB565X: | 1056 | case V4L2_PIX_FMT_RGB565X: |
1050 | case V4L2_PIX_FMT_UYVY: | 1057 | case V4L2_PIX_FMT_UYVY: |
1058 | case V4L2_PIX_FMT_YUYV: | ||
1051 | case V4L2_PIX_FMT_SBGGR8: | 1059 | case V4L2_PIX_FMT_SBGGR8: |
1052 | break; | 1060 | break; |
1053 | default: | 1061 | default: |
@@ -1080,6 +1088,42 @@ static int stk_vidioc_try_fmt_cap(struct file *filp, | |||
1080 | return 0; | 1088 | return 0; |
1081 | } | 1089 | } |
1082 | 1090 | ||
1091 | static int stk_setup_format(struct stk_camera *dev) | ||
1092 | { | ||
1093 | int i = 0; | ||
1094 | int depth; | ||
1095 | if (dev->vsettings.palette == V4L2_PIX_FMT_SBGGR8) | ||
1096 | depth = 1; | ||
1097 | else | ||
1098 | depth = 2; | ||
1099 | while (stk_sizes[i].m != dev->vsettings.mode | ||
1100 | && i < ARRAY_SIZE(stk_sizes)) | ||
1101 | i++; | ||
1102 | if (i == ARRAY_SIZE(stk_sizes)) { | ||
1103 | STK_ERROR("Something is broken in %s\n", __FUNCTION__); | ||
1104 | return -EFAULT; | ||
1105 | } | ||
1106 | /* This registers controls some timings, not sure of what. */ | ||
1107 | stk_camera_write_reg(dev, 0x001b, 0x0e); | ||
1108 | if (dev->vsettings.mode == MODE_SXGA) | ||
1109 | stk_camera_write_reg(dev, 0x001c, 0x0e); | ||
1110 | else | ||
1111 | stk_camera_write_reg(dev, 0x001c, 0x46); | ||
1112 | /* | ||
1113 | * Registers 0x0115 0x0114 are the size of each line (bytes), | ||
1114 | * regs 0x0117 0x0116 are the heigth of the image. | ||
1115 | */ | ||
1116 | stk_camera_write_reg(dev, 0x0115, | ||
1117 | ((stk_sizes[i].w * depth) >> 8) & 0xff); | ||
1118 | stk_camera_write_reg(dev, 0x0114, | ||
1119 | (stk_sizes[i].w * depth) & 0xff); | ||
1120 | stk_camera_write_reg(dev, 0x0117, | ||
1121 | (stk_sizes[i].h >> 8) & 0xff); | ||
1122 | stk_camera_write_reg(dev, 0x0116, | ||
1123 | stk_sizes[i].h & 0xff); | ||
1124 | return stk_sensor_configure(dev); | ||
1125 | } | ||
1126 | |||
1083 | static int stk_vidioc_s_fmt_cap(struct file *filp, | 1127 | static int stk_vidioc_s_fmt_cap(struct file *filp, |
1084 | void *priv, struct v4l2_format *fmtd) | 1128 | void *priv, struct v4l2_format *fmtd) |
1085 | { | 1129 | { |
@@ -1094,10 +1138,10 @@ static int stk_vidioc_s_fmt_cap(struct file *filp, | |||
1094 | return -EBUSY; | 1138 | return -EBUSY; |
1095 | if (dev->owner && dev->owner != filp) | 1139 | if (dev->owner && dev->owner != filp) |
1096 | return -EBUSY; | 1140 | return -EBUSY; |
1097 | dev->owner = filp; | ||
1098 | ret = stk_vidioc_try_fmt_cap(filp, priv, fmtd); | 1141 | ret = stk_vidioc_try_fmt_cap(filp, priv, fmtd); |
1099 | if (ret) | 1142 | if (ret) |
1100 | return ret; | 1143 | return ret; |
1144 | dev->owner = filp; | ||
1101 | 1145 | ||
1102 | dev->vsettings.palette = fmtd->fmt.pix.pixelformat; | 1146 | dev->vsettings.palette = fmtd->fmt.pix.pixelformat; |
1103 | stk_free_buffers(dev); | 1147 | stk_free_buffers(dev); |
@@ -1105,25 +1149,7 @@ static int stk_vidioc_s_fmt_cap(struct file *filp, | |||
1105 | dev->vsettings.mode = stk_sizes[fmtd->fmt.pix.priv].m; | 1149 | dev->vsettings.mode = stk_sizes[fmtd->fmt.pix.priv].m; |
1106 | 1150 | ||
1107 | stk_initialise(dev); | 1151 | stk_initialise(dev); |
1108 | /* This registers controls some timings, not sure of what. */ | 1152 | return stk_setup_format(dev); |
1109 | stk_camera_write_reg(dev, 0x001b, 0x0e); | ||
1110 | if (dev->vsettings.mode == MODE_SXGA) | ||
1111 | stk_camera_write_reg(dev, 0x001c, 0x0e); | ||
1112 | else | ||
1113 | stk_camera_write_reg(dev, 0x001c, 0x46); | ||
1114 | /* | ||
1115 | * Registers 0x0115 0x0114 are the size of each line (bytes), | ||
1116 | * regs 0x0117 0x0116 are the heigth of the image. | ||
1117 | */ | ||
1118 | stk_camera_write_reg(dev, 0x0115, | ||
1119 | (fmtd->fmt.pix.bytesperline >> 8) & 0xff); | ||
1120 | stk_camera_write_reg(dev, 0x0114, | ||
1121 | fmtd->fmt.pix.bytesperline & 0xff); | ||
1122 | stk_camera_write_reg(dev, 0x0117, | ||
1123 | (fmtd->fmt.pix.height >> 8) & 0xff); | ||
1124 | stk_camera_write_reg(dev, 0x0116, | ||
1125 | fmtd->fmt.pix.height & 0xff); | ||
1126 | return stk_sensor_configure(dev); | ||
1127 | } | 1153 | } |
1128 | 1154 | ||
1129 | static int stk_vidioc_reqbufs(struct file *filp, | 1155 | static int stk_vidioc_reqbufs(struct file *filp, |
@@ -1288,6 +1314,9 @@ static struct file_operations v4l_stk_fops = { | |||
1288 | .poll = v4l_stk_poll, | 1314 | .poll = v4l_stk_poll, |
1289 | .mmap = v4l_stk_mmap, | 1315 | .mmap = v4l_stk_mmap, |
1290 | .ioctl = video_ioctl2, | 1316 | .ioctl = video_ioctl2, |
1317 | #ifdef CONFIG_COMPAT | ||
1318 | .compat_ioctl = v4l_compat_ioctl32, | ||
1319 | #endif | ||
1291 | .llseek = no_llseek | 1320 | .llseek = no_llseek |
1292 | }; | 1321 | }; |
1293 | 1322 | ||
@@ -1403,7 +1432,7 @@ static int stk_camera_probe(struct usb_interface *interface, | |||
1403 | dev->vsettings.brightness = 0x7fff; | 1432 | dev->vsettings.brightness = 0x7fff; |
1404 | dev->vsettings.palette = V4L2_PIX_FMT_RGB565; | 1433 | dev->vsettings.palette = V4L2_PIX_FMT_RGB565; |
1405 | dev->vsettings.mode = MODE_VGA; | 1434 | dev->vsettings.mode = MODE_VGA; |
1406 | dev->frame_size = 640*480*2; | 1435 | dev->frame_size = 640 * 480 * 2; |
1407 | 1436 | ||
1408 | INIT_LIST_HEAD(&dev->sio_avail); | 1437 | INIT_LIST_HEAD(&dev->sio_avail); |
1409 | INIT_LIST_HEAD(&dev->sio_full); | 1438 | INIT_LIST_HEAD(&dev->sio_full); |
@@ -1417,6 +1446,7 @@ static int stk_camera_probe(struct usb_interface *interface, | |||
1417 | } | 1446 | } |
1418 | 1447 | ||
1419 | stk_create_sysfs_files(&dev->vdev); | 1448 | stk_create_sysfs_files(&dev->vdev); |
1449 | usb_autopm_enable(dev->interface); | ||
1420 | 1450 | ||
1421 | return 0; | 1451 | return 0; |
1422 | } | 1452 | } |
@@ -1434,11 +1464,41 @@ static void stk_camera_disconnect(struct usb_interface *interface) | |||
1434 | kref_put(&dev->kref, stk_camera_cleanup); | 1464 | kref_put(&dev->kref, stk_camera_cleanup); |
1435 | } | 1465 | } |
1436 | 1466 | ||
1467 | #ifdef CONFIG_PM | ||
1468 | int stk_camera_suspend(struct usb_interface *intf, pm_message_t message) | ||
1469 | { | ||
1470 | struct stk_camera *dev = usb_get_intfdata(intf); | ||
1471 | if (is_streaming(dev)) { | ||
1472 | stk_stop_stream(dev); | ||
1473 | /* yes, this is ugly */ | ||
1474 | set_streaming(dev); | ||
1475 | } | ||
1476 | return 0; | ||
1477 | } | ||
1478 | |||
1479 | int stk_camera_resume(struct usb_interface *intf) | ||
1480 | { | ||
1481 | struct stk_camera *dev = usb_get_intfdata(intf); | ||
1482 | if (!is_initialised(dev)) | ||
1483 | return 0; | ||
1484 | unset_initialised(dev); | ||
1485 | stk_initialise(dev); | ||
1486 | stk_setup_format(dev); | ||
1487 | if (is_streaming(dev)) | ||
1488 | stk_start_stream(dev); | ||
1489 | return 0; | ||
1490 | } | ||
1491 | #endif | ||
1492 | |||
1437 | static struct usb_driver stk_camera_driver = { | 1493 | static struct usb_driver stk_camera_driver = { |
1438 | .name = "stkwebcam", | 1494 | .name = "stkwebcam", |
1439 | .probe = stk_camera_probe, | 1495 | .probe = stk_camera_probe, |
1440 | .disconnect = stk_camera_disconnect, | 1496 | .disconnect = stk_camera_disconnect, |
1441 | .id_table = stkwebcam_table, | 1497 | .id_table = stkwebcam_table, |
1498 | #ifdef CONFIG_PM | ||
1499 | .suspend = stk_camera_suspend, | ||
1500 | .resume = stk_camera_resume, | ||
1501 | #endif | ||
1442 | }; | 1502 | }; |
1443 | 1503 | ||
1444 | 1504 | ||
diff --git a/drivers/media/video/stk-webcam.h b/drivers/media/video/stk-webcam.h index 7e989d1ac1e0..df4dfefc5327 100644 --- a/drivers/media/video/stk-webcam.h +++ b/drivers/media/video/stk-webcam.h | |||
@@ -79,6 +79,7 @@ enum stk_status { | |||
79 | #define unset_present(dev) ((dev)->status &= \ | 79 | #define unset_present(dev) ((dev)->status &= \ |
80 | ~(S_PRESENT|S_INITIALISED|S_STREAMING)) | 80 | ~(S_PRESENT|S_INITIALISED|S_STREAMING)) |
81 | #define set_initialised(dev) ((dev)->status |= S_INITIALISED) | 81 | #define set_initialised(dev) ((dev)->status |= S_INITIALISED) |
82 | #define unset_initialised(dev) ((dev)->status &= ~S_INITIALISED) | ||
82 | #define set_memallocd(dev) ((dev)->status |= S_MEMALLOCD) | 83 | #define set_memallocd(dev) ((dev)->status |= S_MEMALLOCD) |
83 | #define unset_memallocd(dev) ((dev)->status &= ~S_MEMALLOCD) | 84 | #define unset_memallocd(dev) ((dev)->status &= ~S_MEMALLOCD) |
84 | #define set_streaming(dev) ((dev)->status |= S_STREAMING) | 85 | #define set_streaming(dev) ((dev)->status |= S_STREAMING) |
@@ -127,8 +128,6 @@ void stk_camera_delete(struct kref *); | |||
127 | int stk_camera_write_reg(struct stk_camera *, u16, u8); | 128 | int stk_camera_write_reg(struct stk_camera *, u16, u8); |
128 | int stk_camera_read_reg(struct stk_camera *, u16, int *); | 129 | int stk_camera_read_reg(struct stk_camera *, u16, int *); |
129 | 130 | ||
130 | int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val); | ||
131 | int stk_sensor_inb(struct stk_camera *dev, u8 reg, u8 *val); | ||
132 | int stk_sensor_init(struct stk_camera *); | 131 | int stk_sensor_init(struct stk_camera *); |
133 | int stk_sensor_configure(struct stk_camera *); | 132 | int stk_sensor_configure(struct stk_camera *); |
134 | int stk_sensor_sleep(struct stk_camera *dev); | 133 | int stk_sensor_sleep(struct stk_camera *dev); |
diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c index 41cd6a0b0485..fb895f6684a3 100644 --- a/drivers/media/video/tcm825x.c +++ b/drivers/media/video/tcm825x.c | |||
@@ -851,7 +851,7 @@ static int tcm825x_probe(struct i2c_client *client) | |||
851 | sensor->platform_data = client->dev.platform_data; | 851 | sensor->platform_data = client->dev.platform_data; |
852 | 852 | ||
853 | if (sensor->platform_data == NULL | 853 | if (sensor->platform_data == NULL |
854 | && !sensor->platform_data->is_okay()) | 854 | || !sensor->platform_data->is_okay()) |
855 | return -ENODEV; | 855 | return -ENODEV; |
856 | 856 | ||
857 | sensor->v4l2_int_device = &tcm825x_int_device; | 857 | sensor->v4l2_int_device = &tcm825x_int_device; |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index ba538f6fbcc3..78a09a2a4857 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1038,7 +1038,7 @@ static int tuner_resume(struct i2c_client *c) | |||
1038 | 1038 | ||
1039 | /* ---------------------------------------------------------------------- */ | 1039 | /* ---------------------------------------------------------------------- */ |
1040 | 1040 | ||
1041 | LIST_HEAD(tuner_list); | 1041 | static LIST_HEAD(tuner_list); |
1042 | 1042 | ||
1043 | /* Search for existing radio and/or TV tuners on the given I2C adapter. | 1043 | /* Search for existing radio and/or TV tuners on the given I2C adapter. |
1044 | Note that when this function is called from tuner_probe you can be | 1044 | Note that when this function is called from tuner_probe you can be |
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index f191f6a48070..50cf876f020f 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c | |||
@@ -754,6 +754,9 @@ skip_std_specific: | |||
754 | goto check_device; | 754 | goto check_device; |
755 | } | 755 | } |
756 | 756 | ||
757 | if (new_fw.type & FM) | ||
758 | goto check_device; | ||
759 | |||
757 | /* Load SCODE firmware, if exists */ | 760 | /* Load SCODE firmware, if exists */ |
758 | tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr); | 761 | tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr); |
759 | 762 | ||
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index a75560540e79..01ebcec040c4 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -1571,14 +1571,14 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip, | |||
1571 | ctrl->value=chip->muted; | 1571 | ctrl->value=chip->muted; |
1572 | return 0; | 1572 | return 0; |
1573 | case V4L2_CID_AUDIO_VOLUME: | 1573 | case V4L2_CID_AUDIO_VOLUME: |
1574 | if (!desc->flags & CHIP_HAS_VOLUME) | 1574 | if (!(desc->flags & CHIP_HAS_VOLUME)) |
1575 | break; | 1575 | break; |
1576 | ctrl->value = max(chip->left,chip->right); | 1576 | ctrl->value = max(chip->left,chip->right); |
1577 | return 0; | 1577 | return 0; |
1578 | case V4L2_CID_AUDIO_BALANCE: | 1578 | case V4L2_CID_AUDIO_BALANCE: |
1579 | { | 1579 | { |
1580 | int volume; | 1580 | int volume; |
1581 | if (!desc->flags & CHIP_HAS_VOLUME) | 1581 | if (!(desc->flags & CHIP_HAS_VOLUME)) |
1582 | break; | 1582 | break; |
1583 | volume = max(chip->left,chip->right); | 1583 | volume = max(chip->left,chip->right); |
1584 | if (volume) | 1584 | if (volume) |
@@ -1621,7 +1621,7 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip, | |||
1621 | { | 1621 | { |
1622 | int volume,balance; | 1622 | int volume,balance; |
1623 | 1623 | ||
1624 | if (!desc->flags & CHIP_HAS_VOLUME) | 1624 | if (!(desc->flags & CHIP_HAS_VOLUME)) |
1625 | break; | 1625 | break; |
1626 | 1626 | ||
1627 | volume = max(chip->left,chip->right); | 1627 | volume = max(chip->left,chip->right); |
@@ -1642,7 +1642,7 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip, | |||
1642 | case V4L2_CID_AUDIO_BALANCE: | 1642 | case V4L2_CID_AUDIO_BALANCE: |
1643 | { | 1643 | { |
1644 | int volume, balance; | 1644 | int volume, balance; |
1645 | if (!desc->flags & CHIP_HAS_VOLUME) | 1645 | if (!(desc->flags & CHIP_HAS_VOLUME)) |
1646 | break; | 1646 | break; |
1647 | 1647 | ||
1648 | volume = max(chip->left,chip->right); | 1648 | volume = max(chip->left,chip->right); |
@@ -1702,7 +1702,7 @@ static int chip_command(struct i2c_client *client, | |||
1702 | break; | 1702 | break; |
1703 | case V4L2_CID_AUDIO_VOLUME: | 1703 | case V4L2_CID_AUDIO_VOLUME: |
1704 | case V4L2_CID_AUDIO_BALANCE: | 1704 | case V4L2_CID_AUDIO_BALANCE: |
1705 | if (!desc->flags & CHIP_HAS_VOLUME) | 1705 | if (!(desc->flags & CHIP_HAS_VOLUME)) |
1706 | return -EINVAL; | 1706 | return -EINVAL; |
1707 | break; | 1707 | break; |
1708 | case V4L2_CID_AUDIO_BASS: | 1708 | case V4L2_CID_AUDIO_BASS: |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 0b8fbad3c721..dc0da44a5af6 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -242,7 +242,7 @@ hauppauge_tuner[] = | |||
242 | { TUNER_ABSENT, "TCL M2523_3DBH_E"}, | 242 | { TUNER_ABSENT, "TCL M2523_3DBH_E"}, |
243 | { TUNER_ABSENT, "TCL M2523_3DIH_E"}, | 243 | { TUNER_ABSENT, "TCL M2523_3DIH_E"}, |
244 | { TUNER_ABSENT, "TCL MFPE05_2_U"}, | 244 | { TUNER_ABSENT, "TCL MFPE05_2_U"}, |
245 | { TUNER_ABSENT, "Philips FMD1216MEX"}, | 245 | { TUNER_PHILIPS_FMD1216ME_MK3, "Philips FMD1216MEX"}, |
246 | { TUNER_ABSENT, "Philips FRH2036B"}, | 246 | { TUNER_ABSENT, "Philips FRH2036B"}, |
247 | { TUNER_ABSENT, "Panasonic ENGF75_01GF"}, | 247 | { TUNER_ABSENT, "Panasonic ENGF75_01GF"}, |
248 | { TUNER_ABSENT, "MaxLinear MXL5005"}, | 248 | { TUNER_ABSENT, "MaxLinear MXL5005"}, |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index c056ff6d810c..34deb68ae568 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #include <asm/pgtable.h> | 56 | #include <asm/pgtable.h> |
57 | #include <asm/io.h> | 57 | #include <asm/io.h> |
58 | #include <asm/div64.h> | 58 | #include <asm/div64.h> |
59 | #include <linux/video_decoder.h> | ||
60 | #define __OLD_VIDIOC_ /* To allow fixing old calls*/ | 59 | #define __OLD_VIDIOC_ /* To allow fixing old calls*/ |
61 | #include <media/v4l2-common.h> | 60 | #include <media/v4l2-common.h> |
62 | #include <media/v4l2-chip-ident.h> | 61 | #include <media/v4l2-chip-ident.h> |
@@ -82,108 +81,6 @@ MODULE_LICENSE("GPL"); | |||
82 | */ | 81 | */ |
83 | 82 | ||
84 | 83 | ||
85 | char *v4l2_norm_to_name(v4l2_std_id id) | ||
86 | { | ||
87 | char *name; | ||
88 | u32 myid = id; | ||
89 | |||
90 | /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle | ||
91 | 64 bit comparations. So, on that architecture, with some gcc variants, | ||
92 | compilation fails. Currently, the max value is 30bit wide. | ||
93 | */ | ||
94 | BUG_ON(myid != id); | ||
95 | |||
96 | switch (myid) { | ||
97 | case V4L2_STD_PAL: | ||
98 | name="PAL"; break; | ||
99 | case V4L2_STD_PAL_BG: | ||
100 | name="PAL-BG"; break; | ||
101 | case V4L2_STD_PAL_DK: | ||
102 | name="PAL-DK"; break; | ||
103 | case V4L2_STD_PAL_B: | ||
104 | name="PAL-B"; break; | ||
105 | case V4L2_STD_PAL_B1: | ||
106 | name="PAL-B1"; break; | ||
107 | case V4L2_STD_PAL_G: | ||
108 | name="PAL-G"; break; | ||
109 | case V4L2_STD_PAL_H: | ||
110 | name="PAL-H"; break; | ||
111 | case V4L2_STD_PAL_I: | ||
112 | name="PAL-I"; break; | ||
113 | case V4L2_STD_PAL_D: | ||
114 | name="PAL-D"; break; | ||
115 | case V4L2_STD_PAL_D1: | ||
116 | name="PAL-D1"; break; | ||
117 | case V4L2_STD_PAL_K: | ||
118 | name="PAL-K"; break; | ||
119 | case V4L2_STD_PAL_M: | ||
120 | name="PAL-M"; break; | ||
121 | case V4L2_STD_PAL_N: | ||
122 | name="PAL-N"; break; | ||
123 | case V4L2_STD_PAL_Nc: | ||
124 | name="PAL-Nc"; break; | ||
125 | case V4L2_STD_PAL_60: | ||
126 | name="PAL-60"; break; | ||
127 | case V4L2_STD_NTSC: | ||
128 | name="NTSC"; break; | ||
129 | case V4L2_STD_NTSC_M: | ||
130 | name="NTSC-M"; break; | ||
131 | case V4L2_STD_NTSC_M_JP: | ||
132 | name="NTSC-M-JP"; break; | ||
133 | case V4L2_STD_NTSC_443: | ||
134 | name="NTSC-443"; break; | ||
135 | case V4L2_STD_NTSC_M_KR: | ||
136 | name="NTSC-M-KR"; break; | ||
137 | case V4L2_STD_SECAM: | ||
138 | name="SECAM"; break; | ||
139 | case V4L2_STD_SECAM_DK: | ||
140 | name="SECAM-DK"; break; | ||
141 | case V4L2_STD_SECAM_B: | ||
142 | name="SECAM-B"; break; | ||
143 | case V4L2_STD_SECAM_D: | ||
144 | name="SECAM-D"; break; | ||
145 | case V4L2_STD_SECAM_G: | ||
146 | name="SECAM-G"; break; | ||
147 | case V4L2_STD_SECAM_H: | ||
148 | name="SECAM-H"; break; | ||
149 | case V4L2_STD_SECAM_K: | ||
150 | name="SECAM-K"; break; | ||
151 | case V4L2_STD_SECAM_K1: | ||
152 | name="SECAM-K1"; break; | ||
153 | case V4L2_STD_SECAM_L: | ||
154 | name="SECAM-L"; break; | ||
155 | case V4L2_STD_SECAM_LC: | ||
156 | name="SECAM-LC"; break; | ||
157 | default: | ||
158 | name="Unknown"; break; | ||
159 | } | ||
160 | |||
161 | return name; | ||
162 | } | ||
163 | |||
164 | /* Fill in the fields of a v4l2_standard structure according to the | ||
165 | 'id' and 'transmission' parameters. Returns negative on error. */ | ||
166 | int v4l2_video_std_construct(struct v4l2_standard *vs, | ||
167 | int id, char *name) | ||
168 | { | ||
169 | u32 index = vs->index; | ||
170 | |||
171 | memset(vs, 0, sizeof(struct v4l2_standard)); | ||
172 | vs->index = index; | ||
173 | vs->id = id; | ||
174 | if (id & V4L2_STD_525_60) { | ||
175 | vs->frameperiod.numerator = 1001; | ||
176 | vs->frameperiod.denominator = 30000; | ||
177 | vs->framelines = 525; | ||
178 | } else { | ||
179 | vs->frameperiod.numerator = 1; | ||
180 | vs->frameperiod.denominator = 25; | ||
181 | vs->framelines = 625; | ||
182 | } | ||
183 | strlcpy(vs->name,name,sizeof(vs->name)); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | /* ----------------------------------------------------------------- */ | 84 | /* ----------------------------------------------------------------- */ |
188 | /* priority handling */ | 85 | /* priority handling */ |
189 | 86 | ||
@@ -196,6 +93,7 @@ int v4l2_prio_init(struct v4l2_prio_state *global) | |||
196 | memset(global,0,sizeof(*global)); | 93 | memset(global,0,sizeof(*global)); |
197 | return 0; | 94 | return 0; |
198 | } | 95 | } |
96 | EXPORT_SYMBOL(v4l2_prio_init); | ||
199 | 97 | ||
200 | int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, | 98 | int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, |
201 | enum v4l2_priority new) | 99 | enum v4l2_priority new) |
@@ -211,11 +109,13 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, | |||
211 | *local = new; | 109 | *local = new; |
212 | return 0; | 110 | return 0; |
213 | } | 111 | } |
112 | EXPORT_SYMBOL(v4l2_prio_change); | ||
214 | 113 | ||
215 | int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local) | 114 | int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local) |
216 | { | 115 | { |
217 | return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT); | 116 | return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT); |
218 | } | 117 | } |
118 | EXPORT_SYMBOL(v4l2_prio_open); | ||
219 | 119 | ||
220 | int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local) | 120 | int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local) |
221 | { | 121 | { |
@@ -223,6 +123,7 @@ int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local) | |||
223 | atomic_dec(&global->prios[*local]); | 123 | atomic_dec(&global->prios[*local]); |
224 | return 0; | 124 | return 0; |
225 | } | 125 | } |
126 | EXPORT_SYMBOL(v4l2_prio_close); | ||
226 | 127 | ||
227 | enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) | 128 | enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) |
228 | { | 129 | { |
@@ -234,6 +135,7 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global) | |||
234 | return V4L2_PRIORITY_BACKGROUND; | 135 | return V4L2_PRIORITY_BACKGROUND; |
235 | return V4L2_PRIORITY_UNSET; | 136 | return V4L2_PRIORITY_UNSET; |
236 | } | 137 | } |
138 | EXPORT_SYMBOL(v4l2_prio_max); | ||
237 | 139 | ||
238 | int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local) | 140 | int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local) |
239 | { | 141 | { |
@@ -241,225 +143,7 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local) | |||
241 | return -EBUSY; | 143 | return -EBUSY; |
242 | return 0; | 144 | return 0; |
243 | } | 145 | } |
244 | 146 | EXPORT_SYMBOL(v4l2_prio_check); | |
245 | |||
246 | /* ----------------------------------------------------------------- */ | ||
247 | /* some arrays for pretty-printing debug messages of enum types */ | ||
248 | |||
249 | char *v4l2_field_names[] = { | ||
250 | [V4L2_FIELD_ANY] = "any", | ||
251 | [V4L2_FIELD_NONE] = "none", | ||
252 | [V4L2_FIELD_TOP] = "top", | ||
253 | [V4L2_FIELD_BOTTOM] = "bottom", | ||
254 | [V4L2_FIELD_INTERLACED] = "interlaced", | ||
255 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | ||
256 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | ||
257 | [V4L2_FIELD_ALTERNATE] = "alternate", | ||
258 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
259 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
260 | }; | ||
261 | |||
262 | char *v4l2_type_names[] = { | ||
263 | [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", | ||
264 | [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", | ||
265 | [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", | ||
266 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | ||
267 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | ||
268 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", | ||
269 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", | ||
270 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
271 | }; | ||
272 | |||
273 | |||
274 | #define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown" | ||
275 | |||
276 | /* ------------------------------------------------------------------ */ | ||
277 | /* debug help functions */ | ||
278 | |||
279 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
280 | static const char *v4l1_ioctls[] = { | ||
281 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | ||
282 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | ||
283 | [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", | ||
284 | [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", | ||
285 | [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", | ||
286 | [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", | ||
287 | [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", | ||
288 | [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", | ||
289 | [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", | ||
290 | [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", | ||
291 | [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", | ||
292 | [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", | ||
293 | [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", | ||
294 | [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", | ||
295 | [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", | ||
296 | [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", | ||
297 | [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", | ||
298 | [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", | ||
299 | [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", | ||
300 | [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", | ||
301 | [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", | ||
302 | [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", | ||
303 | [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", | ||
304 | [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", | ||
305 | [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", | ||
306 | [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", | ||
307 | [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", | ||
308 | [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", | ||
309 | [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" | ||
310 | }; | ||
311 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
312 | #endif | ||
313 | |||
314 | static const char *v4l2_ioctls[] = { | ||
315 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | ||
316 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | ||
317 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | ||
318 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | ||
319 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | ||
320 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | ||
321 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | ||
322 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | ||
323 | [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF", | ||
324 | [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY", | ||
325 | [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF", | ||
326 | [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF", | ||
327 | [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON", | ||
328 | [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF", | ||
329 | [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM", | ||
330 | [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM", | ||
331 | [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD", | ||
332 | [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD", | ||
333 | [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD", | ||
334 | [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT", | ||
335 | [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL", | ||
336 | [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL", | ||
337 | [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER", | ||
338 | [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER", | ||
339 | [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO", | ||
340 | [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO", | ||
341 | [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL", | ||
342 | [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU", | ||
343 | [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT", | ||
344 | [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT", | ||
345 | [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT", | ||
346 | [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT", | ||
347 | [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT", | ||
348 | [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT", | ||
349 | [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT", | ||
350 | [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR", | ||
351 | [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR", | ||
352 | [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY", | ||
353 | [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY", | ||
354 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | ||
355 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | ||
356 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | ||
357 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | ||
358 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | ||
359 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | ||
360 | [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT", | ||
361 | [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO", | ||
362 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", | ||
363 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", | ||
364 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", | ||
365 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", | ||
366 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", | ||
367 | [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", | ||
368 | [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", | ||
369 | [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS", | ||
370 | #if 1 | ||
371 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", | ||
372 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", | ||
373 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX", | ||
374 | [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD", | ||
375 | [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD", | ||
376 | |||
377 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | ||
378 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | ||
379 | |||
380 | [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", | ||
381 | #endif | ||
382 | }; | ||
383 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | ||
384 | |||
385 | static const char *v4l2_int_ioctls[] = { | ||
386 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
387 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | ||
388 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | ||
389 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | ||
390 | [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT", | ||
391 | [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT", | ||
392 | [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT", | ||
393 | [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE", | ||
394 | [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO", | ||
395 | [_IOC_NR(DECODER_INIT)] = "DECODER_INIT", | ||
396 | [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS", | ||
397 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | ||
398 | #endif | ||
399 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | ||
400 | |||
401 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | ||
402 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | ||
403 | [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG", | ||
404 | |||
405 | [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", | ||
406 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", | ||
407 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", | ||
408 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", | ||
409 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", | ||
410 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", | ||
411 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", | ||
412 | [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", | ||
413 | [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", | ||
414 | [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING", | ||
415 | [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING", | ||
416 | [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING", | ||
417 | [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ", | ||
418 | [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT", | ||
419 | [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT", | ||
420 | [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT", | ||
421 | }; | ||
422 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) | ||
423 | |||
424 | |||
425 | /* Common ioctl debug function. This function can be used by | ||
426 | external ioctl messages as well as internal V4L ioctl */ | ||
427 | void v4l_printk_ioctl(unsigned int cmd) | ||
428 | { | ||
429 | char *dir; | ||
430 | |||
431 | switch (_IOC_DIR(cmd)) { | ||
432 | case _IOC_NONE: dir = "--"; break; | ||
433 | case _IOC_READ: dir = "r-"; break; | ||
434 | case _IOC_WRITE: dir = "-w"; break; | ||
435 | case _IOC_READ | _IOC_WRITE: dir = "rw"; break; | ||
436 | default: dir = "*ERR*"; break; | ||
437 | } | ||
438 | switch (_IOC_TYPE(cmd)) { | ||
439 | case 'd': | ||
440 | printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n", | ||
441 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | ||
442 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
443 | break; | ||
444 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
445 | case 'v': | ||
446 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | ||
447 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
448 | v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
449 | break; | ||
450 | #endif | ||
451 | case 'V': | ||
452 | printk("v4l2 ioctl %s, dir=%s (0x%08x)\n", | ||
453 | (_IOC_NR(cmd) < V4L2_IOCTLS) ? | ||
454 | v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
455 | break; | ||
456 | |||
457 | default: | ||
458 | printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n", | ||
459 | _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd); | ||
460 | } | ||
461 | } | ||
462 | |||
463 | 147 | ||
464 | /* ----------------------------------------------------------------- */ | 148 | /* ----------------------------------------------------------------- */ |
465 | 149 | ||
@@ -488,6 +172,7 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, | |||
488 | } | 172 | } |
489 | return 0; | 173 | return 0; |
490 | } | 174 | } |
175 | EXPORT_SYMBOL(v4l2_ctrl_check); | ||
491 | 176 | ||
492 | /* Returns NULL or a character pointer array containing the menu for | 177 | /* Returns NULL or a character pointer array containing the menu for |
493 | the given control ID. The pointer array ends with a NULL pointer. | 178 | the given control ID. The pointer array ends with a NULL pointer. |
@@ -648,6 +333,7 @@ const char **v4l2_ctrl_get_menu(u32 id) | |||
648 | return NULL; | 333 | return NULL; |
649 | } | 334 | } |
650 | } | 335 | } |
336 | EXPORT_SYMBOL(v4l2_ctrl_get_menu); | ||
651 | 337 | ||
652 | /* Fill in a struct v4l2_queryctrl */ | 338 | /* Fill in a struct v4l2_queryctrl */ |
653 | int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) | 339 | int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) |
@@ -770,6 +456,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
770 | snprintf(qctrl->name, sizeof(qctrl->name), name); | 456 | snprintf(qctrl->name, sizeof(qctrl->name), name); |
771 | return 0; | 457 | return 0; |
772 | } | 458 | } |
459 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); | ||
773 | 460 | ||
774 | /* Fill in a struct v4l2_queryctrl with standard values based on | 461 | /* Fill in a struct v4l2_queryctrl with standard values based on |
775 | the control ID. */ | 462 | the control ID. */ |
@@ -904,6 +591,7 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl) | |||
904 | return -EINVAL; | 591 | return -EINVAL; |
905 | } | 592 | } |
906 | } | 593 | } |
594 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); | ||
907 | 595 | ||
908 | /* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and | 596 | /* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and |
909 | the menu. The qctrl pointer may be NULL, in which case it is ignored. */ | 597 | the menu. The qctrl pointer may be NULL, in which case it is ignored. */ |
@@ -922,6 +610,7 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc | |||
922 | qmenu->reserved = 0; | 610 | qmenu->reserved = 0; |
923 | return 0; | 611 | return 0; |
924 | } | 612 | } |
613 | EXPORT_SYMBOL(v4l2_ctrl_query_menu); | ||
925 | 614 | ||
926 | /* ctrl_classes points to an array of u32 pointers, the last element is | 615 | /* ctrl_classes points to an array of u32 pointers, the last element is |
927 | a NULL pointer. Each u32 array is a 0-terminated array of control IDs. | 616 | a NULL pointer. Each u32 array is a 0-terminated array of control IDs. |
@@ -972,7 +661,20 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) | |||
972 | return 0; | 661 | return 0; |
973 | return **ctrl_classes; | 662 | return **ctrl_classes; |
974 | } | 663 | } |
664 | EXPORT_SYMBOL(v4l2_ctrl_next); | ||
975 | 665 | ||
666 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) | ||
667 | { | ||
668 | switch (match_type) { | ||
669 | case V4L2_CHIP_MATCH_HOST: | ||
670 | return match_chip == 0; | ||
671 | default: | ||
672 | return 0; | ||
673 | } | ||
674 | } | ||
675 | EXPORT_SYMBOL(v4l2_chip_match_host); | ||
676 | |||
677 | #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) | ||
976 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) | 678 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) |
977 | { | 679 | { |
978 | switch (match_type) { | 680 | switch (match_type) { |
@@ -984,6 +686,7 @@ int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_c | |||
984 | return 0; | 686 | return 0; |
985 | } | 687 | } |
986 | } | 688 | } |
689 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); | ||
987 | 690 | ||
988 | int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, | 691 | int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, |
989 | u32 ident, u32 revision) | 692 | u32 ident, u32 revision) |
@@ -1000,16 +703,7 @@ int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chi | |||
1000 | } | 703 | } |
1001 | return 0; | 704 | return 0; |
1002 | } | 705 | } |
1003 | 706 | EXPORT_SYMBOL(v4l2_chip_ident_i2c_client); | |
1004 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) | ||
1005 | { | ||
1006 | switch (match_type) { | ||
1007 | case V4L2_CHIP_MATCH_HOST: | ||
1008 | return match_chip == 0; | ||
1009 | default: | ||
1010 | return 0; | ||
1011 | } | ||
1012 | } | ||
1013 | 707 | ||
1014 | /* ----------------------------------------------------------------- */ | 708 | /* ----------------------------------------------------------------- */ |
1015 | 709 | ||
@@ -1038,38 +732,5 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver | |||
1038 | } | 732 | } |
1039 | return err != -ENOMEM ? 0 : err; | 733 | return err != -ENOMEM ? 0 : err; |
1040 | } | 734 | } |
1041 | |||
1042 | /* ----------------------------------------------------------------- */ | ||
1043 | |||
1044 | EXPORT_SYMBOL(v4l2_norm_to_name); | ||
1045 | EXPORT_SYMBOL(v4l2_video_std_construct); | ||
1046 | |||
1047 | EXPORT_SYMBOL(v4l2_prio_init); | ||
1048 | EXPORT_SYMBOL(v4l2_prio_change); | ||
1049 | EXPORT_SYMBOL(v4l2_prio_open); | ||
1050 | EXPORT_SYMBOL(v4l2_prio_close); | ||
1051 | EXPORT_SYMBOL(v4l2_prio_max); | ||
1052 | EXPORT_SYMBOL(v4l2_prio_check); | ||
1053 | |||
1054 | EXPORT_SYMBOL(v4l2_field_names); | ||
1055 | EXPORT_SYMBOL(v4l2_type_names); | ||
1056 | EXPORT_SYMBOL(v4l_printk_ioctl); | ||
1057 | |||
1058 | EXPORT_SYMBOL(v4l2_ctrl_next); | ||
1059 | EXPORT_SYMBOL(v4l2_ctrl_check); | ||
1060 | EXPORT_SYMBOL(v4l2_ctrl_get_menu); | ||
1061 | EXPORT_SYMBOL(v4l2_ctrl_query_menu); | ||
1062 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); | ||
1063 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); | ||
1064 | |||
1065 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); | ||
1066 | EXPORT_SYMBOL(v4l2_chip_ident_i2c_client); | ||
1067 | EXPORT_SYMBOL(v4l2_chip_match_host); | ||
1068 | |||
1069 | EXPORT_SYMBOL(v4l2_i2c_attach); | 735 | EXPORT_SYMBOL(v4l2_i2c_attach); |
1070 | 736 | #endif | |
1071 | /* | ||
1072 | * Local variables: | ||
1073 | * c-basic-offset: 8 | ||
1074 | * End: | ||
1075 | */ | ||
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 80a14da9acef..eab79ffdf56a 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -147,7 +147,7 @@ void videobuf_queue_core_init(struct videobuf_queue *q, | |||
147 | /* Having implementations for abstract methods are mandatory */ | 147 | /* Having implementations for abstract methods are mandatory */ |
148 | BUG_ON(!q->int_ops); | 148 | BUG_ON(!q->int_ops); |
149 | 149 | ||
150 | mutex_init(&q->lock); | 150 | mutex_init(&q->vb_lock); |
151 | INIT_LIST_HEAD(&q->stream); | 151 | INIT_LIST_HEAD(&q->stream); |
152 | } | 152 | } |
153 | 153 | ||
@@ -189,7 +189,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) | |||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* Locking: Caller holds q->lock */ | 192 | /* Locking: Caller holds q->vb_lock */ |
193 | void videobuf_queue_cancel(struct videobuf_queue *q) | 193 | void videobuf_queue_cancel(struct videobuf_queue *q) |
194 | { | 194 | { |
195 | unsigned long flags = 0; | 195 | unsigned long flags = 0; |
@@ -220,7 +220,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q) | |||
220 | 220 | ||
221 | /* --------------------------------------------------------------------- */ | 221 | /* --------------------------------------------------------------------- */ |
222 | 222 | ||
223 | /* Locking: Caller holds q->lock */ | 223 | /* Locking: Caller holds q->vb_lock */ |
224 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q) | 224 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q) |
225 | { | 225 | { |
226 | enum v4l2_field field = q->field; | 226 | enum v4l2_field field = q->field; |
@@ -239,7 +239,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) | |||
239 | return field; | 239 | return field; |
240 | } | 240 | } |
241 | 241 | ||
242 | /* Locking: Caller holds q->lock */ | 242 | /* Locking: Caller holds q->vb_lock */ |
243 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | 243 | static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, |
244 | struct videobuf_buffer *vb, enum v4l2_buf_type type) | 244 | struct videobuf_buffer *vb, enum v4l2_buf_type type) |
245 | { | 245 | { |
@@ -295,7 +295,7 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, | |||
295 | b->sequence = vb->field_count >> 1; | 295 | b->sequence = vb->field_count >> 1; |
296 | } | 296 | } |
297 | 297 | ||
298 | /* Locking: Caller holds q->lock */ | 298 | /* Locking: Caller holds q->vb_lock */ |
299 | static int __videobuf_mmap_free(struct videobuf_queue *q) | 299 | static int __videobuf_mmap_free(struct videobuf_queue *q) |
300 | { | 300 | { |
301 | int i; | 301 | int i; |
@@ -328,13 +328,13 @@ static int __videobuf_mmap_free(struct videobuf_queue *q) | |||
328 | int videobuf_mmap_free(struct videobuf_queue *q) | 328 | int videobuf_mmap_free(struct videobuf_queue *q) |
329 | { | 329 | { |
330 | int ret; | 330 | int ret; |
331 | mutex_lock(&q->lock); | 331 | mutex_lock(&q->vb_lock); |
332 | ret = __videobuf_mmap_free(q); | 332 | ret = __videobuf_mmap_free(q); |
333 | mutex_unlock(&q->lock); | 333 | mutex_unlock(&q->vb_lock); |
334 | return ret; | 334 | return ret; |
335 | } | 335 | } |
336 | 336 | ||
337 | /* Locking: Caller holds q->lock */ | 337 | /* Locking: Caller holds q->vb_lock */ |
338 | static int __videobuf_mmap_setup(struct videobuf_queue *q, | 338 | static int __videobuf_mmap_setup(struct videobuf_queue *q, |
339 | unsigned int bcount, unsigned int bsize, | 339 | unsigned int bcount, unsigned int bsize, |
340 | enum v4l2_memory memory) | 340 | enum v4l2_memory memory) |
@@ -384,9 +384,9 @@ int videobuf_mmap_setup(struct videobuf_queue *q, | |||
384 | enum v4l2_memory memory) | 384 | enum v4l2_memory memory) |
385 | { | 385 | { |
386 | int ret; | 386 | int ret; |
387 | mutex_lock(&q->lock); | 387 | mutex_lock(&q->vb_lock); |
388 | ret = __videobuf_mmap_setup(q, bcount, bsize, memory); | 388 | ret = __videobuf_mmap_setup(q, bcount, bsize, memory); |
389 | mutex_unlock(&q->lock); | 389 | mutex_unlock(&q->vb_lock); |
390 | return ret; | 390 | return ret; |
391 | } | 391 | } |
392 | 392 | ||
@@ -408,7 +408,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
408 | return -EINVAL; | 408 | return -EINVAL; |
409 | } | 409 | } |
410 | 410 | ||
411 | mutex_lock(&q->lock); | 411 | mutex_lock(&q->vb_lock); |
412 | if (req->type != q->type) { | 412 | if (req->type != q->type) { |
413 | dprintk(1, "reqbufs: queue type invalid\n"); | 413 | dprintk(1, "reqbufs: queue type invalid\n"); |
414 | retval = -EINVAL; | 414 | retval = -EINVAL; |
@@ -444,7 +444,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, | |||
444 | req->count = retval; | 444 | req->count = retval; |
445 | 445 | ||
446 | done: | 446 | done: |
447 | mutex_unlock(&q->lock); | 447 | mutex_unlock(&q->vb_lock); |
448 | return retval; | 448 | return retval; |
449 | } | 449 | } |
450 | 450 | ||
@@ -452,7 +452,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | |||
452 | { | 452 | { |
453 | int ret = -EINVAL; | 453 | int ret = -EINVAL; |
454 | 454 | ||
455 | mutex_lock(&q->lock); | 455 | mutex_lock(&q->vb_lock); |
456 | if (unlikely(b->type != q->type)) { | 456 | if (unlikely(b->type != q->type)) { |
457 | dprintk(1, "querybuf: Wrong type.\n"); | 457 | dprintk(1, "querybuf: Wrong type.\n"); |
458 | goto done; | 458 | goto done; |
@@ -470,7 +470,7 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | |||
470 | 470 | ||
471 | ret = 0; | 471 | ret = 0; |
472 | done: | 472 | done: |
473 | mutex_unlock(&q->lock); | 473 | mutex_unlock(&q->vb_lock); |
474 | return ret; | 474 | return ret; |
475 | } | 475 | } |
476 | 476 | ||
@@ -487,7 +487,7 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
487 | if (b->memory == V4L2_MEMORY_MMAP) | 487 | if (b->memory == V4L2_MEMORY_MMAP) |
488 | down_read(¤t->mm->mmap_sem); | 488 | down_read(¤t->mm->mmap_sem); |
489 | 489 | ||
490 | mutex_lock(&q->lock); | 490 | mutex_lock(&q->vb_lock); |
491 | retval = -EBUSY; | 491 | retval = -EBUSY; |
492 | if (q->reading) { | 492 | if (q->reading) { |
493 | dprintk(1, "qbuf: Reading running...\n"); | 493 | dprintk(1, "qbuf: Reading running...\n"); |
@@ -573,7 +573,7 @@ int videobuf_qbuf(struct videobuf_queue *q, | |||
573 | retval = 0; | 573 | retval = 0; |
574 | 574 | ||
575 | done: | 575 | done: |
576 | mutex_unlock(&q->lock); | 576 | mutex_unlock(&q->vb_lock); |
577 | 577 | ||
578 | if (b->memory == V4L2_MEMORY_MMAP) | 578 | if (b->memory == V4L2_MEMORY_MMAP) |
579 | up_read(¤t->mm->mmap_sem); | 579 | up_read(¤t->mm->mmap_sem); |
@@ -589,7 +589,7 @@ int videobuf_dqbuf(struct videobuf_queue *q, | |||
589 | 589 | ||
590 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); | 590 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
591 | 591 | ||
592 | mutex_lock(&q->lock); | 592 | mutex_lock(&q->vb_lock); |
593 | retval = -EBUSY; | 593 | retval = -EBUSY; |
594 | if (q->reading) { | 594 | if (q->reading) { |
595 | dprintk(1, "dqbuf: Reading running...\n"); | 595 | dprintk(1, "dqbuf: Reading running...\n"); |
@@ -632,7 +632,7 @@ int videobuf_dqbuf(struct videobuf_queue *q, | |||
632 | videobuf_status(q, b, buf, q->type); | 632 | videobuf_status(q, b, buf, q->type); |
633 | 633 | ||
634 | done: | 634 | done: |
635 | mutex_unlock(&q->lock); | 635 | mutex_unlock(&q->vb_lock); |
636 | return retval; | 636 | return retval; |
637 | } | 637 | } |
638 | 638 | ||
@@ -642,7 +642,7 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
642 | unsigned long flags = 0; | 642 | unsigned long flags = 0; |
643 | int retval; | 643 | int retval; |
644 | 644 | ||
645 | mutex_lock(&q->lock); | 645 | mutex_lock(&q->vb_lock); |
646 | retval = -EBUSY; | 646 | retval = -EBUSY; |
647 | if (q->reading) | 647 | if (q->reading) |
648 | goto done; | 648 | goto done; |
@@ -659,11 +659,11 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
659 | spin_unlock_irqrestore(q->irqlock, flags); | 659 | spin_unlock_irqrestore(q->irqlock, flags); |
660 | 660 | ||
661 | done: | 661 | done: |
662 | mutex_unlock(&q->lock); | 662 | mutex_unlock(&q->vb_lock); |
663 | return retval; | 663 | return retval; |
664 | } | 664 | } |
665 | 665 | ||
666 | /* Locking: Caller holds q->lock */ | 666 | /* Locking: Caller holds q->vb_lock */ |
667 | static int __videobuf_streamoff(struct videobuf_queue *q) | 667 | static int __videobuf_streamoff(struct videobuf_queue *q) |
668 | { | 668 | { |
669 | if (!q->streaming) | 669 | if (!q->streaming) |
@@ -679,14 +679,14 @@ int videobuf_streamoff(struct videobuf_queue *q) | |||
679 | { | 679 | { |
680 | int retval; | 680 | int retval; |
681 | 681 | ||
682 | mutex_lock(&q->lock); | 682 | mutex_lock(&q->vb_lock); |
683 | retval = __videobuf_streamoff(q); | 683 | retval = __videobuf_streamoff(q); |
684 | mutex_unlock(&q->lock); | 684 | mutex_unlock(&q->vb_lock); |
685 | 685 | ||
686 | return retval; | 686 | return retval; |
687 | } | 687 | } |
688 | 688 | ||
689 | /* Locking: Caller holds q->lock */ | 689 | /* Locking: Caller holds q->vb_lock */ |
690 | static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, | 690 | static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, |
691 | char __user *data, | 691 | char __user *data, |
692 | size_t count, loff_t *ppos) | 692 | size_t count, loff_t *ppos) |
@@ -745,7 +745,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
745 | 745 | ||
746 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); | 746 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
747 | 747 | ||
748 | mutex_lock(&q->lock); | 748 | mutex_lock(&q->vb_lock); |
749 | 749 | ||
750 | nbufs = 1; size = 0; | 750 | nbufs = 1; size = 0; |
751 | q->ops->buf_setup(q, &nbufs, &size); | 751 | q->ops->buf_setup(q, &nbufs, &size); |
@@ -817,11 +817,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
817 | } | 817 | } |
818 | 818 | ||
819 | done: | 819 | done: |
820 | mutex_unlock(&q->lock); | 820 | mutex_unlock(&q->vb_lock); |
821 | return retval; | 821 | return retval; |
822 | } | 822 | } |
823 | 823 | ||
824 | /* Locking: Caller holds q->lock */ | 824 | /* Locking: Caller holds q->vb_lock */ |
825 | static int __videobuf_read_start(struct videobuf_queue *q) | 825 | static int __videobuf_read_start(struct videobuf_queue *q) |
826 | { | 826 | { |
827 | enum v4l2_field field; | 827 | enum v4l2_field field; |
@@ -882,23 +882,23 @@ int videobuf_read_start(struct videobuf_queue *q) | |||
882 | { | 882 | { |
883 | int rc; | 883 | int rc; |
884 | 884 | ||
885 | mutex_lock(&q->lock); | 885 | mutex_lock(&q->vb_lock); |
886 | rc = __videobuf_read_start(q); | 886 | rc = __videobuf_read_start(q); |
887 | mutex_unlock(&q->lock); | 887 | mutex_unlock(&q->vb_lock); |
888 | 888 | ||
889 | return rc; | 889 | return rc; |
890 | } | 890 | } |
891 | 891 | ||
892 | void videobuf_read_stop(struct videobuf_queue *q) | 892 | void videobuf_read_stop(struct videobuf_queue *q) |
893 | { | 893 | { |
894 | mutex_lock(&q->lock); | 894 | mutex_lock(&q->vb_lock); |
895 | __videobuf_read_stop(q); | 895 | __videobuf_read_stop(q); |
896 | mutex_unlock(&q->lock); | 896 | mutex_unlock(&q->vb_lock); |
897 | } | 897 | } |
898 | 898 | ||
899 | void videobuf_stop(struct videobuf_queue *q) | 899 | void videobuf_stop(struct videobuf_queue *q) |
900 | { | 900 | { |
901 | mutex_lock(&q->lock); | 901 | mutex_lock(&q->vb_lock); |
902 | 902 | ||
903 | if (q->streaming) | 903 | if (q->streaming) |
904 | __videobuf_streamoff(q); | 904 | __videobuf_streamoff(q); |
@@ -906,7 +906,7 @@ void videobuf_stop(struct videobuf_queue *q) | |||
906 | if (q->reading) | 906 | if (q->reading) |
907 | __videobuf_read_stop(q); | 907 | __videobuf_read_stop(q); |
908 | 908 | ||
909 | mutex_unlock(&q->lock); | 909 | mutex_unlock(&q->vb_lock); |
910 | } | 910 | } |
911 | 911 | ||
912 | 912 | ||
@@ -920,7 +920,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
920 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); | 920 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
921 | 921 | ||
922 | dprintk(2, "%s\n", __FUNCTION__); | 922 | dprintk(2, "%s\n", __FUNCTION__); |
923 | mutex_lock(&q->lock); | 923 | mutex_lock(&q->vb_lock); |
924 | retval = -EBUSY; | 924 | retval = -EBUSY; |
925 | if (q->streaming) | 925 | if (q->streaming) |
926 | goto done; | 926 | goto done; |
@@ -980,7 +980,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
980 | } | 980 | } |
981 | 981 | ||
982 | done: | 982 | done: |
983 | mutex_unlock(&q->lock); | 983 | mutex_unlock(&q->vb_lock); |
984 | return retval; | 984 | return retval; |
985 | } | 985 | } |
986 | 986 | ||
@@ -991,7 +991,7 @@ unsigned int videobuf_poll_stream(struct file *file, | |||
991 | struct videobuf_buffer *buf = NULL; | 991 | struct videobuf_buffer *buf = NULL; |
992 | unsigned int rc = 0; | 992 | unsigned int rc = 0; |
993 | 993 | ||
994 | mutex_lock(&q->lock); | 994 | mutex_lock(&q->vb_lock); |
995 | if (q->streaming) { | 995 | if (q->streaming) { |
996 | if (!list_empty(&q->stream)) | 996 | if (!list_empty(&q->stream)) |
997 | buf = list_entry(q->stream.next, | 997 | buf = list_entry(q->stream.next, |
@@ -1019,7 +1019,7 @@ unsigned int videobuf_poll_stream(struct file *file, | |||
1019 | buf->state == VIDEOBUF_ERROR) | 1019 | buf->state == VIDEOBUF_ERROR) |
1020 | rc = POLLIN|POLLRDNORM; | 1020 | rc = POLLIN|POLLRDNORM; |
1021 | } | 1021 | } |
1022 | mutex_unlock(&q->lock); | 1022 | mutex_unlock(&q->vb_lock); |
1023 | return rc; | 1023 | return rc; |
1024 | } | 1024 | } |
1025 | 1025 | ||
@@ -1030,10 +1030,10 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, | |||
1030 | 1030 | ||
1031 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); | 1031 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); |
1032 | 1032 | ||
1033 | mutex_lock(&q->lock); | 1033 | mutex_lock(&q->vb_lock); |
1034 | retval = CALL(q, mmap_mapper, q, vma); | 1034 | retval = CALL(q, mmap_mapper, q, vma); |
1035 | q->is_mmapped = 1; | 1035 | q->is_mmapped = 1; |
1036 | mutex_unlock(&q->lock); | 1036 | mutex_unlock(&q->vb_lock); |
1037 | 1037 | ||
1038 | return retval; | 1038 | return retval; |
1039 | } | 1039 | } |
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 98efd7ab1f50..53fed4b74ce9 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -356,7 +356,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
356 | map->count--; | 356 | map->count--; |
357 | if (0 == map->count) { | 357 | if (0 == map->count) { |
358 | dprintk(1,"munmap %p q=%p\n",map,q); | 358 | dprintk(1,"munmap %p q=%p\n",map,q); |
359 | mutex_lock(&q->lock); | 359 | mutex_lock(&q->vb_lock); |
360 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 360 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
361 | if (NULL == q->bufs[i]) | 361 | if (NULL == q->bufs[i]) |
362 | continue; | 362 | continue; |
@@ -373,7 +373,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
373 | q->bufs[i]->baddr = 0; | 373 | q->bufs[i]->baddr = 0; |
374 | q->ops->buf_release(q,q->bufs[i]); | 374 | q->ops->buf_release(q,q->bufs[i]); |
375 | } | 375 | } |
376 | mutex_unlock(&q->lock); | 376 | mutex_unlock(&q->vb_lock); |
377 | kfree(map); | 377 | kfree(map); |
378 | } | 378 | } |
379 | return; | 379 | return; |
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index 9b3898347ca5..5266ecc91dab 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c | |||
@@ -70,7 +70,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
70 | map->count--; | 70 | map->count--; |
71 | if (0 == map->count) { | 71 | if (0 == map->count) { |
72 | dprintk(1,"munmap %p q=%p\n",map,q); | 72 | dprintk(1,"munmap %p q=%p\n",map,q); |
73 | mutex_lock(&q->lock); | 73 | mutex_lock(&q->vb_lock); |
74 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 74 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
75 | if (NULL == q->bufs[i]) | 75 | if (NULL == q->bufs[i]) |
76 | continue; | 76 | continue; |
@@ -83,7 +83,7 @@ videobuf_vm_close(struct vm_area_struct *vma) | |||
83 | q->bufs[i]->map = NULL; | 83 | q->bufs[i]->map = NULL; |
84 | q->bufs[i]->baddr = 0; | 84 | q->bufs[i]->baddr = 0; |
85 | } | 85 | } |
86 | mutex_unlock(&q->lock); | 86 | mutex_unlock(&q->vb_lock); |
87 | kfree(map); | 87 | kfree(map); |
88 | } | 88 | } |
89 | return; | 89 | return; |
@@ -107,7 +107,7 @@ static struct vm_operations_struct videobuf_vm_ops = | |||
107 | 107 | ||
108 | static void *__videobuf_alloc(size_t size) | 108 | static void *__videobuf_alloc(size_t size) |
109 | { | 109 | { |
110 | struct videbuf_vmalloc_memory *mem; | 110 | struct videobuf_vmalloc_memory *mem; |
111 | struct videobuf_buffer *vb; | 111 | struct videobuf_buffer *vb; |
112 | 112 | ||
113 | vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); | 113 | vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); |
@@ -127,9 +127,7 @@ static int __videobuf_iolock (struct videobuf_queue* q, | |||
127 | struct v4l2_framebuffer *fbuf) | 127 | struct v4l2_framebuffer *fbuf) |
128 | { | 128 | { |
129 | int pages; | 129 | int pages; |
130 | 130 | struct videobuf_vmalloc_memory *mem=vb->priv; | |
131 | struct videbuf_vmalloc_memory *mem=vb->priv; | ||
132 | |||
133 | 131 | ||
134 | BUG_ON(!mem); | 132 | BUG_ON(!mem); |
135 | 133 | ||
@@ -195,7 +193,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q) | |||
195 | static int __videobuf_mmap_mapper(struct videobuf_queue *q, | 193 | static int __videobuf_mmap_mapper(struct videobuf_queue *q, |
196 | struct vm_area_struct *vma) | 194 | struct vm_area_struct *vma) |
197 | { | 195 | { |
198 | struct videbuf_vmalloc_memory *mem; | 196 | struct videobuf_vmalloc_memory *mem; |
199 | struct videobuf_mapping *map; | 197 | struct videobuf_mapping *map; |
200 | unsigned int first; | 198 | unsigned int first; |
201 | int retval; | 199 | int retval; |
@@ -267,7 +265,7 @@ static int __videobuf_copy_to_user ( struct videobuf_queue *q, | |||
267 | char __user *data, size_t count, | 265 | char __user *data, size_t count, |
268 | int nonblocking ) | 266 | int nonblocking ) |
269 | { | 267 | { |
270 | struct videbuf_vmalloc_memory *mem=q->read_buf->priv; | 268 | struct videobuf_vmalloc_memory *mem=q->read_buf->priv; |
271 | BUG_ON (!mem); | 269 | BUG_ON (!mem); |
272 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); | 270 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); |
273 | 271 | ||
@@ -288,7 +286,7 @@ static int __videobuf_copy_stream ( struct videobuf_queue *q, | |||
288 | int vbihack, int nonblocking ) | 286 | int vbihack, int nonblocking ) |
289 | { | 287 | { |
290 | unsigned int *fc; | 288 | unsigned int *fc; |
291 | struct videbuf_vmalloc_memory *mem=q->read_buf->priv; | 289 | struct videobuf_vmalloc_memory *mem=q->read_buf->priv; |
292 | BUG_ON (!mem); | 290 | BUG_ON (!mem); |
293 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); | 291 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); |
294 | 292 | ||
@@ -341,7 +339,7 @@ EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init); | |||
341 | 339 | ||
342 | void *videobuf_to_vmalloc (struct videobuf_buffer *buf) | 340 | void *videobuf_to_vmalloc (struct videobuf_buffer *buf) |
343 | { | 341 | { |
344 | struct videbuf_vmalloc_memory *mem=buf->priv; | 342 | struct videobuf_vmalloc_memory *mem=buf->priv; |
345 | BUG_ON (!mem); | 343 | BUG_ON (!mem); |
346 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); | 344 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); |
347 | 345 | ||
@@ -351,7 +349,7 @@ EXPORT_SYMBOL_GPL(videobuf_to_vmalloc); | |||
351 | 349 | ||
352 | void videobuf_vmalloc_free (struct videobuf_buffer *buf) | 350 | void videobuf_vmalloc_free (struct videobuf_buffer *buf) |
353 | { | 351 | { |
354 | struct videbuf_vmalloc_memory *mem=buf->priv; | 352 | struct videobuf_vmalloc_memory *mem=buf->priv; |
355 | BUG_ON (!mem); | 353 | BUG_ON (!mem); |
356 | 354 | ||
357 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); | 355 | MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 28655f8983c6..0d9b63762a48 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
@@ -46,10 +46,373 @@ | |||
46 | #include <linux/videodev.h> | 46 | #include <linux/videodev.h> |
47 | #endif | 47 | #endif |
48 | #include <media/v4l2-common.h> | 48 | #include <media/v4l2-common.h> |
49 | #include <linux/video_decoder.h> | ||
49 | 50 | ||
50 | #define VIDEO_NUM_DEVICES 256 | 51 | #define VIDEO_NUM_DEVICES 256 |
51 | #define VIDEO_NAME "video4linux" | 52 | #define VIDEO_NAME "video4linux" |
52 | 53 | ||
54 | /* video4linux standard ID conversion to standard name | ||
55 | */ | ||
56 | char *v4l2_norm_to_name(v4l2_std_id id) | ||
57 | { | ||
58 | char *name; | ||
59 | u32 myid = id; | ||
60 | |||
61 | /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle | ||
62 | 64 bit comparations. So, on that architecture, with some gcc | ||
63 | variants, compilation fails. Currently, the max value is 30bit wide. | ||
64 | */ | ||
65 | BUG_ON(myid != id); | ||
66 | |||
67 | switch (myid) { | ||
68 | case V4L2_STD_PAL: | ||
69 | name = "PAL"; | ||
70 | break; | ||
71 | case V4L2_STD_PAL_BG: | ||
72 | name = "PAL-BG"; | ||
73 | break; | ||
74 | case V4L2_STD_PAL_DK: | ||
75 | name = "PAL-DK"; | ||
76 | break; | ||
77 | case V4L2_STD_PAL_B: | ||
78 | name = "PAL-B"; | ||
79 | break; | ||
80 | case V4L2_STD_PAL_B1: | ||
81 | name = "PAL-B1"; | ||
82 | break; | ||
83 | case V4L2_STD_PAL_G: | ||
84 | name = "PAL-G"; | ||
85 | break; | ||
86 | case V4L2_STD_PAL_H: | ||
87 | name = "PAL-H"; | ||
88 | break; | ||
89 | case V4L2_STD_PAL_I: | ||
90 | name = "PAL-I"; | ||
91 | break; | ||
92 | case V4L2_STD_PAL_D: | ||
93 | name = "PAL-D"; | ||
94 | break; | ||
95 | case V4L2_STD_PAL_D1: | ||
96 | name = "PAL-D1"; | ||
97 | break; | ||
98 | case V4L2_STD_PAL_K: | ||
99 | name = "PAL-K"; | ||
100 | break; | ||
101 | case V4L2_STD_PAL_M: | ||
102 | name = "PAL-M"; | ||
103 | break; | ||
104 | case V4L2_STD_PAL_N: | ||
105 | name = "PAL-N"; | ||
106 | break; | ||
107 | case V4L2_STD_PAL_Nc: | ||
108 | name = "PAL-Nc"; | ||
109 | break; | ||
110 | case V4L2_STD_PAL_60: | ||
111 | name = "PAL-60"; | ||
112 | break; | ||
113 | case V4L2_STD_NTSC: | ||
114 | name = "NTSC"; | ||
115 | break; | ||
116 | case V4L2_STD_NTSC_M: | ||
117 | name = "NTSC-M"; | ||
118 | break; | ||
119 | case V4L2_STD_NTSC_M_JP: | ||
120 | name = "NTSC-M-JP"; | ||
121 | break; | ||
122 | case V4L2_STD_NTSC_443: | ||
123 | name = "NTSC-443"; | ||
124 | break; | ||
125 | case V4L2_STD_NTSC_M_KR: | ||
126 | name = "NTSC-M-KR"; | ||
127 | break; | ||
128 | case V4L2_STD_SECAM: | ||
129 | name = "SECAM"; | ||
130 | break; | ||
131 | case V4L2_STD_SECAM_DK: | ||
132 | name = "SECAM-DK"; | ||
133 | break; | ||
134 | case V4L2_STD_SECAM_B: | ||
135 | name = "SECAM-B"; | ||
136 | break; | ||
137 | case V4L2_STD_SECAM_D: | ||
138 | name = "SECAM-D"; | ||
139 | break; | ||
140 | case V4L2_STD_SECAM_G: | ||
141 | name = "SECAM-G"; | ||
142 | break; | ||
143 | case V4L2_STD_SECAM_H: | ||
144 | name = "SECAM-H"; | ||
145 | break; | ||
146 | case V4L2_STD_SECAM_K: | ||
147 | name = "SECAM-K"; | ||
148 | break; | ||
149 | case V4L2_STD_SECAM_K1: | ||
150 | name = "SECAM-K1"; | ||
151 | break; | ||
152 | case V4L2_STD_SECAM_L: | ||
153 | name = "SECAM-L"; | ||
154 | break; | ||
155 | case V4L2_STD_SECAM_LC: | ||
156 | name = "SECAM-LC"; | ||
157 | break; | ||
158 | default: | ||
159 | name = "Unknown"; | ||
160 | break; | ||
161 | } | ||
162 | |||
163 | return name; | ||
164 | } | ||
165 | EXPORT_SYMBOL(v4l2_norm_to_name); | ||
166 | |||
167 | /* Fill in the fields of a v4l2_standard structure according to the | ||
168 | 'id' and 'transmission' parameters. Returns negative on error. */ | ||
169 | int v4l2_video_std_construct(struct v4l2_standard *vs, | ||
170 | int id, char *name) | ||
171 | { | ||
172 | u32 index = vs->index; | ||
173 | |||
174 | memset(vs, 0, sizeof(struct v4l2_standard)); | ||
175 | vs->index = index; | ||
176 | vs->id = id; | ||
177 | if (id & V4L2_STD_525_60) { | ||
178 | vs->frameperiod.numerator = 1001; | ||
179 | vs->frameperiod.denominator = 30000; | ||
180 | vs->framelines = 525; | ||
181 | } else { | ||
182 | vs->frameperiod.numerator = 1; | ||
183 | vs->frameperiod.denominator = 25; | ||
184 | vs->framelines = 625; | ||
185 | } | ||
186 | strlcpy(vs->name, name, sizeof(vs->name)); | ||
187 | return 0; | ||
188 | } | ||
189 | EXPORT_SYMBOL(v4l2_video_std_construct); | ||
190 | |||
191 | /* ----------------------------------------------------------------- */ | ||
192 | /* some arrays for pretty-printing debug messages of enum types */ | ||
193 | |||
194 | char *v4l2_field_names[] = { | ||
195 | [V4L2_FIELD_ANY] = "any", | ||
196 | [V4L2_FIELD_NONE] = "none", | ||
197 | [V4L2_FIELD_TOP] = "top", | ||
198 | [V4L2_FIELD_BOTTOM] = "bottom", | ||
199 | [V4L2_FIELD_INTERLACED] = "interlaced", | ||
200 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | ||
201 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | ||
202 | [V4L2_FIELD_ALTERNATE] = "alternate", | ||
203 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
204 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
205 | }; | ||
206 | EXPORT_SYMBOL(v4l2_field_names); | ||
207 | |||
208 | char *v4l2_type_names[] = { | ||
209 | [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", | ||
210 | [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", | ||
211 | [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", | ||
212 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | ||
213 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | ||
214 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", | ||
215 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", | ||
216 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
217 | }; | ||
218 | EXPORT_SYMBOL(v4l2_type_names); | ||
219 | |||
220 | static char *v4l2_memory_names[] = { | ||
221 | [V4L2_MEMORY_MMAP] = "mmap", | ||
222 | [V4L2_MEMORY_USERPTR] = "userptr", | ||
223 | [V4L2_MEMORY_OVERLAY] = "overlay", | ||
224 | }; | ||
225 | |||
226 | #define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \ | ||
227 | arr[a] : "unknown") | ||
228 | |||
229 | /* ------------------------------------------------------------------ */ | ||
230 | /* debug help functions */ | ||
231 | |||
232 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
233 | static const char *v4l1_ioctls[] = { | ||
234 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | ||
235 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | ||
236 | [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", | ||
237 | [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", | ||
238 | [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", | ||
239 | [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", | ||
240 | [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", | ||
241 | [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", | ||
242 | [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", | ||
243 | [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", | ||
244 | [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", | ||
245 | [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", | ||
246 | [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", | ||
247 | [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", | ||
248 | [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", | ||
249 | [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", | ||
250 | [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", | ||
251 | [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", | ||
252 | [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", | ||
253 | [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", | ||
254 | [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", | ||
255 | [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", | ||
256 | [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", | ||
257 | [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", | ||
258 | [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", | ||
259 | [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", | ||
260 | [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", | ||
261 | [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", | ||
262 | [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" | ||
263 | }; | ||
264 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
265 | #endif | ||
266 | |||
267 | static const char *v4l2_ioctls[] = { | ||
268 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | ||
269 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | ||
270 | [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", | ||
271 | [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", | ||
272 | [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", | ||
273 | [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", | ||
274 | [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", | ||
275 | [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", | ||
276 | [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF", | ||
277 | [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY", | ||
278 | [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF", | ||
279 | [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF", | ||
280 | [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON", | ||
281 | [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF", | ||
282 | [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM", | ||
283 | [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM", | ||
284 | [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD", | ||
285 | [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD", | ||
286 | [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD", | ||
287 | [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT", | ||
288 | [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL", | ||
289 | [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL", | ||
290 | [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER", | ||
291 | [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER", | ||
292 | [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO", | ||
293 | [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO", | ||
294 | [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL", | ||
295 | [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU", | ||
296 | [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT", | ||
297 | [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT", | ||
298 | [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT", | ||
299 | [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT", | ||
300 | [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT", | ||
301 | [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT", | ||
302 | [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT", | ||
303 | [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR", | ||
304 | [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR", | ||
305 | [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY", | ||
306 | [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY", | ||
307 | [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP", | ||
308 | [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP", | ||
309 | [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP", | ||
310 | [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP", | ||
311 | [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP", | ||
312 | [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD", | ||
313 | [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT", | ||
314 | [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO", | ||
315 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", | ||
316 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", | ||
317 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", | ||
318 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", | ||
319 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", | ||
320 | [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", | ||
321 | [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", | ||
322 | [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS", | ||
323 | #if 1 | ||
324 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", | ||
325 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", | ||
326 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX", | ||
327 | [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD", | ||
328 | [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD", | ||
329 | |||
330 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | ||
331 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | ||
332 | |||
333 | [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", | ||
334 | #endif | ||
335 | }; | ||
336 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | ||
337 | |||
338 | static const char *v4l2_int_ioctls[] = { | ||
339 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
340 | [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", | ||
341 | [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", | ||
342 | [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", | ||
343 | [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT", | ||
344 | [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT", | ||
345 | [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT", | ||
346 | [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE", | ||
347 | [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO", | ||
348 | [_IOC_NR(DECODER_INIT)] = "DECODER_INIT", | ||
349 | [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS", | ||
350 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | ||
351 | #endif | ||
352 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | ||
353 | |||
354 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | ||
355 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | ||
356 | [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG", | ||
357 | |||
358 | [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", | ||
359 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", | ||
360 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", | ||
361 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", | ||
362 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", | ||
363 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", | ||
364 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", | ||
365 | [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", | ||
366 | [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", | ||
367 | [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING", | ||
368 | [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING", | ||
369 | [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING", | ||
370 | [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ", | ||
371 | [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT", | ||
372 | [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT", | ||
373 | [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT", | ||
374 | }; | ||
375 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) | ||
376 | |||
377 | /* Common ioctl debug function. This function can be used by | ||
378 | external ioctl messages as well as internal V4L ioctl */ | ||
379 | void v4l_printk_ioctl(unsigned int cmd) | ||
380 | { | ||
381 | char *dir; | ||
382 | |||
383 | switch (_IOC_DIR(cmd)) { | ||
384 | case _IOC_NONE: dir = "--"; break; | ||
385 | case _IOC_READ: dir = "r-"; break; | ||
386 | case _IOC_WRITE: dir = "-w"; break; | ||
387 | case _IOC_READ | _IOC_WRITE: dir = "rw"; break; | ||
388 | default: dir = "*ERR*"; break; | ||
389 | } | ||
390 | switch (_IOC_TYPE(cmd)) { | ||
391 | case 'd': | ||
392 | printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n", | ||
393 | (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? | ||
394 | v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
395 | break; | ||
396 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
397 | case 'v': | ||
398 | printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", | ||
399 | (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
400 | v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
401 | break; | ||
402 | #endif | ||
403 | case 'V': | ||
404 | printk("v4l2 ioctl %s, dir=%s (0x%08x)\n", | ||
405 | (_IOC_NR(cmd) < V4L2_IOCTLS) ? | ||
406 | v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); | ||
407 | break; | ||
408 | |||
409 | default: | ||
410 | printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n", | ||
411 | _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd); | ||
412 | } | ||
413 | } | ||
414 | EXPORT_SYMBOL(v4l_printk_ioctl); | ||
415 | |||
53 | /* | 416 | /* |
54 | * sysfs stuff | 417 | * sysfs stuff |
55 | */ | 418 | */ |
@@ -69,11 +432,13 @@ struct video_device *video_device_alloc(void) | |||
69 | vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); | 432 | vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); |
70 | return vfd; | 433 | return vfd; |
71 | } | 434 | } |
435 | EXPORT_SYMBOL(video_device_alloc); | ||
72 | 436 | ||
73 | void video_device_release(struct video_device *vfd) | 437 | void video_device_release(struct video_device *vfd) |
74 | { | 438 | { |
75 | kfree(vfd); | 439 | kfree(vfd); |
76 | } | 440 | } |
441 | EXPORT_SYMBOL(video_device_release); | ||
77 | 442 | ||
78 | static void video_release(struct device *cd) | 443 | static void video_release(struct device *cd) |
79 | { | 444 | { |
@@ -110,6 +475,7 @@ struct video_device* video_devdata(struct file *file) | |||
110 | { | 475 | { |
111 | return video_device[iminor(file->f_path.dentry->d_inode)]; | 476 | return video_device[iminor(file->f_path.dentry->d_inode)]; |
112 | } | 477 | } |
478 | EXPORT_SYMBOL(video_devdata); | ||
113 | 479 | ||
114 | /* | 480 | /* |
115 | * Open a video device - FIXME: Obsoleted | 481 | * Open a video device - FIXME: Obsoleted |
@@ -278,6 +644,7 @@ out: | |||
278 | kfree(mbuf); | 644 | kfree(mbuf); |
279 | return err; | 645 | return err; |
280 | } | 646 | } |
647 | EXPORT_SYMBOL(video_usercopy); | ||
281 | 648 | ||
282 | /* | 649 | /* |
283 | * open/release helper functions -- handle exclusive opens | 650 | * open/release helper functions -- handle exclusive opens |
@@ -297,6 +664,7 @@ int video_exclusive_open(struct inode *inode, struct file *file) | |||
297 | mutex_unlock(&vfl->lock); | 664 | mutex_unlock(&vfl->lock); |
298 | return retval; | 665 | return retval; |
299 | } | 666 | } |
667 | EXPORT_SYMBOL(video_exclusive_open); | ||
300 | 668 | ||
301 | int video_exclusive_release(struct inode *inode, struct file *file) | 669 | int video_exclusive_release(struct inode *inode, struct file *file) |
302 | { | 670 | { |
@@ -305,41 +673,7 @@ int video_exclusive_release(struct inode *inode, struct file *file) | |||
305 | vfl->users--; | 673 | vfl->users--; |
306 | return 0; | 674 | return 0; |
307 | } | 675 | } |
308 | 676 | EXPORT_SYMBOL(video_exclusive_release); | |
309 | static char *v4l2_memory_names[] = { | ||
310 | [V4L2_MEMORY_MMAP] = "mmap", | ||
311 | [V4L2_MEMORY_USERPTR] = "userptr", | ||
312 | [V4L2_MEMORY_OVERLAY] = "overlay", | ||
313 | }; | ||
314 | |||
315 | |||
316 | /* FIXME: Those stuff are replicated also on v4l2-common.c */ | ||
317 | static char *v4l2_type_names_FIXME[] = { | ||
318 | [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "video-cap", | ||
319 | [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "video-over", | ||
320 | [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "video-out", | ||
321 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | ||
322 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | ||
323 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", | ||
324 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture", | ||
325 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
326 | [V4L2_BUF_TYPE_PRIVATE] = "private", | ||
327 | }; | ||
328 | |||
329 | static char *v4l2_field_names_FIXME[] = { | ||
330 | [V4L2_FIELD_ANY] = "any", | ||
331 | [V4L2_FIELD_NONE] = "none", | ||
332 | [V4L2_FIELD_TOP] = "top", | ||
333 | [V4L2_FIELD_BOTTOM] = "bottom", | ||
334 | [V4L2_FIELD_INTERLACED] = "interlaced", | ||
335 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | ||
336 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | ||
337 | [V4L2_FIELD_ALTERNATE] = "alternate", | ||
338 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
339 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
340 | }; | ||
341 | |||
342 | #define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown" | ||
343 | 677 | ||
344 | static void dbgbuf(unsigned int cmd, struct video_device *vfd, | 678 | static void dbgbuf(unsigned int cmd, struct video_device *vfd, |
345 | struct v4l2_buffer *p) | 679 | struct v4l2_buffer *p) |
@@ -354,10 +688,10 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, | |||
354 | (int)(p->timestamp.tv_sec%60), | 688 | (int)(p->timestamp.tv_sec%60), |
355 | p->timestamp.tv_usec, | 689 | p->timestamp.tv_usec, |
356 | p->index, | 690 | p->index, |
357 | prt_names(p->type,v4l2_type_names_FIXME), | 691 | prt_names(p->type, v4l2_type_names), |
358 | p->bytesused,p->flags, | 692 | p->bytesused, p->flags, |
359 | p->field,p->sequence, | 693 | p->field, p->sequence, |
360 | prt_names(p->memory,v4l2_memory_names), | 694 | prt_names(p->memory, v4l2_memory_names), |
361 | p->m.userptr, p->length); | 695 | p->m.userptr, p->length); |
362 | dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " | 696 | dbgarg2 ("timecode= %02d:%02d:%02d type=%d, " |
363 | "flags=0x%08d, frames=%d, userbits=0x%08x\n", | 697 | "flags=0x%08d, frames=%d, userbits=0x%08x\n", |
@@ -382,8 +716,8 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd, | |||
382 | (fmt->pixelformat >> 8) & 0xff, | 716 | (fmt->pixelformat >> 8) & 0xff, |
383 | (fmt->pixelformat >> 16) & 0xff, | 717 | (fmt->pixelformat >> 16) & 0xff, |
384 | (fmt->pixelformat >> 24) & 0xff, | 718 | (fmt->pixelformat >> 24) & 0xff, |
385 | prt_names(fmt->field,v4l2_field_names_FIXME), | 719 | prt_names(fmt->field, v4l2_field_names), |
386 | fmt->bytesperline,fmt->sizeimage,fmt->colorspace); | 720 | fmt->bytesperline, fmt->sizeimage, fmt->colorspace); |
387 | }; | 721 | }; |
388 | 722 | ||
389 | 723 | ||
@@ -597,7 +931,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
597 | 931 | ||
598 | /* FIXME: Should be one dump per type */ | 932 | /* FIXME: Should be one dump per type */ |
599 | dbgarg (cmd, "type=%s\n", prt_names(type, | 933 | dbgarg (cmd, "type=%s\n", prt_names(type, |
600 | v4l2_type_names_FIXME)); | 934 | v4l2_type_names)); |
601 | 935 | ||
602 | switch (type) { | 936 | switch (type) { |
603 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 937 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
@@ -650,7 +984,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
650 | 984 | ||
651 | /* FIXME: Should be one dump per type */ | 985 | /* FIXME: Should be one dump per type */ |
652 | dbgarg (cmd, "type=%s\n", prt_names(f->type, | 986 | dbgarg (cmd, "type=%s\n", prt_names(f->type, |
653 | v4l2_type_names_FIXME)); | 987 | v4l2_type_names)); |
654 | 988 | ||
655 | switch (f->type) { | 989 | switch (f->type) { |
656 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 990 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
@@ -702,7 +1036,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
702 | 1036 | ||
703 | /* FIXME: Should be one dump per type */ | 1037 | /* FIXME: Should be one dump per type */ |
704 | dbgarg (cmd, "type=%s\n", prt_names(f->type, | 1038 | dbgarg (cmd, "type=%s\n", prt_names(f->type, |
705 | v4l2_type_names_FIXME)); | 1039 | v4l2_type_names)); |
706 | switch (f->type) { | 1040 | switch (f->type) { |
707 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 1041 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
708 | if (vfd->vidioc_try_fmt_cap) | 1042 | if (vfd->vidioc_try_fmt_cap) |
@@ -768,8 +1102,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
768 | ret=vfd->vidioc_reqbufs(file, fh, p); | 1102 | ret=vfd->vidioc_reqbufs(file, fh, p); |
769 | dbgarg (cmd, "count=%d, type=%s, memory=%s\n", | 1103 | dbgarg (cmd, "count=%d, type=%s, memory=%s\n", |
770 | p->count, | 1104 | p->count, |
771 | prt_names(p->type,v4l2_type_names_FIXME), | 1105 | prt_names(p->type, v4l2_type_names), |
772 | prt_names(p->memory,v4l2_memory_names)); | 1106 | prt_names(p->memory, v4l2_memory_names)); |
773 | break; | 1107 | break; |
774 | } | 1108 | } |
775 | case VIDIOC_QUERYBUF: | 1109 | case VIDIOC_QUERYBUF: |
@@ -858,7 +1192,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
858 | enum v4l2_buf_type i = *(int *)arg; | 1192 | enum v4l2_buf_type i = *(int *)arg; |
859 | if (!vfd->vidioc_streamon) | 1193 | if (!vfd->vidioc_streamon) |
860 | break; | 1194 | break; |
861 | dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); | 1195 | dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); |
862 | ret=vfd->vidioc_streamon(file, fh,i); | 1196 | ret=vfd->vidioc_streamon(file, fh,i); |
863 | break; | 1197 | break; |
864 | } | 1198 | } |
@@ -868,7 +1202,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
868 | 1202 | ||
869 | if (!vfd->vidioc_streamoff) | 1203 | if (!vfd->vidioc_streamoff) |
870 | break; | 1204 | break; |
871 | dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME)); | 1205 | dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); |
872 | ret=vfd->vidioc_streamoff(file, fh, i); | 1206 | ret=vfd->vidioc_streamoff(file, fh, i); |
873 | break; | 1207 | break; |
874 | } | 1208 | } |
@@ -1624,7 +1958,7 @@ out: | |||
1624 | kfree(mbuf); | 1958 | kfree(mbuf); |
1625 | return err; | 1959 | return err; |
1626 | } | 1960 | } |
1627 | 1961 | EXPORT_SYMBOL(video_ioctl2); | |
1628 | 1962 | ||
1629 | static const struct file_operations video_fops; | 1963 | static const struct file_operations video_fops; |
1630 | 1964 | ||
@@ -1743,6 +2077,7 @@ fail_minor: | |||
1743 | mutex_unlock(&videodev_lock); | 2077 | mutex_unlock(&videodev_lock); |
1744 | return ret; | 2078 | return ret; |
1745 | } | 2079 | } |
2080 | EXPORT_SYMBOL(video_register_device); | ||
1746 | 2081 | ||
1747 | /** | 2082 | /** |
1748 | * video_unregister_device - unregister a video4linux device | 2083 | * video_unregister_device - unregister a video4linux device |
@@ -1762,6 +2097,7 @@ void video_unregister_device(struct video_device *vfd) | |||
1762 | device_unregister(&vfd->class_dev); | 2097 | device_unregister(&vfd->class_dev); |
1763 | mutex_unlock(&videodev_lock); | 2098 | mutex_unlock(&videodev_lock); |
1764 | } | 2099 | } |
2100 | EXPORT_SYMBOL(video_unregister_device); | ||
1765 | 2101 | ||
1766 | /* | 2102 | /* |
1767 | * Video fs operations | 2103 | * Video fs operations |
@@ -1806,16 +2142,6 @@ static void __exit videodev_exit(void) | |||
1806 | module_init(videodev_init) | 2142 | module_init(videodev_init) |
1807 | module_exit(videodev_exit) | 2143 | module_exit(videodev_exit) |
1808 | 2144 | ||
1809 | EXPORT_SYMBOL(video_register_device); | ||
1810 | EXPORT_SYMBOL(video_unregister_device); | ||
1811 | EXPORT_SYMBOL(video_devdata); | ||
1812 | EXPORT_SYMBOL(video_usercopy); | ||
1813 | EXPORT_SYMBOL(video_exclusive_open); | ||
1814 | EXPORT_SYMBOL(video_exclusive_release); | ||
1815 | EXPORT_SYMBOL(video_ioctl2); | ||
1816 | EXPORT_SYMBOL(video_device_alloc); | ||
1817 | EXPORT_SYMBOL(video_device_release); | ||
1818 | |||
1819 | MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); | 2145 | MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); |
1820 | MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); | 2146 | MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); |
1821 | MODULE_LICENSE("GPL"); | 2147 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index 937c4a616c0e..498a43c1f2b1 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -221,15 +221,15 @@ enum zoran_map_mode { | |||
221 | }; | 221 | }; |
222 | 222 | ||
223 | enum gpio_type { | 223 | enum gpio_type { |
224 | GPIO_JPEG_SLEEP = 0, | 224 | ZR_GPIO_JPEG_SLEEP = 0, |
225 | GPIO_JPEG_RESET, | 225 | ZR_GPIO_JPEG_RESET, |
226 | GPIO_JPEG_FRAME, | 226 | ZR_GPIO_JPEG_FRAME, |
227 | GPIO_VID_DIR, | 227 | ZR_GPIO_VID_DIR, |
228 | GPIO_VID_EN, | 228 | ZR_GPIO_VID_EN, |
229 | GPIO_VID_RESET, | 229 | ZR_GPIO_VID_RESET, |
230 | GPIO_CLK_SEL1, | 230 | ZR_GPIO_CLK_SEL1, |
231 | GPIO_CLK_SEL2, | 231 | ZR_GPIO_CLK_SEL2, |
232 | GPIO_MAX, | 232 | ZR_GPIO_MAX, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | enum gpcs_type { | 235 | enum gpcs_type { |
@@ -378,11 +378,11 @@ struct card_info { | |||
378 | 378 | ||
379 | u32 jpeg_int; /* JPEG interrupt */ | 379 | u32 jpeg_int; /* JPEG interrupt */ |
380 | u32 vsync_int; /* VSYNC interrupt */ | 380 | u32 vsync_int; /* VSYNC interrupt */ |
381 | s8 gpio[GPIO_MAX]; | 381 | s8 gpio[ZR_GPIO_MAX]; |
382 | u8 gpcs[GPCS_MAX]; | 382 | u8 gpcs[GPCS_MAX]; |
383 | 383 | ||
384 | struct vfe_polarity vfe_pol; | 384 | struct vfe_polarity vfe_pol; |
385 | u8 gpio_pol[GPIO_MAX]; | 385 | u8 gpio_pol[ZR_GPIO_MAX]; |
386 | 386 | ||
387 | /* is the /GWS line conected? */ | 387 | /* is the /GWS line conected? */ |
388 | u8 gws_not_connected; | 388 | u8 gws_not_connected; |
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 68c7c505587e..f97c20692057 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -250,7 +250,7 @@ void | |||
250 | jpeg_codec_sleep (struct zoran *zr, | 250 | jpeg_codec_sleep (struct zoran *zr, |
251 | int sleep) | 251 | int sleep) |
252 | { | 252 | { |
253 | GPIO(zr, zr->card.gpio[GPIO_JPEG_SLEEP], !sleep); | 253 | GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_SLEEP], !sleep); |
254 | if (!sleep) { | 254 | if (!sleep) { |
255 | dprintk(3, | 255 | dprintk(3, |
256 | KERN_DEBUG | 256 | KERN_DEBUG |
@@ -277,9 +277,9 @@ jpeg_codec_reset (struct zoran *zr) | |||
277 | 0); | 277 | 0); |
278 | udelay(2); | 278 | udelay(2); |
279 | } else { | 279 | } else { |
280 | GPIO(zr, zr->card.gpio[GPIO_JPEG_RESET], 0); | 280 | GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_RESET], 0); |
281 | udelay(2); | 281 | udelay(2); |
282 | GPIO(zr, zr->card.gpio[GPIO_JPEG_RESET], 1); | 282 | GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_RESET], 1); |
283 | udelay(2); | 283 | udelay(2); |
284 | } | 284 | } |
285 | 285 | ||
@@ -688,7 +688,7 @@ static inline void | |||
688 | set_frame (struct zoran *zr, | 688 | set_frame (struct zoran *zr, |
689 | int val) | 689 | int val) |
690 | { | 690 | { |
691 | GPIO(zr, zr->card.gpio[GPIO_JPEG_FRAME], val); | 691 | GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_FRAME], val); |
692 | } | 692 | } |
693 | 693 | ||
694 | static void | 694 | static void |
@@ -704,8 +704,8 @@ set_videobus_dir (struct zoran *zr, | |||
704 | GPIO(zr, 5, 1); | 704 | GPIO(zr, 5, 1); |
705 | break; | 705 | break; |
706 | default: | 706 | default: |
707 | GPIO(zr, zr->card.gpio[GPIO_VID_DIR], | 707 | GPIO(zr, zr->card.gpio[ZR_GPIO_VID_DIR], |
708 | zr->card.gpio_pol[GPIO_VID_DIR] ? !val : val); | 708 | zr->card.gpio_pol[ZR_GPIO_VID_DIR] ? !val : val); |
709 | break; | 709 | break; |
710 | } | 710 | } |
711 | } | 711 | } |
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index 1fdbb46de7f3..1b44784d0efb 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -93,6 +93,8 @@ static struct usb_device_id device_table[] = { | |||
93 | {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, | 93 | {USB_DEVICE(0x06d6, 0x0034), .driver_info = METHOD0 }, |
94 | {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, | 94 | {USB_DEVICE(0x0a17, 0x0062), .driver_info = METHOD2 }, |
95 | {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 }, | 95 | {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 }, |
96 | {USB_DEVICE(0x0a17, 0x004e), .driver_info = METHOD2 }, | ||
97 | {USB_DEVICE(0x041e, 0x405d), .driver_info = METHOD2 }, | ||
96 | {} /* Terminating entry */ | 98 | {} /* Terminating entry */ |
97 | }; | 99 | }; |
98 | 100 | ||
diff --git a/include/linux/videodev.h b/include/linux/videodev.h index 52e3d5fd5be4..9385a566aed8 100644 --- a/include/linux/videodev.h +++ b/include/linux/videodev.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifndef __LINUX_VIDEODEV_H | 12 | #ifndef __LINUX_VIDEODEV_H |
13 | #define __LINUX_VIDEODEV_H | 13 | #define __LINUX_VIDEODEV_H |
14 | 14 | ||
15 | #include <linux/ioctl.h> | ||
15 | #include <linux/videodev2.h> | 16 | #include <linux/videodev2.h> |
16 | 17 | ||
17 | #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) | 18 | #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 439474f24e34..17a80177a674 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #define __user | 62 | #define __user |
63 | #include <sys/time.h> | 63 | #include <sys/time.h> |
64 | #endif | 64 | #endif |
65 | #include <linux/ioctl.h> | ||
65 | #include <linux/types.h> | 66 | #include <linux/types.h> |
66 | 67 | ||
67 | /* | 68 | /* |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 831547d79683..a4274203f252 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -142,6 +142,7 @@ extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; | |||
142 | extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; | 142 | extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; |
143 | extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; | 143 | extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; |
144 | extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; | 144 | extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; |
145 | extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; | ||
145 | 146 | ||
146 | #endif | 147 | #endif |
147 | 148 | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 475d0d8275e0..316a58453134 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -61,8 +61,6 @@ | |||
61 | v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ | 61 | v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ |
62 | } while (0) | 62 | } while (0) |
63 | 63 | ||
64 | /* Prints the ioctl in a human-readable format */ | ||
65 | extern void v4l_printk_ioctl(unsigned int cmd); | ||
66 | 64 | ||
67 | /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ | 65 | /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ |
68 | #define v4l_print_ioctl(name, cmd) \ | 66 | #define v4l_print_ioctl(name, cmd) \ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index c544c6f90893..f2114459995d 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -44,6 +44,8 @@ extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs); | |||
44 | extern char *v4l2_norm_to_name(v4l2_std_id id); | 44 | extern char *v4l2_norm_to_name(v4l2_std_id id); |
45 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, | 45 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, |
46 | int id, char *name); | 46 | int id, char *name); |
47 | /* Prints the ioctl in a human-readable format */ | ||
48 | extern void v4l_printk_ioctl(unsigned int cmd); | ||
47 | 49 | ||
48 | /* prority handling */ | 50 | /* prority handling */ |
49 | struct v4l2_prio_state { | 51 | struct v4l2_prio_state { |
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 97f14d469595..99033945cdee 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
@@ -149,7 +149,7 @@ struct videobuf_qtype_ops { | |||
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct videobuf_queue { | 151 | struct videobuf_queue { |
152 | struct mutex lock; | 152 | struct mutex vb_lock; |
153 | spinlock_t *irqlock; | 153 | spinlock_t *irqlock; |
154 | void *dev; /* on pci, points to struct pci_dev */ | 154 | void *dev; /* on pci, points to struct pci_dev */ |
155 | 155 | ||
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index 26a8958d23d1..ec63ab0fab93 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | /* --------------------------------------------------------------------- */ | 18 | /* --------------------------------------------------------------------- */ |
19 | 19 | ||
20 | struct videbuf_vmalloc_memory | 20 | struct videobuf_vmalloc_memory |
21 | { | 21 | { |
22 | u32 magic; | 22 | u32 magic; |
23 | 23 | ||