aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c2
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c22
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c2
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c2
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c40
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.h12
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/arv.c6
-rw-r--r--drivers/media/video/bt832.c2
-rw-r--r--drivers/media/video/btcx-risc.c2
-rw-r--r--drivers/media/video/bttv-cards.c6
-rw-r--r--drivers/media/video/bttv-driver.c87
-rw-r--r--drivers/media/video/bttv-i2c.c6
-rw-r--r--drivers/media/video/bttvp.h5
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/video/cx88/Kconfig3
-rw-r--r--drivers/media/video/cx88/Makefile1
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c9
-rw-r--r--drivers/media/video/cx88/cx88-core.c15
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c8
-rw-r--r--drivers/media/video/cx88/cx88-vp3054-i2c.c4
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c77
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c7
-rw-r--r--drivers/media/video/msp3400-driver.c14
-rw-r--r--drivers/media/video/msp3400.h8
-rw-r--r--drivers/media/video/mt20xx.c12
-rw-r--r--drivers/media/video/planb.c4
-rw-r--r--drivers/media/video/saa6588.c10
-rw-r--r--drivers/media/video/saa711x.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c21
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c11
-rw-r--r--drivers/media/video/tda8290.c4
-rw-r--r--drivers/media/video/tea5767.c18
-rw-r--r--drivers/media/video/tuner-core.c85
-rw-r--r--drivers/media/video/tuner-simple.c794
-rw-r--r--drivers/media/video/tuner-types.c1406
-rw-r--r--drivers/media/video/tveeprom.c2
-rw-r--r--drivers/media/video/tvp5150.c2
-rw-r--r--drivers/media/video/v4l2-common.c1
-rw-r--r--drivers/media/video/videodev.c25
42 files changed, 1786 insertions, 966 deletions
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index f29571450038..a04bb61f21f4 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -542,7 +542,7 @@ static struct pci_driver bt878_pci_driver = {
542 .remove = bt878_remove, 542 .remove = bt878_remove,
543}; 543};
544 544
545static int bt878_pci_driver_registered = 0; 545static int bt878_pci_driver_registered;
546 546
547/*******************************/ 547/*******************************/
548/* Module management functions */ 548/* Module management functions */
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 06b696e9acbd..54f8b95717b0 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -33,7 +33,7 @@
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/fs.h> 34#include <linux/fs.h>
35#include <linux/cdev.h> 35#include <linux/cdev.h>
36 36#include <linux/mutex.h>
37#include "dvbdev.h" 37#include "dvbdev.h"
38 38
39static int dvbdev_debug; 39static int dvbdev_debug;
@@ -44,7 +44,7 @@ MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off).");
44#define dprintk if (dvbdev_debug) printk 44#define dprintk if (dvbdev_debug) printk
45 45
46static LIST_HEAD(dvb_adapter_list); 46static LIST_HEAD(dvb_adapter_list);
47static DECLARE_MUTEX(dvbdev_register_lock); 47static DEFINE_MUTEX(dvbdev_register_lock);
48 48
49static const char * const dnames[] = { 49static const char * const dnames[] = {
50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca", 50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca",
@@ -202,11 +202,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
202 struct dvb_device *dvbdev; 202 struct dvb_device *dvbdev;
203 int id; 203 int id;
204 204
205 if (down_interruptible (&dvbdev_register_lock)) 205 if (mutex_lock_interruptible(&dvbdev_register_lock))
206 return -ERESTARTSYS; 206 return -ERESTARTSYS;
207 207
208 if ((id = dvbdev_get_free_id (adap, type)) < 0) { 208 if ((id = dvbdev_get_free_id (adap, type)) < 0) {
209 up (&dvbdev_register_lock); 209 mutex_unlock(&dvbdev_register_lock);
210 *pdvbdev = NULL; 210 *pdvbdev = NULL;
211 printk ("%s: could get find free device id...\n", __FUNCTION__); 211 printk ("%s: could get find free device id...\n", __FUNCTION__);
212 return -ENFILE; 212 return -ENFILE;
@@ -215,11 +215,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
215 *pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL); 215 *pdvbdev = dvbdev = kmalloc(sizeof(struct dvb_device), GFP_KERNEL);
216 216
217 if (!dvbdev) { 217 if (!dvbdev) {
218 up(&dvbdev_register_lock); 218 mutex_unlock(&dvbdev_register_lock);
219 return -ENOMEM; 219 return -ENOMEM;
220 } 220 }
221 221
222 up (&dvbdev_register_lock); 222 mutex_unlock(&dvbdev_register_lock);
223 223
224 memcpy(dvbdev, template, sizeof(struct dvb_device)); 224 memcpy(dvbdev, template, sizeof(struct dvb_device));
225 dvbdev->type = type; 225 dvbdev->type = type;
@@ -289,11 +289,11 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
289{ 289{
290 int num; 290 int num;
291 291
292 if (down_interruptible (&dvbdev_register_lock)) 292 if (mutex_lock_interruptible(&dvbdev_register_lock))
293 return -ERESTARTSYS; 293 return -ERESTARTSYS;
294 294
295 if ((num = dvbdev_get_free_adapter_num ()) < 0) { 295 if ((num = dvbdev_get_free_adapter_num ()) < 0) {
296 up (&dvbdev_register_lock); 296 mutex_unlock(&dvbdev_register_lock);
297 return -ENFILE; 297 return -ENFILE;
298 } 298 }
299 299
@@ -309,7 +309,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
309 309
310 list_add_tail (&adap->list_head, &dvb_adapter_list); 310 list_add_tail (&adap->list_head, &dvb_adapter_list);
311 311
312 up (&dvbdev_register_lock); 312 mutex_unlock(&dvbdev_register_lock);
313 313
314 return num; 314 return num;
315} 315}
@@ -320,10 +320,10 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
320{ 320{
321 devfs_remove("dvb/adapter%d", adap->num); 321 devfs_remove("dvb/adapter%d", adap->num);
322 322
323 if (down_interruptible (&dvbdev_register_lock)) 323 if (mutex_lock_interruptible(&dvbdev_register_lock))
324 return -ERESTARTSYS; 324 return -ERESTARTSYS;
325 list_del (&adap->list_head); 325 list_del (&adap->list_head);
326 up (&dvbdev_register_lock); 326 mutex_unlock(&dvbdev_register_lock);
327 return 0; 327 return 0;
328} 328}
329EXPORT_SYMBOL(dvb_unregister_adapter); 329EXPORT_SYMBOL(dvb_unregister_adapter);
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 18d169836c9c..a7fb06f4cd34 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -691,6 +691,8 @@ module_init (cxusb_module_init);
691module_exit (cxusb_module_exit); 691module_exit (cxusb_module_exit);
692 692
693MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 693MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
694MODULE_AUTHOR("Michael Krufky <mkrufky@m1k.net>");
695MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
694MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design"); 696MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
695MODULE_VERSION("1.0-alpha"); 697MODULE_VERSION("1.0-alpha");
696MODULE_LICENSE("GPL"); 698MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index 757075f007c1..1b9934ea5b06 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -333,7 +333,7 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = {
333 .name = "Samsung TBMV30111IN", 333 .name = "Samsung TBMV30111IN",
334 .min = 54000000, 334 .min = 54000000,
335 .max = 860000000, 335 .max = 860000000,
336 .count = 4, 336 .count = 6,
337 .entries = { 337 .entries = {
338 { 172000000, 44000000, 166666, 0xb4, 0x01 }, 338 { 172000000, 44000000, 166666, 0xb4, 0x01 },
339 { 214000000, 44000000, 166666, 0xb4, 0x02 }, 339 { 214000000, 44000000, 166666, 0xb4, 0x02 },
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 327a8089193b..27494901975f 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -81,7 +81,7 @@ static int adac = DVB_ADAC_TI;
81static int hw_sections; 81static int hw_sections;
82static int rgb_on; 82static int rgb_on;
83static int volume = 255; 83static int volume = 255;
84static int budgetpatch = 0; 84static int budgetpatch;
85 85
86module_param_named(debug, av7110_debug, int, 0644); 86module_param_named(debug, av7110_debug, int, 0644);
87MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)"); 87MODULE_PARM_DESC(debug, "debug level (bitmask, default 0)");
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(budgetpatch, "use budget-patch hardware modification: default 0
103 103
104static void restart_feeds(struct av7110 *av7110); 104static void restart_feeds(struct av7110 *av7110);
105 105
106static int av7110_num = 0; 106static int av7110_num;
107 107
108#define FE_FUNC_OVERRIDE(fe_func, av7110_copy, av7110_func) \ 108#define FE_FUNC_OVERRIDE(fe_func, av7110_copy, av7110_func) \
109{\ 109{\
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index cb377452b57d..b2e63e9fc053 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -146,52 +146,52 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len)
146{ 146{
147 int i; 147 int i;
148 int blocks, rest; 148 int blocks, rest;
149 u32 base, bootblock = BOOT_BLOCK; 149 u32 base, bootblock = AV7110_BOOT_BLOCK;
150 150
151 dprintk(4, "%p\n", av7110); 151 dprintk(4, "%p\n", av7110);
152 152
153 blocks = len / BOOT_MAX_SIZE; 153 blocks = len / AV7110_BOOT_MAX_SIZE;
154 rest = len % BOOT_MAX_SIZE; 154 rest = len % AV7110_BOOT_MAX_SIZE;
155 base = DRAM_START_CODE; 155 base = DRAM_START_CODE;
156 156
157 for (i = 0; i < blocks; i++) { 157 for (i = 0; i < blocks; i++) {
158 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 158 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
159 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i); 159 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at block %d\n", i);
160 return -ETIMEDOUT; 160 return -ETIMEDOUT;
161 } 161 }
162 dprintk(4, "writing DRAM block %d\n", i); 162 dprintk(4, "writing DRAM block %d\n", i);
163 mwdebi(av7110, DEBISWAB, bootblock, 163 mwdebi(av7110, DEBISWAB, bootblock,
164 ((char*)data) + i * BOOT_MAX_SIZE, BOOT_MAX_SIZE); 164 ((char*)data) + i * AV7110_BOOT_MAX_SIZE, AV7110_BOOT_MAX_SIZE);
165 bootblock ^= 0x1400; 165 bootblock ^= 0x1400;
166 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); 166 iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4);
167 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, BOOT_MAX_SIZE, 2); 167 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, AV7110_BOOT_MAX_SIZE, 2);
168 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 168 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
169 base += BOOT_MAX_SIZE; 169 base += AV7110_BOOT_MAX_SIZE;
170 } 170 }
171 171
172 if (rest > 0) { 172 if (rest > 0) {
173 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 173 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
174 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n"); 174 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout at last block\n");
175 return -ETIMEDOUT; 175 return -ETIMEDOUT;
176 } 176 }
177 if (rest > 4) 177 if (rest > 4)
178 mwdebi(av7110, DEBISWAB, bootblock, 178 mwdebi(av7110, DEBISWAB, bootblock,
179 ((char*)data) + i * BOOT_MAX_SIZE, rest); 179 ((char*)data) + i * AV7110_BOOT_MAX_SIZE, rest);
180 else 180 else
181 mwdebi(av7110, DEBISWAB, bootblock, 181 mwdebi(av7110, DEBISWAB, bootblock,
182 ((char*)data) + i * BOOT_MAX_SIZE - 4, rest + 4); 182 ((char*)data) + i * AV7110_BOOT_MAX_SIZE - 4, rest + 4);
183 183
184 iwdebi(av7110, DEBISWAB, BOOT_BASE, swab32(base), 4); 184 iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4);
185 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, rest, 2); 185 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, rest, 2);
186 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 186 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
187 } 187 }
188 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) { 188 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0) {
189 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n"); 189 printk(KERN_ERR "dvb-ttpci: load_dram(): timeout after last block\n");
190 return -ETIMEDOUT; 190 return -ETIMEDOUT;
191 } 191 }
192 iwdebi(av7110, DEBINOSWAP, BOOT_SIZE, 0, 2); 192 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, 0, 2);
193 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 193 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
194 if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BOOT_COMPLETE) < 0) { 194 if (waitdebi(av7110, AV7110_BOOT_STATE, BOOTSTATE_AV7110_BOOT_COMPLETE) < 0) {
195 printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n"); 195 printk(KERN_ERR "dvb-ttpci: load_dram(): final handshake timeout\n");
196 return -ETIMEDOUT; 196 return -ETIMEDOUT;
197 } 197 }
@@ -262,7 +262,7 @@ int av7110_bootarm(struct av7110 *av7110)
262 //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT); 262 //saa7146_setgpio(dev, 3, SAA7146_GPIO_INPUT);
263 263
264 mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode)); 264 mwdebi(av7110, DEBISWAB, DPRAM_BASE, bootcode, sizeof(bootcode));
265 iwdebi(av7110, DEBINOSWAP, BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2); 265 iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_STATE, BOOTSTATE_BUFFER_FULL, 2);
266 266
267 if (saa7146_wait_for_debi_done(av7110->dev, 1)) { 267 if (saa7146_wait_for_debi_done(av7110->dev, 1)) {
268 printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): " 268 printk(KERN_ERR "dvb-ttpci: av7110_bootarm(): "
diff --git a/drivers/media/dvb/ttpci/av7110_hw.h b/drivers/media/dvb/ttpci/av7110_hw.h
index 84b83299b8be..4e173c67fbb2 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.h
+++ b/drivers/media/dvb/ttpci/av7110_hw.h
@@ -18,7 +18,7 @@ enum av7110_bootstate
18{ 18{
19 BOOTSTATE_BUFFER_EMPTY = 0, 19 BOOTSTATE_BUFFER_EMPTY = 0,
20 BOOTSTATE_BUFFER_FULL = 1, 20 BOOTSTATE_BUFFER_FULL = 1,
21 BOOTSTATE_BOOT_COMPLETE = 2 21 BOOTSTATE_AV7110_BOOT_COMPLETE = 2
22}; 22};
23 23
24enum av7110_type_rec_play_format 24enum av7110_type_rec_play_format
@@ -295,11 +295,11 @@ enum av7110_command_type {
295#define DPRAM_BASE 0x4000 295#define DPRAM_BASE 0x4000
296 296
297/* boot protocol area */ 297/* boot protocol area */
298#define BOOT_STATE (DPRAM_BASE + 0x3F8) 298#define AV7110_BOOT_STATE (DPRAM_BASE + 0x3F8)
299#define BOOT_SIZE (DPRAM_BASE + 0x3FA) 299#define AV7110_BOOT_SIZE (DPRAM_BASE + 0x3FA)
300#define BOOT_BASE (DPRAM_BASE + 0x3FC) 300#define AV7110_BOOT_BASE (DPRAM_BASE + 0x3FC)
301#define BOOT_BLOCK (DPRAM_BASE + 0x400) 301#define AV7110_BOOT_BLOCK (DPRAM_BASE + 0x400)
302#define BOOT_MAX_SIZE 0xc00 302#define AV7110_BOOT_MAX_SIZE 0xc00
303 303
304/* firmware command protocol area */ 304/* firmware command protocol area */
305#define IRQ_STATE (DPRAM_BASE + 0x0F4) 305#define IRQ_STATE (DPRAM_BASE + 0x0F4)
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index dd24896906fe..faf728366c4e 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -8,7 +8,8 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \
8zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o 8zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
9zr36067-objs := zoran_procfs.o zoran_device.o \ 9zr36067-objs := zoran_procfs.o zoran_device.o \
10 zoran_driver.o zoran_card.o 10 zoran_driver.o zoran_card.o
11tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o 11tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \
12 mt20xx.o tda8290.o tea5767.o
12 13
13msp3400-objs := msp3400-driver.o msp3400-kthreads.o 14msp3400-objs := msp3400-driver.o msp3400-kthreads.o
14 15
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 7d5a068353f2..994b75fe165a 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -129,9 +129,9 @@ static unsigned char yuv[MAX_AR_FRAME_BYTES];
129static int freq = DEFAULT_FREQ; /* BCLK: available 50 or 70 (MHz) */ 129static int freq = DEFAULT_FREQ; /* BCLK: available 50 or 70 (MHz) */
130static int vga = 0; /* default mode(0:QVGA mode, other:VGA mode) */ 130static int vga = 0; /* default mode(0:QVGA mode, other:VGA mode) */
131static int vga_interlace = 0; /* 0 is normal mode for, else interlace mode */ 131static int vga_interlace = 0; /* 0 is normal mode for, else interlace mode */
132MODULE_PARM(freq, "i"); 132module_param(freq, int, 0);
133MODULE_PARM(vga, "i"); 133module_param(vga, int, 0);
134MODULE_PARM(vga_interlace, "i"); 134module_param(vga_interlace, int, 0);
135 135
136static int ar_initialize(struct video_device *dev); 136static int ar_initialize(struct video_device *dev);
137 137
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index 07c78f1f7a44..cc54b62f4601 100644
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -43,7 +43,7 @@ static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1,
43 I2C_CLIENT_END }; 43 I2C_CLIENT_END };
44I2C_CLIENT_INSMOD; 44I2C_CLIENT_INSMOD;
45 45
46int debug = 0; /* debug output */ 46int debug; /* debug output */
47module_param(debug, int, 0644); 47module_param(debug, int, 0644);
48 48
49/* ---------------------------------------------------------------------- */ 49/* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c
index a48de3c0e3f0..b4aca7249276 100644
--- a/drivers/media/video/btcx-risc.c
+++ b/drivers/media/video/btcx-risc.c
@@ -37,7 +37,7 @@ MODULE_DESCRIPTION("some code shared by bttv and cx88xx drivers");
37MODULE_AUTHOR("Gerd Knorr"); 37MODULE_AUTHOR("Gerd Knorr");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40static unsigned int debug = 0; 40static unsigned int debug;
41module_param(debug, int, 0644); 41module_param(debug, int, 0644);
42MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)"); 42MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");
43 43
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 65323e78d5fd..9749d6ed6231 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -92,8 +92,8 @@ static void identify_by_eeprom(struct bttv *btv,
92static int __devinit pvr_boot(struct bttv *btv); 92static int __devinit pvr_boot(struct bttv *btv);
93 93
94/* config variables */ 94/* config variables */
95static unsigned int triton1=0; 95static unsigned int triton1;
96static unsigned int vsfx=0; 96static unsigned int vsfx;
97static unsigned int latency = UNSET; 97static unsigned int latency = UNSET;
98int no_overlay=-1; 98int no_overlay=-1;
99 99
@@ -106,7 +106,7 @@ static struct bttv *master[BTTV_MAX] = { [ 0 ... (BTTV_MAX-1) ] = NULL };
106#ifdef MODULE 106#ifdef MODULE
107static unsigned int autoload = 1; 107static unsigned int autoload = 1;
108#else 108#else
109static unsigned int autoload = 0; 109static unsigned int autoload;
110#endif 110#endif
111static unsigned int gpiomask = UNSET; 111static unsigned int gpiomask = UNSET;
112static unsigned int audioall = UNSET; 112static unsigned int audioall = UNSET;
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 0e6970346788..aa4c4c521880 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -48,47 +48,46 @@
48unsigned int bttv_num; /* number of Bt848s in use */ 48unsigned int bttv_num; /* number of Bt848s in use */
49struct bttv bttvs[BTTV_MAX]; 49struct bttv bttvs[BTTV_MAX];
50 50
51unsigned int bttv_debug = 0; 51unsigned int bttv_debug;
52unsigned int bttv_verbose = 1; 52unsigned int bttv_verbose = 1;
53unsigned int bttv_gpio = 0; 53unsigned int bttv_gpio;
54 54
55/* config variables */ 55/* config variables */
56#ifdef __BIG_ENDIAN 56#ifdef __BIG_ENDIAN
57static unsigned int bigendian=1; 57static unsigned int bigendian=1;
58#else 58#else
59static unsigned int bigendian=0; 59static unsigned int bigendian;
60#endif 60#endif
61static unsigned int radio[BTTV_MAX]; 61static unsigned int radio[BTTV_MAX];
62static unsigned int irq_debug = 0; 62static unsigned int irq_debug;
63static unsigned int gbuffers = 8; 63static unsigned int gbuffers = 8;
64static unsigned int gbufsize = 0x208000; 64static unsigned int gbufsize = 0x208000;
65 65
66static int video_nr = -1; 66static int video_nr = -1;
67static int radio_nr = -1; 67static int radio_nr = -1;
68static int vbi_nr = -1; 68static int vbi_nr = -1;
69static int debug_latency = 0; 69static int debug_latency;
70 70
71static unsigned int fdsr = 0; 71static unsigned int fdsr;
72 72
73/* options */ 73/* options */
74static unsigned int combfilter = 0; 74static unsigned int combfilter;
75static unsigned int lumafilter = 0; 75static unsigned int lumafilter;
76static unsigned int automute = 1; 76static unsigned int automute = 1;
77static unsigned int chroma_agc = 0; 77static unsigned int chroma_agc;
78static unsigned int adc_crush = 1; 78static unsigned int adc_crush = 1;
79static unsigned int whitecrush_upper = 0xCF; 79static unsigned int whitecrush_upper = 0xCF;
80static unsigned int whitecrush_lower = 0x7F; 80static unsigned int whitecrush_lower = 0x7F;
81static unsigned int vcr_hack = 0; 81static unsigned int vcr_hack;
82static unsigned int irq_iswitch = 0; 82static unsigned int irq_iswitch;
83static unsigned int uv_ratio = 50; 83static unsigned int uv_ratio = 50;
84static unsigned int full_luma_range = 0; 84static unsigned int full_luma_range;
85static unsigned int coring = 0; 85static unsigned int coring;
86extern int no_overlay; 86extern int no_overlay;
87 87
88/* API features (turn on/off stuff for testing) */ 88/* API features (turn on/off stuff for testing) */
89static unsigned int v4l2 = 1; 89static unsigned int v4l2 = 1;
90 90
91
92/* insmod args */ 91/* insmod args */
93module_param(bttv_verbose, int, 0644); 92module_param(bttv_verbose, int, 0644);
94module_param(bttv_gpio, int, 0644); 93module_param(bttv_gpio, int, 0644);
@@ -685,16 +684,16 @@ int check_alloc_btres(struct bttv *btv, struct bttv_fh *fh, int bit)
685 return 1; 684 return 1;
686 685
687 /* is it free? */ 686 /* is it free? */
688 down(&btv->reslock); 687 mutex_lock(&btv->reslock);
689 if (btv->resources & bit) { 688 if (btv->resources & bit) {
690 /* no, someone else uses it */ 689 /* no, someone else uses it */
691 up(&btv->reslock); 690 mutex_unlock(&btv->reslock);
692 return 0; 691 return 0;
693 } 692 }
694 /* it's free, grab it */ 693 /* it's free, grab it */
695 fh->resources |= bit; 694 fh->resources |= bit;
696 btv->resources |= bit; 695 btv->resources |= bit;
697 up(&btv->reslock); 696 mutex_unlock(&btv->reslock);
698 return 1; 697 return 1;
699} 698}
700 699
@@ -717,10 +716,10 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
717 /* trying to free ressources not allocated by us ... */ 716 /* trying to free ressources not allocated by us ... */
718 printk("bttv: BUG! (btres)\n"); 717 printk("bttv: BUG! (btres)\n");
719 } 718 }
720 down(&btv->reslock); 719 mutex_lock(&btv->reslock);
721 fh->resources &= ~bits; 720 fh->resources &= ~bits;
722 btv->resources &= ~bits; 721 btv->resources &= ~bits;
723 up(&btv->reslock); 722 mutex_unlock(&btv->reslock);
724} 723}
725 724
726/* ----------------------------------------------------------------------- */ 725/* ----------------------------------------------------------------------- */
@@ -1537,12 +1536,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1537 case VIDIOCSFREQ: 1536 case VIDIOCSFREQ:
1538 { 1537 {
1539 unsigned long *freq = arg; 1538 unsigned long *freq = arg;
1540 down(&btv->lock); 1539 mutex_lock(&btv->lock);
1541 btv->freq=*freq; 1540 btv->freq=*freq;
1542 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq); 1541 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq);
1543 if (btv->has_matchbox && btv->radio_user) 1542 if (btv->has_matchbox && btv->radio_user)
1544 tea5757_set_freq(btv,*freq); 1543 tea5757_set_freq(btv,*freq);
1545 up(&btv->lock); 1544 mutex_unlock(&btv->lock);
1546 return 0; 1545 return 0;
1547 } 1546 }
1548 1547
@@ -1572,10 +1571,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1572 if (v->mode >= BTTV_TVNORMS) 1571 if (v->mode >= BTTV_TVNORMS)
1573 return -EINVAL; 1572 return -EINVAL;
1574 1573
1575 down(&btv->lock); 1574 mutex_lock(&btv->lock);
1576 set_tvnorm(btv,v->mode); 1575 set_tvnorm(btv,v->mode);
1577 bttv_call_i2c_clients(btv,cmd,v); 1576 bttv_call_i2c_clients(btv,cmd,v);
1578 up(&btv->lock); 1577 mutex_unlock(&btv->lock);
1579 return 0; 1578 return 0;
1580 } 1579 }
1581 1580
@@ -1612,17 +1611,17 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1612 if (v->norm >= BTTV_TVNORMS) 1611 if (v->norm >= BTTV_TVNORMS)
1613 return -EINVAL; 1612 return -EINVAL;
1614 1613
1615 down(&btv->lock); 1614 mutex_lock(&btv->lock);
1616 if (channel == btv->input && 1615 if (channel == btv->input &&
1617 v->norm == btv->tvnorm) { 1616 v->norm == btv->tvnorm) {
1618 /* nothing to do */ 1617 /* nothing to do */
1619 up(&btv->lock); 1618 mutex_unlock(&btv->lock);
1620 return 0; 1619 return 0;
1621 } 1620 }
1622 1621
1623 btv->tvnorm = v->norm; 1622 btv->tvnorm = v->norm;
1624 set_input(btv,v->channel); 1623 set_input(btv,v->channel);
1625 up(&btv->lock); 1624 mutex_unlock(&btv->lock);
1626 return 0; 1625 return 0;
1627 } 1626 }
1628 1627
@@ -1635,14 +1634,14 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1635 v->flags |= VIDEO_AUDIO_MUTABLE; 1634 v->flags |= VIDEO_AUDIO_MUTABLE;
1636 v->mode = VIDEO_SOUND_MONO; 1635 v->mode = VIDEO_SOUND_MONO;
1637 1636
1638 down(&btv->lock); 1637 mutex_lock(&btv->lock);
1639 bttv_call_i2c_clients(btv,cmd,v); 1638 bttv_call_i2c_clients(btv,cmd,v);
1640 1639
1641 /* card specific hooks */ 1640 /* card specific hooks */
1642 if (btv->audio_hook) 1641 if (btv->audio_hook)
1643 btv->audio_hook(btv,v,0); 1642 btv->audio_hook(btv,v,0);
1644 1643
1645 up(&btv->lock); 1644 mutex_unlock(&btv->lock);
1646 return 0; 1645 return 0;
1647 } 1646 }
1648 case VIDIOCSAUDIO: 1647 case VIDIOCSAUDIO:
@@ -1653,7 +1652,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1653 if (audio >= bttv_tvcards[btv->c.type].audio_inputs) 1652 if (audio >= bttv_tvcards[btv->c.type].audio_inputs)
1654 return -EINVAL; 1653 return -EINVAL;
1655 1654
1656 down(&btv->lock); 1655 mutex_lock(&btv->lock);
1657 audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); 1656 audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE);
1658 bttv_call_i2c_clients(btv,cmd,v); 1657 bttv_call_i2c_clients(btv,cmd,v);
1659 1658
@@ -1661,7 +1660,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1661 if (btv->audio_hook) 1660 if (btv->audio_hook)
1662 btv->audio_hook(btv,v,1); 1661 btv->audio_hook(btv,v,1);
1663 1662
1664 up(&btv->lock); 1663 mutex_unlock(&btv->lock);
1665 return 0; 1664 return 0;
1666 } 1665 }
1667 1666
@@ -1695,10 +1694,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1695 if (i == BTTV_TVNORMS) 1694 if (i == BTTV_TVNORMS)
1696 return -EINVAL; 1695 return -EINVAL;
1697 1696
1698 down(&btv->lock); 1697 mutex_lock(&btv->lock);
1699 set_tvnorm(btv,i); 1698 set_tvnorm(btv,i);
1700 i2c_vidiocschan(btv); 1699 i2c_vidiocschan(btv);
1701 up(&btv->lock); 1700 mutex_unlock(&btv->lock);
1702 return 0; 1701 return 0;
1703 } 1702 }
1704 case VIDIOC_QUERYSTD: 1703 case VIDIOC_QUERYSTD:
@@ -1756,9 +1755,9 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1756 1755
1757 if (*i > bttv_tvcards[btv->c.type].video_inputs) 1756 if (*i > bttv_tvcards[btv->c.type].video_inputs)
1758 return -EINVAL; 1757 return -EINVAL;
1759 down(&btv->lock); 1758 mutex_lock(&btv->lock);
1760 set_input(btv,*i); 1759 set_input(btv,*i);
1761 up(&btv->lock); 1760 mutex_unlock(&btv->lock);
1762 return 0; 1761 return 0;
1763 } 1762 }
1764 1763
@@ -1770,7 +1769,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1770 return -EINVAL; 1769 return -EINVAL;
1771 if (0 != t->index) 1770 if (0 != t->index)
1772 return -EINVAL; 1771 return -EINVAL;
1773 down(&btv->lock); 1772 mutex_lock(&btv->lock);
1774 memset(t,0,sizeof(*t)); 1773 memset(t,0,sizeof(*t));
1775 strcpy(t->name, "Television"); 1774 strcpy(t->name, "Television");
1776 t->type = V4L2_TUNER_ANALOG_TV; 1775 t->type = V4L2_TUNER_ANALOG_TV;
@@ -1805,7 +1804,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1805 } 1804 }
1806 } 1805 }
1807 /* FIXME: fill capability+audmode */ 1806 /* FIXME: fill capability+audmode */
1808 up(&btv->lock); 1807 mutex_unlock(&btv->lock);
1809 return 0; 1808 return 0;
1810 } 1809 }
1811 case VIDIOC_S_TUNER: 1810 case VIDIOC_S_TUNER:
@@ -1816,7 +1815,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1816 return -EINVAL; 1815 return -EINVAL;
1817 if (0 != t->index) 1816 if (0 != t->index)
1818 return -EINVAL; 1817 return -EINVAL;
1819 down(&btv->lock); 1818 mutex_lock(&btv->lock);
1820 { 1819 {
1821 struct video_audio va; 1820 struct video_audio va;
1822 memset(&va, 0, sizeof(struct video_audio)); 1821 memset(&va, 0, sizeof(struct video_audio));
@@ -1833,7 +1832,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1833 if (btv->audio_hook) 1832 if (btv->audio_hook)
1834 btv->audio_hook(btv,&va,1); 1833 btv->audio_hook(btv,&va,1);
1835 } 1834 }
1836 up(&btv->lock); 1835 mutex_unlock(&btv->lock);
1837 return 0; 1836 return 0;
1838 } 1837 }
1839 1838
@@ -1854,12 +1853,12 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1854 return -EINVAL; 1853 return -EINVAL;
1855 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV)) 1854 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))
1856 return -EINVAL; 1855 return -EINVAL;
1857 down(&btv->lock); 1856 mutex_lock(&btv->lock);
1858 btv->freq = f->frequency; 1857 btv->freq = f->frequency;
1859 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq); 1858 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq);
1860 if (btv->has_matchbox && btv->radio_user) 1859 if (btv->has_matchbox && btv->radio_user)
1861 tea5757_set_freq(btv,btv->freq); 1860 tea5757_set_freq(btv,btv->freq);
1862 up(&btv->lock); 1861 mutex_unlock(&btv->lock);
1863 return 0; 1862 return 0;
1864 } 1863 }
1865 case VIDIOC_LOG_STATUS: 1864 case VIDIOC_LOG_STATUS:
@@ -3157,7 +3156,7 @@ static int radio_open(struct inode *inode, struct file *file)
3157 return -ENODEV; 3156 return -ENODEV;
3158 3157
3159 dprintk("bttv%d: open called (radio)\n",btv->c.nr); 3158 dprintk("bttv%d: open called (radio)\n",btv->c.nr);
3160 down(&btv->lock); 3159 mutex_lock(&btv->lock);
3161 3160
3162 btv->radio_user++; 3161 btv->radio_user++;
3163 3162
@@ -3166,7 +3165,7 @@ static int radio_open(struct inode *inode, struct file *file)
3166 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); 3165 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);
3167 audio_mux(btv,AUDIO_RADIO); 3166 audio_mux(btv,AUDIO_RADIO);
3168 3167
3169 up(&btv->lock); 3168 mutex_unlock(&btv->lock);
3170 return 0; 3169 return 0;
3171} 3170}
3172 3171
@@ -3921,8 +3920,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
3921 sprintf(btv->c.name,"bttv%d",btv->c.nr); 3920 sprintf(btv->c.name,"bttv%d",btv->c.nr);
3922 3921
3923 /* initialize structs / fill in defaults */ 3922 /* initialize structs / fill in defaults */
3924 init_MUTEX(&btv->lock); 3923 mutex_init(&btv->lock);
3925 init_MUTEX(&btv->reslock); 3924 mutex_init(&btv->reslock);
3926 spin_lock_init(&btv->s_lock); 3925 spin_lock_init(&btv->s_lock);
3927 spin_lock_init(&btv->gpio_lock); 3926 spin_lock_init(&btv->gpio_lock);
3928 init_waitqueue_head(&btv->gpioq); 3927 init_waitqueue_head(&btv->gpioq);
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index 748d630c7fe4..614c12018557 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -41,9 +41,9 @@ static struct i2c_client bttv_i2c_client_template;
41 41
42static int attach_inform(struct i2c_client *client); 42static int attach_inform(struct i2c_client *client);
43 43
44static int i2c_debug = 0; 44static int i2c_debug;
45static int i2c_hw = 0; 45static int i2c_hw;
46static int i2c_scan = 0; 46static int i2c_scan;
47module_param(i2c_debug, int, 0644); 47module_param(i2c_debug, int, 0644);
48module_param(i2c_hw, int, 0444); 48module_param(i2c_hw, int, 0444);
49module_param(i2c_scan, int, 0444); 49module_param(i2c_scan, int, 0444);
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h
index dd00c20ab95e..9cb72f176f7d 100644
--- a/drivers/media/video/bttvp.h
+++ b/drivers/media/video/bttvp.h
@@ -35,6 +35,7 @@
35#include <linux/videodev.h> 35#include <linux/videodev.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/mutex.h>
38#include <asm/scatterlist.h> 39#include <asm/scatterlist.h>
39#include <asm/io.h> 40#include <asm/io.h>
40 41
@@ -309,9 +310,9 @@ struct bttv {
309 310
310 /* locking */ 311 /* locking */
311 spinlock_t s_lock; 312 spinlock_t s_lock;
312 struct semaphore lock; 313 struct mutex lock;
313 int resources; 314 int resources;
314 struct semaphore reslock; 315 struct mutex reslock;
315#ifdef VIDIOC_G_PRIORITY 316#ifdef VIDIOC_G_PRIORITY
316 struct v4l2_prio_state prio; 317 struct v4l2_prio_state prio;
317#endif 318#endif
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 1d75a42629d1..c66c2c1f4809 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -43,7 +43,7 @@ MODULE_LICENSE("GPL");
43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
44 44
45 45
46int cx25840_debug = 0; 46static int cx25840_debug;
47 47
48module_param_named(debug,cx25840_debug, int, 0644); 48module_param_named(debug,cx25840_debug, int, 0644);
49 49
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 76fcb4e995c9..53308911ae6e 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -31,8 +31,7 @@ config VIDEO_CX88_DVB
31 31
32config VIDEO_CX88_ALSA 32config VIDEO_CX88_ALSA
33 tristate "ALSA DMA audio support" 33 tristate "ALSA DMA audio support"
34 depends on VIDEO_CX88 && SND 34 depends on VIDEO_CX88 && SND && EXPERIMENTAL
35 select SND_PCM_OSS
36 ---help--- 35 ---help---
37 This is a video4linux driver for direct (DMA) audio on 36 This is a video4linux driver for direct (DMA) audio on
38 Conexant 2388x based TV cards. 37 Conexant 2388x based TV cards.
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index e4b2134fe567..6e5eaa22619e 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -5,6 +5,7 @@ cx8802-objs := cx88-mpeg.o
5 5
6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o 6obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o cx8802.o cx88-blackbird.o
7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o 7obj-$(CONFIG_VIDEO_CX88_DVB) += cx88-dvb.o cx88-vp3054-i2c.o
8obj-$(CONFIG_VIDEO_CX88_ALSA) += cx88-alsa.o
8 9
9EXTRA_CFLAGS += -I$(src)/.. 10EXTRA_CFLAGS += -I$(src)/..
10EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core 11EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 7695b521eb35..a2e36a1e5f59 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -116,7 +116,7 @@ MODULE_LICENSE("GPL");
116MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," 116MODULE_SUPPORTED_DEVICE("{{Conexant,23881},"
117 "{{Conexant,23882}," 117 "{{Conexant,23882},"
118 "{{Conexant,23883}"); 118 "{{Conexant,23883}");
119static unsigned int debug = 0; 119static unsigned int debug;
120module_param(debug,int,0644); 120module_param(debug,int,0644);
121MODULE_PARM_DESC(debug,"enable debug messages"); 121MODULE_PARM_DESC(debug,"enable debug messages");
122 122
@@ -333,10 +333,10 @@ static snd_pcm_hardware_t snd_cx88_digital_hw = {
333 .channels_min = 1, 333 .channels_min = 1,
334 .channels_max = 2, 334 .channels_max = 2,
335 .buffer_bytes_max = (2*2048), 335 .buffer_bytes_max = (2*2048),
336 .period_bytes_min = 256, 336 .period_bytes_min = 2048,
337 .period_bytes_max = 2048, 337 .period_bytes_max = 2048,
338 .periods_min = 2, 338 .periods_min = 2,
339 .periods_max = 16, 339 .periods_max = 2,
340}; 340};
341 341
342/* 342/*
@@ -653,7 +653,7 @@ static void snd_cx88_dev_free(snd_card_t * card)
653 * Alsa Constructor - Component probe 653 * Alsa Constructor - Component probe
654 */ 654 */
655 655
656static int devno=0; 656static int devno;
657static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci, 657static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci,
658 snd_cx88_card_t **rchip) 658 snd_cx88_card_t **rchip)
659{ 659{
@@ -805,7 +805,6 @@ static struct pci_driver cx88_audio_pci_driver = {
805 .id_table = cx88_audio_pci_tbl, 805 .id_table = cx88_audio_pci_tbl,
806 .probe = cx88_audio_initdev, 806 .probe = cx88_audio_initdev,
807 .remove = cx88_audio_finidev, 807 .remove = cx88_audio_finidev,
808 SND_PCI_PM_CALLBACKS
809}; 808};
810 809
811/**************************************************************************** 810/****************************************************************************
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 194446f28c55..8d6d6a6cf785 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -32,6 +32,7 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/videodev2.h> 34#include <linux/videodev2.h>
35#include <linux/mutex.h>
35 36
36#include "cx88.h" 37#include "cx88.h"
37#include <media/v4l2-common.h> 38#include <media/v4l2-common.h>
@@ -75,7 +76,7 @@ MODULE_PARM_DESC(nocomb,"disable comb filter");
75 76
76static unsigned int cx88_devcount; 77static unsigned int cx88_devcount;
77static LIST_HEAD(cx88_devlist); 78static LIST_HEAD(cx88_devlist);
78static DECLARE_MUTEX(devlist); 79static DEFINE_MUTEX(devlist);
79 80
80#define NO_SYNC_LINE (-1U) 81#define NO_SYNC_LINE (-1U)
81 82
@@ -1036,7 +1037,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1036 struct list_head *item; 1037 struct list_head *item;
1037 int i; 1038 int i;
1038 1039
1039 down(&devlist); 1040 mutex_lock(&devlist);
1040 list_for_each(item,&cx88_devlist) { 1041 list_for_each(item,&cx88_devlist) {
1041 core = list_entry(item, struct cx88_core, devlist); 1042 core = list_entry(item, struct cx88_core, devlist);
1042 if (pci->bus->number != core->pci_bus) 1043 if (pci->bus->number != core->pci_bus)
@@ -1047,7 +1048,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1047 if (0 != get_ressources(core,pci)) 1048 if (0 != get_ressources(core,pci))
1048 goto fail_unlock; 1049 goto fail_unlock;
1049 atomic_inc(&core->refcount); 1050 atomic_inc(&core->refcount);
1050 up(&devlist); 1051 mutex_unlock(&devlist);
1051 return core; 1052 return core;
1052 } 1053 }
1053 core = kzalloc(sizeof(*core),GFP_KERNEL); 1054 core = kzalloc(sizeof(*core),GFP_KERNEL);
@@ -1122,13 +1123,13 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1122 cx88_card_setup(core); 1123 cx88_card_setup(core);
1123 cx88_ir_init(core,pci); 1124 cx88_ir_init(core,pci);
1124 1125
1125 up(&devlist); 1126 mutex_unlock(&devlist);
1126 return core; 1127 return core;
1127 1128
1128fail_free: 1129fail_free:
1129 kfree(core); 1130 kfree(core);
1130fail_unlock: 1131fail_unlock:
1131 up(&devlist); 1132 mutex_unlock(&devlist);
1132 return NULL; 1133 return NULL;
1133} 1134}
1134 1135
@@ -1140,14 +1141,14 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
1140 if (!atomic_dec_and_test(&core->refcount)) 1141 if (!atomic_dec_and_test(&core->refcount))
1141 return; 1142 return;
1142 1143
1143 down(&devlist); 1144 mutex_lock(&devlist);
1144 cx88_ir_fini(core); 1145 cx88_ir_fini(core);
1145 if (0 == core->i2c_rc) 1146 if (0 == core->i2c_rc)
1146 i2c_bit_del_bus(&core->i2c_adap); 1147 i2c_bit_del_bus(&core->i2c_adap);
1147 list_del(&core->devlist); 1148 list_del(&core->devlist);
1148 iounmap(core->lmmio); 1149 iounmap(core->lmmio);
1149 cx88_devcount--; 1150 cx88_devcount--;
1150 up(&devlist); 1151 mutex_unlock(&devlist);
1151 kfree(core); 1152 kfree(core);
1152} 1153}
1153 1154
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 24118e43e73a..da8d97ce0c4b 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -60,6 +60,11 @@ static unsigned int audio_debug = 0;
60module_param(audio_debug, int, 0644); 60module_param(audio_debug, int, 0644);
61MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); 61MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
62 62
63static unsigned int always_analog = 0;
64module_param(always_analog,int,0644);
65MODULE_PARM_DESC(always_analog,"force analog audio out");
66
67
63#define dprintk(fmt, arg...) if (audio_debug) \ 68#define dprintk(fmt, arg...) if (audio_debug) \
64 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 69 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
65 70
@@ -155,7 +160,8 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
155 cx_write(AUD_I2SOUTPUTCNTL, 1); 160 cx_write(AUD_I2SOUTPUTCNTL, 1);
156 cx_write(AUD_I2SCNTL, 0); 161 cx_write(AUD_I2SCNTL, 0);
157 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ 162 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
158 } else { 163 }
164 if ((always_analog) || (!cx88_boards[core->board].blackbird)) {
159 ctl |= EN_DAC_ENABLE; 165 ctl |= EN_DAC_ENABLE;
160 cx_write(AUD_CTL, ctl); 166 cx_write(AUD_CTL, ctl);
161 } 167 }
diff --git a/drivers/media/video/cx88/cx88-vp3054-i2c.c b/drivers/media/video/cx88/cx88-vp3054-i2c.c
index 372cd29cedbd..751a754a45e9 100644
--- a/drivers/media/video/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/video/cx88/cx88-vp3054-i2c.c
@@ -32,6 +32,10 @@
32#include "cx88-vp3054-i2c.h" 32#include "cx88-vp3054-i2c.h"
33 33
34 34
35MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
36MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
37MODULE_LICENSE("GPL");
38
35/* ----------------------------------------------------------------------- */ 39/* ----------------------------------------------------------------------- */
36 40
37static void vp3054_bit_setscl(void *data, int state) 41static void vp3054_bit_setscl(void *data, int state)
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 9b94f77d6fd7..30dfa5370c73 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -76,6 +76,58 @@ static IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE] = {
76 [ 0x40 ] = KEY_ZOOM, 76 [ 0x40 ] = KEY_ZOOM,
77}; 77};
78 78
79static IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE] = {
80 [ 0x3a ] = KEY_KP0,
81 [ 0x31 ] = KEY_KP1,
82 [ 0x32 ] = KEY_KP2,
83 [ 0x33 ] = KEY_KP3,
84 [ 0x34 ] = KEY_KP4,
85 [ 0x35 ] = KEY_KP5,
86 [ 0x36 ] = KEY_KP6,
87 [ 0x37 ] = KEY_KP7,
88 [ 0x38 ] = KEY_KP8,
89 [ 0x39 ] = KEY_KP9,
90
91 [ 0x2f ] = KEY_POWER,
92
93 [ 0x2e ] = KEY_P,
94 [ 0x1f ] = KEY_L,
95 [ 0x2b ] = KEY_I,
96
97 [ 0x2d ] = KEY_ZOOM,
98 [ 0x1e ] = KEY_ZOOM,
99 [ 0x1b ] = KEY_VOLUMEUP,
100 [ 0x0f ] = KEY_VOLUMEDOWN,
101 [ 0x17 ] = KEY_CHANNELUP,
102 [ 0x1c ] = KEY_CHANNELDOWN,
103 [ 0x25 ] = KEY_INFO,
104
105 [ 0x3c ] = KEY_MUTE,
106
107 [ 0x3d ] = KEY_LEFT,
108 [ 0x3b ] = KEY_RIGHT,
109
110 [ 0x3f ] = KEY_UP,
111 [ 0x3e ] = KEY_DOWN,
112 [ 0x1a ] = KEY_PAUSE,
113
114 [ 0x1d ] = KEY_MENU,
115 [ 0x19 ] = KEY_PLAY,
116 [ 0x16 ] = KEY_REWIND,
117 [ 0x13 ] = KEY_FORWARD,
118 [ 0x15 ] = KEY_PAUSE,
119 [ 0x0e ] = KEY_REWIND,
120 [ 0x0d ] = KEY_PLAY,
121 [ 0x0b ] = KEY_STOP,
122 [ 0x07 ] = KEY_FORWARD,
123 [ 0x27 ] = KEY_RECORD,
124 [ 0x26 ] = KEY_TUNER,
125 [ 0x29 ] = KEY_TEXT,
126 [ 0x2a ] = KEY_MEDIA,
127 [ 0x18 ] = KEY_EPG,
128 [ 0x27 ] = KEY_RECORD,
129};
130
79/* ----------------------------------------------------------------------- */ 131/* ----------------------------------------------------------------------- */
80 132
81static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 133static int get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
@@ -138,6 +190,28 @@ static int get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
138 return 1; 190 return 1;
139} 191}
140 192
193static int get_key_pinnacle_usb(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
194{
195 unsigned char buf[3];
196
197 /* poll IR chip */
198
199 if (3 != i2c_master_recv(&ir->c,buf,3)) {
200 dprintk("read error\n");
201 return -EIO;
202 }
203
204 dprintk("key %02x\n", buf[2]&0x3f);
205 if (buf[0]!=0x00){
206 return 0;
207 }
208
209 *ir_key = buf[2]&0x3f;
210 *ir_raw = buf[2]&0x3f;
211
212 return 1;
213}
214
141/* ----------------------------------------------------------------------- */ 215/* ----------------------------------------------------------------------- */
142void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir) 216void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
143{ 217{
@@ -159,6 +233,9 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir)
159 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)"); 233 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Terratec)");
160 break; 234 break;
161 case (EM2820_BOARD_PINNACLE_USB_2): 235 case (EM2820_BOARD_PINNACLE_USB_2):
236 ir->ir_codes = ir_codes_em_pinnacle_usb;
237 ir->get_key = get_key_pinnacle_usb;
238 snprintf(ir->c.name, sizeof(ir->c.name), "i2c IR (EM28XX Pinnacle PCTV)");
162 break; 239 break;
163 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2): 240 case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
164 ir->ir_codes = ir_codes_hauppauge_new; 241 ir->ir_codes = ir_codes_hauppauge_new;
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 3323dffe26a4..eea304f75176 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -29,6 +29,7 @@
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/version.h> 30#include <linux/version.h>
31#include <linux/video_decoder.h> 31#include <linux/video_decoder.h>
32#include <linux/mutex.h>
32 33
33#include "em28xx.h" 34#include "em28xx.h"
34#include <media/tuner.h> 35#include <media/tuner.h>
@@ -191,7 +192,7 @@ static struct v4l2_queryctrl saa711x_qctrl[] = {
191 192
192static struct usb_driver em28xx_usb_driver; 193static struct usb_driver em28xx_usb_driver;
193 194
194static DECLARE_MUTEX(em28xx_sysfs_lock); 195static DEFINE_MUTEX(em28xx_sysfs_lock);
195static DECLARE_RWSEM(em28xx_disconnect); 196static DECLARE_RWSEM(em28xx_disconnect);
196 197
197/********************* v4l2 interface ******************************************/ 198/********************* v4l2 interface ******************************************/
@@ -394,7 +395,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
394*/ 395*/
395static void em28xx_release_resources(struct em28xx *dev) 396static void em28xx_release_resources(struct em28xx *dev)
396{ 397{
397 down(&em28xx_sysfs_lock); 398 mutex_lock(&em28xx_sysfs_lock);
398 399
399 em28xx_info("V4L2 device /dev/video%d deregistered\n", 400 em28xx_info("V4L2 device /dev/video%d deregistered\n",
400 dev->vdev->minor); 401 dev->vdev->minor);
@@ -403,7 +404,7 @@ static void em28xx_release_resources(struct em28xx *dev)
403/* video_unregister_device(dev->vbi_dev); */ 404/* video_unregister_device(dev->vbi_dev); */
404 em28xx_i2c_unregister(dev); 405 em28xx_i2c_unregister(dev);
405 usb_put_dev(dev->udev); 406 usb_put_dev(dev->udev);
406 up(&em28xx_sysfs_lock); 407 mutex_unlock(&em28xx_sysfs_lock);
407} 408}
408 409
409/* 410/*
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 9b05a0ab776d..69ed369c2f48 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -66,12 +66,12 @@ MODULE_LICENSE("GPL");
66 66
67/* module parameters */ 67/* module parameters */
68static int opmode = OPMODE_AUTO; 68static int opmode = OPMODE_AUTO;
69int msp_debug = 0; /* msp_debug output */ 69int msp_debug; /* msp_debug output */
70int msp_once = 0; /* no continous stereo monitoring */ 70int msp_once; /* no continous stereo monitoring */
71int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france), 71int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france),
72 the autoscan seems work well only with FM... */ 72 the autoscan seems work well only with FM... */
73int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */ 73int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */
74int msp_dolby = 0; 74int msp_dolby;
75 75
76int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual 76int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual
77 (msp34xxg only) 0x00a0-0x03c0 */ 77 (msp34xxg only) 0x00a0-0x03c0 */
@@ -1031,8 +1031,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
1031 } 1031 }
1032 1032
1033 default: 1033 default:
1034 /* nothing */ 1034 /* unknown */
1035 break; 1035 return -EINVAL;
1036 } 1036 }
1037 return 0; 1037 return 0;
1038} 1038}
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h
index 70a5ef8ba017..a9ac57d0700b 100644
--- a/drivers/media/video/msp3400.h
+++ b/drivers/media/video/msp3400.h
@@ -6,14 +6,6 @@
6 6
7/* ---------------------------------------------------------------------- */ 7/* ---------------------------------------------------------------------- */
8 8
9struct msp_matrix {
10 int input;
11 int output;
12};
13
14/* ioctl for MSP_SET_MATRIX will have to be registered */
15#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)
16
17/* This macro is allowed for *constants* only, gcc must calculate it 9/* This macro is allowed for *constants* only, gcc must calculate it
18 at compile time. Remember -- no floats in kernel mode */ 10 at compile time. Remember -- no floats in kernel mode */
19#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24))) 11#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 0bf1caac5887..c7c9f3f8715c 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -353,8 +353,8 @@ static int mt2032_init(struct i2c_client *c)
353 } while (xok != 1 ); 353 } while (xok != 1 );
354 t->xogc=xogc; 354 t->xogc=xogc;
355 355
356 t->tv_freq = mt2032_set_tv_freq; 356 t->set_tv_freq = mt2032_set_tv_freq;
357 t->radio_freq = mt2032_set_radio_freq; 357 t->set_radio_freq = mt2032_set_radio_freq;
358 return(1); 358 return(1);
359} 359}
360 360
@@ -481,8 +481,8 @@ static int mt2050_init(struct i2c_client *c)
481 i2c_master_recv(c,buf,1); 481 i2c_master_recv(c,buf,1);
482 482
483 tuner_dbg("mt2050: sro is %x\n",buf[0]); 483 tuner_dbg("mt2050: sro is %x\n",buf[0]);
484 t->tv_freq = mt2050_set_tv_freq; 484 t->set_tv_freq = mt2050_set_tv_freq;
485 t->radio_freq = mt2050_set_radio_freq; 485 t->set_radio_freq = mt2050_set_radio_freq;
486 return 0; 486 return 0;
487} 487}
488 488
@@ -494,8 +494,8 @@ int microtune_init(struct i2c_client *c)
494 int company_code; 494 int company_code;
495 495
496 memset(buf,0,sizeof(buf)); 496 memset(buf,0,sizeof(buf));
497 t->tv_freq = NULL; 497 t->set_tv_freq = NULL;
498 t->radio_freq = NULL; 498 t->set_radio_freq = NULL;
499 t->standby = NULL; 499 t->standby = NULL;
500 if (t->std & V4L2_STD_525_60) { 500 if (t->std & V4L2_STD_525_60) {
501 tuner_dbg("pinnacle ntsc\n"); 501 tuner_dbg("pinnacle ntsc\n");
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index b19c33434eaf..f3fc361bec97 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -76,9 +76,9 @@ static volatile struct planb_registers *planb_regs;
76static int def_norm = PLANB_DEF_NORM; /* default norm */ 76static int def_norm = PLANB_DEF_NORM; /* default norm */
77static int video_nr = -1; 77static int video_nr = -1;
78 78
79MODULE_PARM(def_norm, "i"); 79module_param(def_norm, int, 0);
80MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)"); 80MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)");
81MODULE_PARM(video_nr,"i"); 81module_param(video_nr, int, 0);
82MODULE_LICENSE("GPL"); 82MODULE_LICENSE("GPL");
83 83
84 84
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c
index e70b17ef36e9..d17395c4f55c 100644
--- a/drivers/media/video/saa6588.c
+++ b/drivers/media/video/saa6588.c
@@ -50,15 +50,15 @@ static unsigned int rbds = 0;
50static unsigned int plvl = 0; 50static unsigned int plvl = 0;
51static unsigned int bufblocks = 100; 51static unsigned int bufblocks = 100;
52 52
53MODULE_PARM(debug, "i"); 53module_param(debug, int, 0644);
54MODULE_PARM_DESC(debug, "enable debug messages"); 54MODULE_PARM_DESC(debug, "enable debug messages");
55MODULE_PARM(xtal, "i"); 55module_param(xtal, int, 0);
56MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0"); 56MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0");
57MODULE_PARM(rbds, "i"); 57module_param(rbds, int, 0);
58MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0"); 58MODULE_PARM_DESC(rbds, "select mode, 0=RDS, 1=RBDS, default 0");
59MODULE_PARM(plvl, "i"); 59module_param(plvl, int, 0);
60MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0"); 60MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0");
61MODULE_PARM(bufblocks, "i"); 61module_param(bufblocks, int, 0);
62MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100"); 62MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100");
63 63
64MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder"); 64MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder");
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c
index ae53063875f9..6c161f2f5e2c 100644
--- a/drivers/media/video/saa711x.c
+++ b/drivers/media/video/saa711x.c
@@ -52,7 +52,7 @@ MODULE_LICENSE("GPL");
52#include <linux/video_decoder.h> 52#include <linux/video_decoder.h>
53 53
54static int debug = 0; 54static int debug = 0;
55MODULE_PARM(debug, "i"); 55module_param(debug, int, 0644);
56MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)"); 56MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)");
57 57
58 58
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 275d06af69d2..c64718aec9cb 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2515,6 +2515,7 @@ struct saa7134_board saa7134_boards[] = {
2515 .tuner_addr = ADDR_UNSET, 2515 .tuner_addr = ADDR_UNSET,
2516 .radio_addr = ADDR_UNSET, 2516 .radio_addr = ADDR_UNSET,
2517 .mpeg = SAA7134_MPEG_DVB, 2517 .mpeg = SAA7134_MPEG_DVB,
2518 .gpiomask = 1 << 21,
2518 .inputs = {{ 2519 .inputs = {{
2519 .name = name_tv, 2520 .name = name_tv,
2520 .vmux = 1, 2521 .vmux = 1,
@@ -2529,6 +2530,11 @@ struct saa7134_board saa7134_boards[] = {
2529 .vmux = 8, 2530 .vmux = 8,
2530 .amux = LINE1, 2531 .amux = LINE1,
2531 }}, 2532 }},
2533 .radio = {
2534 .name = name_radio,
2535 .amux = TV,
2536 .gpio = 0x0200000,
2537 },
2532 }, 2538 },
2533 [SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = { 2539 [SAA7134_BOARD_MSI_TVATANYWHERE_PLUS] = {
2534 .name = "MSI TV@Anywhere plus", 2540 .name = "MSI TV@Anywhere plus",
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 3983a6524cac..028904bd94a2 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -31,6 +31,7 @@
31#include <linux/sound.h> 31#include <linux/sound.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/mutex.h>
34 35
35#include "saa7134-reg.h" 36#include "saa7134-reg.h"
36#include "saa7134.h" 37#include "saa7134.h"
@@ -84,7 +85,7 @@ MODULE_PARM_DESC(radio_nr, "radio device number");
84MODULE_PARM_DESC(tuner, "tuner type"); 85MODULE_PARM_DESC(tuner, "tuner type");
85MODULE_PARM_DESC(card, "card type"); 86MODULE_PARM_DESC(card, "card type");
86 87
87static DECLARE_MUTEX(devlist_lock); 88static DEFINE_MUTEX(devlist_lock);
88LIST_HEAD(saa7134_devlist); 89LIST_HEAD(saa7134_devlist);
89static LIST_HEAD(mops_list); 90static LIST_HEAD(mops_list);
90static unsigned int saa7134_devcount; 91static unsigned int saa7134_devcount;
@@ -140,7 +141,7 @@ static int pending_call(struct notifier_block *self, unsigned long state,
140 return NOTIFY_DONE; 141 return NOTIFY_DONE;
141} 142}
142 143
143static int pending_registered=0; 144static int pending_registered;
144static struct notifier_block pending_notifier = { 145static struct notifier_block pending_notifier = {
145 .notifier_call = pending_call, 146 .notifier_call = pending_call,
146}; 147};
@@ -969,13 +970,13 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
969 pci_set_drvdata(pci_dev,dev); 970 pci_set_drvdata(pci_dev,dev);
970 saa7134_devcount++; 971 saa7134_devcount++;
971 972
972 down(&devlist_lock); 973 mutex_lock(&devlist_lock);
973 list_for_each(item,&mops_list) { 974 list_for_each(item,&mops_list) {
974 mops = list_entry(item, struct saa7134_mpeg_ops, next); 975 mops = list_entry(item, struct saa7134_mpeg_ops, next);
975 mpeg_ops_attach(mops, dev); 976 mpeg_ops_attach(mops, dev);
976 } 977 }
977 list_add_tail(&dev->devlist,&saa7134_devlist); 978 list_add_tail(&dev->devlist,&saa7134_devlist);
978 up(&devlist_lock); 979 mutex_unlock(&devlist_lock);
979 980
980 /* check for signal */ 981 /* check for signal */
981 saa7134_irq_video_intl(dev); 982 saa7134_irq_video_intl(dev);
@@ -1031,13 +1032,13 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1031 saa7134_hwfini(dev); 1032 saa7134_hwfini(dev);
1032 1033
1033 /* unregister */ 1034 /* unregister */
1034 down(&devlist_lock); 1035 mutex_lock(&devlist_lock);
1035 list_del(&dev->devlist); 1036 list_del(&dev->devlist);
1036 list_for_each(item,&mops_list) { 1037 list_for_each(item,&mops_list) {
1037 mops = list_entry(item, struct saa7134_mpeg_ops, next); 1038 mops = list_entry(item, struct saa7134_mpeg_ops, next);
1038 mpeg_ops_detach(mops, dev); 1039 mpeg_ops_detach(mops, dev);
1039 } 1040 }
1040 up(&devlist_lock); 1041 mutex_unlock(&devlist_lock);
1041 saa7134_devcount--; 1042 saa7134_devcount--;
1042 1043
1043 saa7134_i2c_unregister(dev); 1044 saa7134_i2c_unregister(dev);
@@ -1071,13 +1072,13 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops)
1071 struct list_head *item; 1072 struct list_head *item;
1072 struct saa7134_dev *dev; 1073 struct saa7134_dev *dev;
1073 1074
1074 down(&devlist_lock); 1075 mutex_lock(&devlist_lock);
1075 list_for_each(item,&saa7134_devlist) { 1076 list_for_each(item,&saa7134_devlist) {
1076 dev = list_entry(item, struct saa7134_dev, devlist); 1077 dev = list_entry(item, struct saa7134_dev, devlist);
1077 mpeg_ops_attach(ops, dev); 1078 mpeg_ops_attach(ops, dev);
1078 } 1079 }
1079 list_add_tail(&ops->next,&mops_list); 1080 list_add_tail(&ops->next,&mops_list);
1080 up(&devlist_lock); 1081 mutex_unlock(&devlist_lock);
1081 return 0; 1082 return 0;
1082} 1083}
1083 1084
@@ -1086,13 +1087,13 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops)
1086 struct list_head *item; 1087 struct list_head *item;
1087 struct saa7134_dev *dev; 1088 struct saa7134_dev *dev;
1088 1089
1089 down(&devlist_lock); 1090 mutex_lock(&devlist_lock);
1090 list_del(&ops->next); 1091 list_del(&ops->next);
1091 list_for_each(item,&saa7134_devlist) { 1092 list_for_each(item,&saa7134_devlist) {
1092 dev = list_entry(item, struct saa7134_dev, devlist); 1093 dev = list_entry(item, struct saa7134_dev, devlist);
1093 mpeg_ops_detach(ops, dev); 1094 mpeg_ops_detach(ops, dev);
1094 } 1095 }
1095 up(&devlist_lock); 1096 mutex_unlock(&devlist_lock);
1096} 1097}
1097 1098
1098EXPORT_SYMBOL(saa7134_ts_register); 1099EXPORT_SYMBOL(saa7134_ts_register);
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 93268427750d..afa4dcb3f96d 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -180,8 +180,8 @@ static void tvaudio_init(struct saa7134_dev *dev)
180 saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); 180 saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff);
181 saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); 181 saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff);
182 saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); 182 saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff);
183 // frame locked audio was reported not to be reliable 183 /* frame locked audio is mandatory for NICAM */
184 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); 184 saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01);
185 185
186 saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); 186 saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14);
187 saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); 187 saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50);
@@ -809,7 +809,12 @@ static int tvaudio_thread_ddep(void *data)
809 dprintk("ddep override: %s\n",stdres[audio_ddep]); 809 dprintk("ddep override: %s\n",stdres[audio_ddep]);
810 } else if (&card(dev).radio == dev->input) { 810 } else if (&card(dev).radio == dev->input) {
811 dprintk("FM Radio\n"); 811 dprintk("FM Radio\n");
812 norms = (0x0f << 2) | 0x01; 812 if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
813 norms = (0x11 << 2) | 0x01;
814 saa_dsp_writel(dev, 0x42c >> 2, 0x729555);
815 } else {
816 norms = (0x0f << 2) | 0x01;
817 }
813 } else { 818 } else {
814 /* (let chip) scan for sound carrier */ 819 /* (let chip) scan for sound carrier */
815 norms = 0; 820 norms = 0;
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 2498b76df429..7b4fb282ac82 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -567,8 +567,8 @@ int tda8290_init(struct i2c_client *c)
567 } 567 }
568 tuner_info("tuner: type set to %s\n", c->name); 568 tuner_info("tuner: type set to %s\n", c->name);
569 569
570 t->tv_freq = set_tv_freq; 570 t->set_tv_freq = set_tv_freq;
571 t->radio_freq = set_radio_freq; 571 t->set_radio_freq = set_radio_freq;
572 t->has_signal = has_signal; 572 t->has_signal = has_signal;
573 t->standby = standby; 573 t->standby = standby;
574 t->tda827x_lpsel = 0; 574 t->tda827x_lpsel = 0;
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index 921fe72f23d5..c2b98f81c192 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -62,7 +62,7 @@ extern int tuner_debug;
62 62
63#define TEA5767_PORT1_HIGH 0x01 63#define TEA5767_PORT1_HIGH 0x01
64 64
65/* Forth register */ 65/* Fourth register */
66#define TEA5767_PORT2_HIGH 0x80 66#define TEA5767_PORT2_HIGH 0x80
67/* Chips stops working. Only I2C bus remains on */ 67/* Chips stops working. Only I2C bus remains on */
68#define TEA5767_STDBY 0x40 68#define TEA5767_STDBY 0x40
@@ -85,7 +85,7 @@ extern int tuner_debug;
85/* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */ 85/* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */
86#define TEA5767_SRCH_IND 0x01 86#define TEA5767_SRCH_IND 0x01
87 87
88/* Fiveth register */ 88/* Fifth register */
89 89
90/* By activating, it will use Xtal at 13 MHz as reference for divider */ 90/* By activating, it will use Xtal at 13 MHz as reference for divider */
91#define TEA5767_PLLREF_ENABLE 0x80 91#define TEA5767_PLLREF_ENABLE 0x80
@@ -109,13 +109,13 @@ extern int tuner_debug;
109#define TEA5767_STEREO_MASK 0x80 109#define TEA5767_STEREO_MASK 0x80
110#define TEA5767_IF_CNTR_MASK 0x7f 110#define TEA5767_IF_CNTR_MASK 0x7f
111 111
112/* Four register */ 112/* Fourth register */
113#define TEA5767_ADC_LEVEL_MASK 0xf0 113#define TEA5767_ADC_LEVEL_MASK 0xf0
114 114
115/* should be 0 */ 115/* should be 0 */
116#define TEA5767_CHIP_ID_MASK 0x0f 116#define TEA5767_CHIP_ID_MASK 0x0f
117 117
118/* Fiveth register */ 118/* Fifth register */
119/* Reserved for future extensions */ 119/* Reserved for future extensions */
120#define TEA5767_RESERVED_MASK 0xff 120#define TEA5767_RESERVED_MASK 0xff
121 121
@@ -220,19 +220,19 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n"); 220 tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
221 buffer[2] |= TEA5767_HIGH_LO_INJECT; 221 buffer[2] |= TEA5767_HIGH_LO_INJECT;
222 buffer[4] |= TEA5767_PLLREF_ENABLE; 222 buffer[4] |= TEA5767_PLLREF_ENABLE;
223 div = (frq * 4000 / 16 + 700000 + 225000 + 25000) / 50000; 223 div = (frq * (4000 / 16) + 700000 + 225000 + 25000) / 50000;
224 break; 224 break;
225 case TEA5767_LOW_LO_13MHz: 225 case TEA5767_LOW_LO_13MHz:
226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n"); 226 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
227 227
228 buffer[4] |= TEA5767_PLLREF_ENABLE; 228 buffer[4] |= TEA5767_PLLREF_ENABLE;
229 div = (frq * 4000 / 16 - 700000 - 225000 + 25000) / 50000; 229 div = (frq * (4000 / 16) - 700000 - 225000 + 25000) / 50000;
230 break; 230 break;
231 case TEA5767_LOW_LO_32768: 231 case TEA5767_LOW_LO_32768:
232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n"); 232 tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
233 buffer[3] |= TEA5767_XTAL_32768; 233 buffer[3] |= TEA5767_XTAL_32768;
234 /* const 700=4000*175 Khz - to adjust freq to right value */ 234 /* const 700=4000*175 Khz - to adjust freq to right value */
235 div = ((frq * 4000 / 16 - 700000 - 225000) + 16384) >> 15; 235 div = ((frq * (4000 / 16) - 700000 - 225000) + 16384) >> 15;
236 break; 236 break;
237 case TEA5767_HIGH_LO_32768: 237 case TEA5767_HIGH_LO_32768:
238 default: 238 default:
@@ -350,8 +350,8 @@ int tea5767_tuner_init(struct i2c_client *c)
350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); 350 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
351 strlcpy(c->name, "tea5767", sizeof(c->name)); 351 strlcpy(c->name, "tea5767", sizeof(c->name));
352 352
353 t->tv_freq = set_tv_freq; 353 t->set_tv_freq = set_tv_freq;
354 t->radio_freq = set_radio_freq; 354 t->set_radio_freq = set_radio_freq;
355 t->has_signal = tea5767_signal; 355 t->has_signal = tea5767_signal;
356 t->is_stereo = tea5767_stereo; 356 t->is_stereo = tea5767_stereo;
357 t->standby = tea5767_standby; 357 t->standby = tea5767_standby;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index f30ef79d795e..2995b22acb43 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -82,7 +82,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
82 tuner_warn ("tuner type not set\n"); 82 tuner_warn ("tuner type not set\n");
83 return; 83 return;
84 } 84 }
85 if (NULL == t->tv_freq) { 85 if (NULL == t->set_tv_freq) {
86 tuner_warn ("Tuner has no way to set tv freq\n"); 86 tuner_warn ("Tuner has no way to set tv freq\n");
87 return; 87 return;
88 } 88 }
@@ -90,8 +90,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", 90 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n",
91 freq / 16, freq % 16 * 100 / 16, tv_range[0], 91 freq / 16, freq % 16 * 100 / 16, tv_range[0],
92 tv_range[1]); 92 tv_range[1]);
93 /* V4L2 spec: if the freq is not possible then the closest
94 possible value should be selected */
95 if (freq < tv_range[0] * 16)
96 freq = tv_range[0] * 16;
97 else
98 freq = tv_range[1] * 16;
93 } 99 }
94 t->tv_freq(c, freq); 100 t->set_tv_freq(c, freq);
95} 101}
96 102
97static void set_radio_freq(struct i2c_client *c, unsigned int freq) 103static void set_radio_freq(struct i2c_client *c, unsigned int freq)
@@ -102,18 +108,23 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
102 tuner_warn ("tuner type not set\n"); 108 tuner_warn ("tuner type not set\n");
103 return; 109 return;
104 } 110 }
105 if (NULL == t->radio_freq) { 111 if (NULL == t->set_radio_freq) {
106 tuner_warn ("tuner has no way to set radio frequency\n"); 112 tuner_warn ("tuner has no way to set radio frequency\n");
107 return; 113 return;
108 } 114 }
109 if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) { 115 if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
110 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", 116 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
111 freq / 16000, freq % 16000 * 100 / 16000, 117 freq / 16000, freq % 16000 * 100 / 16000,
112 radio_range[0], radio_range[1]); 118 radio_range[0], radio_range[1]);
119 /* V4L2 spec: if the freq is not possible then the closest
120 possible value should be selected */
121 if (freq < radio_range[0] * 16000)
122 freq = radio_range[0] * 16000;
123 else
124 freq = radio_range[1] * 16000;
113 } 125 }
114 126
115 t->radio_freq(c, freq); 127 t->set_radio_freq(c, freq);
116 return;
117} 128}
118 129
119static void set_freq(struct i2c_client *c, unsigned long freq) 130static void set_freq(struct i2c_client *c, unsigned long freq)
@@ -125,15 +136,16 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
125 tuner_dbg("radio freq set to %lu.%02lu\n", 136 tuner_dbg("radio freq set to %lu.%02lu\n",
126 freq / 16000, freq % 16000 * 100 / 16000); 137 freq / 16000, freq % 16000 * 100 / 16000);
127 set_radio_freq(c, freq); 138 set_radio_freq(c, freq);
139 t->radio_freq = freq;
128 break; 140 break;
129 case V4L2_TUNER_ANALOG_TV: 141 case V4L2_TUNER_ANALOG_TV:
130 case V4L2_TUNER_DIGITAL_TV: 142 case V4L2_TUNER_DIGITAL_TV:
131 tuner_dbg("tv freq set to %lu.%02lu\n", 143 tuner_dbg("tv freq set to %lu.%02lu\n",
132 freq / 16, freq % 16 * 100 / 16); 144 freq / 16, freq % 16 * 100 / 16);
133 set_tv_freq(c, freq); 145 set_tv_freq(c, freq);
146 t->tv_freq = freq;
134 break; 147 break;
135 } 148 }
136 t->freq = freq;
137} 149}
138 150
139static void set_type(struct i2c_client *c, unsigned int type, 151static void set_type(struct i2c_client *c, unsigned int type,
@@ -212,7 +224,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
212 if (t->mode_mask == T_UNINITIALIZED) 224 if (t->mode_mask == T_UNINITIALIZED)
213 t->mode_mask = new_mode_mask; 225 t->mode_mask = new_mode_mask;
214 226
215 set_freq(c, t->freq); 227 set_freq(c, (V4L2_TUNER_RADIO == t->mode) ? t->radio_freq : t->tv_freq);
216 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", 228 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
217 c->adapter->name, c->driver->driver.name, c->addr << 1, type, 229 c->adapter->name, c->driver->driver.name, c->addr << 1, type,
218 t->mode_mask); 230 t->mode_mask);
@@ -377,11 +389,11 @@ static void tuner_status(struct i2c_client *client)
377 default: p = "undefined"; break; 389 default: p = "undefined"; break;
378 } 390 }
379 if (t->mode == V4L2_TUNER_RADIO) { 391 if (t->mode == V4L2_TUNER_RADIO) {
380 freq = t->freq / 16000; 392 freq = t->radio_freq / 16000;
381 freq_fraction = (t->freq % 16000) * 100 / 16000; 393 freq_fraction = (t->radio_freq % 16000) * 100 / 16000;
382 } else { 394 } else {
383 freq = t->freq / 16; 395 freq = t->tv_freq / 16;
384 freq_fraction = (t->freq % 16) * 100 / 16; 396 freq_fraction = (t->tv_freq % 16) * 100 / 16;
385 } 397 }
386 tuner_info("Tuner mode: %s\n", p); 398 tuner_info("Tuner mode: %s\n", p);
387 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); 399 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
@@ -456,7 +468,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
456 t->type = TUNER_TEA5767; 468 t->type = TUNER_TEA5767;
457 t->mode_mask = T_RADIO; 469 t->mode_mask = T_RADIO;
458 t->mode = T_STANDBY; 470 t->mode = T_STANDBY;
459 t->freq = 87.5 * 16; /* Sets freq to FM range */ 471 t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */
460 default_mode_mask &= ~T_RADIO; 472 default_mode_mask &= ~T_RADIO;
461 473
462 goto register_client; 474 goto register_client;
@@ -469,7 +481,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
469 if (default_mode_mask != T_UNINITIALIZED) { 481 if (default_mode_mask != T_UNINITIALIZED) {
470 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask); 482 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
471 t->mode_mask = default_mode_mask; 483 t->mode_mask = default_mode_mask;
472 t->freq = 400 * 16; /* Sets freq to VHF High */ 484 t->tv_freq = 400 * 16; /* Sets freq to VHF High */
485 t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */
473 default_mode_mask = T_UNINITIALIZED; 486 default_mode_mask = T_UNINITIALIZED;
474 } 487 }
475 488
@@ -565,16 +578,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
565 set_addr(client, (struct tuner_setup *)arg); 578 set_addr(client, (struct tuner_setup *)arg);
566 break; 579 break;
567 case AUDC_SET_RADIO: 580 case AUDC_SET_RADIO:
568 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); 581 if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO")
582 == EINVAL)
583 return 0;
584 if (t->radio_freq)
585 set_freq(client, t->radio_freq);
569 break; 586 break;
570 case TUNER_SET_STANDBY: 587 case TUNER_SET_STANDBY:
571 { 588 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
572 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) 589 return 0;
573 return 0; 590 if (t->standby)
574 if (t->standby) 591 t->standby (client);
575 t->standby (client); 592 break;
576 break;
577 }
578 case VIDIOCSAUDIO: 593 case VIDIOCSAUDIO:
579 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 594 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
580 return 0; 595 return 0;
@@ -583,7 +598,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
583 598
584 /* Should be implemented, since bttv calls it */ 599 /* Should be implemented, since bttv calls it */
585 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 600 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
586
587 break; 601 break;
588 /* --- v4l ioctls --- */ 602 /* --- v4l ioctls --- */
589 /* take care: bttv does userspace copying, we'll get a 603 /* take care: bttv does userspace copying, we'll get a
@@ -609,8 +623,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
609 if (vc->norm < ARRAY_SIZE(map)) 623 if (vc->norm < ARRAY_SIZE(map))
610 t->std = map[vc->norm]; 624 t->std = map[vc->norm];
611 tuner_fixup_std(t); 625 tuner_fixup_std(t);
612 if (t->freq) 626 if (t->tv_freq)
613 set_tv_freq(client, t->freq); 627 set_tv_freq(client, t->tv_freq);
614 return 0; 628 return 0;
615 } 629 }
616 case VIDIOCSFREQ: 630 case VIDIOCSFREQ:
@@ -684,15 +698,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
684 698
685 t->std = *id; 699 t->std = *id;
686 tuner_fixup_std(t); 700 tuner_fixup_std(t);
687 if (t->freq) 701 if (t->tv_freq)
688 set_freq(client, t->freq); 702 set_freq(client, t->tv_freq);
689 break; 703 break;
690 } 704 }
691 case VIDIOC_S_FREQUENCY: 705 case VIDIOC_S_FREQUENCY:
692 { 706 {
693 struct v4l2_frequency *f = arg; 707 struct v4l2_frequency *f = arg;
694 708
695 t->freq = f->frequency;
696 switch_v4l2(); 709 switch_v4l2();
697 if (V4L2_TUNER_RADIO == f->type && 710 if (V4L2_TUNER_RADIO == f->type &&
698 V4L2_TUNER_RADIO != t->mode) { 711 V4L2_TUNER_RADIO != t->mode) {
@@ -700,7 +713,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
700 == EINVAL) 713 == EINVAL)
701 return 0; 714 return 0;
702 } 715 }
703 set_freq(client,t->freq); 716 set_freq(client,f->frequency);
704 717
705 break; 718 break;
706 } 719 }
@@ -712,7 +725,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
712 return 0; 725 return 0;
713 switch_v4l2(); 726 switch_v4l2();
714 f->type = t->mode; 727 f->type = t->mode;
715 f->frequency = t->freq; 728 f->frequency = (V4L2_TUNER_RADIO == t->mode) ?
729 t->radio_freq : t->tv_freq;
716 break; 730 break;
717 } 731 }
718 case VIDIOC_G_TUNER: 732 case VIDIOC_G_TUNER:
@@ -763,7 +777,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
763 777
764 if (V4L2_TUNER_RADIO == t->mode) { 778 if (V4L2_TUNER_RADIO == t->mode) {
765 t->audmode = tuner->audmode; 779 t->audmode = tuner->audmode;
766 set_radio_freq(client, t->freq); 780 set_radio_freq(client, t->radio_freq);
767 } 781 }
768 break; 782 break;
769 } 783 }
@@ -791,8 +805,13 @@ static int tuner_resume(struct device *dev)
791 struct tuner *t = i2c_get_clientdata (c); 805 struct tuner *t = i2c_get_clientdata (c);
792 806
793 tuner_dbg ("resume\n"); 807 tuner_dbg ("resume\n");
794 if (t->freq) 808 if (V4L2_TUNER_RADIO == t->mode) {
795 set_freq(c, t->freq); 809 if (t->radio_freq)
810 set_freq(c, t->radio_freq);
811 } else {
812 if (t->tv_freq)
813 set_freq(c, t->tv_freq);
814 }
796 return 0; 815 return 0;
797} 816}
798 817
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index e5fb74365836..37977ff49780 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -79,722 +79,16 @@ MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner");
79#define TUNER_PLL_LOCKED 0x40 79#define TUNER_PLL_LOCKED 0x40
80#define TUNER_STEREO_MK3 0x04 80#define TUNER_STEREO_MK3 0x04
81 81
82#define TUNER_MAX_RANGES 3 82#define TUNER_PARAM_ANALOG 0 /* to be removed */
83 83/* FIXME:
84/* ---------------------------------------------------------------------- */ 84 * Right now, all tuners are using the first tuner_params[] array element
85 85 * for analog mode. In the future, we will be merging similar tuner
86struct tunertype 86 * definitions together, such that each tuner definition will have a
87{ 87 * tuner_params struct for each available video standard. At that point,
88 char *name; 88 * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array
89 89 * element will be chosen based on the video standard in use.
90 int count; 90 *
91 struct {
92 unsigned short thresh;
93 unsigned char cb;
94 } ranges[TUNER_MAX_RANGES];
95 unsigned char config;
96};
97
98/*
99 * The floats in the tuner struct are computed at compile time
100 * by gcc and cast back to integers. Thus we don't violate the
101 * "no float in kernel" rule.
102 */ 91 */
103static struct tunertype tuners[] = {
104 /* 0-9 */
105 [TUNER_TEMIC_PAL] = { /* TEMIC PAL */
106 .name = "Temic PAL (4002 FH5)",
107 .count = 3,
108 .ranges = {
109 { 16 * 140.25 /*MHz*/, 0x02, },
110 { 16 * 463.25 /*MHz*/, 0x04, },
111 { 16 * 999.99 , 0x01, },
112 },
113 .config = 0x8e,
114 },
115 [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
116 .name = "Philips PAL_I (FI1246 and compatibles)",
117 .count = 3,
118 .ranges = {
119 { 16 * 140.25 /*MHz*/, 0xa0, },
120 { 16 * 463.25 /*MHz*/, 0x90, },
121 { 16 * 999.99 , 0x30, },
122 },
123 .config = 0x8e,
124 },
125 [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
126 .name = "Philips NTSC (FI1236,FM1236 and compatibles)",
127 .count = 3,
128 .ranges = {
129 { 16 * 157.25 /*MHz*/, 0xa0, },
130 { 16 * 451.25 /*MHz*/, 0x90, },
131 { 16 * 999.99 , 0x30, },
132 },
133 .config = 0x8e,
134 },
135 [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
136 .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
137 .count = 3,
138 .ranges = {
139 { 16 * 168.25 /*MHz*/, 0xa7, },
140 { 16 * 447.25 /*MHz*/, 0x97, },
141 { 16 * 999.99 , 0x37, },
142 },
143 .config = 0x8e,
144 },
145 [TUNER_ABSENT] = { /* Tuner Absent */
146 .name = "NoTuner",
147 .count = 1,
148 .ranges = {
149 { 0, 0x00, },
150 },
151 .config = 0x00,
152 },
153 [TUNER_PHILIPS_PAL] = { /* Philips PAL */
154 .name = "Philips PAL_BG (FI1216 and compatibles)",
155 .count = 3,
156 .ranges = {
157 { 16 * 168.25 /*MHz*/, 0xa0, },
158 { 16 * 447.25 /*MHz*/, 0x90, },
159 { 16 * 999.99 , 0x30, },
160 },
161 .config = 0x8e,
162 },
163 [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
164 .name = "Temic NTSC (4032 FY5)",
165 .count = 3,
166 .ranges = {
167 { 16 * 157.25 /*MHz*/, 0x02, },
168 { 16 * 463.25 /*MHz*/, 0x04, },
169 { 16 * 999.99 , 0x01, },
170 },
171 .config = 0x8e,
172 },
173 [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
174 .name = "Temic PAL_I (4062 FY5)",
175 .count = 3,
176 .ranges = {
177 { 16 * 170.00 /*MHz*/, 0x02, },
178 { 16 * 450.00 /*MHz*/, 0x04, },
179 { 16 * 999.99 , 0x01, },
180 },
181 .config = 0x8e,
182 },
183 [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
184 .name = "Temic NTSC (4036 FY5)",
185 .count = 3,
186 .ranges = {
187 { 16 * 157.25 /*MHz*/, 0xa0, },
188 { 16 * 463.25 /*MHz*/, 0x90, },
189 { 16 * 999.99 , 0x30, },
190 },
191 .config = 0x8e,
192 },
193 [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
194 .name = "Alps HSBH1",
195 .count = 3,
196 .ranges = {
197 { 16 * 137.25 /*MHz*/, 0x01, },
198 { 16 * 385.25 /*MHz*/, 0x02, },
199 { 16 * 999.99 , 0x08, },
200 },
201 .config = 0x8e,
202 },
203
204 /* 10-19 */
205 [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
206 .name = "Alps TSBE1",
207 .count = 3,
208 .ranges = {
209 { 16 * 137.25 /*MHz*/, 0x01, },
210 { 16 * 385.25 /*MHz*/, 0x02, },
211 { 16 * 999.99 , 0x08, },
212 },
213 .config = 0x8e,
214 },
215 [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
216 .name = "Alps TSBB5",
217 .count = 3,
218 .ranges = {
219 { 16 * 133.25 /*MHz*/, 0x01, },
220 { 16 * 351.25 /*MHz*/, 0x02, },
221 { 16 * 999.99 , 0x08, },
222 },
223 .config = 0x8e,
224 },
225 [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
226 .name = "Alps TSBE5",
227 .count = 3,
228 .ranges = {
229 { 16 * 133.25 /*MHz*/, 0x01, },
230 { 16 * 351.25 /*MHz*/, 0x02, },
231 { 16 * 999.99 , 0x08, },
232 },
233 .config = 0x8e,
234 },
235 [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
236 .name = "Alps TSBC5",
237 .count = 3,
238 .ranges = {
239 { 16 * 133.25 /*MHz*/, 0x01, },
240 { 16 * 351.25 /*MHz*/, 0x02, },
241 { 16 * 999.99 , 0x08, },
242 },
243 .config = 0x8e,
244 },
245 [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
246 .name = "Temic PAL_BG (4006FH5)",
247 .count = 3,
248 .ranges = {
249 { 16 * 170.00 /*MHz*/, 0xa0, },
250 { 16 * 450.00 /*MHz*/, 0x90, },
251 { 16 * 999.99 , 0x30, },
252 },
253 .config = 0x8e,
254 },
255 [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
256 .name = "Alps TSCH6",
257 .count = 3,
258 .ranges = {
259 { 16 * 137.25 /*MHz*/, 0x14, },
260 { 16 * 385.25 /*MHz*/, 0x12, },
261 { 16 * 999.99 , 0x11, },
262 },
263 .config = 0x8e,
264 },
265 [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
266 .name = "Temic PAL_DK (4016 FY5)",
267 .count = 3,
268 .ranges = {
269 { 16 * 168.25 /*MHz*/, 0xa0, },
270 { 16 * 456.25 /*MHz*/, 0x90, },
271 { 16 * 999.99 , 0x30, },
272 },
273 .config = 0x8e,
274 },
275 [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
276 .name = "Philips NTSC_M (MK2)",
277 .count = 3,
278 .ranges = {
279 { 16 * 160.00 /*MHz*/, 0xa0, },
280 { 16 * 454.00 /*MHz*/, 0x90, },
281 { 16 * 999.99 , 0x30, },
282 },
283 .config = 0x8e,
284 },
285 [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
286 .name = "Temic PAL_I (4066 FY5)",
287 .count = 3,
288 .ranges = {
289 { 16 * 169.00 /*MHz*/, 0xa0, },
290 { 16 * 454.00 /*MHz*/, 0x90, },
291 { 16 * 999.99 , 0x30, },
292 },
293 .config = 0x8e,
294 },
295 [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
296 .name = "Temic PAL* auto (4006 FN5)",
297 .count = 3,
298 .ranges = {
299 { 16 * 169.00 /*MHz*/, 0xa0, },
300 { 16 * 454.00 /*MHz*/, 0x90, },
301 { 16 * 999.99 , 0x30, },
302 },
303 .config = 0x8e,
304 },
305
306 /* 20-29 */
307 [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
308 .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
309 .count = 3,
310 .ranges = {
311 { 16 * 141.00 /*MHz*/, 0xa0, },
312 { 16 * 464.00 /*MHz*/, 0x90, },
313 { 16 * 999.99 , 0x30, },
314 },
315 .config = 0x8e,
316 },
317 [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
318 .name = "Temic NTSC (4039 FR5)",
319 .count = 3,
320 .ranges = {
321 { 16 * 158.00 /*MHz*/, 0xa0, },
322 { 16 * 453.00 /*MHz*/, 0x90, },
323 { 16 * 999.99 , 0x30, },
324 },
325 .config = 0x8e,
326 },
327 [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
328 .name = "Temic PAL/SECAM multi (4046 FM5)",
329 .count = 3,
330 .ranges = {
331 { 16 * 169.00 /*MHz*/, 0xa0, },
332 { 16 * 454.00 /*MHz*/, 0x90, },
333 { 16 * 999.99 , 0x30, },
334 },
335 .config = 0x8e,
336 },
337 [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
338 .name = "Philips PAL_DK (FI1256 and compatibles)",
339 .count = 3,
340 .ranges = {
341 { 16 * 170.00 /*MHz*/, 0xa0, },
342 { 16 * 450.00 /*MHz*/, 0x90, },
343 { 16 * 999.99 , 0x30, },
344 },
345 .config = 0x8e,
346 },
347 [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
348 .name = "Philips PAL/SECAM multi (FQ1216ME)",
349 .count = 3,
350 .ranges = {
351 { 16 * 170.00 /*MHz*/, 0xa0, },
352 { 16 * 450.00 /*MHz*/, 0x90, },
353 { 16 * 999.99 , 0x30, },
354 },
355 .config = 0x8e,
356 },
357 [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
358 .name = "LG PAL_I+FM (TAPC-I001D)",
359 .count = 3,
360 .ranges = {
361 { 16 * 170.00 /*MHz*/, 0xa0, },
362 { 16 * 450.00 /*MHz*/, 0x90, },
363 { 16 * 999.99 , 0x30, },
364 },
365 .config = 0x8e,
366 },
367 [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
368 .name = "LG PAL_I (TAPC-I701D)",
369 .count = 3,
370 .ranges = {
371 { 16 * 170.00 /*MHz*/, 0xa0, },
372 { 16 * 450.00 /*MHz*/, 0x90, },
373 { 16 * 999.99 , 0x30, },
374 },
375 .config = 0x8e,
376 },
377 [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
378 .name = "LG NTSC+FM (TPI8NSR01F)",
379 .count = 3,
380 .ranges = {
381 { 16 * 210.00 /*MHz*/, 0xa0, },
382 { 16 * 497.00 /*MHz*/, 0x90, },
383 { 16 * 999.99 , 0x30, },
384 },
385 .config = 0x8e,
386 },
387 [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
388 .name = "LG PAL_BG+FM (TPI8PSB01D)",
389 .count = 3,
390 .ranges = {
391 { 16 * 170.00 /*MHz*/, 0xa0, },
392 { 16 * 450.00 /*MHz*/, 0x90, },
393 { 16 * 999.99 , 0x30, },
394 },
395 .config = 0x8e,
396 },
397 [TUNER_LG_PAL] = { /* LGINNOTEK PAL */
398 .name = "LG PAL_BG (TPI8PSB11D)",
399 .count = 3,
400 .ranges = {
401 { 16 * 170.00 /*MHz*/, 0xa0, },
402 { 16 * 450.00 /*MHz*/, 0x90, },
403 { 16 * 999.99 , 0x30, },
404 },
405 .config = 0x8e,
406 },
407
408 /* 30-39 */
409 [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
410 .name = "Temic PAL* auto + FM (4009 FN5)",
411 .count = 3,
412 .ranges = {
413 { 16 * 141.00 /*MHz*/, 0xa0, },
414 { 16 * 464.00 /*MHz*/, 0x90, },
415 { 16 * 999.99 , 0x30, },
416 },
417 .config = 0x8e,
418 },
419 [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
420 .name = "SHARP NTSC_JP (2U5JF5540)",
421 .count = 3,
422 .ranges = {
423 { 16 * 137.25 /*MHz*/, 0x01, },
424 { 16 * 317.25 /*MHz*/, 0x02, },
425 { 16 * 999.99 , 0x08, },
426 },
427 .config = 0x8e,
428 },
429 [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
430 .name = "Samsung PAL TCPM9091PD27",
431 .count = 3,
432 .ranges = {
433 { 16 * 169 /*MHz*/, 0xa0, },
434 { 16 * 464 /*MHz*/, 0x90, },
435 { 16 * 999.99 , 0x30, },
436 },
437 .config = 0x8e,
438 },
439 [TUNER_MT2032] = { /* Microtune PAL|NTSC */
440 .name = "MT20xx universal",
441 /* see mt20xx.c for details */ },
442 [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
443 .name = "Temic PAL_BG (4106 FH5)",
444 .count = 3,
445 .ranges = {
446 { 16 * 141.00 /*MHz*/, 0xa0, },
447 { 16 * 464.00 /*MHz*/, 0x90, },
448 { 16 * 999.99 , 0x30, },
449 },
450 .config = 0x8e,
451 },
452 [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
453 .name = "Temic PAL_DK/SECAM_L (4012 FY5)",
454 .count = 3,
455 .ranges = {
456 { 16 * 140.25 /*MHz*/, 0x02, },
457 { 16 * 463.25 /*MHz*/, 0x04, },
458 { 16 * 999.99 , 0x01, },
459 },
460 .config = 0x8e,
461 },
462 [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
463 .name = "Temic NTSC (4136 FY5)",
464 .count = 3,
465 .ranges = {
466 { 16 * 158.00 /*MHz*/, 0xa0, },
467 { 16 * 453.00 /*MHz*/, 0x90, },
468 { 16 * 999.99 , 0x30, },
469 },
470 .config = 0x8e,
471 },
472 [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
473 .name = "LG PAL (newer TAPC series)",
474 .count = 3,
475 .ranges = {
476 { 16 * 170.00 /*MHz*/, 0x01, },
477 { 16 * 450.00 /*MHz*/, 0x02, },
478 { 16 * 999.99 , 0x08, },
479 },
480 .config = 0x8e,
481 },
482 [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
483 .name = "Philips PAL/SECAM multi (FM1216ME MK3)",
484 .count = 3,
485 .ranges = {
486 { 16 * 158.00 /*MHz*/, 0x01, },
487 { 16 * 442.00 /*MHz*/, 0x02, },
488 { 16 * 999.99 , 0x04, },
489 },
490 .config = 0x8e,
491 },
492 [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
493 .name = "LG NTSC (newer TAPC series)",
494 .count = 3,
495 .ranges = {
496 { 16 * 170.00 /*MHz*/, 0x01, },
497 { 16 * 450.00 /*MHz*/, 0x02, },
498 { 16 * 999.99 , 0x08, },
499 },
500 .config = 0x8e,
501 },
502
503 /* 40-49 */
504 [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
505 .name = "HITACHI V7-J180AT",
506 .count = 3,
507 .ranges = {
508 { 16 * 170.00 /*MHz*/, 0x01, },
509 { 16 * 450.00 /*MHz*/, 0x02, },
510 { 16 * 999.99 , 0x08, },
511 },
512 .config = 0x8e,
513 },
514 [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
515 .name = "Philips PAL_MK (FI1216 MK)",
516 .count = 3,
517 .ranges = {
518 { 16 * 140.25 /*MHz*/, 0x01, },
519 { 16 * 463.25 /*MHz*/, 0xc2, },
520 { 16 * 999.99 , 0xcf, },
521 },
522 .config = 0x8e,
523 },
524 [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
525 .name = "Philips 1236D ATSC/NTSC dual in",
526 .count = 3,
527 .ranges = {
528 { 16 * 157.25 /*MHz*/, 0xa0, },
529 { 16 * 454.00 /*MHz*/, 0x90, },
530 { 16 * 999.99 , 0x30, },
531 },
532 .config = 0x8e,
533 },
534 [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
535 .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
536 .count = 3,
537 .ranges = {
538 { 16 * 160.00 /*MHz*/, 0x01, },
539 { 16 * 442.00 /*MHz*/, 0x02, },
540 { 16 * 999.99 , 0x04, },
541 },
542 .config = 0x8e,
543 },
544 [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
545 .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
546 .count = 3,
547 .ranges = {
548 { 16 * 160.00 /*MHz*/, 0x01, },
549 { 16 * 442.00 /*MHz*/, 0x02, },
550 { 16 * 999.99 , 0x04, },
551 },
552 .config = 0x8e,
553 },
554 [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
555 .name = "Microtune 4049 FM5",
556 .count = 3,
557 .ranges = {
558 { 16 * 141.00 /*MHz*/, 0xa0, },
559 { 16 * 464.00 /*MHz*/, 0x90, },
560 { 16 * 999.99 , 0x30, },
561 },
562 .config = 0x8e,
563 },
564 [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
565 .name = "Panasonic VP27s/ENGE4324D",
566 .count = 3,
567 .ranges = {
568 { 16 * 160.00 /*MHz*/, 0x01, },
569 { 16 * 454.00 /*MHz*/, 0x02, },
570 { 16 * 999.99 , 0x08, },
571 },
572 .config = 0xce,
573 },
574 [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
575 .name = "LG NTSC (TAPE series)",
576 .count = 3,
577 .ranges = {
578 { 16 * 160.00 /*MHz*/, 0x01, },
579 { 16 * 442.00 /*MHz*/, 0x02, },
580 { 16 * 999.99 , 0x04, },
581 },
582 .config = 0x8e,
583 },
584 [TUNER_TNF_8831BGFF] = { /* Philips PAL */
585 .name = "Tenna TNF 8831 BGFF)",
586 .count = 3,
587 .ranges = {
588 { 16 * 161.25 /*MHz*/, 0xa0, },
589 { 16 * 463.25 /*MHz*/, 0x90, },
590 { 16 * 999.99 , 0x30, },
591 },
592 .config = 0x8e,
593 },
594 [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
595 .name = "Microtune 4042 FI5 ATSC/NTSC dual in",
596 .count = 3,
597 .ranges = {
598 { 16 * 162.00 /*MHz*/, 0xa2, },
599 { 16 * 457.00 /*MHz*/, 0x94, },
600 { 16 * 999.99 , 0x31, },
601 },
602 .config = 0x8e,
603 },
604
605 /* 50-59 */
606 [TUNER_TCL_2002N] = { /* TCL NTSC */
607 .name = "TCL 2002N",
608 .count = 3,
609 .ranges = {
610 { 16 * 172.00 /*MHz*/, 0x01, },
611 { 16 * 448.00 /*MHz*/, 0x02, },
612 { 16 * 999.99 , 0x08, },
613 },
614 .config = 0x8e,
615 },
616 [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
617 .name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
618 .count = 3,
619 .ranges = {
620 { 16 * 160.00 /*MHz*/, 0x01, },
621 { 16 * 442.00 /*MHz*/, 0x02, },
622 { 16 * 999.99 , 0x04, },
623 },
624 .config = 0x8e,
625 },
626 [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
627 .name = "Thomson DTT 7610 (ATSC/NTSC)",
628 .count = 3,
629 .ranges = {
630 { 16 * 157.25 /*MHz*/, 0x39, },
631 { 16 * 454.00 /*MHz*/, 0x3a, },
632 { 16 * 999.99 , 0x3c, },
633 },
634 .config = 0x8e,
635 },
636 [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
637 .name = "Philips FQ1286",
638 .count = 3,
639 .ranges = {
640 { 16 * 160.00 /*MHz*/, 0x41, },
641 { 16 * 454.00 /*MHz*/, 0x42, },
642 { 16 * 999.99 , 0x04, },
643 },
644 .config = 0x8e,
645 },
646 [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
647 .name = "tda8290+75",
648 /* see tda8290.c for details */ },
649 [TUNER_TCL_2002MB] = { /* TCL PAL */
650 .name = "TCL 2002MB",
651 .count = 3,
652 .ranges = {
653 { 16 * 170.00 /*MHz*/, 0x01, },
654 { 16 * 450.00 /*MHz*/, 0x02, },
655 { 16 * 999.99 , 0x08, },
656 },
657 .config = 0xce,
658 },
659 [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
660 .name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
661 .count = 3,
662 .ranges = {
663 { 16 * 160.00 /*MHz*/, 0x01, },
664 { 16 * 442.00 /*MHz*/, 0x02, },
665 { 16 * 999.99 , 0x04, },
666 },
667 .config = 0xce,
668 },
669 [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
670 .name = "Philips FQ1236A MK4",
671 .count = 3,
672 .ranges = {
673 { 16 * 160.00 /*MHz*/, 0x01, },
674 { 16 * 442.00 /*MHz*/, 0x02, },
675 { 16 * 999.99 , 0x04, },
676 },
677 .config = 0x8e,
678 },
679 [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
680 .name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
681 .count = 3,
682 .ranges = {
683 { 16 * 160.00 /*MHz*/, 0xa0, },
684 { 16 * 454.00 /*MHz*/, 0x90, },
685 { 16 * 999.99 , 0x30, },
686 },
687 .config = 0x8e,
688 },
689 [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
690 .name = "Ymec TVision TVF-5533MF",
691 .count = 3,
692 .ranges = {
693 { 16 * 160.00 /*MHz*/, 0x01, },
694 { 16 * 454.00 /*MHz*/, 0x02, },
695 { 16 * 999.99 , 0x04, },
696 },
697 .config = 0x8e,
698 },
699
700 /* 60-69 */
701 [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */
702 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
703 .name = "Thomson DTT 761X (ATSC/NTSC)",
704 .count = 3,
705 .ranges = {
706 { 16 * 145.25 /*MHz*/, 0x39, },
707 { 16 * 415.25 /*MHz*/, 0x3a, },
708 { 16 * 999.99 , 0x3c, },
709 },
710 .config = 0x8e,
711 },
712 [TUNER_TENA_9533_DI] = { /* Philips PAL */
713 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
714 .count = 3,
715 .ranges = {
716 { 16 * 160.25 /*MHz*/, 0x01, },
717 { 16 * 464.25 /*MHz*/, 0x02, },
718 { 16 * 999.99 , 0x04, },
719 },
720 .config = 0x8e,
721 },
722 [TUNER_TEA5767] = { /* Philips RADIO */
723 .name = "Philips TEA5767HN FM Radio",
724 /* see tea5767.c for details */},
725 [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
726 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
727 .count = 3,
728 .ranges = {
729 { 16 * 160.00 /*MHz*/, 0x51, },
730 { 16 * 442.00 /*MHz*/, 0x52, },
731 { 16 * 999.99 , 0x54, },
732 },
733 .config = 0x86,
734 },
735 [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
736 .name = "LG TDVS-H062F/TUA6034",
737 .count = 3,
738 .ranges = {
739 { 16 * 160.00 /*MHz*/, 0x01 },
740 { 16 * 455.00 /*MHz*/, 0x02 },
741 { 16 * 999.99 , 0x04 },
742 },
743 .config = 0x8e,
744 },
745 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
746 .name = "Ymec TVF66T5-B/DFF",
747 .count = 3,
748 .ranges = {
749 { 16 * 160.25 /*MHz*/, 0x01, },
750 { 16 * 464.25 /*MHz*/, 0x02, },
751 { 16 * 999.99 , 0x08, },
752 },
753 .config = 0x8e,
754 },
755 [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
756 .name = "LG NTSC (TALN mini series)",
757 .count = 3,
758 .ranges = {
759 { 16 * 137.25 /*MHz*/, 0x01, },
760 { 16 * 373.25 /*MHz*/, 0x02, },
761 { 16 * 999.99 , 0x08, },
762 },
763 .config = 0x8e,
764 },
765 [TUNER_PHILIPS_TD1316] = { /* Philips PAL */
766 .name = "Philips TD1316 Hybrid Tuner",
767 .count = 3,
768 .ranges = {
769 { 16 * 160.00 /*MHz*/, 0xa1, },
770 { 16 * 442.00 /*MHz*/, 0xa2, },
771 { 16 * 999.99 , 0xa4, },
772 },
773 .config = 0xc8,
774 },
775 [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
776 .name = "Philips TUV1236D ATSC/NTSC dual in",
777 .count = 3,
778 .ranges = {
779 { 16 * 157.25 /*MHz*/, 0x01, },
780 { 16 * 454.00 /*MHz*/, 0x02, },
781 { 16 * 999.99 , 0x04, },
782 },
783 .config = 0xce,
784 },
785 [TUNER_TNF_5335MF] = { /* Philips NTSC */
786 .name = "Tena TNF 5335 MF",
787 .count = 3,
788 .ranges = {
789 { 16 * 157.25 /*MHz*/, 0x01, },
790 { 16 * 454.00 /*MHz*/, 0x02, },
791 { 16 * 999.99 , 0x04, },
792 },
793 .config = 0x8e,
794 },
795};
796
797unsigned const int tuner_count = ARRAY_SIZE(tuners);
798 92
799/* ---------------------------------------------------------------------- */ 93/* ---------------------------------------------------------------------- */
800 94
@@ -842,16 +136,23 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
842 u8 config, tuneraddr; 136 u8 config, tuneraddr;
843 u16 div; 137 u16 div;
844 struct tunertype *tun; 138 struct tunertype *tun;
845 unsigned char buffer[4]; 139 u8 buffer[4];
846 int rc, IFPCoff, i; 140 int rc, IFPCoff, i, j;
847 141
848 tun = &tuners[t->type]; 142 tun = &tuners[t->type];
849 for (i = 0; i < tun->count; i++) { 143 j = TUNER_PARAM_ANALOG;
850 if (freq > tun->ranges[i].thresh) 144
145 for (i = 0; i < tun->params[j].count; i++) {
146 if (freq > tun->params[j].ranges[i].limit)
851 continue; 147 continue;
852 break; 148 break;
853 } 149 }
854 config = tun->ranges[i].cb; 150 if (i == tun->params[j].count) {
151 tuner_dbg("TV frequency out of range (%d > %d)",
152 freq, tun->params[j].ranges[i - 1].limit);
153 freq = tun->params[j].ranges[--i].limit;
154 }
155 config = tun->params[j].ranges[i].cb;
855 /* i == 0 -> VHF_LO */ 156 /* i == 0 -> VHF_LO */
856 /* i == 1 -> VHF_HI */ 157 /* i == 1 -> VHF_HI */
857 /* i == 2 -> UHF */ 158 /* i == 2 -> UHF */
@@ -914,7 +215,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
914 215
915 case TUNER_MICROTUNE_4042FI5: 216 case TUNER_MICROTUNE_4042FI5:
916 /* Set the charge pump for fast tuning */ 217 /* Set the charge pump for fast tuning */
917 tun->config |= TUNER_CHARGE_PUMP; 218 tun->params[j].config |= TUNER_CHARGE_PUMP;
918 break; 219 break;
919 220
920 case TUNER_PHILIPS_TUV1236D: 221 case TUNER_PHILIPS_TUV1236D:
@@ -943,20 +244,6 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
943 break; 244 break;
944 } 245 }
945 246
946 /*
947 * Philips FI1216MK2 remark from specification :
948 * for channel selection involving band switching, and to ensure
949 * smooth tuning to the desired channel without causing
950 * unnecessary charge pump action, it is recommended to consider
951 * the difference between wanted channel frequency and the
952 * current channel frequency. Unnecessary charge pump action
953 * will result in very low tuning voltage which may drive the
954 * oscillator to extreme conditions.
955 *
956 * Progfou: specification says to send config data before
957 * frequency in case (wanted frequency < current frequency).
958 */
959
960 /* IFPCoff = Video Intermediate Frequency - Vif: 247 /* IFPCoff = Video Intermediate Frequency - Vif:
961 940 =16*58.75 NTSC/J (Japan) 248 940 =16*58.75 NTSC/J (Japan)
962 732 =16*45.75 M/N STD 249 732 =16*45.75 M/N STD
@@ -988,17 +275,18 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
988 offset / 16, offset % 16 * 100 / 16, 275 offset / 16, offset % 16 * 100 / 16,
989 div); 276 div);
990 277
991 if (t->type == TUNER_PHILIPS_SECAM && freq < t->freq) { 278 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
992 buffer[0] = tun->config; 279 buffer[0] = tun->params[j].config;
993 buffer[1] = config; 280 buffer[1] = config;
994 buffer[2] = (div>>8) & 0x7f; 281 buffer[2] = (div>>8) & 0x7f;
995 buffer[3] = div & 0xff; 282 buffer[3] = div & 0xff;
996 } else { 283 } else {
997 buffer[0] = (div>>8) & 0x7f; 284 buffer[0] = (div>>8) & 0x7f;
998 buffer[1] = div & 0xff; 285 buffer[1] = div & 0xff;
999 buffer[2] = tun->config; 286 buffer[2] = tun->params[j].config;
1000 buffer[3] = config; 287 buffer[3] = config;
1001 } 288 }
289 t->last_div = div;
1002 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 290 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1003 buffer[0],buffer[1],buffer[2],buffer[3]); 291 buffer[0],buffer[1],buffer[2],buffer[3]);
1004 292
@@ -1024,10 +312,10 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
1024 } 312 }
1025 313
1026 /* Set the charge pump for optimized phase noise figure */ 314 /* Set the charge pump for optimized phase noise figure */
1027 tun->config &= ~TUNER_CHARGE_PUMP; 315 tun->params[j].config &= ~TUNER_CHARGE_PUMP;
1028 buffer[0] = (div>>8) & 0x7f; 316 buffer[0] = (div>>8) & 0x7f;
1029 buffer[1] = div & 0xff; 317 buffer[1] = div & 0xff;
1030 buffer[2] = tun->config; 318 buffer[2] = tun->params[j].config;
1031 buffer[3] = config; 319 buffer[3] = config;
1032 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 320 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
1033 buffer[0],buffer[1],buffer[2],buffer[3]); 321 buffer[0],buffer[1],buffer[2],buffer[3]);
@@ -1041,13 +329,15 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
1041{ 329{
1042 struct tunertype *tun; 330 struct tunertype *tun;
1043 struct tuner *t = i2c_get_clientdata(c); 331 struct tuner *t = i2c_get_clientdata(c);
1044 unsigned char buffer[4]; 332 u8 buffer[4];
1045 unsigned div; 333 u16 div;
1046 int rc; 334 int rc, j;
1047 335
1048 tun = &tuners[t->type]; 336 tun = &tuners[t->type];
337 j = TUNER_PARAM_ANALOG;
338
1049 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ 339 div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
1050 buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ 340 buffer[2] = (tun->params[j].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
1051 341
1052 switch (t->type) { 342 switch (t->type) {
1053 case TUNER_TENA_9533_DI: 343 case TUNER_TENA_9533_DI:
@@ -1076,9 +366,19 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
1076 } 366 }
1077 buffer[0] = (div>>8) & 0x7f; 367 buffer[0] = (div>>8) & 0x7f;
1078 buffer[1] = div & 0xff; 368 buffer[1] = div & 0xff;
369 if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
370 buffer[0] = buffer[2];
371 buffer[1] = buffer[3];
372 buffer[2] = (div>>8) & 0x7f;
373 buffer[3] = div & 0xff;
374 } else {
375 buffer[0] = (div>>8) & 0x7f;
376 buffer[1] = div & 0xff;
377 }
1079 378
1080 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n", 379 tuner_dbg("radio 0x%02x 0x%02x 0x%02x 0x%02x\n",
1081 buffer[0],buffer[1],buffer[2],buffer[3]); 380 buffer[0],buffer[1],buffer[2],buffer[3]);
381 t->last_div = div;
1082 382
1083 if (4 != (rc = i2c_master_send(c,buffer,4))) 383 if (4 != (rc = i2c_master_send(c,buffer,4)))
1084 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 384 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
@@ -1092,10 +392,10 @@ int default_tuner_init(struct i2c_client *c)
1092 t->type, tuners[t->type].name); 392 t->type, tuners[t->type].name);
1093 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 393 strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
1094 394
1095 t->tv_freq = default_set_tv_freq; 395 t->set_tv_freq = default_set_tv_freq;
1096 t->radio_freq = default_set_radio_freq; 396 t->set_radio_freq = default_set_radio_freq;
1097 t->has_signal = tuner_signal; 397 t->has_signal = tuner_signal;
1098 t->is_stereo = tuner_stereo; 398 t->is_stereo = tuner_stereo;
1099 t->standby = NULL; 399 t->standby = NULL;
1100 400
1101 return 0; 401 return 0;
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
new file mode 100644
index 000000000000..6fe781798d89
--- /dev/null
+++ b/drivers/media/video/tuner-types.c
@@ -0,0 +1,1406 @@
1/*
2 *
3 * i2c tv tuner chip device type database.
4 *
5 */
6
7#include <linux/i2c.h>
8#include <media/tuner.h>
9#include <media/tuner-types.h>
10
11/* ---------------------------------------------------------------------- */
12
13/*
14 * The floats in the tuner struct are computed at compile time
15 * by gcc and cast back to integers. Thus we don't violate the
16 * "no float in kernel" rule.
17 *
18 * A tuner_range may be referenced by multiple tuner_params structs.
19 * There are many duplicates in here. Reusing tuner_range structs,
20 * rather than defining new ones for each tuner, will cut down on
21 * memory usage, and is preferred when possible.
22 *
23 * Each tuner_params array may contain one or more elements, one
24 * for each video standard.
25 *
26 * FIXME: Some tuner_range definitions are duplicated, and
27 * should be eliminated.
28 *
29 * FIXME: tunertype struct contains an element, has_tda988x.
30 * We must set this for all tunertypes that contain a tda988x
31 * chip, and then we can remove this setting from the various
32 * card structs.
33 */
34
35/* 0-9 */
36/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */
37
38static struct tuner_range tuner_temic_pal_ranges[] = {
39 { 16 * 140.25 /*MHz*/, 0x02, },
40 { 16 * 463.25 /*MHz*/, 0x04, },
41 { 16 * 999.99 , 0x01, },
42};
43
44static struct tuner_params tuner_temic_pal_params[] = {
45 {
46 .type = TUNER_PARAM_TYPE_PAL,
47 .ranges = tuner_temic_pal_ranges,
48 .count = ARRAY_SIZE(tuner_temic_pal_ranges),
49 .config = 0x8e,
50 },
51};
52
53/* ------------ TUNER_PHILIPS_PAL_I - Philips PAL_I ------------ */
54
55static struct tuner_range tuner_philips_pal_i_ranges[] = {
56 { 16 * 140.25 /*MHz*/, 0xa0, },
57 { 16 * 463.25 /*MHz*/, 0x90, },
58 { 16 * 999.99 , 0x30, },
59};
60
61static struct tuner_params tuner_philips_pal_i_params[] = {
62 {
63 .type = TUNER_PARAM_TYPE_PAL,
64 .ranges = tuner_philips_pal_i_ranges,
65 .count = ARRAY_SIZE(tuner_philips_pal_i_ranges),
66 .config = 0x8e,
67 },
68};
69
70/* ------------ TUNER_PHILIPS_NTSC - Philips NTSC ------------ */
71
72static struct tuner_range tuner_philips_ntsc_ranges[] = {
73 { 16 * 157.25 /*MHz*/, 0xa0, },
74 { 16 * 451.25 /*MHz*/, 0x90, },
75 { 16 * 999.99 , 0x30, },
76};
77
78static struct tuner_params tuner_philips_ntsc_params[] = {
79 {
80 .type = TUNER_PARAM_TYPE_NTSC,
81 .ranges = tuner_philips_ntsc_ranges,
82 .count = ARRAY_SIZE(tuner_philips_ntsc_ranges),
83 .config = 0x8e,
84 .cb_first_if_lower_freq = 1,
85 },
86};
87
88/* ------------ TUNER_PHILIPS_SECAM - Philips SECAM ------------ */
89
90static struct tuner_range tuner_philips_secam_ranges[] = {
91 { 16 * 168.25 /*MHz*/, 0xa7, },
92 { 16 * 447.25 /*MHz*/, 0x97, },
93 { 16 * 999.99 , 0x37, },
94};
95
96static struct tuner_params tuner_philips_secam_params[] = {
97 {
98 .type = TUNER_PARAM_TYPE_SECAM,
99 .ranges = tuner_philips_secam_ranges,
100 .count = ARRAY_SIZE(tuner_philips_secam_ranges),
101 .config = 0x8e,
102 .cb_first_if_lower_freq = 1,
103 },
104};
105
106/* ------------ TUNER_PHILIPS_PAL - Philips PAL ------------ */
107
108static struct tuner_range tuner_philips_pal_ranges[] = {
109 { 16 * 168.25 /*MHz*/, 0xa0, },
110 { 16 * 447.25 /*MHz*/, 0x90, },
111 { 16 * 999.99 , 0x30, },
112};
113
114static struct tuner_params tuner_philips_pal_params[] = {
115 {
116 .type = TUNER_PARAM_TYPE_PAL,
117 .ranges = tuner_philips_pal_ranges,
118 .count = ARRAY_SIZE(tuner_philips_pal_ranges),
119 .config = 0x8e,
120 .cb_first_if_lower_freq = 1,
121 },
122};
123
124/* ------------ TUNER_TEMIC_NTSC - TEMIC NTSC ------------ */
125
126static struct tuner_range tuner_temic_ntsc_ranges[] = {
127 { 16 * 157.25 /*MHz*/, 0x02, },
128 { 16 * 463.25 /*MHz*/, 0x04, },
129 { 16 * 999.99 , 0x01, },
130};
131
132static struct tuner_params tuner_temic_ntsc_params[] = {
133 {
134 .type = TUNER_PARAM_TYPE_NTSC,
135 .ranges = tuner_temic_ntsc_ranges,
136 .count = ARRAY_SIZE(tuner_temic_ntsc_ranges),
137 .config = 0x8e,
138 },
139};
140
141/* ------------ TUNER_TEMIC_PAL_I - TEMIC PAL_I ------------ */
142
143static struct tuner_range tuner_temic_pal_i_ranges[] = {
144 { 16 * 170.00 /*MHz*/, 0x02, },
145 { 16 * 450.00 /*MHz*/, 0x04, },
146 { 16 * 999.99 , 0x01, },
147};
148
149static struct tuner_params tuner_temic_pal_i_params[] = {
150 {
151 .type = TUNER_PARAM_TYPE_PAL,
152 .ranges = tuner_temic_pal_i_ranges,
153 .count = ARRAY_SIZE(tuner_temic_pal_i_ranges),
154 .config = 0x8e,
155 },
156};
157
158/* ------------ TUNER_TEMIC_4036FY5_NTSC - TEMIC NTSC ------------ */
159
160static struct tuner_range tuner_temic_4036fy5_ntsc_ranges[] = {
161 { 16 * 157.25 /*MHz*/, 0xa0, },
162 { 16 * 463.25 /*MHz*/, 0x90, },
163 { 16 * 999.99 , 0x30, },
164};
165
166static struct tuner_params tuner_temic_4036fy5_ntsc_params[] = {
167 {
168 .type = TUNER_PARAM_TYPE_NTSC,
169 .ranges = tuner_temic_4036fy5_ntsc_ranges,
170 .count = ARRAY_SIZE(tuner_temic_4036fy5_ntsc_ranges),
171 .config = 0x8e,
172 },
173};
174
175/* ------------ TUNER_ALPS_TSBH1_NTSC - TEMIC NTSC ------------ */
176
177static struct tuner_range tuner_alps_tsb_1_ranges[] = {
178 { 16 * 137.25 /*MHz*/, 0x01, },
179 { 16 * 385.25 /*MHz*/, 0x02, },
180 { 16 * 999.99 , 0x08, },
181};
182
183static struct tuner_params tuner_alps_tsbh1_ntsc_params[] = {
184 {
185 .type = TUNER_PARAM_TYPE_NTSC,
186 .ranges = tuner_alps_tsb_1_ranges,
187 .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges),
188 .config = 0x8e,
189 },
190};
191
192/* 10-19 */
193/* ------------ TUNER_ALPS_TSBE1_PAL - TEMIC PAL ------------ */
194
195static struct tuner_params tuner_alps_tsb_1_params[] = {
196 {
197 .type = TUNER_PARAM_TYPE_PAL,
198 .ranges = tuner_alps_tsb_1_ranges,
199 .count = ARRAY_SIZE(tuner_alps_tsb_1_ranges),
200 .config = 0x8e,
201 },
202};
203
204/* ------------ TUNER_ALPS_TSBB5_PAL_I - Alps PAL_I ------------ */
205
206static struct tuner_range tuner_alps_tsb_5_pal_ranges[] = {
207 { 16 * 133.25 /*MHz*/, 0x01, },
208 { 16 * 351.25 /*MHz*/, 0x02, },
209 { 16 * 999.99 , 0x08, },
210};
211
212static struct tuner_params tuner_alps_tsbb5_params[] = {
213 {
214 .type = TUNER_PARAM_TYPE_PAL,
215 .ranges = tuner_alps_tsb_5_pal_ranges,
216 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
217 .config = 0x8e,
218 },
219};
220
221/* ------------ TUNER_ALPS_TSBE5_PAL - Alps PAL ------------ */
222
223static struct tuner_params tuner_alps_tsbe5_params[] = {
224 {
225 .type = TUNER_PARAM_TYPE_PAL,
226 .ranges = tuner_alps_tsb_5_pal_ranges,
227 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
228 .config = 0x8e,
229 },
230};
231
232/* ------------ TUNER_ALPS_TSBC5_PAL - Alps PAL ------------ */
233
234static struct tuner_params tuner_alps_tsbc5_params[] = {
235 {
236 .type = TUNER_PARAM_TYPE_PAL,
237 .ranges = tuner_alps_tsb_5_pal_ranges,
238 .count = ARRAY_SIZE(tuner_alps_tsb_5_pal_ranges),
239 .config = 0x8e,
240 },
241};
242
243/* ------------ TUNER_TEMIC_4006FH5_PAL - TEMIC PAL ------------ */
244
245static struct tuner_range tuner_temic_4006fh5_pal_ranges[] = {
246 { 16 * 170.00 /*MHz*/, 0xa0, },
247 { 16 * 450.00 /*MHz*/, 0x90, },
248 { 16 * 999.99 , 0x30, },
249};
250
251static struct tuner_params tuner_temic_4006fh5_params[] = {
252 {
253 .type = TUNER_PARAM_TYPE_PAL,
254 .ranges = tuner_temic_4006fh5_pal_ranges,
255 .count = ARRAY_SIZE(tuner_temic_4006fh5_pal_ranges),
256 .config = 0x8e,
257 },
258};
259
260/* ------------ TUNER_ALPS_TSHC6_NTSC - Alps NTSC ------------ */
261
262static struct tuner_range tuner_alps_tshc6_ntsc_ranges[] = {
263 { 16 * 137.25 /*MHz*/, 0x14, },
264 { 16 * 385.25 /*MHz*/, 0x12, },
265 { 16 * 999.99 , 0x11, },
266};
267
268static struct tuner_params tuner_alps_tshc6_params[] = {
269 {
270 .type = TUNER_PARAM_TYPE_NTSC,
271 .ranges = tuner_alps_tshc6_ntsc_ranges,
272 .count = ARRAY_SIZE(tuner_alps_tshc6_ntsc_ranges),
273 .config = 0x8e,
274 },
275};
276
277/* ------------ TUNER_TEMIC_PAL_DK - TEMIC PAL ------------ */
278
279static struct tuner_range tuner_temic_pal_dk_ranges[] = {
280 { 16 * 168.25 /*MHz*/, 0xa0, },
281 { 16 * 456.25 /*MHz*/, 0x90, },
282 { 16 * 999.99 , 0x30, },
283};
284
285static struct tuner_params tuner_temic_pal_dk_params[] = {
286 {
287 .type = TUNER_PARAM_TYPE_PAL,
288 .ranges = tuner_temic_pal_dk_ranges,
289 .count = ARRAY_SIZE(tuner_temic_pal_dk_ranges),
290 .config = 0x8e,
291 },
292};
293
294/* ------------ TUNER_PHILIPS_NTSC_M - Philips NTSC ------------ */
295
296static struct tuner_range tuner_philips_ntsc_m_ranges[] = {
297 { 16 * 160.00 /*MHz*/, 0xa0, },
298 { 16 * 454.00 /*MHz*/, 0x90, },
299 { 16 * 999.99 , 0x30, },
300};
301
302static struct tuner_params tuner_philips_ntsc_m_params[] = {
303 {
304 .type = TUNER_PARAM_TYPE_NTSC,
305 .ranges = tuner_philips_ntsc_m_ranges,
306 .count = ARRAY_SIZE(tuner_philips_ntsc_m_ranges),
307 .config = 0x8e,
308 },
309};
310
311/* ------------ TUNER_TEMIC_4066FY5_PAL_I - TEMIC PAL_I ------------ */
312
313static struct tuner_range tuner_temic_40x6f_5_pal_ranges[] = {
314 { 16 * 169.00 /*MHz*/, 0xa0, },
315 { 16 * 454.00 /*MHz*/, 0x90, },
316 { 16 * 999.99 , 0x30, },
317};
318
319static struct tuner_params tuner_temic_4066fy5_pal_i_params[] = {
320 {
321 .type = TUNER_PARAM_TYPE_PAL,
322 .ranges = tuner_temic_40x6f_5_pal_ranges,
323 .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges),
324 .config = 0x8e,
325 },
326};
327
328/* ------------ TUNER_TEMIC_4006FN5_MULTI_PAL - TEMIC PAL ------------ */
329
330static struct tuner_params tuner_temic_4006fn5_multi_params[] = {
331 {
332 .type = TUNER_PARAM_TYPE_PAL,
333 .ranges = tuner_temic_40x6f_5_pal_ranges,
334 .count = ARRAY_SIZE(tuner_temic_40x6f_5_pal_ranges),
335 .config = 0x8e,
336 },
337};
338
339/* 20-29 */
340/* ------------ TUNER_TEMIC_4009FR5_PAL - TEMIC PAL ------------ */
341
342static struct tuner_range tuner_temic_4009f_5_pal_ranges[] = {
343 { 16 * 141.00 /*MHz*/, 0xa0, },
344 { 16 * 464.00 /*MHz*/, 0x90, },
345 { 16 * 999.99 , 0x30, },
346};
347
348static struct tuner_params tuner_temic_4009f_5_params[] = {
349 {
350 .type = TUNER_PARAM_TYPE_PAL,
351 .ranges = tuner_temic_4009f_5_pal_ranges,
352 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
353 .config = 0x8e,
354 },
355};
356
357/* ------------ TUNER_TEMIC_4039FR5_NTSC - TEMIC NTSC ------------ */
358
359static struct tuner_range tuner_temic_4039fr5_ntsc_ranges[] = {
360 { 16 * 158.00 /*MHz*/, 0xa0, },
361 { 16 * 453.00 /*MHz*/, 0x90, },
362 { 16 * 999.99 , 0x30, },
363};
364
365static struct tuner_params tuner_temic_4039fr5_params[] = {
366 {
367 .type = TUNER_PARAM_TYPE_NTSC,
368 .ranges = tuner_temic_4039fr5_ntsc_ranges,
369 .count = ARRAY_SIZE(tuner_temic_4039fr5_ntsc_ranges),
370 .config = 0x8e,
371 },
372};
373
374/* ------------ TUNER_TEMIC_4046FM5 - TEMIC PAL ------------ */
375
376static struct tuner_range tuner_temic_4046fm5_pal_ranges[] = {
377 { 16 * 169.00 /*MHz*/, 0xa0, },
378 { 16 * 454.00 /*MHz*/, 0x90, },
379 { 16 * 999.99 , 0x30, },
380};
381
382static struct tuner_params tuner_temic_4046fm5_params[] = {
383 {
384 .type = TUNER_PARAM_TYPE_PAL,
385 .ranges = tuner_temic_4046fm5_pal_ranges,
386 .count = ARRAY_SIZE(tuner_temic_4046fm5_pal_ranges),
387 .config = 0x8e,
388 },
389};
390
391/* ------------ TUNER_PHILIPS_PAL_DK - Philips PAL ------------ */
392
393static struct tuner_range tuner_lg_pal_ranges[] = {
394 { 16 * 170.00 /*MHz*/, 0xa0, },
395 { 16 * 450.00 /*MHz*/, 0x90, },
396 { 16 * 999.99 , 0x30, },
397};
398
399static struct tuner_params tuner_philips_pal_dk_params[] = {
400 {
401 .type = TUNER_PARAM_TYPE_PAL,
402 .ranges = tuner_lg_pal_ranges,
403 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
404 .config = 0x8e,
405 },
406};
407
408/* ------------ TUNER_PHILIPS_FQ1216ME - Philips PAL ------------ */
409
410static struct tuner_params tuner_philips_fq1216me_params[] = {
411 {
412 .type = TUNER_PARAM_TYPE_PAL,
413 .ranges = tuner_lg_pal_ranges,
414 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
415 .config = 0x8e,
416 },
417};
418
419/* ------------ TUNER_LG_PAL_I_FM - LGINNOTEK PAL_I ------------ */
420
421static struct tuner_params tuner_lg_pal_i_fm_params[] = {
422 {
423 .type = TUNER_PARAM_TYPE_PAL,
424 .ranges = tuner_lg_pal_ranges,
425 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
426 .config = 0x8e,
427 },
428};
429
430/* ------------ TUNER_LG_PAL_I - LGINNOTEK PAL_I ------------ */
431
432static struct tuner_params tuner_lg_pal_i_params[] = {
433 {
434 .type = TUNER_PARAM_TYPE_PAL,
435 .ranges = tuner_lg_pal_ranges,
436 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
437 .config = 0x8e,
438 },
439};
440
441/* ------------ TUNER_LG_NTSC_FM - LGINNOTEK NTSC ------------ */
442
443static struct tuner_range tuner_lg_ntsc_fm_ranges[] = {
444 { 16 * 210.00 /*MHz*/, 0xa0, },
445 { 16 * 497.00 /*MHz*/, 0x90, },
446 { 16 * 999.99 , 0x30, },
447};
448
449static struct tuner_params tuner_lg_ntsc_fm_params[] = {
450 {
451 .type = TUNER_PARAM_TYPE_NTSC,
452 .ranges = tuner_lg_ntsc_fm_ranges,
453 .count = ARRAY_SIZE(tuner_lg_ntsc_fm_ranges),
454 .config = 0x8e,
455 },
456};
457
458/* ------------ TUNER_LG_PAL_FM - LGINNOTEK PAL ------------ */
459
460static struct tuner_params tuner_lg_pal_fm_params[] = {
461 {
462 .type = TUNER_PARAM_TYPE_PAL,
463 .ranges = tuner_lg_pal_ranges,
464 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
465 .config = 0x8e,
466 },
467};
468
469/* ------------ TUNER_LG_PAL - LGINNOTEK PAL ------------ */
470
471static struct tuner_params tuner_lg_pal_params[] = {
472 {
473 .type = TUNER_PARAM_TYPE_PAL,
474 .ranges = tuner_lg_pal_ranges,
475 .count = ARRAY_SIZE(tuner_lg_pal_ranges),
476 .config = 0x8e,
477 },
478};
479
480/* 30-39 */
481/* ------------ TUNER_TEMIC_4009FN5_MULTI_PAL_FM - TEMIC PAL ------------ */
482
483static struct tuner_params tuner_temic_4009_fn5_multi_pal_fm_params[] = {
484 {
485 .type = TUNER_PARAM_TYPE_PAL,
486 .ranges = tuner_temic_4009f_5_pal_ranges,
487 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
488 .config = 0x8e,
489 },
490};
491
492/* ------------ TUNER_SHARP_2U5JF5540_NTSC - SHARP NTSC ------------ */
493
494static struct tuner_range tuner_sharp_2u5jf5540_ntsc_ranges[] = {
495 { 16 * 137.25 /*MHz*/, 0x01, },
496 { 16 * 317.25 /*MHz*/, 0x02, },
497 { 16 * 999.99 , 0x08, },
498};
499
500static struct tuner_params tuner_sharp_2u5jf5540_params[] = {
501 {
502 .type = TUNER_PARAM_TYPE_NTSC,
503 .ranges = tuner_sharp_2u5jf5540_ntsc_ranges,
504 .count = ARRAY_SIZE(tuner_sharp_2u5jf5540_ntsc_ranges),
505 .config = 0x8e,
506 },
507};
508
509/* ------------ TUNER_Samsung_PAL_TCPM9091PD27 - Samsung PAL ------------ */
510
511static struct tuner_range tuner_samsung_pal_tcpm9091pd27_ranges[] = {
512 { 16 * 169 /*MHz*/, 0xa0, },
513 { 16 * 464 /*MHz*/, 0x90, },
514 { 16 * 999.99 , 0x30, },
515};
516
517static struct tuner_params tuner_samsung_pal_tcpm9091pd27_params[] = {
518 {
519 .type = TUNER_PARAM_TYPE_PAL,
520 .ranges = tuner_samsung_pal_tcpm9091pd27_ranges,
521 .count = ARRAY_SIZE(tuner_samsung_pal_tcpm9091pd27_ranges),
522 .config = 0x8e,
523 },
524};
525
526/* ------------ TUNER_TEMIC_4106FH5 - TEMIC PAL ------------ */
527
528static struct tuner_params tuner_temic_4106fh5_params[] = {
529 {
530 .type = TUNER_PARAM_TYPE_PAL,
531 .ranges = tuner_temic_4009f_5_pal_ranges,
532 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
533 .config = 0x8e,
534 },
535};
536
537/* ------------ TUNER_TEMIC_4012FY5 - TEMIC PAL ------------ */
538
539static struct tuner_range tuner_temic_4012fy5_pal_ranges[] = {
540 { 16 * 140.25 /*MHz*/, 0x02, },
541 { 16 * 463.25 /*MHz*/, 0x04, },
542 { 16 * 999.99 , 0x01, },
543};
544
545static struct tuner_params tuner_temic_4012fy5_params[] = {
546 {
547 .type = TUNER_PARAM_TYPE_PAL,
548 .ranges = tuner_temic_4012fy5_pal_ranges,
549 .count = ARRAY_SIZE(tuner_temic_4012fy5_pal_ranges),
550 .config = 0x8e,
551 },
552};
553
554/* ------------ TUNER_TEMIC_4136FY5 - TEMIC NTSC ------------ */
555
556static struct tuner_range tuner_temic_4136_fy5_ntsc_ranges[] = {
557 { 16 * 158.00 /*MHz*/, 0xa0, },
558 { 16 * 453.00 /*MHz*/, 0x90, },
559 { 16 * 999.99 , 0x30, },
560};
561
562static struct tuner_params tuner_temic_4136_fy5_params[] = {
563 {
564 .type = TUNER_PARAM_TYPE_NTSC,
565 .ranges = tuner_temic_4136_fy5_ntsc_ranges,
566 .count = ARRAY_SIZE(tuner_temic_4136_fy5_ntsc_ranges),
567 .config = 0x8e,
568 },
569};
570
571/* ------------ TUNER_LG_PAL_NEW_TAPC - LGINNOTEK PAL ------------ */
572
573static struct tuner_range tuner_lg_new_tapc_ranges[] = {
574 { 16 * 170.00 /*MHz*/, 0x01, },
575 { 16 * 450.00 /*MHz*/, 0x02, },
576 { 16 * 999.99 , 0x08, },
577};
578
579static struct tuner_params tuner_lg_pal_new_tapc_params[] = {
580 {
581 .type = TUNER_PARAM_TYPE_PAL,
582 .ranges = tuner_lg_new_tapc_ranges,
583 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
584 .config = 0x8e,
585 },
586};
587
588/* ------------ TUNER_PHILIPS_FM1216ME_MK3 - Philips PAL ------------ */
589
590static struct tuner_range tuner_fm1216me_mk3_pal_ranges[] = {
591 { 16 * 158.00 /*MHz*/, 0x01, },
592 { 16 * 442.00 /*MHz*/, 0x02, },
593 { 16 * 999.99 , 0x04, },
594};
595
596static struct tuner_params tuner_fm1216me_mk3_params[] = {
597 {
598 .type = TUNER_PARAM_TYPE_PAL,
599 .ranges = tuner_fm1216me_mk3_pal_ranges,
600 .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges),
601 .config = 0x8e,
602 .cb_first_if_lower_freq = 1,
603 },
604};
605
606/* ------------ TUNER_LG_NTSC_NEW_TAPC - LGINNOTEK NTSC ------------ */
607
608static struct tuner_params tuner_lg_ntsc_new_tapc_params[] = {
609 {
610 .type = TUNER_PARAM_TYPE_NTSC,
611 .ranges = tuner_lg_new_tapc_ranges,
612 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
613 .config = 0x8e,
614 },
615};
616
617/* 40-49 */
618/* ------------ TUNER_HITACHI_NTSC - HITACHI NTSC ------------ */
619
620static struct tuner_params tuner_hitachi_ntsc_params[] = {
621 {
622 .type = TUNER_PARAM_TYPE_NTSC,
623 .ranges = tuner_lg_new_tapc_ranges,
624 .count = ARRAY_SIZE(tuner_lg_new_tapc_ranges),
625 .config = 0x8e,
626 },
627};
628
629/* ------------ TUNER_PHILIPS_PAL_MK - Philips PAL ------------ */
630
631static struct tuner_range tuner_philips_pal_mk_pal_ranges[] = {
632 { 16 * 140.25 /*MHz*/, 0x01, },
633 { 16 * 463.25 /*MHz*/, 0xc2, },
634 { 16 * 999.99 , 0xcf, },
635};
636
637static struct tuner_params tuner_philips_pal_mk_params[] = {
638 {
639 .type = TUNER_PARAM_TYPE_PAL,
640 .ranges = tuner_philips_pal_mk_pal_ranges,
641 .count = ARRAY_SIZE(tuner_philips_pal_mk_pal_ranges),
642 .config = 0x8e,
643 },
644};
645
646/* ------------ TUNER_PHILIPS_ATSC - Philips ATSC ------------ */
647
648static struct tuner_range tuner_philips_atsc_ranges[] = {
649 { 16 * 157.25 /*MHz*/, 0xa0, },
650 { 16 * 454.00 /*MHz*/, 0x90, },
651 { 16 * 999.99 , 0x30, },
652};
653
654static struct tuner_params tuner_philips_atsc_params[] = {
655 {
656 .type = TUNER_PARAM_TYPE_NTSC,
657 .ranges = tuner_philips_atsc_ranges,
658 .count = ARRAY_SIZE(tuner_philips_atsc_ranges),
659 .config = 0x8e,
660 },
661};
662
663/* ------------ TUNER_PHILIPS_FM1236_MK3 - Philips NTSC ------------ */
664
665static struct tuner_range tuner_fm1236_mk3_ntsc_ranges[] = {
666 { 16 * 160.00 /*MHz*/, 0x01, },
667 { 16 * 442.00 /*MHz*/, 0x02, },
668 { 16 * 999.99 , 0x04, },
669};
670
671static struct tuner_params tuner_fm1236_mk3_params[] = {
672 {
673 .type = TUNER_PARAM_TYPE_NTSC,
674 .ranges = tuner_fm1236_mk3_ntsc_ranges,
675 .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges),
676 .config = 0x8e,
677 .cb_first_if_lower_freq = 1,
678 },
679};
680
681/* ------------ TUNER_PHILIPS_4IN1 - Philips NTSC ------------ */
682
683static struct tuner_range tuner_philips_4in1_ntsc_ranges[] = {
684 { 16 * 160.00 /*MHz*/, 0x01, },
685 { 16 * 442.00 /*MHz*/, 0x02, },
686 { 16 * 999.99 , 0x04, },
687};
688
689static struct tuner_params tuner_philips_4in1_params[] = {
690 {
691 .type = TUNER_PARAM_TYPE_NTSC,
692 .ranges = tuner_philips_4in1_ntsc_ranges,
693 .count = ARRAY_SIZE(tuner_philips_4in1_ntsc_ranges),
694 .config = 0x8e,
695 },
696};
697
698/* ------------ TUNER_MICROTUNE_4049FM5 - Microtune PAL ------------ */
699
700static struct tuner_params tuner_microtune_4049_fm5_params[] = {
701 {
702 .type = TUNER_PARAM_TYPE_PAL,
703 .ranges = tuner_temic_4009f_5_pal_ranges,
704 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
705 .config = 0x8e,
706 },
707};
708
709/* ------------ TUNER_PANASONIC_VP27 - Panasonic NTSC ------------ */
710
711static struct tuner_range tuner_panasonic_vp27_ntsc_ranges[] = {
712 { 16 * 160.00 /*MHz*/, 0x01, },
713 { 16 * 454.00 /*MHz*/, 0x02, },
714 { 16 * 999.99 , 0x08, },
715};
716
717static struct tuner_params tuner_panasonic_vp27_params[] = {
718 {
719 .type = TUNER_PARAM_TYPE_NTSC,
720 .ranges = tuner_panasonic_vp27_ntsc_ranges,
721 .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges),
722 .config = 0xce,
723 },
724};
725
726/* ------------ TUNER_LG_NTSC_TAPE - LGINNOTEK NTSC ------------ */
727
728static struct tuner_range tuner_lg_ntsc_tape_ranges[] = {
729 { 16 * 160.00 /*MHz*/, 0x01, },
730 { 16 * 442.00 /*MHz*/, 0x02, },
731 { 16 * 999.99 , 0x04, },
732};
733
734static struct tuner_params tuner_lg_ntsc_tape_params[] = {
735 {
736 .type = TUNER_PARAM_TYPE_NTSC,
737 .ranges = tuner_lg_ntsc_tape_ranges,
738 .count = ARRAY_SIZE(tuner_lg_ntsc_tape_ranges),
739 .config = 0x8e,
740 },
741};
742
743/* ------------ TUNER_TNF_8831BGFF - Philips PAL ------------ */
744
745static struct tuner_range tuner_tnf_8831bgff_pal_ranges[] = {
746 { 16 * 161.25 /*MHz*/, 0xa0, },
747 { 16 * 463.25 /*MHz*/, 0x90, },
748 { 16 * 999.99 , 0x30, },
749};
750
751static struct tuner_params tuner_tnf_8831bgff_params[] = {
752 {
753 .type = TUNER_PARAM_TYPE_PAL,
754 .ranges = tuner_tnf_8831bgff_pal_ranges,
755 .count = ARRAY_SIZE(tuner_tnf_8831bgff_pal_ranges),
756 .config = 0x8e,
757 },
758};
759
760/* ------------ TUNER_MICROTUNE_4042FI5 - Microtune NTSC ------------ */
761
762static struct tuner_range tuner_microtune_4042fi5_ntsc_ranges[] = {
763 { 16 * 162.00 /*MHz*/, 0xa2, },
764 { 16 * 457.00 /*MHz*/, 0x94, },
765 { 16 * 999.99 , 0x31, },
766};
767
768static struct tuner_params tuner_microtune_4042fi5_params[] = {
769 {
770 .type = TUNER_PARAM_TYPE_NTSC,
771 .ranges = tuner_microtune_4042fi5_ntsc_ranges,
772 .count = ARRAY_SIZE(tuner_microtune_4042fi5_ntsc_ranges),
773 .config = 0x8e,
774 },
775};
776
777/* 50-59 */
778/* ------------ TUNER_TCL_2002N - TCL NTSC ------------ */
779
780static struct tuner_range tuner_tcl_2002n_ntsc_ranges[] = {
781 { 16 * 172.00 /*MHz*/, 0x01, },
782 { 16 * 448.00 /*MHz*/, 0x02, },
783 { 16 * 999.99 , 0x08, },
784};
785
786static struct tuner_params tuner_tcl_2002n_params[] = {
787 {
788 .type = TUNER_PARAM_TYPE_NTSC,
789 .ranges = tuner_tcl_2002n_ntsc_ranges,
790 .count = ARRAY_SIZE(tuner_tcl_2002n_ntsc_ranges),
791 .config = 0x8e,
792 .cb_first_if_lower_freq = 1,
793 },
794};
795
796/* ------------ TUNER_PHILIPS_FM1256_IH3 - Philips PAL ------------ */
797
798static struct tuner_range tuner_philips_fm1256_ih3_pal_ranges[] = {
799 { 16 * 160.00 /*MHz*/, 0x01, },
800 { 16 * 442.00 /*MHz*/, 0x02, },
801 { 16 * 999.99 , 0x04, },
802};
803
804static struct tuner_params tuner_philips_fm1256_ih3_params[] = {
805 {
806 .type = TUNER_PARAM_TYPE_PAL,
807 .ranges = tuner_philips_fm1256_ih3_pal_ranges,
808 .count = ARRAY_SIZE(tuner_philips_fm1256_ih3_pal_ranges),
809 .config = 0x8e,
810 },
811};
812
813/* ------------ TUNER_THOMSON_DTT7610 - THOMSON ATSC ------------ */
814
815static struct tuner_range tuner_thomson_dtt7610_ntsc_ranges[] = {
816 { 16 * 157.25 /*MHz*/, 0x39, },
817 { 16 * 454.00 /*MHz*/, 0x3a, },
818 { 16 * 999.99 , 0x3c, },
819};
820
821static struct tuner_params tuner_thomson_dtt7610_params[] = {
822 {
823 .type = TUNER_PARAM_TYPE_NTSC,
824 .ranges = tuner_thomson_dtt7610_ntsc_ranges,
825 .count = ARRAY_SIZE(tuner_thomson_dtt7610_ntsc_ranges),
826 .config = 0x8e,
827 },
828};
829
830/* ------------ TUNER_PHILIPS_FQ1286 - Philips NTSC ------------ */
831
832static struct tuner_range tuner_philips_fq1286_ntsc_ranges[] = {
833 { 16 * 160.00 /*MHz*/, 0x41, },
834 { 16 * 454.00 /*MHz*/, 0x42, },
835 { 16 * 999.99 , 0x04, },
836};
837
838static struct tuner_params tuner_philips_fq1286_params[] = {
839 {
840 .type = TUNER_PARAM_TYPE_NTSC,
841 .ranges = tuner_philips_fq1286_ntsc_ranges,
842 .count = ARRAY_SIZE(tuner_philips_fq1286_ntsc_ranges),
843 .config = 0x8e,
844 },
845};
846
847/* ------------ TUNER_TCL_2002MB - TCL PAL ------------ */
848
849static struct tuner_range tuner_tcl_2002mb_pal_ranges[] = {
850 { 16 * 170.00 /*MHz*/, 0x01, },
851 { 16 * 450.00 /*MHz*/, 0x02, },
852 { 16 * 999.99 , 0x08, },
853};
854
855static struct tuner_params tuner_tcl_2002mb_params[] = {
856 {
857 .type = TUNER_PARAM_TYPE_PAL,
858 .ranges = tuner_tcl_2002mb_pal_ranges,
859 .count = ARRAY_SIZE(tuner_tcl_2002mb_pal_ranges),
860 .config = 0xce,
861 },
862};
863
864/* ------------ TUNER_PHILIPS_FQ1216AME_MK4 - Philips PAL ------------ */
865
866static struct tuner_range tuner_philips_fq12_6a___mk4_ranges[] = {
867 { 16 * 160.00 /*MHz*/, 0x01, },
868 { 16 * 442.00 /*MHz*/, 0x02, },
869 { 16 * 999.99 , 0x04, },
870};
871
872static struct tuner_params tuner_philips_fq1216ame_mk4_params[] = {
873 {
874 .type = TUNER_PARAM_TYPE_PAL,
875 .ranges = tuner_philips_fq12_6a___mk4_ranges,
876 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges),
877 .config = 0xce,
878 },
879};
880
881/* ------------ TUNER_PHILIPS_FQ1236A_MK4 - Philips NTSC ------------ */
882
883static struct tuner_params tuner_philips_fq1236a_mk4_params[] = {
884 {
885 .type = TUNER_PARAM_TYPE_NTSC,
886 .ranges = tuner_philips_fq12_6a___mk4_ranges,
887 .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_ranges),
888 .config = 0x8e,
889 },
890};
891
892/* ------------ TUNER_YMEC_TVF_8531MF - Philips NTSC ------------ */
893
894static struct tuner_range tuner_ymec_tvf_8531mf_ntsc_ranges[] = {
895 { 16 * 160.00 /*MHz*/, 0xa0, },
896 { 16 * 454.00 /*MHz*/, 0x90, },
897 { 16 * 999.99 , 0x30, },
898};
899
900static struct tuner_params tuner_ymec_tvf_8531mf_params[] = {
901 {
902 .type = TUNER_PARAM_TYPE_NTSC,
903 .ranges = tuner_ymec_tvf_8531mf_ntsc_ranges,
904 .count = ARRAY_SIZE(tuner_ymec_tvf_8531mf_ntsc_ranges),
905 .config = 0x8e,
906 },
907};
908
909/* ------------ TUNER_YMEC_TVF_5533MF - Philips NTSC ------------ */
910
911static struct tuner_range tuner_ymec_tvf_5533mf_ntsc_ranges[] = {
912 { 16 * 160.00 /*MHz*/, 0x01, },
913 { 16 * 454.00 /*MHz*/, 0x02, },
914 { 16 * 999.99 , 0x04, },
915};
916
917static struct tuner_params tuner_ymec_tvf_5533mf_params[] = {
918 {
919 .type = TUNER_PARAM_TYPE_NTSC,
920 .ranges = tuner_ymec_tvf_5533mf_ntsc_ranges,
921 .count = ARRAY_SIZE(tuner_ymec_tvf_5533mf_ntsc_ranges),
922 .config = 0x8e,
923 },
924};
925
926/* 60-69 */
927/* ------------ TUNER_THOMSON_DTT761X - THOMSON ATSC ------------ */
928/* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
929
930static struct tuner_range tuner_thomson_dtt761x_ntsc_ranges[] = {
931 { 16 * 145.25 /*MHz*/, 0x39, },
932 { 16 * 415.25 /*MHz*/, 0x3a, },
933 { 16 * 999.99 , 0x3c, },
934};
935
936
937static struct tuner_params tuner_thomson_dtt761x_params[] = {
938 {
939 .type = TUNER_PARAM_TYPE_NTSC,
940 .ranges = tuner_thomson_dtt761x_ntsc_ranges,
941 .count = ARRAY_SIZE(tuner_thomson_dtt761x_ntsc_ranges),
942 .config = 0x8e,
943 },
944};
945
946/* ------------ TUNER_TENA_9533_DI - Philips PAL ------------ */
947
948static struct tuner_range tuner_tuner_tena_9533_di_pal_ranges[] = {
949 { 16 * 160.25 /*MHz*/, 0x01, },
950 { 16 * 464.25 /*MHz*/, 0x02, },
951 { 16 * 999.99 , 0x04, },
952};
953
954static struct tuner_params tuner_tena_9533_di_params[] = {
955 {
956 .type = TUNER_PARAM_TYPE_PAL,
957 .ranges = tuner_tuner_tena_9533_di_pal_ranges,
958 .count = ARRAY_SIZE(tuner_tuner_tena_9533_di_pal_ranges),
959 .config = 0x8e,
960 },
961};
962
963/* ------------ TUNER_PHILIPS_FMD1216ME_MK3 - Philips PAL ------------ */
964
965static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = {
966 { 16 * 160.00 /*MHz*/, 0x51, },
967 { 16 * 442.00 /*MHz*/, 0x52, },
968 { 16 * 999.99 , 0x54, },
969};
970
971
972static struct tuner_params tuner_tuner_philips_fmd1216me_mk3_params[] = {
973 {
974 .type = TUNER_PARAM_TYPE_PAL,
975 .ranges = tuner_philips_fmd1216me_mk3_pal_ranges,
976 .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges),
977 .config = 0x86,
978 },
979};
980
981
982/* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */
983
984static struct tuner_range tuner_tua6034_ntsc_ranges[] = {
985 { 16 * 160.00 /*MHz*/, 0x01 },
986 { 16 * 455.00 /*MHz*/, 0x02 },
987 { 16 * 999.99 , 0x04 },
988};
989
990
991static struct tuner_params tuner_tua6034_params[] = {
992 {
993 .type = TUNER_PARAM_TYPE_NTSC,
994 .ranges = tuner_tua6034_ntsc_ranges,
995 .count = ARRAY_SIZE(tuner_tua6034_ntsc_ranges),
996 .config = 0x8e,
997 },
998};
999
1000/* ------------ TUNER_YMEC_TVF66T5_B_DFF - Philips PAL ------------ */
1001
1002static struct tuner_range tuner_ymec_tvf66t5_b_dff_pal_ranges[] = {
1003 { 16 * 160.25 /*MHz*/, 0x01, },
1004 { 16 * 464.25 /*MHz*/, 0x02, },
1005 { 16 * 999.99 , 0x08, },
1006};
1007
1008static struct tuner_params tuner_ymec_tvf66t5_b_dff_params[] = {
1009 {
1010 .type = TUNER_PARAM_TYPE_PAL,
1011 .ranges = tuner_ymec_tvf66t5_b_dff_pal_ranges,
1012 .count = ARRAY_SIZE(tuner_ymec_tvf66t5_b_dff_pal_ranges),
1013 .config = 0x8e,
1014 },
1015};
1016
1017/* ------------ TUNER_LG_NTSC_TALN_MINI - LGINNOTEK NTSC ------------ */
1018
1019static struct tuner_range tuner_lg_taln_mini_ntsc_ranges[] = {
1020 { 16 * 137.25 /*MHz*/, 0x01, },
1021 { 16 * 373.25 /*MHz*/, 0x02, },
1022 { 16 * 999.99 , 0x08, },
1023};
1024
1025static struct tuner_params tuner_lg_taln_mini_params[] = {
1026 {
1027 .type = TUNER_PARAM_TYPE_NTSC,
1028 .ranges = tuner_lg_taln_mini_ntsc_ranges,
1029 .count = ARRAY_SIZE(tuner_lg_taln_mini_ntsc_ranges),
1030 .config = 0x8e,
1031 },
1032};
1033
1034/* ------------ TUNER_PHILIPS_TD1316 - Philips PAL ------------ */
1035
1036static struct tuner_range tuner_philips_td1316_pal_ranges[] = {
1037 { 16 * 160.00 /*MHz*/, 0xa1, },
1038 { 16 * 442.00 /*MHz*/, 0xa2, },
1039 { 16 * 999.99 , 0xa4, },
1040};
1041
1042static struct tuner_params tuner_philips_td1316_params[] = {
1043 {
1044 .type = TUNER_PARAM_TYPE_PAL,
1045 .ranges = tuner_philips_td1316_pal_ranges,
1046 .count = ARRAY_SIZE(tuner_philips_td1316_pal_ranges),
1047 .config = 0xc8,
1048 },
1049};
1050
1051/* ------------ TUNER_PHILIPS_TUV1236D - Philips ATSC ------------ */
1052
1053static struct tuner_range tuner_tuv1236d_ntsc_ranges[] = {
1054 { 16 * 157.25 /*MHz*/, 0x01, },
1055 { 16 * 454.00 /*MHz*/, 0x02, },
1056 { 16 * 999.99 , 0x04, },
1057};
1058
1059
1060static struct tuner_params tuner_tuner_tuv1236d_params[] = {
1061 {
1062 .type = TUNER_PARAM_TYPE_NTSC,
1063 .ranges = tuner_tuv1236d_ntsc_ranges,
1064 .count = ARRAY_SIZE(tuner_tuv1236d_ntsc_ranges),
1065 .config = 0xce,
1066 },
1067};
1068
1069/* ------------ TUNER_TNF_5335MF - Philips NTSC ------------ */
1070
1071static struct tuner_range tuner_tnf_5335mf_ntsc_ranges[] = {
1072 { 16 * 157.25 /*MHz*/, 0x01, },
1073 { 16 * 454.00 /*MHz*/, 0x02, },
1074 { 16 * 999.99 , 0x04, },
1075};
1076
1077static struct tuner_params tuner_tnf_5335mf_params[] = {
1078 {
1079 .type = TUNER_PARAM_TYPE_NTSC,
1080 .ranges = tuner_tnf_5335mf_ntsc_ranges,
1081 .count = ARRAY_SIZE(tuner_tnf_5335mf_ntsc_ranges),
1082 .config = 0x8e,
1083 },
1084};
1085
1086/* 70-79 */
1087/* ------------ TUNER_SAMSUNG_TCPN_2121P30A - Samsung NTSC ------------ */
1088
1089static struct tuner_range tuner_samsung_tcpn_2121p30a_ntsc_ranges[] = {
1090 { 16 * 175.75 /*MHz*/, 0x01, },
1091 { 16 * 410.25 /*MHz*/, 0x02, },
1092 { 16 * 999.99 , 0x08, },
1093};
1094
1095static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = {
1096 {
1097 .type = TUNER_PARAM_TYPE_NTSC,
1098 .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges,
1099 .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges),
1100 .config = 0xce,
1101 },
1102};
1103
1104/* --------------------------------------------------------------------- */
1105
1106struct tunertype tuners[] = {
1107 /* 0-9 */
1108 [TUNER_TEMIC_PAL] = { /* TEMIC PAL */
1109 .name = "Temic PAL (4002 FH5)",
1110 .params = tuner_temic_pal_params,
1111 },
1112 [TUNER_PHILIPS_PAL_I] = { /* Philips PAL_I */
1113 .name = "Philips PAL_I (FI1246 and compatibles)",
1114 .params = tuner_philips_pal_i_params,
1115 },
1116 [TUNER_PHILIPS_NTSC] = { /* Philips NTSC */
1117 .name = "Philips NTSC (FI1236,FM1236 and compatibles)",
1118 .params = tuner_philips_ntsc_params,
1119 },
1120 [TUNER_PHILIPS_SECAM] = { /* Philips SECAM */
1121 .name = "Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
1122 .params = tuner_philips_secam_params,
1123 },
1124 [TUNER_ABSENT] = { /* Tuner Absent */
1125 .name = "NoTuner",
1126 },
1127 [TUNER_PHILIPS_PAL] = { /* Philips PAL */
1128 .name = "Philips PAL_BG (FI1216 and compatibles)",
1129 .params = tuner_philips_pal_params,
1130 },
1131 [TUNER_TEMIC_NTSC] = { /* TEMIC NTSC */
1132 .name = "Temic NTSC (4032 FY5)",
1133 .params = tuner_temic_ntsc_params,
1134 },
1135 [TUNER_TEMIC_PAL_I] = { /* TEMIC PAL_I */
1136 .name = "Temic PAL_I (4062 FY5)",
1137 .params = tuner_temic_pal_i_params,
1138 },
1139 [TUNER_TEMIC_4036FY5_NTSC] = { /* TEMIC NTSC */
1140 .name = "Temic NTSC (4036 FY5)",
1141 .params = tuner_temic_4036fy5_ntsc_params,
1142 },
1143 [TUNER_ALPS_TSBH1_NTSC] = { /* TEMIC NTSC */
1144 .name = "Alps HSBH1",
1145 .params = tuner_alps_tsbh1_ntsc_params,
1146 },
1147
1148 /* 10-19 */
1149 [TUNER_ALPS_TSBE1_PAL] = { /* TEMIC PAL */
1150 .name = "Alps TSBE1",
1151 .params = tuner_alps_tsb_1_params,
1152 },
1153 [TUNER_ALPS_TSBB5_PAL_I] = { /* Alps PAL_I */
1154 .name = "Alps TSBB5",
1155 .params = tuner_alps_tsbb5_params,
1156 },
1157 [TUNER_ALPS_TSBE5_PAL] = { /* Alps PAL */
1158 .name = "Alps TSBE5",
1159 .params = tuner_alps_tsbe5_params,
1160 },
1161 [TUNER_ALPS_TSBC5_PAL] = { /* Alps PAL */
1162 .name = "Alps TSBC5",
1163 .params = tuner_alps_tsbc5_params,
1164 },
1165 [TUNER_TEMIC_4006FH5_PAL] = { /* TEMIC PAL */
1166 .name = "Temic PAL_BG (4006FH5)",
1167 .params = tuner_temic_4006fh5_params,
1168 },
1169 [TUNER_ALPS_TSHC6_NTSC] = { /* Alps NTSC */
1170 .name = "Alps TSCH6",
1171 .params = tuner_alps_tshc6_params,
1172 },
1173 [TUNER_TEMIC_PAL_DK] = { /* TEMIC PAL */
1174 .name = "Temic PAL_DK (4016 FY5)",
1175 .params = tuner_temic_pal_dk_params,
1176 },
1177 [TUNER_PHILIPS_NTSC_M] = { /* Philips NTSC */
1178 .name = "Philips NTSC_M (MK2)",
1179 .params = tuner_philips_ntsc_m_params,
1180 },
1181 [TUNER_TEMIC_4066FY5_PAL_I] = { /* TEMIC PAL_I */
1182 .name = "Temic PAL_I (4066 FY5)",
1183 .params = tuner_temic_4066fy5_pal_i_params,
1184 },
1185 [TUNER_TEMIC_4006FN5_MULTI_PAL] = { /* TEMIC PAL */
1186 .name = "Temic PAL* auto (4006 FN5)",
1187 .params = tuner_temic_4006fn5_multi_params,
1188 },
1189
1190 /* 20-29 */
1191 [TUNER_TEMIC_4009FR5_PAL] = { /* TEMIC PAL */
1192 .name = "Temic PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
1193 .params = tuner_temic_4009f_5_params,
1194 },
1195 [TUNER_TEMIC_4039FR5_NTSC] = { /* TEMIC NTSC */
1196 .name = "Temic NTSC (4039 FR5)",
1197 .params = tuner_temic_4039fr5_params,
1198 },
1199 [TUNER_TEMIC_4046FM5] = { /* TEMIC PAL */
1200 .name = "Temic PAL/SECAM multi (4046 FM5)",
1201 .params = tuner_temic_4046fm5_params,
1202 },
1203 [TUNER_PHILIPS_PAL_DK] = { /* Philips PAL */
1204 .name = "Philips PAL_DK (FI1256 and compatibles)",
1205 .params = tuner_philips_pal_dk_params,
1206 },
1207 [TUNER_PHILIPS_FQ1216ME] = { /* Philips PAL */
1208 .name = "Philips PAL/SECAM multi (FQ1216ME)",
1209 .params = tuner_philips_fq1216me_params,
1210 },
1211 [TUNER_LG_PAL_I_FM] = { /* LGINNOTEK PAL_I */
1212 .name = "LG PAL_I+FM (TAPC-I001D)",
1213 .params = tuner_lg_pal_i_fm_params,
1214 },
1215 [TUNER_LG_PAL_I] = { /* LGINNOTEK PAL_I */
1216 .name = "LG PAL_I (TAPC-I701D)",
1217 .params = tuner_lg_pal_i_params,
1218 },
1219 [TUNER_LG_NTSC_FM] = { /* LGINNOTEK NTSC */
1220 .name = "LG NTSC+FM (TPI8NSR01F)",
1221 .params = tuner_lg_ntsc_fm_params,
1222 },
1223 [TUNER_LG_PAL_FM] = { /* LGINNOTEK PAL */
1224 .name = "LG PAL_BG+FM (TPI8PSB01D)",
1225 .params = tuner_lg_pal_fm_params,
1226 },
1227 [TUNER_LG_PAL] = { /* LGINNOTEK PAL */
1228 .name = "LG PAL_BG (TPI8PSB11D)",
1229 .params = tuner_lg_pal_params,
1230 },
1231
1232 /* 30-39 */
1233 [TUNER_TEMIC_4009FN5_MULTI_PAL_FM] = { /* TEMIC PAL */
1234 .name = "Temic PAL* auto + FM (4009 FN5)",
1235 .params = tuner_temic_4009_fn5_multi_pal_fm_params,
1236 },
1237 [TUNER_SHARP_2U5JF5540_NTSC] = { /* SHARP NTSC */
1238 .name = "SHARP NTSC_JP (2U5JF5540)",
1239 .params = tuner_sharp_2u5jf5540_params,
1240 },
1241 [TUNER_Samsung_PAL_TCPM9091PD27] = { /* Samsung PAL */
1242 .name = "Samsung PAL TCPM9091PD27",
1243 .params = tuner_samsung_pal_tcpm9091pd27_params,
1244 },
1245 [TUNER_MT2032] = { /* Microtune PAL|NTSC */
1246 .name = "MT20xx universal",
1247 /* see mt20xx.c for details */ },
1248 [TUNER_TEMIC_4106FH5] = { /* TEMIC PAL */
1249 .name = "Temic PAL_BG (4106 FH5)",
1250 .params = tuner_temic_4106fh5_params,
1251 },
1252 [TUNER_TEMIC_4012FY5] = { /* TEMIC PAL */
1253 .name = "Temic PAL_DK/SECAM_L (4012 FY5)",
1254 .params = tuner_temic_4012fy5_params,
1255 },
1256 [TUNER_TEMIC_4136FY5] = { /* TEMIC NTSC */
1257 .name = "Temic NTSC (4136 FY5)",
1258 .params = tuner_temic_4136_fy5_params,
1259 },
1260 [TUNER_LG_PAL_NEW_TAPC] = { /* LGINNOTEK PAL */
1261 .name = "LG PAL (newer TAPC series)",
1262 .params = tuner_lg_pal_new_tapc_params,
1263 },
1264 [TUNER_PHILIPS_FM1216ME_MK3] = { /* Philips PAL */
1265 .name = "Philips PAL/SECAM multi (FM1216ME MK3)",
1266 .params = tuner_fm1216me_mk3_params,
1267 },
1268 [TUNER_LG_NTSC_NEW_TAPC] = { /* LGINNOTEK NTSC */
1269 .name = "LG NTSC (newer TAPC series)",
1270 .params = tuner_lg_ntsc_new_tapc_params,
1271 },
1272
1273 /* 40-49 */
1274 [TUNER_HITACHI_NTSC] = { /* HITACHI NTSC */
1275 .name = "HITACHI V7-J180AT",
1276 .params = tuner_hitachi_ntsc_params,
1277 },
1278 [TUNER_PHILIPS_PAL_MK] = { /* Philips PAL */
1279 .name = "Philips PAL_MK (FI1216 MK)",
1280 .params = tuner_philips_pal_mk_params,
1281 },
1282 [TUNER_PHILIPS_ATSC] = { /* Philips ATSC */
1283 .name = "Philips 1236D ATSC/NTSC dual in",
1284 .params = tuner_philips_atsc_params,
1285 },
1286 [TUNER_PHILIPS_FM1236_MK3] = { /* Philips NTSC */
1287 .name = "Philips NTSC MK3 (FM1236MK3 or FM1236/F)",
1288 .params = tuner_fm1236_mk3_params,
1289 },
1290 [TUNER_PHILIPS_4IN1] = { /* Philips NTSC */
1291 .name = "Philips 4 in 1 (ATI TV Wonder Pro/Conexant)",
1292 .params = tuner_philips_4in1_params,
1293 },
1294 [TUNER_MICROTUNE_4049FM5] = { /* Microtune PAL */
1295 .name = "Microtune 4049 FM5",
1296 .params = tuner_microtune_4049_fm5_params,
1297 },
1298 [TUNER_PANASONIC_VP27] = { /* Panasonic NTSC */
1299 .name = "Panasonic VP27s/ENGE4324D",
1300 .params = tuner_panasonic_vp27_params,
1301 },
1302 [TUNER_LG_NTSC_TAPE] = { /* LGINNOTEK NTSC */
1303 .name = "LG NTSC (TAPE series)",
1304 .params = tuner_lg_ntsc_tape_params,
1305 },
1306 [TUNER_TNF_8831BGFF] = { /* Philips PAL */
1307 .name = "Tenna TNF 8831 BGFF)",
1308 .params = tuner_tnf_8831bgff_params,
1309 },
1310 [TUNER_MICROTUNE_4042FI5] = { /* Microtune NTSC */
1311 .name = "Microtune 4042 FI5 ATSC/NTSC dual in",
1312 .params = tuner_microtune_4042fi5_params,
1313 },
1314
1315 /* 50-59 */
1316 [TUNER_TCL_2002N] = { /* TCL NTSC */
1317 .name = "TCL 2002N",
1318 .params = tuner_tcl_2002n_params,
1319 },
1320 [TUNER_PHILIPS_FM1256_IH3] = { /* Philips PAL */
1321 .name = "Philips PAL/SECAM_D (FM 1256 I-H3)",
1322 .params = tuner_philips_fm1256_ih3_params,
1323 },
1324 [TUNER_THOMSON_DTT7610] = { /* THOMSON ATSC */
1325 .name = "Thomson DTT 7610 (ATSC/NTSC)",
1326 .params = tuner_thomson_dtt7610_params,
1327 },
1328 [TUNER_PHILIPS_FQ1286] = { /* Philips NTSC */
1329 .name = "Philips FQ1286",
1330 .params = tuner_philips_fq1286_params,
1331 },
1332 [TUNER_PHILIPS_TDA8290] = { /* Philips PAL|NTSC */
1333 .name = "tda8290+75",
1334 /* see tda8290.c for details */ },
1335 [TUNER_TCL_2002MB] = { /* TCL PAL */
1336 .name = "TCL 2002MB",
1337 .params = tuner_tcl_2002mb_params,
1338 },
1339 [TUNER_PHILIPS_FQ1216AME_MK4] = { /* Philips PAL */
1340 .name = "Philips PAL/SECAM multi (FQ1216AME MK4)",
1341 .params = tuner_philips_fq1216ame_mk4_params,
1342 },
1343 [TUNER_PHILIPS_FQ1236A_MK4] = { /* Philips NTSC */
1344 .name = "Philips FQ1236A MK4",
1345 .params = tuner_philips_fq1236a_mk4_params,
1346 },
1347 [TUNER_YMEC_TVF_8531MF] = { /* Philips NTSC */
1348 .name = "Ymec TVision TVF-8531MF/8831MF/8731MF",
1349 .params = tuner_ymec_tvf_8531mf_params,
1350 },
1351 [TUNER_YMEC_TVF_5533MF] = { /* Philips NTSC */
1352 .name = "Ymec TVision TVF-5533MF",
1353 .params = tuner_ymec_tvf_5533mf_params,
1354 },
1355
1356 /* 60-69 */
1357 [TUNER_THOMSON_DTT761X] = { /* THOMSON ATSC */
1358 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
1359 .name = "Thomson DTT 761X (ATSC/NTSC)",
1360 .params = tuner_thomson_dtt761x_params,
1361 },
1362 [TUNER_TENA_9533_DI] = { /* Philips PAL */
1363 .name = "Tena TNF9533-D/IF/TNF9533-B/DF",
1364 .params = tuner_tena_9533_di_params,
1365 },
1366 [TUNER_TEA5767] = { /* Philips RADIO */
1367 .name = "Philips TEA5767HN FM Radio",
1368 /* see tea5767.c for details */
1369 },
1370 [TUNER_PHILIPS_FMD1216ME_MK3] = { /* Philips PAL */
1371 .name = "Philips FMD1216ME MK3 Hybrid Tuner",
1372 .params = tuner_tuner_philips_fmd1216me_mk3_params,
1373 },
1374 [TUNER_LG_TDVS_H062F] = { /* LGINNOTEK ATSC */
1375 .name = "LG TDVS-H062F/TUA6034",
1376 .params = tuner_tua6034_params,
1377 },
1378 [TUNER_YMEC_TVF66T5_B_DFF] = { /* Philips PAL */
1379 .name = "Ymec TVF66T5-B/DFF",
1380 .params = tuner_ymec_tvf66t5_b_dff_params,
1381 },
1382 [TUNER_LG_NTSC_TALN_MINI] = { /* LGINNOTEK NTSC */
1383 .name = "LG NTSC (TALN mini series)",
1384 .params = tuner_lg_taln_mini_params,
1385 },
1386 [TUNER_PHILIPS_TD1316] = { /* Philips PAL */
1387 .name = "Philips TD1316 Hybrid Tuner",
1388 .params = tuner_philips_td1316_params,
1389 },
1390 [TUNER_PHILIPS_TUV1236D] = { /* Philips ATSC */
1391 .name = "Philips TUV1236D ATSC/NTSC dual in",
1392 .params = tuner_tuner_tuv1236d_params,
1393 },
1394 [TUNER_TNF_5335MF] = { /* Philips NTSC */
1395 .name = "Tena TNF 5335 MF",
1396 .params = tuner_tnf_5335mf_params,
1397 },
1398
1399 /* 70-79 */
1400 [TUNER_SAMSUNG_TCPN_2121P30A] = { /* Samsung NTSC */
1401 .name = "Samsung TCPN 2121P30A",
1402 .params = tuner_samsung_tcpn_2121p30a_params,
1403 },
1404};
1405
1406unsigned const int tuner_count = ARRAY_SIZE(tuners);
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 5e71a354e879..582551b0969b 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -190,7 +190,7 @@ hauppauge_tuner[] =
190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, 190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"},
191 { TUNER_TCL_2002N, "TCL 2002N 6A"}, 191 { TUNER_TCL_2002N, "TCL 2002N 6A"},
192 { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"}, 192 { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"},
193 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 193 { TUNER_SAMSUNG_TCPN_2121P30A, "Samsung TCPN 2121P30A"},
194 { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, 194 { TUNER_ABSENT, "Samsung TCPE 4121P30A"},
195 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, 195 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"},
196 /* 90-99 */ 196 /* 90-99 */
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 9094fa9f2ecb..fad9ea0ae4f2 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -634,7 +634,7 @@ struct i2c_vbi_ram_value {
634 unsigned char values[26]; 634 unsigned char values[26];
635}; 635};
636 636
637struct i2c_vbi_ram_value vbi_ram_default[] = 637static struct i2c_vbi_ram_value vbi_ram_default[] =
638{ 638{
639 {0x010, /* WST SECAM 6 */ 639 {0x010, /* WST SECAM 6 */
640 { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 } 640 { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 }
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 5dbd7c1b362a..cd2c4475525e 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -306,6 +306,7 @@ static const char *v4l2_int_ioctls[] = {
306#endif 306#endif
307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", 307 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", 308 [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT",
309 [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX",
309 310
310 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", 311 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
311 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", 312 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index d5be25987142..078880e4c8c0 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -29,7 +29,6 @@
29#include <linux/devfs_fs_kernel.h> 29#include <linux/devfs_fs_kernel.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/semaphore.h>
33 32
34#include <linux/videodev.h> 33#include <linux/videodev.h>
35 34
@@ -83,7 +82,7 @@ static struct class video_class = {
83 */ 82 */
84 83
85static struct video_device *video_device[VIDEO_NUM_DEVICES]; 84static struct video_device *video_device[VIDEO_NUM_DEVICES];
86static DECLARE_MUTEX(videodev_lock); 85static DEFINE_MUTEX(videodev_lock);
87 86
88struct video_device* video_devdata(struct file *file) 87struct video_device* video_devdata(struct file *file)
89{ 88{
@@ -102,15 +101,15 @@ static int video_open(struct inode *inode, struct file *file)
102 101
103 if(minor>=VIDEO_NUM_DEVICES) 102 if(minor>=VIDEO_NUM_DEVICES)
104 return -ENODEV; 103 return -ENODEV;
105 down(&videodev_lock); 104 mutex_lock(&videodev_lock);
106 vfl=video_device[minor]; 105 vfl=video_device[minor];
107 if(vfl==NULL) { 106 if(vfl==NULL) {
108 up(&videodev_lock); 107 mutex_unlock(&videodev_lock);
109 request_module("char-major-%d-%d", VIDEO_MAJOR, minor); 108 request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
110 down(&videodev_lock); 109 mutex_lock(&videodev_lock);
111 vfl=video_device[minor]; 110 vfl=video_device[minor];
112 if (vfl==NULL) { 111 if (vfl==NULL) {
113 up(&videodev_lock); 112 mutex_unlock(&videodev_lock);
114 return -ENODEV; 113 return -ENODEV;
115 } 114 }
116 } 115 }
@@ -123,7 +122,7 @@ static int video_open(struct inode *inode, struct file *file)
123 file->f_op = fops_get(old_fops); 122 file->f_op = fops_get(old_fops);
124 } 123 }
125 fops_put(old_fops); 124 fops_put(old_fops);
126 up(&videodev_lock); 125 mutex_unlock(&videodev_lock);
127 return err; 126 return err;
128} 127}
129 128
@@ -304,12 +303,12 @@ int video_register_device(struct video_device *vfd, int type, int nr)
304 } 303 }
305 304
306 /* pick a minor number */ 305 /* pick a minor number */
307 down(&videodev_lock); 306 mutex_lock(&videodev_lock);
308 if (nr >= 0 && nr < end-base) { 307 if (nr >= 0 && nr < end-base) {
309 /* use the one the driver asked for */ 308 /* use the one the driver asked for */
310 i = base+nr; 309 i = base+nr;
311 if (NULL != video_device[i]) { 310 if (NULL != video_device[i]) {
312 up(&videodev_lock); 311 mutex_unlock(&videodev_lock);
313 return -ENFILE; 312 return -ENFILE;
314 } 313 }
315 } else { 314 } else {
@@ -318,13 +317,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
318 if (NULL == video_device[i]) 317 if (NULL == video_device[i])
319 break; 318 break;
320 if (i == end) { 319 if (i == end) {
321 up(&videodev_lock); 320 mutex_unlock(&videodev_lock);
322 return -ENFILE; 321 return -ENFILE;
323 } 322 }
324 } 323 }
325 video_device[i]=vfd; 324 video_device[i]=vfd;
326 vfd->minor=i; 325 vfd->minor=i;
327 up(&videodev_lock); 326 mutex_unlock(&videodev_lock);
328 327
329 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base); 328 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base);
330 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor), 329 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor),
@@ -362,14 +361,14 @@ int video_register_device(struct video_device *vfd, int type, int nr)
362 361
363void video_unregister_device(struct video_device *vfd) 362void video_unregister_device(struct video_device *vfd)
364{ 363{
365 down(&videodev_lock); 364 mutex_lock(&videodev_lock);
366 if(video_device[vfd->minor]!=vfd) 365 if(video_device[vfd->minor]!=vfd)
367 panic("videodev: bad unregister"); 366 panic("videodev: bad unregister");
368 367
369 devfs_remove(vfd->devfs_name); 368 devfs_remove(vfd->devfs_name);
370 video_device[vfd->minor]=NULL; 369 video_device[vfd->minor]=NULL;
371 class_device_unregister(&vfd->class_dev); 370 class_device_unregister(&vfd->class_dev);
372 up(&videodev_lock); 371 mutex_unlock(&videodev_lock);
373} 372}
374 373
375 374