aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/mt20xx.c6
-rw-r--r--drivers/media/video/tda8290.c20
-rw-r--r--drivers/media/video/tda9887.c7
-rw-r--r--drivers/media/video/tea5767.c334
-rw-r--r--drivers/media/video/tuner-core.c163
-rw-r--r--drivers/media/video/tuner-simple.c34
-rw-r--r--include/media/tuner.h20
8 files changed, 471 insertions, 116 deletions
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 2dc906fdfa55..810e7aac0a53 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -7,8 +7,7 @@ bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \
7zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o 7zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
8zr36067-objs := zoran_procfs.o zoran_device.o \ 8zr36067-objs := zoran_procfs.o zoran_device.o \
9 zoran_driver.o zoran_card.o 9 zoran_driver.o zoran_card.o
10tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o 10tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o
11
12obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o 11obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o
13 12
14obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ 13obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 95ad17b7f38e..9c005cb128d7 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: mt20xx.c,v 1.4 2005/03/04 09:24:56 kraxel Exp $ 2 * $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls microtune tuners, mt2032 + mt2050 at the moment. 5 * controls microtune tuners, mt2032 + mt2050 at the moment.
@@ -295,8 +295,8 @@ static void mt2032_set_radio_freq(struct i2c_client *c, unsigned int freq)
295 int if2 = t->radio_if2; 295 int if2 = t->radio_if2;
296 296
297 // per Manual for FM tuning: first if center freq. 1085 MHz 297 // per Manual for FM tuning: first if center freq. 1085 MHz
298 mt2032_set_if_freq(c, freq*62500 /* freq*1000*1000/16 */, 298 mt2032_set_if_freq(c, freq * 1000 / 16,
299 1085*1000*1000,if2,if2,if2); 299 1085*1000*1000,if2,if2,if2);
300} 300}
301 301
302// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 302// Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index b27cc348d95c..f59d4601cc63 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $ 2 * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls the philips tda8290+75 tuner chip combo. 5 * controls the philips tda8290+75 tuner chip combo.
@@ -69,7 +69,7 @@ static __u8 get_freq_entry( struct freq_entry* table, __u16 freq)
69static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 }; 69static unsigned char i2c_enable_bridge[2] = { 0x21, 0xC0 };
70static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 }; 70static unsigned char i2c_disable_bridge[2] = { 0x21, 0x80 };
71static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00, 71static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00,
72 0x7C, 0x04, 0xA3, 0x3F, 72 0xfC, 0x04, 0xA3, 0x3F,
73 0x2A, 0x04, 0xFF, 0x00, 73 0x2A, 0x04, 0xFF, 0x00,
74 0x00, 0x40 }; 74 0x00, 0x40 };
75static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; 75static unsigned char i2c_set_VS[2] = { 0x30, 0x6F };
@@ -138,16 +138,24 @@ static int tda8290_tune(struct i2c_client *c)
138 138
139static void set_frequency(struct tuner *t, u16 ifc) 139static void set_frequency(struct tuner *t, u16 ifc)
140{ 140{
141 u32 N = (((t->freq<<3)+ifc)&0x3fffc); 141 u32 freq;
142 u32 N;
142 143
143 N = N >> get_freq_entry(div_table, t->freq); 144 if (t->mode == V4L2_TUNER_RADIO)
145 freq = t->freq / 1000;
146 else
147 freq = t->freq;
148
149 N = (((freq<<3)+ifc)&0x3fffc);
150
151 N = N >> get_freq_entry(div_table, freq);
144 t->i2c_set_freq[0] = 0; 152 t->i2c_set_freq[0] = 0;
145 t->i2c_set_freq[1] = (unsigned char)(N>>8); 153 t->i2c_set_freq[1] = (unsigned char)(N>>8);
146 t->i2c_set_freq[2] = (unsigned char) N; 154 t->i2c_set_freq[2] = (unsigned char) N;
147 t->i2c_set_freq[3] = 0x40; 155 t->i2c_set_freq[3] = 0x40;
148 t->i2c_set_freq[4] = 0x52; 156 t->i2c_set_freq[4] = 0x52;
149 t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq); 157 t->i2c_set_freq[5] = get_freq_entry(band_table, freq);
150 t->i2c_set_freq[6] = get_freq_entry(agc_table, t->freq); 158 t->i2c_set_freq[6] = get_freq_entry(agc_table, freq);
151 t->i2c_set_freq[7] = 0x8f; 159 t->i2c_set_freq[7] = 0x8f;
152} 160}
153 161
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 39773633cc3c..ee35562f4d1a 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -368,7 +368,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
368 if (t->radio_mode == V4L2_TUNER_MODE_MONO) 368 if (t->radio_mode == V4L2_TUNER_MODE_MONO)
369 norm = &radio_mono; 369 norm = &radio_mono;
370 else 370 else
371 norm = &radio_stereo; 371 norm = &radio_stereo;
372 } else { 372 } else {
373 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { 373 for (i = 0; i < ARRAY_SIZE(tvnorms); i++) {
374 if (tvnorms[i].std & t->std) { 374 if (tvnorms[i].std & t->std) {
@@ -566,7 +566,6 @@ static int tda9887_configure(struct tda9887 *t)
566 if (UNSET != t->pinnacle_id) { 566 if (UNSET != t->pinnacle_id) {
567 tda9887_set_pinnacle(t,buf); 567 tda9887_set_pinnacle(t,buf);
568 } 568 }
569
570 tda9887_set_config(t,buf); 569 tda9887_set_config(t,buf);
571 tda9887_set_insmod(t,buf); 570 tda9887_set_insmod(t,buf);
572 571
@@ -615,8 +614,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
615 t->pinnacle_id = UNSET; 614 t->pinnacle_id = UNSET;
616 t->radio_mode = V4L2_TUNER_MODE_STEREO; 615 t->radio_mode = V4L2_TUNER_MODE_STEREO;
617 616
618 i2c_set_clientdata(&t->client, t); 617 i2c_set_clientdata(&t->client, t);
619 i2c_attach_client(&t->client); 618 i2c_attach_client(&t->client);
620 619
621 return 0; 620 return 0;
622} 621}
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
new file mode 100644
index 000000000000..a29f08f81f63
--- /dev/null
+++ b/drivers/media/video/tea5767.c
@@ -0,0 +1,334 @@
1/*
2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3 * I2C address is allways 0xC0.
4 *
5 * $Id: tea5767.c,v 1.11 2005/06/21 15:40:33 mchehab Exp $
6 *
7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
8 * This code is placed under the terms of the GNU General Public License
9 *
10 * tea5767 autodetection thanks to Torsten Seeboth and Atsushi Nakagawa
11 * from their contributions on DScaler.
12 */
13
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h>
19#include <linux/timer.h>
20#include <linux/delay.h>
21#include <linux/errno.h>
22#include <linux/slab.h>
23#include <linux/videodev.h>
24#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h>
26
27#include <media/tuner.h>
28
29/* Declared at tuner-core.c */
30extern unsigned int tuner_debug;
31
32#define PREFIX "TEA5767 "
33
34/*****************************************************************************/
35
36/******************************
37 * Write mode register values *
38 ******************************/
39
40/* First register */
41#define TEA5767_MUTE 0x80 /* Mutes output */
42#define TEA5767_SEARCH 0x40 /* Activates station search */
43/* Bits 0-5 for divider MSB */
44
45/* Second register */
46/* Bits 0-7 for divider LSB */
47
48/* Third register */
49
50/* Station search from botton to up */
51#define TEA5767_SEARCH_UP 0x80
52
53/* Searches with ADC output = 10 */
54#define TEA5767_SRCH_HIGH_LVL 0x60
55
56/* Searches with ADC output = 10 */
57#define TEA5767_SRCH_MID_LVL 0x40
58
59/* Searches with ADC output = 5 */
60#define TEA5767_SRCH_LOW_LVL 0x20
61
62/* if on, div=4*(Frf+Fif)/Fref otherwise, div=4*(Frf-Fif)/Freq) */
63#define TEA5767_HIGH_LO_INJECT 0x10
64
65/* Disable stereo */
66#define TEA5767_MONO 0x08
67
68/* Disable right channel and turns to mono */
69#define TEA5767_MUTE_RIGHT 0x04
70
71/* Disable left channel and turns to mono */
72#define TEA5767_MUTE_LEFT 0x02
73
74#define TEA5767_PORT1_HIGH 0x01
75
76/* Forth register */
77#define TEA5767_PORT2_HIGH 0x80
78/* Chips stops working. Only I2C bus remains on */
79#define TEA5767_STDBY 0x40
80
81/* Japan freq (76-108 MHz. If disabled, 87.5-108 MHz */
82#define TEA5767_JAPAN_BAND 0x20
83
84/* Unselected means 32.768 KHz freq as reference. Otherwise Xtal at 13 MHz */
85#define TEA5767_XTAL_32768 0x10
86
87/* Cuts weak signals */
88#define TEA5767_SOFT_MUTE 0x08
89
90/* Activates high cut control */
91#define TEA5767_HIGH_CUT_CTRL 0x04
92
93/* Activates stereo noise control */
94#define TEA5767_ST_NOISE_CTL 0x02
95
96/* If activate PORT 1 indicates SEARCH or else it is used as PORT1 */
97#define TEA5767_SRCH_IND 0x01
98
99/* Fiveth register */
100
101/* By activating, it will use Xtal at 13 MHz as reference for divider */
102#define TEA5767_PLLREF_ENABLE 0x80
103
104/* By activating, deemphasis=50, or else, deemphasis of 50us */
105#define TEA5767_DEEMPH_75 0X40
106
107/*****************************
108 * Read mode register values *
109 *****************************/
110
111/* First register */
112#define TEA5767_READY_FLAG_MASK 0x80
113#define TEA5767_BAND_LIMIT_MASK 0X40
114/* Bits 0-5 for divider MSB after search or preset */
115
116/* Second register */
117/* Bits 0-7 for divider LSB after search or preset */
118
119/* Third register */
120#define TEA5767_STEREO_MASK 0x80
121#define TEA5767_IF_CNTR_MASK 0x7f
122
123/* Four register */
124#define TEA5767_ADC_LEVEL_MASK 0xf0
125
126/* should be 0 */
127#define TEA5767_CHIP_ID_MASK 0x0f
128
129/* Fiveth register */
130/* Reserved for future extensions */
131#define TEA5767_RESERVED_MASK 0xff
132
133/*****************************************************************************/
134
135static void set_tv_freq(struct i2c_client *c, unsigned int freq)
136{
137 struct tuner *t = i2c_get_clientdata(c);
138
139 tuner_warn("This tuner doesn't support TV freq.\n");
140}
141
142static void tea5767_status_dump(unsigned char *buffer)
143{
144 unsigned int div, frq;
145
146 if (TEA5767_READY_FLAG_MASK & buffer[0])
147 printk(PREFIX "Ready Flag ON\n");
148 else
149 printk(PREFIX "Ready Flag OFF\n");
150
151 if (TEA5767_BAND_LIMIT_MASK & buffer[0])
152 printk(PREFIX "Tuner at band limit\n");
153 else
154 printk(PREFIX "Tuner not at band limit\n");
155
156 div=((buffer[0]&0x3f)<<8) | buffer[1];
157
158 switch (TEA5767_HIGH_LO_32768) {
159 case TEA5767_HIGH_LO_13MHz:
160 frq = 1000*(div*50-700-225)/4; /* Freq in KHz */
161 break;
162 case TEA5767_LOW_LO_13MHz:
163 frq = 1000*(div*50+700+225)/4; /* Freq in KHz */
164 break;
165 case TEA5767_LOW_LO_32768:
166 frq = 1000*(div*32768/1000+700+225)/4; /* Freq in KHz */
167 break;
168 case TEA5767_HIGH_LO_32768:
169 default:
170 frq = 1000*(div*32768/1000-700-225)/4; /* Freq in KHz */
171 break;
172 }
173 buffer[0] = (div>>8) & 0x3f;
174 buffer[1] = div & 0xff;
175
176 printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n",
177 frq/1000,frq%1000,div);
178
179 if (TEA5767_STEREO_MASK & buffer[2])
180 printk(PREFIX "Stereo\n");
181 else
182 printk(PREFIX "Mono\n");
183
184 printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK);
185
186 printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK)>>4);
187
188 printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK));
189
190 printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK));
191}
192
193/* Freq should be specifyed at 62.5 Hz */
194static void set_radio_freq(struct i2c_client *c, unsigned int frq)
195{
196 struct tuner *t = i2c_get_clientdata(c);
197 unsigned char buffer[5];
198 unsigned div;
199 int rc;
200
201 if ( tuner_debug )
202 printk(PREFIX "radio freq counter %d\n",frq);
203
204 /* Rounds freq to next decimal value - for 62.5 KHz step */
205 /* frq = 20*(frq/16)+radio_frq[frq%16]; */
206
207 buffer[2] = TEA5767_PORT1_HIGH;
208 buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
209 buffer[4]=0;
210
211 if (t->audmode == V4L2_TUNER_MODE_MONO) {
212 tuner_dbg("TEA5767 set to mono\n");
213 buffer[2] |= TEA5767_MONO;
214 } else
215 tuner_dbg("TEA5767 set to stereo\n");
216
217 switch (t->type) {
218 case TEA5767_HIGH_LO_13MHz:
219 tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
220 buffer[2] |= TEA5767_HIGH_LO_INJECT;
221 buffer[4] |= TEA5767_PLLREF_ENABLE;
222 div = (frq*4/16+700+225+25)/50;
223 break;
224 case TEA5767_LOW_LO_13MHz:
225 tuner_dbg("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
226
227 buffer[4] |= TEA5767_PLLREF_ENABLE;
228 div = (frq*4/16-700-225+25)/50;
229 break;
230 case TEA5767_LOW_LO_32768:
231 tuner_dbg("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
232 buffer[3] |= TEA5767_XTAL_32768;
233 /* const 700=4000*175 Khz - to adjust freq to right value */
234 div = (1000*(frq*4/16-700-225)+16384)>>15;
235 break;
236 case TEA5767_HIGH_LO_32768:
237 default:
238 tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
239
240 buffer[2] |= TEA5767_HIGH_LO_INJECT;
241 buffer[3] |= TEA5767_XTAL_32768;
242 div = (1000*(frq*4/16+700+225)+16384)>>15;
243 break;
244 }
245 buffer[0] = (div>>8) & 0x3f;
246 buffer[1] = div & 0xff;
247
248 if ( tuner_debug )
249 tea5767_status_dump(buffer);
250
251 if (5 != (rc = i2c_master_send(c,buffer,5)))
252 tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc);
253}
254
255static int tea5767_signal(struct i2c_client *c)
256{
257 unsigned char buffer[5];
258 int rc;
259 struct tuner *t = i2c_get_clientdata(c);
260
261 memset(buffer,0,sizeof(buffer));
262 if (5 != (rc = i2c_master_recv(c,buffer,5)))
263 tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
264
265 return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4));
266}
267
268static int tea5767_stereo(struct i2c_client *c)
269{
270 unsigned char buffer[5];
271 int rc;
272 struct tuner *t = i2c_get_clientdata(c);
273
274 memset(buffer,0,sizeof(buffer));
275 if (5 != (rc = i2c_master_recv(c,buffer,5)))
276 tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
277
278 rc = buffer[2] & TEA5767_STEREO_MASK;
279
280 if ( tuner_debug )
281 tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
282
283 return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0);
284}
285
286int tea_detection(struct i2c_client *c)
287{
288 unsigned char buffer[5]= { 0xff, 0xff, 0xff, 0xff, 0xff };
289 int rc;
290 struct tuner *t = i2c_get_clientdata(c);
291
292 if (5 != (rc = i2c_master_recv(c,buffer,5))) {
293 tuner_warn ( "it is not a TEA5767. Received %i chars.\n",rc );
294 return EINVAL;
295 }
296
297 /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */
298 if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
299 buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
300 tuner_warn ( "All bytes are equal. It is not a TEA5767\n" );
301 return EINVAL;
302 }
303
304 /* Status bytes:
305 * Byte 4: bit 3:1 : CI (Chip Identification) == 0
306 * bit 0 : internally set to 0
307 * Byte 5: bit 7:0 : == 0
308 */
309
310 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) {
311 tuner_warn ( "Chip ID is not zero. It is not a TEA5767\n" );
312 return EINVAL;
313 }
314 tuner_warn ( "TEA5767 detected.\n" );
315 return 0;
316}
317
318int tea5767_tuner_init(struct i2c_client *c)
319{
320 struct tuner *t = i2c_get_clientdata(c);
321
322 if (tea_detection(c)==EINVAL) return EINVAL;
323
324 tuner_info("type set to %d (%s)\n",
325 t->type, TEA5767_TUNER_NAME);
326 strlcpy(c->name, TEA5767_TUNER_NAME, sizeof(c->name));
327
328 t->tv_freq = set_tv_freq;
329 t->radio_freq = set_radio_freq;
330 t->has_signal = tea5767_signal;
331 t->is_stereo = tea5767_stereo;
332
333 return (0);
334}
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index eaabfc858703..6f6bf4a633fc 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-core.c,v 1.15 2005/06/12 01:36:14 mchehab Exp $ 2 * $Id: tuner-core.c,v 1.29 2005/06/21 15:40:33 mchehab Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * core core, i.e. kernel interfaces, registering and so on 5 * core core, i.e. kernel interfaces, registering and so on
@@ -26,7 +26,6 @@
26/* 26/*
27 * comment line bellow to return to old behavor, where only one I2C device is supported 27 * comment line bellow to return to old behavor, where only one I2C device is supported
28 */ 28 */
29#define CONFIG_TUNER_MULTI_I2C /**/
30 29
31#define UNSET (-1U) 30#define UNSET (-1U)
32 31
@@ -58,9 +57,7 @@ MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
58MODULE_LICENSE("GPL"); 57MODULE_LICENSE("GPL");
59 58
60static int this_adap; 59static int this_adap;
61#ifdef CONFIG_TUNER_MULTI_I2C
62static unsigned short first_tuner, tv_tuner, radio_tuner; 60static unsigned short first_tuner, tv_tuner, radio_tuner;
63#endif
64 61
65static struct i2c_driver driver; 62static struct i2c_driver driver;
66static struct i2c_client client_template; 63static struct i2c_client client_template;
@@ -81,26 +78,9 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
81 return; 78 return;
82 } 79 }
83 if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { 80 if (freq < tv_range[0]*16 || freq > tv_range[1]*16) {
84
85 if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) {
86 /* V4L2_TUNER_CAP_LOW frequency */
87
88 tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n");
89
90 t->tv_freq(c,freq>>10);
91
92 return;
93 } else {
94 /* FIXME: better do that chip-specific, but
95 right now we don't have that in the config
96 struct and this way is still better than no
97 check at all */
98 tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", 81 tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n",
99 freq/16,freq%16*100/16,tv_range[0],tv_range[1]); 82 freq/16,freq%16*100/16,tv_range[0],tv_range[1]);
100 return;
101 }
102 } 83 }
103 tuner_dbg("62.5 Khz freq step selected for TV.\n");
104 t->tv_freq(c,freq); 84 t->tv_freq(c,freq);
105} 85}
106 86
@@ -116,31 +96,18 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
116 tuner_info("no radio tuning for this one, sorry.\n"); 96 tuner_info("no radio tuning for this one, sorry.\n");
117 return; 97 return;
118 } 98 }
119 if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { 99 if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) {
120 if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { 100 if (tuner_debug)
121 /* V4L2_TUNER_CAP_LOW frequency */ 101 tuner_info("radio freq step 62.5Hz (%d.%06d)\n",
122 if (t->type == TUNER_TEA5767) { 102 freq/16000,freq%16000*1000/16);
123 tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); 103 t->radio_freq(c,freq);
124 t->radio_freq(c,freq>>10); 104 } else {
125 return; 105 tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n",
126 } 106 freq/16,freq%16*100/16,
127 107 radio_range[0],radio_range[1]);
128 tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n");
129
130 tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000);
131
132 t->radio_freq(c,freq>>10);
133 return;
134
135 } else {
136 tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n",
137 freq/16,freq%16*100/16,
138 radio_range[0],radio_range[1]);
139 return;
140 }
141 } 108 }
142 tuner_dbg("62.5 Khz freq step selected for Radio.\n"); 109
143 t->radio_freq(c,freq); 110 return;
144} 111}
145 112
146static void set_freq(struct i2c_client *c, unsigned long freq) 113static void set_freq(struct i2c_client *c, unsigned long freq)
@@ -166,8 +133,8 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
166static void set_type(struct i2c_client *c, unsigned int type) 133static void set_type(struct i2c_client *c, unsigned int type)
167{ 134{
168 struct tuner *t = i2c_get_clientdata(c); 135 struct tuner *t = i2c_get_clientdata(c);
136 unsigned char buffer[4];
169 137
170 tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type);
171 /* sanity check */ 138 /* sanity check */
172 if (type == UNSET || type == TUNER_ABSENT) 139 if (type == UNSET || type == TUNER_ABSENT)
173 return; 140 return;
@@ -179,8 +146,8 @@ static void set_type(struct i2c_client *c, unsigned int type)
179 t->type = type; 146 t->type = type;
180 return; 147 return;
181 } 148 }
182 if (t->initialized) 149 if ((t->initialized) && (t->type == type))
183 /* run only once */ 150 /* run only once except type change Hac 04/05*/
184 return; 151 return;
185 152
186 t->initialized = 1; 153 t->initialized = 1;
@@ -193,25 +160,42 @@ static void set_type(struct i2c_client *c, unsigned int type)
193 case TUNER_PHILIPS_TDA8290: 160 case TUNER_PHILIPS_TDA8290:
194 tda8290_init(c); 161 tda8290_init(c);
195 break; 162 break;
163 case TUNER_TEA5767:
164 if (tea5767_tuner_init(c)==EINVAL) t->type=TUNER_ABSENT;
165 break;
166 case TUNER_PHILIPS_FMD1216ME_MK3:
167 buffer[0] = 0x0b;
168 buffer[1] = 0xdc;
169 buffer[2] = 0x9c;
170 buffer[3] = 0x60;
171 i2c_master_send(c,buffer,4);
172 mdelay(1);
173 buffer[2] = 0x86;
174 buffer[3] = 0x54;
175 i2c_master_send(c,buffer,4);
176 default_tuner_init(c);
177 break;
196 default: 178 default:
179 /* TEA5767 autodetection code */
180 if (tea5767_tuner_init(c)!=EINVAL) {
181 t->type = TUNER_TEA5767;
182 if (first_tuner == 0x60)
183 first_tuner++;
184 break;
185 }
186
197 default_tuner_init(c); 187 default_tuner_init(c);
198 break; 188 break;
199 } 189 }
190 tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type);
200} 191}
201 192
202#ifdef CONFIG_TUNER_MULTI_I2C
203#define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ 193#define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \
204 return 0; } else \ 194 return 0; } else if (tuner_debug) \
205 tuner_info ("Cmd %s accepted to "tun"\n",cmd); 195 tuner_info ("Cmd %s accepted to "tun"\n",cmd);
206#define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ 196#define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \
207 CHECK_ADDR(radio_tuner,cmd,"radio") } else \ 197 CHECK_ADDR(radio_tuner,cmd,"radio") } else \
208 { CHECK_ADDR(tv_tuner,cmd,"TV"); } 198 { CHECK_ADDR(tv_tuner,cmd,"TV"); }
209#else
210#define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to "tun"\n",cmd);
211#define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted\n",cmd);
212#endif
213
214#ifdef CONFIG_TUNER_MULTI_I2C
215 199
216static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) 200static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr)
217{ 201{
@@ -242,9 +226,6 @@ static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr)
242 } 226 }
243 set_type(c,tun_addr->type); 227 set_type(c,tun_addr->type);
244} 228}
245#else
246#define set_addr(c,tun_addr) set_type(c,(tun_addr)->type)
247#endif
248 229
249static char pal[] = "-"; 230static char pal[] = "-";
250module_param_string(pal, pal, sizeof(pal), 0644); 231module_param_string(pal, pal, sizeof(pal), 0644);
@@ -284,17 +265,12 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
284{ 265{
285 struct tuner *t; 266 struct tuner *t;
286 267
287#ifndef CONFIG_TUNER_MULTI_I2C
288 if (this_adap > 0)
289 return -1;
290#else
291 /* by default, first I2C card is both tv and radio tuner */ 268 /* by default, first I2C card is both tv and radio tuner */
292 if (this_adap == 0) { 269 if (this_adap == 0) {
293 first_tuner = addr; 270 first_tuner = addr;
294 tv_tuner = addr; 271 tv_tuner = addr;
295 radio_tuner = addr; 272 radio_tuner = addr;
296 } 273 }
297#endif
298 this_adap++; 274 this_adap++;
299 275
300 client_template.adapter = adap; 276 client_template.adapter = adap;
@@ -308,6 +284,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
308 i2c_set_clientdata(&t->i2c, t); 284 i2c_set_clientdata(&t->i2c, t);
309 t->type = UNSET; 285 t->type = UNSET;
310 t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ 286 t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */
287 t->audmode = V4L2_TUNER_MODE_STEREO;
311 288
312 i2c_attach_client(&t->i2c); 289 i2c_attach_client(&t->i2c);
313 tuner_info("chip found @ 0x%x (%s)\n", 290 tuner_info("chip found @ 0x%x (%s)\n",
@@ -325,11 +302,9 @@ static int tuner_probe(struct i2c_adapter *adap)
325 } 302 }
326 this_adap = 0; 303 this_adap = 0;
327 304
328#ifdef CONFIG_TUNER_MULTI_I2C
329 first_tuner = 0; 305 first_tuner = 0;
330 tv_tuner = 0; 306 tv_tuner = 0;
331 radio_tuner = 0; 307 radio_tuner = 0;
332#endif
333 308
334 if (adap->class & I2C_CLASS_TV_ANALOG) 309 if (adap->class & I2C_CLASS_TV_ANALOG)
335 return i2c_probe(adap, &addr_data, tuner_attach); 310 return i2c_probe(adap, &addr_data, tuner_attach);
@@ -392,8 +367,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
392 t->radio_if2 = 41300 * 1000; 367 t->radio_if2 = 41300 * 1000;
393 break; 368 break;
394 } 369 }
395 break; 370 break;
396
397 /* --- v4l ioctls --- */ 371 /* --- v4l ioctls --- */
398 /* take care: bttv does userspace copying, we'll get a 372 /* take care: bttv does userspace copying, we'll get a
399 kernel pointer here... */ 373 kernel pointer here... */
@@ -440,11 +414,18 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
440 vt->signal = t->has_signal(client); 414 vt->signal = t->has_signal(client);
441 if (t->is_stereo) { 415 if (t->is_stereo) {
442 if (t->is_stereo(client)) 416 if (t->is_stereo(client))
443 vt-> flags |= VIDEO_TUNER_STEREO_ON; 417 vt->flags |= VIDEO_TUNER_STEREO_ON;
444 else 418 else
445 vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON; 419 vt->flags &= ~VIDEO_TUNER_STEREO_ON;
446 } 420 }
447 vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ 421 vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */
422
423 vt->rangelow = radio_range[0] * 16000;
424 vt->rangehigh = radio_range[1] * 16000;
425
426 } else {
427 vt->rangelow = tv_range[0] * 16;
428 vt->rangehigh = tv_range[1] * 16;
448 } 429 }
449 430
450 return 0; 431 return 0;
@@ -510,20 +491,46 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
510 tuner -> signal = t->has_signal(client); 491 tuner -> signal = t->has_signal(client);
511 if (t->is_stereo) { 492 if (t->is_stereo) {
512 if (t->is_stereo(client)) { 493 if (t->is_stereo(client)) {
513 tuner -> capability |= V4L2_TUNER_CAP_STEREO; 494 tuner -> rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
514 tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO;
515 } else { 495 } else {
516 tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO; 496 tuner -> rxsubchans = V4L2_TUNER_SUB_MONO;
517 } 497 }
518 } 498 }
499 tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
500 tuner->audmode = t->audmode;
501
502 tuner->rangelow = radio_range[0] * 16000;
503 tuner->rangehigh = radio_range[1] * 16000;
504 } else {
505 tuner->rangelow = tv_range[0] * 16;
506 tuner->rangehigh = tv_range[1] * 16;
519 } 507 }
520 /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */
521 tuner->rangelow = tv_range[0] * 16;
522// tuner->rangehigh = tv_range[1] * 16;
523// tuner->rangelow = tv_range[0] * 16384;
524 tuner->rangehigh = tv_range[1] * 16384;
525 break; 508 break;
526 } 509 }
510 case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */
511 {
512 struct v4l2_tuner *tuner = arg;
513
514 CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio");
515 SWITCH_V4L2;
516
517 /* To switch the audio mode, applications initialize the
518 index and audmode fields and the reserved array and
519 call the VIDIOC_S_TUNER ioctl. */
520 /* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO,
521 V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2,
522 V4L2_TUNER_MODE_SAP */
523
524 if (tuner->audmode == V4L2_TUNER_MODE_MONO)
525 t->audmode = V4L2_TUNER_MODE_MONO;
526 else
527 t->audmode = V4L2_TUNER_MODE_STEREO;
528
529 set_radio_freq(client, t->freq);
530 break;
531 }
532 case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */
533 break;
527 default: 534 default:
528 tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); 535 tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);
529 /* nothing */ 536 /* nothing */
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 539f30557317..c39ed6226ee0 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh Exp $ 2 * $Id: tuner-simple.c,v 1.31 2005/06/21 16:02:25 mkrufky Exp $
3 * 3 *
4 * i2c tv tuner chip device driver 4 * i2c tv tuner chip device driver
5 * controls all those simple 4-control-bytes style tuners. 5 * controls all those simple 4-control-bytes style tuners.
@@ -207,28 +207,27 @@ static struct tunertype tuners[] = {
207 { "LG PAL (TAPE series)", LGINNOTEK, PAL, 207 { "LG PAL (TAPE series)", LGINNOTEK, PAL,
208 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623}, 208 16*170.00, 16*450.00, 0x01,0x02,0x08,0xce,623},
209 209
210 { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL, 210 { "Philips PAL/SECAM multi (FQ1216AME MK4)", Philips, PAL,
211 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 }, 211 16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 },
212 { "Philips FQ1236A MK4", Philips, NTSC, 212 { "Philips FQ1236A MK4", Philips, NTSC,
213 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, 213 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
214 214
215 /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ 215 /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */
216 { "Ymec TVision TVF-8531MF", Philips, NTSC, 216 { "Ymec TVision TVF-8531MF", Philips, NTSC,
217 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, 217 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732},
218 { "Ymec TVision TVF-5533MF", Philips, NTSC, 218 { "Ymec TVision TVF-5533MF", Philips, NTSC,
219 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, 219 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732},
220
221 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 220 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC,
222 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, 221 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732},
223 { "Tena TNF9533-D/IF", LGINNOTEK, PAL, 222 /* Should work for TNF9533-D/IF, TNF9533-B/DF */
224 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623}, 223 { "Tena TNF9533-D/IF", Philips, PAL,
224 16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623},
225 225
226 /* 226 /* This entry is for TEA5767 FM radio only chip used on several boards w/TV tuner */
227 * This entry is for TEA5767 FM radio only chip used on several boards
228 * w/TV tuner
229 */
230 { TEA5767_TUNER_NAME, Philips, RADIO, 227 { TEA5767_TUNER_NAME, Philips, RADIO,
231 -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, 228 -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0},
229 { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL,
230 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 },
232}; 231};
233 232
234unsigned const int tuner_count = ARRAY_SIZE(tuners); 233unsigned const int tuner_count = ARRAY_SIZE(tuners);
@@ -455,24 +454,24 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
455 int rc; 454 int rc;
456 455
457 tun=&tuners[t->type]; 456 tun=&tuners[t->type];
458 div = freq + (int)(16*10.7); 457 div = (freq / 1000) + (int)(16*10.7);
459 buffer[2] = tun->config; 458 buffer[2] = tun->config;
460 459
461 switch (t->type) { 460 switch (t->type) {
462 case TUNER_TENA_9533_DI: 461 case TUNER_TENA_9533_DI:
463 case TUNER_YMEC_TVF_5533MF: 462 case TUNER_YMEC_TVF_5533MF:
464
465 /*These values are empirically determinated */ 463 /*These values are empirically determinated */
466 div = (freq*122)/16 - 20; 464 div = (freq * 122) / 16000 - 20;
467 buffer[2] = 0x88; /* could be also 0x80 */ 465 buffer[2] = 0x88; /* could be also 0x80 */
468 buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ 466 buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */
469 break; 467 break;
470 case TUNER_PHILIPS_FM1216ME_MK3: 468 case TUNER_PHILIPS_FM1216ME_MK3:
471 case TUNER_PHILIPS_FM1236_MK3: 469 case TUNER_PHILIPS_FM1236_MK3:
470 case TUNER_PHILIPS_FMD1216ME_MK3:
472 buffer[3] = 0x19; 471 buffer[3] = 0x19;
473 break; 472 break;
474 case TUNER_PHILIPS_FM1256_IH3: 473 case TUNER_PHILIPS_FM1256_IH3:
475 div = (20 * freq)/16 + 333 * 2; 474 div = (20 * freq) / 16000 + 333 * 2;
476 buffer[2] = 0x80; 475 buffer[2] = 0x80;
477 buffer[3] = 0x19; 476 buffer[3] = 0x19;
478 break; 477 break;
@@ -505,6 +504,7 @@ int default_tuner_init(struct i2c_client *c)
505 t->radio_freq = default_set_radio_freq; 504 t->radio_freq = default_set_radio_freq;
506 t->has_signal = tuner_signal; 505 t->has_signal = tuner_signal;
507 t->is_stereo = tuner_stereo; 506 t->is_stereo = tuner_stereo;
507
508 return 0; 508 return 0;
509} 509}
510 510
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 2dd8310901e8..4794c5632360 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -1,5 +1,6 @@
1 1
2/* 2/* $Id: tuner.h,v 1.33 2005/06/21 14:58:08 mkrufky Exp $
3 *
3 tuner.h - definition for different tuners 4 tuner.h - definition for different tuners
4 5
5 Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) 6 Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de)
@@ -23,6 +24,8 @@
23#ifndef _TUNER_H 24#ifndef _TUNER_H
24#define _TUNER_H 25#define _TUNER_H
25 26
27#include <linux/videodev2.h>
28
26#include "id.h" 29#include "id.h"
27 30
28#define ADDR_UNSET (255) 31#define ADDR_UNSET (255)
@@ -88,7 +91,7 @@
88#define TUNER_LG_NTSC_TAPE 47 91#define TUNER_LG_NTSC_TAPE 47
89 92
90#define TUNER_TNF_8831BGFF 48 93#define TUNER_TNF_8831BGFF 48
91#define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */ 94#define TUNER_MICROTUNE_4042FI5 49 /* DViCO FusionHDTV 3 Gold-Q - 4042 FI5 (3X 8147) */
92#define TUNER_TCL_2002N 50 95#define TUNER_TCL_2002N 50
93#define TUNER_PHILIPS_FM1256_IH3 51 96#define TUNER_PHILIPS_FM1256_IH3 51
94 97
@@ -98,18 +101,18 @@
98#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ 101#define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */
99 102
100#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ 103#define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */
101#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ 104#define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */
102 105
103#define TUNER_YMEC_TVF_8531MF 58 106#define TUNER_YMEC_TVF_8531MF 58
104#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 107#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */
105#define TUNER_THOMSON_DTT7611 60 108#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */
106#define TUNER_TENA_9533_DI 61 109#define TUNER_TENA_9533_DI 61
110
107#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 111#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
112#define TUNER_PHILIPS_FMD1216ME_MK3 63
108 113
109#define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" 114#define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio"
110 115
111#define TUNER_THOMSON_DTT7611 60
112
113#define NOTUNER 0 116#define NOTUNER 0
114#define PAL 1 /* PAL_BG */ 117#define PAL 1 /* PAL_BG */
115#define PAL_I 2 118#define PAL_I 2
@@ -194,11 +197,15 @@ struct tuner {
194 unsigned char i2c_easy_mode[2]; 197 unsigned char i2c_easy_mode[2];
195 unsigned char i2c_set_freq[8]; 198 unsigned char i2c_set_freq[8];
196 199
200 /* used to keep track of audmode */
201 unsigned int audmode;
202
197 /* function ptrs */ 203 /* function ptrs */
198 void (*tv_freq)(struct i2c_client *c, unsigned int freq); 204 void (*tv_freq)(struct i2c_client *c, unsigned int freq);
199 void (*radio_freq)(struct i2c_client *c, unsigned int freq); 205 void (*radio_freq)(struct i2c_client *c, unsigned int freq);
200 int (*has_signal)(struct i2c_client *c); 206 int (*has_signal)(struct i2c_client *c);
201 int (*is_stereo)(struct i2c_client *c); 207 int (*is_stereo)(struct i2c_client *c);
208 int (*set_tuner)(struct i2c_client *c, struct v4l2_tuner *v);
202}; 209};
203 210
204extern unsigned int tuner_debug; 211extern unsigned int tuner_debug;
@@ -206,6 +213,7 @@ extern unsigned const int tuner_count;
206 213
207extern int microtune_init(struct i2c_client *c); 214extern int microtune_init(struct i2c_client *c);
208extern int tda8290_init(struct i2c_client *c); 215extern int tda8290_init(struct i2c_client *c);
216extern int tea5767_tuner_init(struct i2c_client *c);
209extern int default_tuner_init(struct i2c_client *c); 217extern int default_tuner_init(struct i2c_client *c);
210 218
211#define tuner_warn(fmt, arg...) \ 219#define tuner_warn(fmt, arg...) \