aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-10-21 19:48:48 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:10 -0500
commit31c9584c0b071dfa7a75db6e21cc727f728f97b0 (patch)
tree50a0e0b7d342fe00d2505ec69f324551659b4172 /drivers
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>
Diffstat (limited to 'drivers')
-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
75 select TUNER_TEA5761 if !VIDEO_TUNER_CUSTOMIZE 75 select TUNER_TEA5761 if !VIDEO_TUNER_CUSTOMIZE
76 select TUNER_TEA5767 if !VIDEO_TUNER_CUSTOMIZE 76 select TUNER_TEA5767 if !VIDEO_TUNER_CUSTOMIZE
77 select TUNER_SIMPLE if !VIDEO_TUNER_CUSTOMIZE 77 select TUNER_SIMPLE if !VIDEO_TUNER_CUSTOMIZE
78 select TUNER_TDA9887 if !VIDEO_TUNER_CUSTOMIZE
78 79
79menuconfig VIDEO_TUNER_CUSTOMIZE 80menuconfig VIDEO_TUNER_CUSTOMIZE
80 bool "Customize analog tuner modules to build" 81 bool "Customize analog tuner modules to build"
@@ -130,10 +131,19 @@ config TUNER_TEA5767
130config TUNER_SIMPLE 131config TUNER_SIMPLE
131 tristate "Simple tuner support" 132 tristate "Simple tuner support"
132 depends on I2C 133 depends on I2C
134 select TUNER_TDA9887
133 default m if VIDEO_TUNER_CUSTOMIZE 135 default m if VIDEO_TUNER_CUSTOMIZE
134 help 136 help
135 Say Y here to include support for various simple tuners. 137 Say Y here to include support for various simple tuners.
136 138
139config TUNER_TDA9887
140 tristate "TDA 9885/6/7 analog IF demodulator"
141 depends on I2C
142 default m if VIDEO_TUNER_CUSTOMIZE
143 help
144 Say Y here to include support for Philips TDA9885/6/7
145 analog IF demodulator.
146
137endif # VIDEO_TUNER_CUSTOMIZE 147endif # VIDEO_TUNER_CUSTOMIZE
138 148
139config VIDEOBUF_GEN 149config 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 @@
4 4
5zr36067-objs := zoran_procfs.o zoran_device.o \ 5zr36067-objs := zoran_procfs.o zoran_device.o \
6 zoran_driver.o zoran_card.o 6 zoran_driver.o zoran_card.o
7tuner-objs := tuner-core.o tuner-types.o tda9887.o 7tuner-objs := tuner-core.o tuner-types.o
8 8
9msp3400-objs := msp3400-driver.o msp3400-kthreads.o 9msp3400-objs := msp3400-driver.o msp3400-kthreads.o
10 10
@@ -87,6 +87,7 @@ obj-$(CONFIG_TUNER_MT20XX) += mt20xx.o
87obj-$(CONFIG_TUNER_TDA8290) += tda8290.o 87obj-$(CONFIG_TUNER_TDA8290) += tda8290.o
88obj-$(CONFIG_TUNER_TEA5767) += tea5767.o 88obj-$(CONFIG_TUNER_TEA5767) += tea5767.o
89obj-$(CONFIG_TUNER_TEA5761) += tea5761.o 89obj-$(CONFIG_TUNER_TEA5761) += tea5761.o
90obj-$(CONFIG_TUNER_TDA9887) += tda9887.o
90 91
91obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o 92obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
92obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o 93obj-$(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 @@
9#include <linux/videodev.h> 9#include <linux/videodev.h>
10#include <media/v4l2-common.h> 10#include <media/v4l2-common.h>
11#include <media/tuner.h> 11#include <media/tuner.h>
12#include "tuner-driver.h" 12#include "tda9887.h"
13 13
14 14
15/* Chips: 15/* Chips:
@@ -20,13 +20,18 @@
20 Used as part of several tuners 20 Used as part of several tuners
21*/ 21*/
22 22
23static int tda9887_debug;
24module_param_named(debug, tda9887_debug, int, 0644);
25
23#define tda9887_info(fmt, arg...) do {\ 26#define tda9887_info(fmt, arg...) do {\
24 printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \ 27 printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
25 i2c_adapter_id(priv->t->i2c.adapter), priv->t->i2c.addr , ##arg); } while (0) 28 i2c_adapter_id(priv->t->i2c.adapter), \
29 priv->t->i2c.addr, ##arg); } while (0)
26#define tda9887_dbg(fmt, arg...) do {\ 30#define tda9887_dbg(fmt, arg...) do {\
27 if (tuner_debug) \ 31 if (tda9887_debug) \
28 printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \ 32 printk(KERN_INFO "%s %d-%04x: " fmt, priv->t->i2c.name, \
29 i2c_adapter_id(priv->t->i2c.adapter), priv->t->i2c.addr , ##arg); } while (0) 33 i2c_adapter_id(priv->t->i2c.adapter), \
34 priv->t->i2c.addr, ##arg); } while (0)
30 35
31struct tda9887_priv { 36struct tda9887_priv {
32 struct tuner_i2c_props i2c_props; 37 struct tuner_i2c_props i2c_props;
@@ -573,13 +578,13 @@ static void tda9887_configure(struct dvb_frontend *fe)
573 578
574 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", 579 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
575 priv->data[1],priv->data[2],priv->data[3]); 580 priv->data[1],priv->data[2],priv->data[3]);
576 if (tuner_debug > 1) 581 if (tda9887_debug > 1)
577 dump_write_message(fe, priv->data); 582 dump_write_message(fe, priv->data);
578 583
579 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,priv->data,4))) 584 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,priv->data,4)))
580 tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); 585 tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc);
581 586
582 if (tuner_debug > 2) { 587 if (tda9887_debug > 2) {
583 msleep_interruptible(1000); 588 msleep_interruptible(1000);
584 tda9887_status(fe); 589 tda9887_status(fe);
585 } 590 }
@@ -590,7 +595,8 @@ static void tda9887_configure(struct dvb_frontend *fe)
590static void tda9887_tuner_status(struct dvb_frontend *fe) 595static void tda9887_tuner_status(struct dvb_frontend *fe)
591{ 596{
592 struct tda9887_priv *priv = fe->analog_demod_priv; 597 struct tda9887_priv *priv = fe->analog_demod_priv;
593 tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]); 598 tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n",
599 priv->data[1], priv->data[2], priv->data[3]);
594} 600}
595 601
596static int tda9887_get_afc(struct dvb_frontend *fe) 602static int tda9887_get_afc(struct dvb_frontend *fe)
@@ -636,7 +642,7 @@ static struct analog_tuner_ops tda9887_tuner_ops = {
636 .release = tda9887_release, 642 .release = tda9887_release,
637}; 643};
638 644
639int tda9887_tuner_init(struct tuner *t) 645int tda9887_attach(struct tuner *t)
640{ 646{
641 struct tda9887_priv *priv = NULL; 647 struct tda9887_priv *priv = NULL;
642 648
@@ -658,6 +664,7 @@ int tda9887_tuner_init(struct tuner *t)
658 664
659 return 0; 665 return 0;
660} 666}
667EXPORT_SYMBOL_GPL(tda9887_attach);
661 668
662/* 669/*
663 * Overrides for Emacs so that we follow Linus's tabbing style. 670 * 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 @@
1/*
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15*/
16
17#ifndef __TDA9887_H__
18#define __TDA9887_H__
19
20#include "tuner-driver.h"
21
22/* ------------------------------------------------------------------------ */
23#if defined(CONFIG_TUNER_TDA9887) || (defined(CONFIG_TUNER_TDA9887_MODULE) && defined(MODULE))
24extern int tda9887_attach(struct tuner *t);
25#else
26static inline int tda9887_attach(struct tuner *t)
27{
28 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
29 return -EINVAL;
30}
31#endif
32
33#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 @@
26#include "tea5767.h" 26#include "tea5767.h"
27#include "tuner-xc2028.h" 27#include "tuner-xc2028.h"
28#include "tuner-simple.h" 28#include "tuner-simple.h"
29#include "tda9887.h"
29 30
30#define UNSET (-1U) 31#define UNSET (-1U)
31 32
@@ -344,7 +345,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
344 break; 345 break;
345 } 346 }
346 case TUNER_TDA9887: 347 case TUNER_TDA9887:
347 tda9887_tuner_init(t); 348 tda9887_attach(t);
348 break; 349 break;
349 default: 350 default:
350 attach_simple_tuner(t); 351 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 {
69 69
70/* ------------------------------------------------------------------------ */ 70/* ------------------------------------------------------------------------ */
71 71
72extern int tda9887_tuner_init(struct tuner *t);
73
74/* ------------------------------------------------------------------------ */
75
76#define tuner_warn(fmt, arg...) do {\ 72#define tuner_warn(fmt, arg...) do {\
77 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 73 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
78 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) 74 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)