summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 1aac94868..e7bc60a5e 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:
@@ -877,7 +903,11 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int tuner_suspend(struct i2c_client *c, pm_message_t state)
+#else
static int tuner_suspend(struct device *dev, pm_message_t state)
+#endif
#else
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)
static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
@@ -886,7 +916,9 @@ static int tuner_suspend(struct device *dev, u32 state, u32 level)
#endif
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+#endif
struct tuner *t = i2c_get_clientdata (c);
tuner_dbg ("suspend\n");
@@ -895,12 +927,18 @@ static int tuner_suspend(struct device *dev, u32 state, u32 level)
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+static int tuner_resume(struct i2c_client *c)
+#else
static int tuner_resume(struct device *dev)
+#endif
#else
static int tuner_resume(struct device *dev, u32 level)
#endif
{
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+#endif
struct tuner *t = i2c_get_clientdata (c);
tuner_dbg ("resume\n");
@@ -929,13 +967,19 @@ static struct i2c_driver driver = {
.attach_adapter = tuner_probe,
.detach_client = tuner_detach,
.command = tuner_command,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
+ .suspend = tuner_suspend,
+ .resume = tuner_resume,
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
.driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
.name = "tuner",
#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
.suspend = tuner_suspend,
.resume = tuner_resume,
+#endif
},
#endif
};