summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-03-07 12:07:01 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-03-07 12:07:01 -0200
commit55ff4f4df681b35c3491f8e19f7487497e2a4891 (patch)
treef87aed963d457025ea4ba5fb24dbc017692acb62
parenta848141281083e26a67ea94725a531b4602756f7 (diff)
downloadmediapointer-dvb-s2-55ff4f4df681b35c3491f8e19f7487497e2a4891.tar.gz
mediapointer-dvb-s2-55ff4f4df681b35c3491f8e19f7487497e2a4891.tar.bz2
Allow using tea5761 radio device on tuner-core
From: Mauro Carvalho Chehab <mchehab@infradead.org> tea5761 is a driver wrote back on 2005, to support Philips tea5671 radio, meanting to be used on some devices that would be lauched with those chips. Recently, some people seems to be interested on having support for those chips at Linux Kernel. Let's enable compilation of this driver and ask they to test if this works fine. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--linux/Documentation/video4linux/CARDLIST.tuner1
-rw-r--r--linux/drivers/media/video/Kconfig8
-rw-r--r--linux/drivers/media/video/Makefile4
-rw-r--r--linux/drivers/media/video/tea5761.c10
-rw-r--r--linux/drivers/media/video/tuner-core.c26
-rw-r--r--linux/drivers/media/video/tuner-types.c4
-rw-r--r--linux/include/media/tuner.h8
-rwxr-xr-xv4l/scripts/gentree.pl1
8 files changed, 55 insertions, 7 deletions
diff --git a/linux/Documentation/video4linux/CARDLIST.tuner b/linux/Documentation/video4linux/CARDLIST.tuner
index 44134f04b..9b02dbb2a 100644
--- a/linux/Documentation/video4linux/CARDLIST.tuner
+++ b/linux/Documentation/video4linux/CARDLIST.tuner
@@ -72,3 +72,4 @@ tuner=70 - Samsung TCPN 2121P30A
tuner=71 - Xceive xc3028
tuner=72 - Thomson FE6600
tuner=73 - Samsung TCPG 6121P30A
+tuner=75 - Philips TEA5761 FM Radio
diff --git a/linux/drivers/media/video/Kconfig b/linux/drivers/media/video/Kconfig
index 639e8b6c3..ac65aaf20 100644
--- a/linux/drivers/media/video/Kconfig
+++ b/linux/drivers/media/video/Kconfig
@@ -484,6 +484,14 @@ config TUNER_3036
Say Y here to include support for Philips SAB3036 compatible tuners.
If in doubt, say N.
+config TUNER_TEA5761
+ tristate "TEA 5761 radio tuner (EXPERIMENTAL)"
+ depends on VIDEO_DEV && I2C
+ select VIDEO_TUNER
+ help
+ Say Y here to include support for Philips TEA5761 radio tuner.
+ If in doubt, say N.
+
config VIDEO_VINO
tristate "SGI Vino Video For Linux (EXPERIMENTAL)"
depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L2
diff --git a/linux/drivers/media/video/Makefile b/linux/drivers/media/video/Makefile
index 9c2de5016..3202e8729 100644
--- a/linux/drivers/media/video/Makefile
+++ b/linux/drivers/media/video/Makefile
@@ -7,6 +7,10 @@ zr36067-objs := zoran_procfs.o zoran_device.o \
tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \
mt20xx.o tda8290.o tea5767.o tda9887.o
+ifneq ($(CONFIG_TUNER_TEA5761),n)
+ tuner-objs += tea5761.o
+endif
+
msp3400-objs := msp3400-driver.o msp3400-kthreads.o
obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o
diff --git a/linux/drivers/media/video/tea5761.c b/linux/drivers/media/video/tea5761.c
index a0f075ed7..fc800f656 100644
--- a/linux/drivers/media/video/tea5761.c
+++ b/linux/drivers/media/video/tea5761.c
@@ -2,10 +2,8 @@
* For Philips TEA5761 FM Chip
* I2C address is allways 0x20 (0x10 at 7-bit mode).
*
- * $Id: tea5761.c,v 1.5 2006/01/11 21:01:01 hverkuil Exp $
- *
- * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@infradead.org)
- * This code is placed under the terms of the GNU General Public License
+ * Copyright (c) 2005-2007 Mauro Carvalho Chehab (mchehab@infradead.org)
+ * This code is placed under the terms of the GNUv2 General Public License
*
*/
@@ -233,8 +231,8 @@ int tea5761_tuner_init(struct i2c_client *c)
tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5761HN FM Radio");
strlcpy(c->name, "tea5761", sizeof(c->name));
- t->tv_freq = set_tv_freq;
- t->radio_freq = set_radio_freq;
+ t->set_tv_freq = set_tv_freq;
+ t->set_radio_freq = set_radio_freq;
t->has_signal = tea5761_signal;
t->is_stereo = tea5761_stereo;
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 1aac94868..02fb067e2 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -29,6 +29,9 @@
/* standard i2c insmod options */
static unsigned short normal_i2c[] = {
+#ifdef CONFIG_TUNER_5761
+ 0x10,
+#endif
0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
@@ -216,6 +219,16 @@ static void set_type(struct i2c_client *c, unsigned int type,
}
t->mode_mask = T_RADIO;
break;
+#ifdef CONFIG_TUNER_5761
+ case TUNER_TEA5761:
+ if (tea5761_tuner_init(c) == EINVAL) {
+ t->type = TUNER_ABSENT;
+ t->mode_mask = T_UNINITIALIZED;
+ return -ENODEV;
+ }
+ t->mode_mask = T_RADIO;
+ break;
+#endif
case TUNER_PHILIPS_FMD1216ME_MK3:
buffer[0] = 0x0b;
buffer[1] = 0xdc;
@@ -506,6 +519,19 @@ static int tuner_attach(struct i2c_adapter *adap, int addr,
/* autodetection code based on the i2c addr */
if (!no_autodetect) {
switch (addr) {
+#ifdef CONFIG_TUNER_5761
+ case 0x10:
+ if (tea5761_autodetection(&t->i2c) != EINVAL) {
+ t->type = TUNER_TEA5761;
+ t->mode_mask = T_RADIO;
+ t->mode = T_STANDBY;
+ t->radio_freq = 87.5 * 16000; /* Sets freq to FM range */
+ default_mode_mask &= ~T_RADIO;
+
+ goto register_client;
+ }
+ break;
+#endif
case 0x42:
case 0x43:
case 0x4a:
diff --git a/linux/drivers/media/video/tuner-types.c b/linux/drivers/media/video/tuner-types.c
index 22b159d44..c644397b1 100644
--- a/linux/drivers/media/video/tuner-types.c
+++ b/linux/drivers/media/video/tuner-types.c
@@ -1511,6 +1511,10 @@ struct tunertype tuners[] = {
.name = "Philips TDA988[5,6,7] IF PLL Demodulator",
/* see tda9887.c for details */
},
+ [TUNER_TEA5761] = { /* Philips RADIO */
+ .name = "Philips TEA5761 FM Radio",
+ /* see tea5767.c for details */
+ },
};
unsigned const int tuner_count = ARRAY_SIZE(tuners);
diff --git a/linux/include/media/tuner.h b/linux/include/media/tuner.h
index 40affbd6f..27d2183a4 100644
--- a/linux/include/media/tuner.h
+++ b/linux/include/media/tuner.h
@@ -123,6 +123,7 @@ extern int tuner_debug;
#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */
#define TUNER_TDA9887 74 /* This tuner should be used only internally */
+#define TUNER_TEA5761 75 /* Only FM Radio Tuner */
/* tv card specific */
#define TDA9887_PRESENT (1<<0)
@@ -232,11 +233,16 @@ extern int microtune_init(struct i2c_client *c);
extern int xc3028_init(struct i2c_client *c);
extern int tda8290_init(struct i2c_client *c);
extern int tda8290_probe(struct i2c_client *c);
-extern int tea5767_tuner_init(struct i2c_client *c);
extern int default_tuner_init(struct i2c_client *c);
+
extern int tea5767_autodetection(struct i2c_client *c);
+extern int tea5767_tuner_init(struct i2c_client *c);
+
extern int tda9887_tuner_init(struct i2c_client *c);
+extern int tea5761_tuner_init(struct i2c_client *c);
+extern int tea5761_autodetection(struct i2c_client *c);
+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
#define tuner_warn(fmt, arg...) do {\
printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index 4d27fd789..f9f56bd7c 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -62,6 +62,7 @@ my %defs = (
'I2C_PEC' => 1,
'I2C_DF_DUMMY' => 0,
'CONFIG_XC3028' => 0,
+ 'CONFIG_TUNER_TEA5761' => 0,
'I2C_CLASS_TV_ANALOG' => 1,
'I2C_CLASS_TV_DIGITAL' => 1);