summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/tuner-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-09 22:42:07 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-09 22:42:07 -0300
commit06baaa0441c7fec2a211ddf7c502f837cd988132 (patch)
tree284236ae49b1385a091119cf7b3520bc7d64552a /linux/drivers/media/video/tuner-core.c
parente5561cf14fe189f7f0d726a1c66ffa992354ab2d (diff)
parentd784aba6717da44bfef18007146f6d00280e39fe (diff)
downloadmediapointer-dvb-s2-06baaa0441c7fec2a211ddf7c502f837cd988132.tar.gz
mediapointer-dvb-s2-06baaa0441c7fec2a211ddf7c502f837cd988132.tar.bz2
merge: http://linuxtv.org/hg/~mkrufky/fusionhdtv7
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/tuner-core.c')
-rw-r--r--linux/drivers/media/video/tuner-core.c61
1 files changed, 21 insertions, 40 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 314d89cef..d80f7ee91 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -21,9 +21,6 @@
#include <media/tuner-types.h>
#include <media/v4l2-common.h>
#include <media/v4l2-i2c-drv-legacy.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "mt20xx.h"
#include "tda8290.h"
#include "tea5761.h"
@@ -100,6 +97,7 @@ struct tuner {
unsigned int type; /* chip type id */
unsigned int config;
int (*tuner_callback) (void *dev, int command, int arg);
+ const char *name;
};
/* standard i2c insmod options */
@@ -113,9 +111,6 @@ static unsigned short normal_i2c[] = {
I2C_CLIENT_END
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
/* insmod options used at init time => read/only */
@@ -161,17 +156,6 @@ static char secam[] = "--";
static char ntsc[] = "-";
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(pal,"s");
-MODULE_PARM(secam,"s");
-MODULE_PARM(ntsc,"s");
-MODULE_PARM(tv_range,"2i");
-MODULE_PARM(radio_range,"2i");
-MODULE_PARM(no_autodetect, "i");
-MODULE_PARM(tuner_debug, "i");
-MODULE_PARM(addr, "i");
-MODULE_PARM(show_i2c, "i");
-#else
module_param(addr, int, 0444);
module_param(no_autodetect, int, 0444);
module_param(show_i2c, int, 0444);
@@ -179,15 +163,8 @@ module_param_named(debug,tuner_debug, int, 0644);
module_param_string(pal, pal, sizeof(pal), 0644);
module_param_string(secam, secam, sizeof(secam), 0644);
module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static unsigned int dummy;
-module_param_array(tv_range, int, dummy, 0644);
-module_param_array(radio_range, int, dummy, 0644);
-#else
module_param_array(tv_range, int, NULL, 0644);
module_param_array(radio_range, int, NULL, 0644);
-#endif
-#endif
MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
@@ -359,13 +336,13 @@ static void tuner_i2c_address_check(struct tuner *t)
tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
tuner_warn("will soon be dropped. This message indicates that your\n");
tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n",
- t->i2c->name, t->i2c->addr);
+ t->name, t->i2c->addr);
tuner_warn("To ensure continued support for your device, please\n");
tuner_warn("send a copy of this message, along with full dmesg\n");
tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
- t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name);
+ t->i2c->adapter->name, t->i2c->addr, t->type, t->name);
tuner_warn("====================== WARNING! ======================\n");
}
@@ -499,19 +476,17 @@ static void set_type(struct i2c_client *c, unsigned int type,
if ((NULL == analog_ops->set_params) &&
(fe_tuner_ops->set_analog_params)) {
- strlcpy(t->i2c->name, fe_tuner_ops->info.name,
- sizeof(t->i2c->name));
+ t->name = fe_tuner_ops->info.name;
t->fe.analog_demod_priv = t;
memcpy(analog_ops, &tuner_core_ops,
sizeof(struct analog_demod_ops));
} else {
- strlcpy(t->i2c->name, analog_ops->info.name,
- sizeof(t->i2c->name));
+ t->name = analog_ops->info.name;
}
- tuner_dbg("type set to %s\n", t->i2c->name);
+ tuner_dbg("type set to %s\n", t->name);
if (t->mode_mask == T_UNINITIALIZED)
t->mode_mask = new_mode_mask;
@@ -1159,7 +1134,7 @@ static int tuner_probe(struct i2c_client *client,
if (NULL == t)
return -ENOMEM;
t->i2c = client;
- strlcpy(client->name, "(tuner unset)", sizeof(client->name));
+ t->name = "(tuner unset)";
i2c_set_clientdata(client, t);
t->type = UNSET;
t->audmode = V4L2_TUNER_MODE_STEREO;
@@ -1281,11 +1256,7 @@ static int tuner_legacy_probe(struct i2c_adapter *adap)
normal_i2c[1] = I2C_CLIENT_END;
}
-#ifdef I2C_CLASS_TV_ANALOG
if ((adap->class & I2C_CLASS_TV_ANALOG) == 0)
-#else
- if (adap->id != I2C_HW_B_BT848)
-#endif
return 0;
/* HACK: Ignore 0x6b and 0x6f on cx88 boards.
@@ -1326,6 +1297,17 @@ static int tuner_remove(struct i2c_client *client)
/* ----------------------------------------------------------------------- */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+/* This driver supports many devices and the idea is to let the driver
+ detect which device is present. So rather than listing all supported
+ devices here, we pretend to support a single, fake device type. */
+static const struct i2c_device_id tuner_id[] = {
+ { "tuner", }, /* autodetect */
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, tuner_id);
+#endif
+
static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "tuner",
.driverid = I2C_DRIVERID_TUNER,
@@ -1335,11 +1317,10 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.suspend = tuner_suspend,
.resume = tuner_resume,
.legacy_probe = tuner_legacy_probe,
-};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+ .id_table = tuner_id,
#endif
+};
/*
* Overrides for Emacs so that we follow Linus's tabbing style.