aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-09-09 16:03:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:49 -0400
commit793cf9e6a54c698e109a599c8b8e303658fcaae6 (patch)
tree522a88bad46df318b04888bad91c49504d3565eb /drivers
parenta1938038dd7e4188a8663e49242fa77dd2adb7ed (diff)
[PATCH] v4l: common part Updates and tuner additions
- Remove $Id CVS logs for V4L files - Included newer cards. - Added a new NEC protocol for ir based on pulse distance. - Enable ATSC support for DViCO FusionHDTV5 Gold. - Added tuner LG NTSC (TALN mini series). - Fixed tea5767 autodetection. - Resolve more tuner types. - Commented debug function removed from mainstream. - Remove comments from mainstream. Still on development tree. - linux/version dependencies removed. - BTSC Lang1 now is set to auto_stereo mode. - New tuner standby API. - i2c-core.c uses hexadecimal for the i2c address, so it should stay consistent. Signed-off-by: Uli Luckas <luckas@musoft.de> Signed-off-by: Mac Michaels <wmichaels1@earthlink.net> Signed-off-by: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Hermann Pitton <hermann.pitton@onlinehome.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/ir-common.c68
-rw-r--r--drivers/media/video/btcx-risc.c1
-rw-r--r--drivers/media/video/btcx-risc.h1
-rw-r--r--drivers/media/video/ir-kbd-gpio.c1
-rw-r--r--drivers/media/video/ir-kbd-i2c.c1
-rw-r--r--drivers/media/video/msp3400.h1
-rw-r--r--drivers/media/video/mt20xx.c2
-rw-r--r--drivers/media/video/tda8290.c19
-rw-r--r--drivers/media/video/tda9887.c39
-rw-r--r--drivers/media/video/tea5767.c37
-rw-r--r--drivers/media/video/tuner-core.c79
-rw-r--r--drivers/media/video/tuner-simple.c5
-rw-r--r--drivers/media/video/tveeprom.c25
-rw-r--r--drivers/media/video/tvmixer.c1
-rw-r--r--drivers/media/video/v4l1-compat.c16
-rw-r--r--drivers/media/video/v4l2-common.c18
-rw-r--r--drivers/media/video/video-buf-dvb.c1
-rw-r--r--drivers/media/video/video-buf.c1
18 files changed, 186 insertions, 130 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c
index ab7a1fba4427..a0e700d7a4a4 100644
--- a/drivers/media/common/ir-common.c
+++ b/drivers/media/common/ir-common.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $
3 * 2 *
4 * some common structs and functions to handle infrared remotes via 3 * some common structs and functions to handle infrared remotes via
5 * input layer ... 4 * input layer ...
@@ -335,6 +334,72 @@ int ir_dump_samples(u32 *samples, int count)
335 return 0; 334 return 0;
336} 335}
337 336
337/* decode raw samples, pulse distance coding used by NEC remotes */
338int ir_decode_pulsedistance(u32 *samples, int count, int low, int high)
339{
340 int i,last,bit,len;
341 u32 curBit;
342 u32 value;
343
344 /* find start burst */
345 for (i = len = 0; i < count * 32; i++) {
346 bit = getbit(samples,i);
347 if (bit) {
348 len++;
349 } else {
350 if (len >= 29)
351 break;
352 len = 0;
353 }
354 }
355
356 /* start burst to short */
357 if (len < 29)
358 return 0xffffffff;
359
360 /* find start silence */
361 for (len = 0; i < count * 32; i++) {
362 bit = getbit(samples,i);
363 if (bit) {
364 break;
365 } else {
366 len++;
367 }
368 }
369
370 /* silence to short */
371 if (len < 7)
372 return 0xffffffff;
373
374 /* go decoding */
375 len = 0;
376 last = 1;
377 value = 0; curBit = 1;
378 for (; i < count * 32; i++) {
379 bit = getbit(samples,i);
380 if (last) {
381 if(bit) {
382 continue;
383 } else {
384 len = 1;
385 }
386 } else {
387 if (bit) {
388 if (len > (low + high) /2)
389 value |= curBit;
390 curBit <<= 1;
391 if (curBit == 1)
392 break;
393 } else {
394 len++;
395 }
396 }
397 last = bit;
398 }
399
400 return value;
401}
402
338/* decode raw samples, biphase coding, used by rc5 for example */ 403/* decode raw samples, biphase coding, used by rc5 for example */
339int ir_decode_biphase(u32 *samples, int count, int low, int high) 404int ir_decode_biphase(u32 *samples, int count, int low, int high)
340{ 405{
@@ -383,6 +448,7 @@ EXPORT_SYMBOL_GPL(ir_input_keydown);
383EXPORT_SYMBOL_GPL(ir_extract_bits); 448EXPORT_SYMBOL_GPL(ir_extract_bits);
384EXPORT_SYMBOL_GPL(ir_dump_samples); 449EXPORT_SYMBOL_GPL(ir_dump_samples);
385EXPORT_SYMBOL_GPL(ir_decode_biphase); 450EXPORT_SYMBOL_GPL(ir_decode_biphase);
451EXPORT_SYMBOL_GPL(ir_decode_pulsedistance);
386 452
387/* 453/*
388 * Local variables: 454 * Local variables:
diff --git a/drivers/media/video/btcx-risc.c b/drivers/media/video/btcx-risc.c
index 7f2d515d2873..a48de3c0e3f0 100644
--- a/drivers/media/video/btcx-risc.c
+++ b/drivers/media/video/btcx-risc.c
@@ -1,5 +1,4 @@
1/* 1/*
2 $Id: btcx-risc.c,v 1.6 2005/02/21 13:57:59 kraxel Exp $
3 2
4 btcx-risc.c 3 btcx-risc.c
5 4
diff --git a/drivers/media/video/btcx-risc.h b/drivers/media/video/btcx-risc.h
index 41f60395a520..503e6c6d7b69 100644
--- a/drivers/media/video/btcx-risc.h
+++ b/drivers/media/video/btcx-risc.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: btcx-risc.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $
3 */ 2 */
4struct btcx_riscmem { 3struct btcx_riscmem {
5 unsigned int size; 4 unsigned int size;
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
index a565823330aa..eddadc76e11d 100644
--- a/drivers/media/video/ir-kbd-gpio.c
+++ b/drivers/media/video/ir-kbd-gpio.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $
3 * 2 *
4 * Copyright (c) 2003 Gerd Knorr 3 * Copyright (c) 2003 Gerd Knorr
5 * Copyright (c) 2003 Pavel Machek 4 * Copyright (c) 2003 Pavel Machek
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 1e273ff3f956..67105b9804a2 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $
3 * 2 *
4 * keyboard input driver for i2c IR remote controls 3 * keyboard input driver for i2c IR remote controls
5 * 4 *
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h
index 023f33056a4f..2d9ff40f0b09 100644
--- a/drivers/media/video/msp3400.h
+++ b/drivers/media/video/msp3400.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $
3 */ 2 */
4 3
5#ifndef MSP3400_H 4#ifndef MSP3400_H
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 2fb7c2d1787a..972aa5e0aeef 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: mt20xx.c,v 1.5 2005/06/16 08:29:49 nsh Exp $
3 * 2 *
4 * i2c tv tuner chip device driver 3 * i2c tv tuner chip device driver
5 * controls microtune tuners, mt2032 + mt2050 at the moment. 4 * controls microtune tuners, mt2032 + mt2050 at the moment.
@@ -494,6 +493,7 @@ int microtune_init(struct i2c_client *c)
494 memset(buf,0,sizeof(buf)); 493 memset(buf,0,sizeof(buf));
495 t->tv_freq = NULL; 494 t->tv_freq = NULL;
496 t->radio_freq = NULL; 495 t->radio_freq = NULL;
496 t->standby = NULL;
497 name = "unknown"; 497 name = "unknown";
498 498
499 i2c_master_send(c,buf,1); 499 i2c_master_send(c,buf,1);
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index a8b6a8df5109..c65f0c7680a2 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $
3 * 2 *
4 * i2c tv tuner chip device driver 3 * i2c tv tuner chip device driver
5 * controls the philips tda8290+75 tuner chip combo. 4 * controls the philips tda8290+75 tuner chip combo.
@@ -9,6 +8,9 @@
9#include <linux/delay.h> 8#include <linux/delay.h>
10#include <media/tuner.h> 9#include <media/tuner.h>
11 10
11#define I2C_ADDR_TDA8290 0x4b
12#define I2C_ADDR_TDA8275 0x61
13
12/* ---------------------------------------------------------------------- */ 14/* ---------------------------------------------------------------------- */
13 15
14struct freq_entry { 16struct freq_entry {
@@ -75,10 +77,12 @@ static unsigned char i2c_init_tda8275[14] = { 0x00, 0x00, 0x00, 0x00,
75static unsigned char i2c_set_VS[2] = { 0x30, 0x6F }; 77static unsigned char i2c_set_VS[2] = { 0x30, 0x6F };
76static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B }; 78static unsigned char i2c_set_GP01_CF[2] = { 0x20, 0x0B };
77static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 }; 79static unsigned char i2c_tda8290_reset[2] = { 0x00, 0x00 };
80static unsigned char i2c_tda8290_standby[2] = { 0x00, 0x02 };
78static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 }; 81static unsigned char i2c_gainset_off[2] = { 0x28, 0x14 };
79static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 }; 82static unsigned char i2c_gainset_on[2] = { 0x28, 0x54 };
80static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 }; 83static unsigned char i2c_agc3_00[2] = { 0x80, 0x00 };
81static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF }; 84static unsigned char i2c_agc2_BF[2] = { 0x60, 0xBF };
85static unsigned char i2c_cb1_D0[2] = { 0x30, 0xD0 };
82static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 }; 86static unsigned char i2c_cb1_D2[2] = { 0x30, 0xD2 };
83static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 }; 87static unsigned char i2c_cb1_56[2] = { 0x30, 0x56 };
84static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 }; 88static unsigned char i2c_cb1_52[2] = { 0x30, 0x52 };
@@ -117,6 +121,13 @@ static struct i2c_msg i2c_msg_epilog[] = {
117 { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on }, 121 { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on },
118}; 122};
119 123
124static struct i2c_msg i2c_msg_standby[] = {
125 { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge },
126 { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 },
127 { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge },
128 { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby },
129};
130
120static int tda8290_tune(struct i2c_client *c) 131static int tda8290_tune(struct i2c_client *c)
121{ 132{
122 struct tuner *t = i2c_get_clientdata(c); 133 struct tuner *t = i2c_get_clientdata(c);
@@ -205,6 +216,11 @@ static int has_signal(struct i2c_client *c)
205 return (afc & 0x80)? 65535:0; 216 return (afc & 0x80)? 65535:0;
206} 217}
207 218
219static void standby(struct i2c_client *c)
220{
221 i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby));
222}
223
208int tda8290_init(struct i2c_client *c) 224int tda8290_init(struct i2c_client *c)
209{ 225{
210 struct tuner *t = i2c_get_clientdata(c); 226 struct tuner *t = i2c_get_clientdata(c);
@@ -214,6 +230,7 @@ int tda8290_init(struct i2c_client *c)
214 t->tv_freq = set_tv_freq; 230 t->tv_freq = set_tv_freq;
215 t->radio_freq = set_radio_freq; 231 t->radio_freq = set_radio_freq;
216 t->has_signal = has_signal; 232 t->has_signal = has_signal;
233 t->standby = standby;
217 234
218 i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge)); 235 i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge));
219 i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init)); 236 i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init));
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index d60fc562aecd..79e0bd1aa70f 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -49,7 +49,7 @@ MODULE_LICENSE("GPL");
49struct tda9887 { 49struct tda9887 {
50 struct i2c_client client; 50 struct i2c_client client;
51 v4l2_std_id std; 51 v4l2_std_id std;
52 unsigned int radio; 52 enum tuner_mode mode;
53 unsigned int config; 53 unsigned int config;
54 unsigned int pinnacle_id; 54 unsigned int pinnacle_id;
55 unsigned int using_v4l2; 55 unsigned int using_v4l2;
@@ -196,7 +196,7 @@ static struct tvnorm tvnorms[] = {
196 .b = ( cNegativeFmTV | 196 .b = ( cNegativeFmTV |
197 cQSS ), 197 cQSS ),
198 .c = ( cDeemphasisON | 198 .c = ( cDeemphasisON |
199 cDeemphasis50 ), 199 cDeemphasis75 ),
200 .e = ( cGating_36 | 200 .e = ( cGating_36 |
201 cAudioIF_4_5 | 201 cAudioIF_4_5 |
202 cVideoIF_45_75 ), 202 cVideoIF_45_75 ),
@@ -364,7 +364,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
364 struct tvnorm *norm = NULL; 364 struct tvnorm *norm = NULL;
365 int i; 365 int i;
366 366
367 if (t->radio) { 367 if (t->mode == T_RADIO) {
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
@@ -378,7 +378,7 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
378 } 378 }
379 } 379 }
380 if (NULL == norm) { 380 if (NULL == norm) {
381 dprintk(PREFIX "Oops: no tvnorm entry found\n"); 381 dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n");
382 return -1; 382 return -1;
383 } 383 }
384 384
@@ -569,6 +569,10 @@ static int tda9887_configure(struct tda9887 *t)
569 tda9887_set_config(t,buf); 569 tda9887_set_config(t,buf);
570 tda9887_set_insmod(t,buf); 570 tda9887_set_insmod(t,buf);
571 571
572 if (t->mode == T_STANDBY) {
573 buf[1] |= cForcedMuteAudioON;
574 }
575
572 576
573 dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", 577 dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
574 buf[1],buf[2],buf[3]); 578 buf[1],buf[2],buf[3]);
@@ -653,10 +657,17 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
653 657
654 /* --- configuration --- */ 658 /* --- configuration --- */
655 case AUDC_SET_RADIO: 659 case AUDC_SET_RADIO:
656 t->radio = 1; 660 {
661 t->mode = T_RADIO;
657 tda9887_configure(t); 662 tda9887_configure(t);
658 break; 663 break;
659 664 }
665 case TUNER_SET_STANDBY:
666 {
667 t->mode = T_STANDBY;
668 tda9887_configure(t);
669 break;
670 }
660 case AUDC_CONFIG_PINNACLE: 671 case AUDC_CONFIG_PINNACLE:
661 { 672 {
662 int *i = arg; 673 int *i = arg;
@@ -689,7 +700,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
689 struct video_channel *vc = arg; 700 struct video_channel *vc = arg;
690 701
691 CHECK_V4L2; 702 CHECK_V4L2;
692 t->radio = 0; 703 t->mode = T_ANALOG_TV;
693 if (vc->norm < ARRAY_SIZE(map)) 704 if (vc->norm < ARRAY_SIZE(map))
694 t->std = map[vc->norm]; 705 t->std = map[vc->norm];
695 tda9887_fixup_std(t); 706 tda9887_fixup_std(t);
@@ -701,7 +712,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
701 v4l2_std_id *id = arg; 712 v4l2_std_id *id = arg;
702 713
703 SWITCH_V4L2; 714 SWITCH_V4L2;
704 t->radio = 0; 715 t->mode = T_ANALOG_TV;
705 t->std = *id; 716 t->std = *id;
706 tda9887_fixup_std(t); 717 tda9887_fixup_std(t);
707 tda9887_configure(t); 718 tda9887_configure(t);
@@ -713,14 +724,14 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
713 724
714 SWITCH_V4L2; 725 SWITCH_V4L2;
715 if (V4L2_TUNER_ANALOG_TV == f->type) { 726 if (V4L2_TUNER_ANALOG_TV == f->type) {
716 if (t->radio == 0) 727 if (t->mode == T_ANALOG_TV)
717 return 0; 728 return 0;
718 t->radio = 0; 729 t->mode = T_ANALOG_TV;
719 } 730 }
720 if (V4L2_TUNER_RADIO == f->type) { 731 if (V4L2_TUNER_RADIO == f->type) {
721 if (t->radio == 1) 732 if (t->mode == T_RADIO)
722 return 0; 733 return 0;
723 t->radio = 1; 734 t->mode = T_RADIO;
724 } 735 }
725 tda9887_configure(t); 736 tda9887_configure(t);
726 break; 737 break;
@@ -735,7 +746,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
735 }; 746 };
736 struct v4l2_tuner* tuner = arg; 747 struct v4l2_tuner* tuner = arg;
737 748
738 if (t->radio) { 749 if (t->mode == T_RADIO) {
739 __u8 reg = 0; 750 __u8 reg = 0;
740 tuner->afc=0; 751 tuner->afc=0;
741 if (1 == i2c_master_recv(&t->client,&reg,1)) 752 if (1 == i2c_master_recv(&t->client,&reg,1))
@@ -747,7 +758,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
747 { 758 {
748 struct v4l2_tuner* tuner = arg; 759 struct v4l2_tuner* tuner = arg;
749 760
750 if (t->radio) { 761 if (t->mode == T_RADIO) {
751 t->radio_mode = tuner->audmode; 762 t->radio_mode = tuner->audmode;
752 tda9887_configure (t); 763 tda9887_configure (t);
753 } 764 }
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index cebcc1fa68d1..38bf50943798 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -2,7 +2,6 @@
2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview 2 * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3 * I2C address is allways 0xC0. 3 * I2C address is allways 0xC0.
4 * 4 *
5 * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $
6 * 5 *
7 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) 6 * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
8 * This code is placed under the terms of the GNU General Public License 7 * This code is placed under the terms of the GNU General Public License
@@ -205,11 +204,6 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
205 TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND; 204 TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
206 buffer[4] = 0; 205 buffer[4] = 0;
207 206
208 if (t->mode == T_STANDBY) {
209 tuner_dbg("TEA5767 set to standby mode\n");
210 buffer[3] |= TEA5767_STDBY;
211 }
212
213 if (t->audmode == V4L2_TUNER_MODE_MONO) { 207 if (t->audmode == V4L2_TUNER_MODE_MONO) {
214 tuner_dbg("TEA5767 set to mono\n"); 208 tuner_dbg("TEA5767 set to mono\n");
215 buffer[2] |= TEA5767_MONO; 209 buffer[2] |= TEA5767_MONO;
@@ -290,13 +284,31 @@ static int tea5767_stereo(struct i2c_client *c)
290 return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0); 284 return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0);
291} 285}
292 286
287static void tea5767_standby(struct i2c_client *c)
288{
289 unsigned char buffer[5];
290 struct tuner *t = i2c_get_clientdata(c);
291 unsigned div, rc;
292
293 div = (87500 * 4 + 700 + 225 + 25) / 50; /* Set frequency to 87.5 MHz */
294 buffer[0] = (div >> 8) & 0x3f;
295 buffer[1] = div & 0xff;
296 buffer[2] = TEA5767_PORT1_HIGH;
297 buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL |
298 TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND | TEA5767_STDBY;
299 buffer[4] = 0;
300
301 if (5 != (rc = i2c_master_send(c, buffer, 5)))
302 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
303}
304
293int tea5767_autodetection(struct i2c_client *c) 305int tea5767_autodetection(struct i2c_client *c)
294{ 306{
295 unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 307 unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
296 int rc; 308 int rc;
297 struct tuner *t = i2c_get_clientdata(c); 309 struct tuner *t = i2c_get_clientdata(c);
298 310
299 if (7 != (rc = i2c_master_recv(c, buffer, 7))) { 311 if ((rc = i2c_master_recv(c, buffer, 7))< 5) {
300 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); 312 tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
301 return EINVAL; 313 return EINVAL;
302 } 314 }
@@ -313,15 +325,10 @@ int tea5767_autodetection(struct i2c_client *c)
313 * bit 0 : internally set to 0 325 * bit 0 : internally set to 0
314 * Byte 5: bit 7:0 : == 0 326 * Byte 5: bit 7:0 : == 0
315 */ 327 */
316 if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) { 328 if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) {
317 tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); 329 tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
318 return EINVAL; 330 return EINVAL;
319 } 331 }
320 /* It seems that tea5767 returns 0xff after the 5th byte */
321 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
322 tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n");
323 return EINVAL;
324 }
325 332
326 /* It seems that tea5767 returns 0xff after the 5th byte */ 333 /* It seems that tea5767 returns 0xff after the 5th byte */
327 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { 334 if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) {
@@ -337,14 +344,14 @@ int tea5767_tuner_init(struct i2c_client *c)
337{ 344{
338 struct tuner *t = i2c_get_clientdata(c); 345 struct tuner *t = i2c_get_clientdata(c);
339 346
340 tuner_info("type set to %d (%s)\n", t->type, 347 tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
341 "Philips TEA5767HN FM Radio");
342 strlcpy(c->name, "tea5767", sizeof(c->name)); 348 strlcpy(c->name, "tea5767", sizeof(c->name));
343 349
344 t->tv_freq = set_tv_freq; 350 t->tv_freq = set_tv_freq;
345 t->radio_freq = set_radio_freq; 351 t->radio_freq = set_radio_freq;
346 t->has_signal = tea5767_signal; 352 t->has_signal = tea5767_signal;
347 t->is_stereo = tea5767_stereo; 353 t->is_stereo = tea5767_stereo;
354 t->standby = tea5767_standby;
348 355
349 return (0); 356 return (0);
350} 357}
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 3b1893c2ae3b..afc96bbb1c11 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $
3 * 2 *
4 * i2c tv tuner chip device driver 3 * i2c tv tuner chip device driver
5 * core core, i.e. kernel interfaces, registering and so on 4 * core core, i.e. kernel interfaces, registering and so on
@@ -182,6 +181,14 @@ static void set_type(struct i2c_client *c, unsigned int type,
182 i2c_master_send(c, buffer, 4); 181 i2c_master_send(c, buffer, 4);
183 default_tuner_init(c); 182 default_tuner_init(c);
184 break; 183 break;
184 case TUNER_LG_TDVS_H062F:
185 /* Set the Auxiliary Byte. */
186 buffer[2] &= ~0x20;
187 buffer[2] |= 0x18;
188 buffer[3] = 0x20;
189 i2c_master_send(c, buffer, 4);
190 default_tuner_init(c);
191 break;
185 default: 192 default:
186 default_tuner_init(c); 193 default_tuner_init(c);
187 break; 194 break;
@@ -208,31 +215,31 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
208{ 215{
209 struct tuner *t = i2c_get_clientdata(c); 216 struct tuner *t = i2c_get_clientdata(c);
210 217
211 if (tun_setup->addr == ADDR_UNSET) { 218 if ((tun_setup->addr == ADDR_UNSET &&
212 if (t->mode_mask & tun_setup->mode_mask) 219 (t->mode_mask & tun_setup->mode_mask)) ||
220 tun_setup->addr == c->addr) {
213 set_type(c, tun_setup->type, tun_setup->mode_mask); 221 set_type(c, tun_setup->type, tun_setup->mode_mask);
214 } else if (tun_setup->addr == c->addr) {
215 set_type(c, tun_setup->type, tun_setup->mode_mask);
216 } 222 }
217} 223}
218 224
219static inline int check_mode(struct tuner *t, char *cmd) 225static inline int check_mode(struct tuner *t, char *cmd)
220{ 226{
221 if (1 << t->mode & t->mode_mask) { 227 if ((1 << t->mode & t->mode_mask) == 0) {
222 switch (t->mode) { 228 return EINVAL;
223 case V4L2_TUNER_RADIO: 229 }
224 tuner_dbg("Cmd %s accepted for radio\n", cmd); 230
225 break; 231 switch (t->mode) {
226 case V4L2_TUNER_ANALOG_TV: 232 case V4L2_TUNER_RADIO:
227 tuner_dbg("Cmd %s accepted for analog TV\n", cmd); 233 tuner_dbg("Cmd %s accepted for radio\n", cmd);
228 break; 234 break;
229 case V4L2_TUNER_DIGITAL_TV: 235 case V4L2_TUNER_ANALOG_TV:
230 tuner_dbg("Cmd %s accepted for digital TV\n", cmd); 236 tuner_dbg("Cmd %s accepted for analog TV\n", cmd);
231 break; 237 break;
232 } 238 case V4L2_TUNER_DIGITAL_TV:
233 return 0; 239 tuner_dbg("Cmd %s accepted for digital TV\n", cmd);
240 break;
234 } 241 }
235 return EINVAL; 242 return 0;
236} 243}
237 244
238static char pal[] = "-"; 245static char pal[] = "-";
@@ -406,20 +413,18 @@ static int tuner_detach(struct i2c_client *client)
406 413
407static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd) 414static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
408{ 415{
409 if (mode != t->mode) { 416 if (mode == t->mode)
410 417 return 0;
411 t->mode = mode; 418
412 if (check_mode(t, cmd) == EINVAL) { 419 t->mode = mode;
413 t->mode = T_STANDBY; 420
414 if (V4L2_TUNER_RADIO == mode) { 421 if (check_mode(t, cmd) == EINVAL) {
415 set_tv_freq(client, 400 * 16); 422 t->mode = T_STANDBY;
416 } else { 423 if (t->standby)
417 set_radio_freq(client, 87.5 * 16000); 424 t->standby (client);
418 } 425 return EINVAL;
419 return EINVAL; 426 }
420 } 427 return 0;
421 }
422 return 0;
423} 428}
424 429
425#define switch_v4l2() if (!t->using_v4l2) \ 430#define switch_v4l2() if (!t->using_v4l2) \
@@ -453,6 +458,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
453 case AUDC_SET_RADIO: 458 case AUDC_SET_RADIO:
454 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO"); 459 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO");
455 break; 460 break;
461 case TUNER_SET_STANDBY:
462 {
463 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
464 return 0;
465 if (t->standby)
466 t->standby (client);
467 break;
468 }
456 case AUDC_CONFIG_PINNACLE: 469 case AUDC_CONFIG_PINNACLE:
457 if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL) 470 if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
458 return 0; 471 return 0;
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index de0c93aeb75d..26034406b372 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $
3 * 2 *
4 * i2c tv tuner chip device driver 3 * i2c tv tuner chip device driver
5 * controls all those simple 4-control-bytes style tuners. 4 * controls all those simple 4-control-bytes style tuners.
@@ -248,9 +247,10 @@ static struct tunertype tuners[] = {
248 247
249 { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC, 248 { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC,
250 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, 249 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732},
251
252 { "Ymec TVF66T5-B/DFF", Philips, PAL, 250 { "Ymec TVF66T5-B/DFF", Philips, PAL,
253 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, 251 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623},
252 { "LG NTSC (TALN mini series)", LGINNOTEK, NTSC,
253 16*150.00,16*425.00,0x01,0x02,0x08,0x8e,732 },
254}; 254};
255 255
256unsigned const int tuner_count = ARRAY_SIZE(tuners); 256unsigned const int tuner_count = ARRAY_SIZE(tuners);
@@ -497,6 +497,7 @@ int default_tuner_init(struct i2c_client *c)
497 t->radio_freq = default_set_radio_freq; 497 t->radio_freq = default_set_radio_freq;
498 t->has_signal = tuner_signal; 498 t->has_signal = tuner_signal;
499 t->is_stereo = tuner_stereo; 499 t->is_stereo = tuner_stereo;
500 t->standby = NULL;
500 501
501 return 0; 502 return 0;
502} 503}
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 3c3356a01cc6..d0a00d3a6c4f 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -155,10 +155,10 @@ hauppauge_tuner[] =
155 { TUNER_ABSENT, "Philips FQ1216ME MK3"}, 155 { TUNER_ABSENT, "Philips FQ1216ME MK3"},
156 { TUNER_ABSENT, "Philips FI1236 MK3"}, 156 { TUNER_ABSENT, "Philips FI1236 MK3"},
157 { TUNER_PHILIPS_FM1216ME_MK3, "Philips FM1216 ME MK3"}, 157 { TUNER_PHILIPS_FM1216ME_MK3, "Philips FM1216 ME MK3"},
158 { TUNER_ABSENT, "Philips FM1236 MK3"}, 158 { TUNER_PHILIPS_FM1236_MK3, "Philips FM1236 MK3"},
159 { TUNER_ABSENT, "Philips FM1216MP MK3"}, 159 { TUNER_ABSENT, "Philips FM1216MP MK3"},
160 /* 60-69 */ 160 /* 60-69 */
161 { TUNER_ABSENT, "LG S001D MK3"}, 161 { TUNER_PHILIPS_FM1216ME_MK3, "LG S001D MK3"},
162 { TUNER_ABSENT, "LG M001D MK3"}, 162 { TUNER_ABSENT, "LG M001D MK3"},
163 { TUNER_ABSENT, "LG S701D MK3"}, 163 { TUNER_ABSENT, "LG S701D MK3"},
164 { TUNER_ABSENT, "LG M701D MK3"}, 164 { TUNER_ABSENT, "LG M701D MK3"},
@@ -183,8 +183,8 @@ hauppauge_tuner[] =
183 { TUNER_ABSENT, "Philips FQ1216LME MK3"}, 183 { TUNER_ABSENT, "Philips FQ1216LME MK3"},
184 { TUNER_ABSENT, "LG TAPC G701D"}, 184 { TUNER_ABSENT, "LG TAPC G701D"},
185 { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"}, 185 { TUNER_LG_NTSC_NEW_TAPC, "LG TAPC H791F"},
186 { TUNER_ABSENT, "TCL 2002MB 3"}, 186 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"},
187 { TUNER_ABSENT, "TCL 2002MI 3"}, 187 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"},
188 { TUNER_TCL_2002N, "TCL 2002N 6A"}, 188 { TUNER_TCL_2002N, "TCL 2002N 6A"},
189 { TUNER_ABSENT, "Philips FQ1236 MK3"}, 189 { TUNER_ABSENT, "Philips FQ1236 MK3"},
190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 190 { TUNER_ABSENT, "Samsung TCPN 2121P30A"},
@@ -445,23 +445,6 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
445} 445}
446EXPORT_SYMBOL(tveeprom_read); 446EXPORT_SYMBOL(tveeprom_read);
447 447
448#if 0
449int tveeprom_dump(unsigned char *eedata, int len)
450{
451 int i;
452
453 dprintk(1, "%s\n",__FUNCTION__);
454 for (i = 0; i < len; i++) {
455 if (0 == (i % 16))
456 printk(KERN_INFO "tveeprom: %02x:",i);
457 printk(" %02x",eedata[i]);
458 if (15 == (i % 16))
459 printk("\n");
460 }
461 return 0;
462}
463EXPORT_SYMBOL(tveeprom_dump);
464#endif /* 0 */
465 448
466/* ----------------------------------------------------------------------- */ 449/* ----------------------------------------------------------------------- */
467/* needed for ivtv.sf.net at the moment. Should go away in the long */ 450/* needed for ivtv.sf.net at the moment. Should go away in the long */
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
index a43301a154af..d86e08ebddfc 100644
--- a/drivers/media/video/tvmixer.c
+++ b/drivers/media/video/tvmixer.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $
3 */ 2 */
4 3
5#include <linux/module.h> 4#include <linux/module.h>
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index 70ecbdb80277..59bb71381a1b 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: v4l1-compat.c,v 1.9 2005/06/12 04:19:19 mchehab Exp $
3 * 2 *
4 * Video for Linux Two 3 * Video for Linux Two
5 * Backward Compatibility Layer 4 * Backward Compatibility Layer
@@ -604,9 +603,6 @@ v4l_compat_translate_ioctl(struct inode *inode,
604 dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err); 603 dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n",err);
605 break; 604 break;
606 } 605 }
607#if 0 /* FIXME */
608 pict->depth = fmt2->fmt.pix.depth;
609#endif
610 pict->palette = pixelformat_to_palette( 606 pict->palette = pixelformat_to_palette(
611 fmt2->fmt.pix.pixelformat); 607 fmt2->fmt.pix.pixelformat);
612 break; 608 break;
@@ -707,13 +703,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
707 } 703 }
708 case VIDIOCSTUNER: /* select a tuner input */ 704 case VIDIOCSTUNER: /* select a tuner input */
709 { 705 {
710#if 0 /* FIXME */
711 err = drv(inode, file, VIDIOC_S_INPUT, &i);
712 if (err < 0)
713 dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n",err);
714#else
715 err = 0; 706 err = 0;
716#endif
717 break; 707 break;
718 } 708 }
719 case VIDIOCGFREQ: /* get frequency */ 709 case VIDIOCGFREQ: /* get frequency */
@@ -852,12 +842,6 @@ v4l_compat_translate_ioctl(struct inode *inode,
852 err = 0; 842 err = 0;
853 break; 843 break;
854 } 844 }
855#if 0
856 case VIDIOCGMBUF:
857 /* v4l2 drivers must implement that themself. The
858 mmap() differences can't be translated fully
859 transparent, thus there is no point to try that */
860#endif
861 case VIDIOCMCAPTURE: /* capture a frame */ 845 case VIDIOCMCAPTURE: /* capture a frame */
862 { 846 {
863 struct video_mmap *mm = arg; 847 struct video_mmap *mm = arg;
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index b5e0cf3448f4..597b8db35a13 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -84,20 +84,6 @@ MODULE_LICENSE("GPL");
84 * Video Standard Operations (contributed by Michael Schimek) 84 * Video Standard Operations (contributed by Michael Schimek)
85 */ 85 */
86 86
87#if 0 /* seems to have no users */
88/* This is the recommended method to deal with the framerate fields. More
89 sophisticated drivers will access the fields directly. */
90unsigned int
91v4l2_video_std_fps(struct v4l2_standard *vs)
92{
93 if (vs->frameperiod.numerator > 0)
94 return (((vs->frameperiod.denominator << 8) /
95 vs->frameperiod.numerator) +
96 (1 << 7)) / (1 << 8);
97 return 0;
98}
99EXPORT_SYMBOL(v4l2_video_std_fps);
100#endif
101 87
102/* Fill in the fields of a v4l2_standard structure according to the 88/* Fill in the fields of a v4l2_standard structure according to the
103 'id' and 'transmission' parameters. Returns negative on error. */ 89 'id' and 'transmission' parameters. Returns negative on error. */
@@ -213,10 +199,6 @@ char *v4l2_ioctl_names[256] = {
213 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT", 199 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
214 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT", 200 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
215 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT", 201 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
216#if 0
217 [_IOC_NR(VIDIOC_G_COMP)] = "VIDIOC_G_COMP",
218 [_IOC_NR(VIDIOC_S_COMP)] = "VIDIOC_S_COMP",
219#endif
220 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS", 202 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
221 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF", 203 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
222 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF", 204 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c
index 15f5bb486963..55f129e964eb 100644
--- a/drivers/media/video/video-buf-dvb.c
+++ b/drivers/media/video/video-buf-dvb.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: video-buf-dvb.c,v 1.7 2004/12/09 12:51:35 kraxel Exp $
3 * 2 *
4 * some helper function for simple DVB cards which simply DMA the 3 * some helper function for simple DVB cards which simply DMA the
5 * complete transport stream and let the computer sort everything else 4 * complete transport stream and let the computer sort everything else
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
index 5afdc7852610..97354f253a80 100644
--- a/drivers/media/video/video-buf.c
+++ b/drivers/media/video/video-buf.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * $Id: video-buf.c,v 1.18 2005/02/24 13:32:30 kraxel Exp $
3 * 2 *
4 * generic helper functions for video4linux capture buffers, to handle 3 * generic helper functions for video4linux capture buffers, to handle
5 * memory management and PCI DMA. Right now bttv + saa7134 use it. 4 * memory management and PCI DMA. Right now bttv + saa7134 use it.