aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tuner-simple.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-06-24 01:05:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:06:39 -0400
commit56fc08ca375491b965cb76fad65bfb98973e80d8 (patch)
treed19bb1d6e1d139dda8989188fae49cf124f3aaac /drivers/media/video/tuner-simple.c
parentb45009b0288a96a3458f4f8e93cb776678d41875 (diff)
[PATCH] v4l: update for tuner cards and some V4L chips
Tuner improvements and additions. TEA5767 FM tuner added. Several small fixes. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Nickolay V Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/tuner-simple.c')
-rw-r--r--drivers/media/video/tuner-simple.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 866f18dc5b58..539f30557317 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.14 2005/05/30 02:02:47 mchehab Exp $ 2 * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh 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.
@@ -220,7 +220,17 @@ static struct tunertype tuners[] = {
220 220
221 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, 221 { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC,
222 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, 222 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732},
223 { "Tena TNF9533-D/IF", LGINNOTEK, PAL,
224 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623},
225
226 /*
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,
231 -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0},
223}; 232};
233
224unsigned const int tuner_count = ARRAY_SIZE(tuners); 234unsigned const int tuner_count = ARRAY_SIZE(tuners);
225 235
226/* ---------------------------------------------------------------------- */ 236/* ---------------------------------------------------------------------- */
@@ -231,6 +241,7 @@ static int tuner_getstatus(struct i2c_client *c)
231 241
232 if (1 != i2c_master_recv(c,&byte,1)) 242 if (1 != i2c_master_recv(c,&byte,1))
233 return 0; 243 return 0;
244
234 return byte; 245 return byte;
235} 246}
236 247
@@ -239,17 +250,33 @@ static int tuner_getstatus(struct i2c_client *c)
239#define TUNER_MODE 0x38 250#define TUNER_MODE 0x38
240#define TUNER_AFC 0x07 251#define TUNER_AFC 0x07
241 252
242#define TUNER_STEREO 0x10 /* radio mode */ 253#define TUNER_STEREO 0x10 /* radio mode */
243#define TUNER_SIGNAL 0x07 /* radio mode */ 254#define TUNER_STEREO_MK3 0x04 /* radio mode */
255#define TUNER_SIGNAL 0x07 /* radio mode */
244 256
245static int tuner_signal(struct i2c_client *c) 257static int tuner_signal(struct i2c_client *c)
246{ 258{
247 return (tuner_getstatus(c) & TUNER_SIGNAL)<<13; 259 return (tuner_getstatus(c) & TUNER_SIGNAL) << 13;
248} 260}
249 261
250static int tuner_stereo(struct i2c_client *c) 262static int tuner_stereo(struct i2c_client *c)
251{ 263{
252 return (tuner_getstatus (c) & TUNER_STEREO); 264 int stereo, status;
265 struct tuner *t = i2c_get_clientdata(c);
266
267 status = tuner_getstatus (c);
268
269 switch (t->type) {
270 case TUNER_PHILIPS_FM1216ME_MK3:
271 case TUNER_PHILIPS_FM1236_MK3:
272 case TUNER_PHILIPS_FM1256_IH3:
273 stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3);
274 break;
275 default:
276 stereo = status & TUNER_STEREO;
277 }
278
279 return stereo;
253} 280}
254 281
255#if 0 /* unused */ 282#if 0 /* unused */
@@ -432,6 +459,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
432 buffer[2] = tun->config; 459 buffer[2] = tun->config;
433 460
434 switch (t->type) { 461 switch (t->type) {
462 case TUNER_TENA_9533_DI:
435 case TUNER_YMEC_TVF_5533MF: 463 case TUNER_YMEC_TVF_5533MF:
436 464
437 /*These values are empirically determinated */ 465 /*These values are empirically determinated */
@@ -473,20 +501,6 @@ int default_tuner_init(struct i2c_client *c)
473 t->type, tuners[t->type].name); 501 t->type, tuners[t->type].name);
474 strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); 502 strlcpy(c->name, tuners[t->type].name, sizeof(c->name));
475 503
476 switch (t->type) {
477 case TUNER_YMEC_TVF_5533MF:
478 {
479 struct tuner_addr tun_addr = { V4L2_TUNER_ANALOG_TV, 0xc2>>1 };
480
481 if (c->driver->command) {
482 c->driver->command(c, TUNER_SET_ADDR, &tun_addr);
483 } else {
484 tuner_warn("Couldn't set TV tuner I2C address to 0x%02x\n",tun_addr.addr<<1);
485 }
486 break;
487 }
488 }
489
490 t->tv_freq = default_set_tv_freq; 504 t->tv_freq = default_set_tv_freq;
491 t->radio_freq = default_set_radio_freq; 505 t->radio_freq = default_set_radio_freq;
492 t->has_signal = tuner_signal; 506 t->has_signal = tuner_signal;