aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Krufky2007-10-21 20:48:48 -0300
committerMauro Carvalho Chehab2008-01-25 19:01:10 -0200
commit31c9584c0b071dfa7a75db6e21cc727f728f97b0 (patch)
tree50a0e0b7d342fe00d2505ec69f324551659b4172
parent5c82f4497b46e9c3877618bc36661a4abbf9c646 (diff)
V4L/DVB (6443): make tda9887 build selectable via Kconfig
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/Kconfig10
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/tda9887.c23
-rw-r--r--drivers/media/video/tda9887.h33
-rw-r--r--drivers/media/video/tuner-core.c3
-rw-r--r--drivers/media/video/tuner-driver.h4
6 files changed, 62 insertions, 14 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index e52229380984..8f4a45346de7 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -75,6 +75,7 @@ config VIDEO_TUNER
select TUNER_TEA5761 if !VIDEO_TUNER_CUSTOMIZE
select TUNER_TEA5767 if !VIDEO_TUNER_CUSTOMIZE
select TUNER_SIMPLE if !VIDEO_TUNER_CUSTOMIZE
+ select TUNER_TDA9887 if !VIDEO_TUNER_CUSTOMIZE
menuconfig VIDEO_TUNER_CUSTOMIZE
bool "Customize analog tuner modules to build"
@@ -130,10 +131,19 @@ config TUNER_TEA5767
config TUNER_SIMPLE
tristate "Simple tuner support"
depends on I2C
+ select TUNER_TDA9887
default m if VIDEO_TUNER_CUSTOMIZE
help
Say Y here to include support for various simple tuners.
+config TUNER_TDA9887
+ tristate "TDA 9885/6/7 analog IF demodulator"
+ depends on I2C
+ default m if VIDEO_TUNER_CUSTOMIZE
+ help
+ Say Y here to include support for Philips TDA9885/6/7
+ analog IF demodulator.
+
endif # VIDEO_TUNER_CUSTOMIZE
config VIDEOBUF_GEN
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 08ac197cc1dd..8a2781821232 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -4,7 +4,7 @@
zr36067-objs := zoran_procfs.o zoran_device.o \
zoran_driver.o zoran_card.o
-tuner-objs := tuner-core.o tuner-types.o tda9887.o
+tuner-objs := tuner-core.o tuner-types.o
msp3400-objs := msp3400-driver.o msp3400-kthreads.o
@@ -87,6 +87,7 @@ obj-$(CONFIG_TUNER_MT20XX) += mt20xx.o
obj-$(CONFIG_TUNER_TDA8290) += tda8290.o
obj-$(CONFIG_TUNER_TEA5767) += tea5767.o
obj-$(CONFIG_TUNER_TEA5761) += tea5761.o
+obj-$(CONFIG_TUNER_TDA9887) += tda9887.o
obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 7663a5579757..4f5d76ff0b44 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -9,7 +9,7 @@
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <media/tuner.h>
-#include "tuner-driver.h"
+#include "tda9887.h"
/* Chips:
@@ -20,13 +20,18 @@
Used as part of several tuners
*/
+static int tda9887_debug;
+module_param_named(debug, tda9887_debug, int, 0644);
+
#define tda9887_info(fmt, arg...) do {\
printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
- i2c_adapter_id(priv->t->i2c.adapter), priv->t->i2c.addr , ##arg); } while (0)
+ i2c_adapter_id(priv->t->i2c.adapter), \
+ priv->t->i2c.addr, ##arg); } while (0)
#define tda9887_dbg(fmt, arg...) do {\
- if (tuner_debug) \
+ if (tda9887_debug) \
printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
- i2c_adapter_id(priv->t->i2c.adapter), priv->t->i2c.addr , ##arg); } while (0)
+ i2c_adapter_id(priv->t->i2c.adapter), \
+ priv->t->i2c.addr, ##arg); } while (0)
struct tda9887_priv {
struct tuner_i2c_props i2c_props;
@@ -573,13 +578,13 @@ static void tda9887_configure(struct dvb_frontend *fe)
tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
priv->data[1],priv->data[2],priv->data[3]);
- if (tuner_debug > 1)
+ if (tda9887_debug > 1)
dump_write_message(fe, priv->data);
if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,priv->data,4)))
tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc);
- if (tuner_debug > 2) {
+ if (tda9887_debug > 2) {
msleep_interruptible(1000);
tda9887_status(fe);
}
@@ -590,7 +595,8 @@ static void tda9887_configure(struct dvb_frontend *fe)
static void tda9887_tuner_status(struct dvb_frontend *fe)
{
struct tda9887_priv *priv = fe->analog_demod_priv;
- tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]);
+ tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n",
+ priv->data[1], priv->data[2], priv->data[3]);
}
static int tda9887_get_afc(struct dvb_frontend *fe)
@@ -636,7 +642,7 @@ static struct analog_tuner_ops tda9887_tuner_ops = {
.release = tda9887_release,
};
-int tda9887_tuner_init(struct tuner *t)
+int tda9887_attach(struct tuner *t)
{
struct tda9887_priv *priv = NULL;
@@ -658,6 +664,7 @@ int tda9887_tuner_init(struct tuner *t)
return 0;
}
+EXPORT_SYMBOL_GPL(tda9887_attach);
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
diff --git a/drivers/media/video/tda9887.h b/drivers/media/video/tda9887.h
new file mode 100644
index 000000000000..b879f0ec2855
--- /dev/null
+++ b/drivers/media/video/tda9887.h
@@ -0,0 +1,33 @@
+/*
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __TDA9887_H__
+#define __TDA9887_H__
+
+#include "tuner-driver.h"
+
+/* ------------------------------------------------------------------------ */
+#if defined(CONFIG_TUNER_TDA9887) || (defined(CONFIG_TUNER_TDA9887_MODULE) && defined(MODULE))
+extern int tda9887_attach(struct tuner *t);
+#else
+static inline int tda9887_attach(struct tuner *t)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
+ return -EINVAL;
+}
+#endif
+
+#endif /* __TDA9887_H__ */
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 3de03da28da0..da16bf998fbe 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -26,6 +26,7 @@
#include "tea5767.h"
#include "tuner-xc2028.h"
#include "tuner-simple.h"
+#include "tda9887.h"
#define UNSET (-1U)
@@ -344,7 +345,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
break;
}
case TUNER_TDA9887:
- tda9887_tuner_init(t);
+ tda9887_attach(t);
break;
default:
attach_simple_tuner(t);
diff --git a/drivers/media/video/tuner-driver.h b/drivers/media/video/tuner-driver.h
index cc9c1c74117b..c03d08cd8324 100644
--- a/drivers/media/video/tuner-driver.h
+++ b/drivers/media/video/tuner-driver.h
@@ -69,10 +69,6 @@ struct tuner {
/* ------------------------------------------------------------------------ */
-extern int tda9887_tuner_init(struct tuner *t);
-
-/* ------------------------------------------------------------------------ */
-
#define tuner_warn(fmt, arg...) do {\
printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)