Commit 15396236 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (4205): Merge tda9887 module into tuner.

Most uses a tda988[5/6/7] IF demodulator as part of the device.
Having this as a separate stuff makes harder to configure it, since there
are some tda9887 options that are tuner-dependent and should be bound into
tuner-types structures.
This patch merges tda9887 module into tuner. More work is required to make
tuner-types to properly use it.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 0ccac4af
......@@ -6,7 +6,7 @@ zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
zr36067-objs := zoran_procfs.o zoran_device.o \
zoran_driver.o zoran_card.o
tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \
mt20xx.o tda8290.o tea5767.o
mt20xx.o tda8290.o tea5767.o tda9887.o
msp3400-objs := msp3400-driver.o msp3400-kthreads.o
......@@ -60,7 +60,7 @@ obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
obj-$(CONFIG_VIDEO_DPC) += saa7111.o dpc7146.o
obj-$(CONFIG_TUNER_3036) += tuner-3036.o
obj-$(CONFIG_VIDEO_TUNER) += tuner.o tda9887.o
obj-$(CONFIG_VIDEO_TUNER) += tuner.o
obj-$(CONFIG_VIDEO_BUF) += video-buf.o
obj-$(CONFIG_VIDEO_BUF_DVB) += video-buf-dvb.o
obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o
......
......@@ -425,9 +425,19 @@ static int attach_inform(struct i2c_client *client)
struct em28xx *dev = client->adapter->algo_data;
switch (client->addr << 1) {
case 0x86:
case 0x43:
case 0x4b:
{
struct tuner_setup tun_setup;
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
tun_setup.type = TUNER_TDA9887;
tun_setup.addr = client->addr;
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
em28xx_i2c_call_clients(dev, TDA9887_SET_CONFIG, &dev->tda9887_conf);
break;
}
case 0x42:
dprintk1(1,"attach_inform: saa7114 detected.\n");
break;
......@@ -453,6 +463,7 @@ static int attach_inform(struct i2c_client *client)
case 0xba:
dprintk1(1,"attach_inform: tvp5150 detected.\n");
break;
default:
dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1);
dev->tuner_addr = client->addr;
......
This diff is collapsed.
......@@ -215,6 +215,9 @@ static void set_type(struct i2c_client *c, unsigned int type,
i2c_master_send(c,buffer,4);
default_tuner_init(c);
break;
case TUNER_TDA9887:
tda9887_tuner_init(c);
break;
default:
default_tuner_init(c);
break;
......@@ -241,6 +244,8 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
{
struct tuner *t = i2c_get_clientdata(c);
tuner_dbg("set addr for type %i\n", t->type);
if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET &&
(t->mode_mask & tun_setup->mode_mask)) ||
tun_setup->addr == c->addr)) {
......@@ -436,6 +441,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
t->audmode = V4L2_TUNER_MODE_STEREO;
t->mode_mask = T_UNINITIALIZED;
t->tuner_status = tuner_status;
if (tuner_debug_old) {
tuner_debug = tuner_debug_old;
printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n");
......@@ -462,10 +468,14 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
case 0x4b:
/* If chip is not tda8290, don't register.
since it can be tda9887*/
if (tda8290_probe(&t->i2c) != 0) {
tuner_dbg("chip at addr %x is not a tda8290\n", addr);
kfree(t);
return 0;
if (tda8290_probe(&t->i2c) == 0) {
tuner_dbg("chip at addr %x is a tda8290\n", addr);
} else {
/* Default is being tda9887 */
t->type = TUNER_TDA9887;
t->mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
t->mode = T_STANDBY;
goto register_client;
}
break;
case 0x60:
......@@ -592,6 +602,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
case TUNER_SET_STANDBY:
if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
return 0;
t->mode = T_STANDBY;
if (t->standby)
t->standby (client);
break;
......@@ -604,6 +615,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* Should be implemented, since bttv calls it */
tuner_dbg("VIDIOCSAUDIO not implemented.\n");
break;
case TDA9887_SET_CONFIG:
{
int *i = arg;
t->tda9887_config = *i;
set_freq(client, t->tv_freq);
break;
}
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
......@@ -744,6 +763,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
switch_v4l2();
tuner->type = t->mode;
if (t->get_afc)
tuner->afc=t->get_afc(client);
if (t->mode == V4L2_TUNER_ANALOG_TV)
tuner->capability |= V4L2_TUNER_CAP_NORM;
if (t->mode != V4L2_TUNER_RADIO) {
......@@ -787,7 +808,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
break;
}
case VIDIOC_LOG_STATUS:
tuner_status(client);
if (t->tuner_status)
t->tuner_status(client);
break;
}
......
......@@ -1421,6 +1421,11 @@ struct tunertype tuners[] = {
.params = tuner_samsung_tcpg_6121p30a_params,
.count = ARRAY_SIZE(tuner_samsung_tcpg_6121p30a_params),
},
[TUNER_TDA9887] = { /* Philips TDA 9887 IF PLL Demodulator.
This chip is part of some modern tuners */
.name = "Philips TDA988[5,6,7] IF PLL Demodulator",
/* see tda9887.c for details */
},
};
unsigned const int tuner_count = ARRAY_SIZE(tuners);
......@@ -25,6 +25,8 @@
#include <linux/videodev2.h>
#include <media/tuner-types.h>
extern int tuner_debug;
#define ADDR_UNSET (255)
#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
......@@ -120,6 +122,7 @@
#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 */
/* tv card specific */
#define TDA9887_PRESENT (1<<0)
......@@ -191,6 +194,10 @@ struct tuner {
int using_v4l2;
/* used by tda9887 */
unsigned int tda9887_config;
unsigned char tda9887_data[4];
/* used by MT2032 */
unsigned int xogc;
unsigned int radio_if2;
......@@ -207,6 +214,8 @@ struct tuner {
void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
int (*has_signal)(struct i2c_client *c);
int (*is_stereo)(struct i2c_client *c);
int (*get_afc)(struct i2c_client *c);
void (*tuner_status)(struct i2c_client *c);
void (*standby)(struct i2c_client *c);
};
......@@ -219,6 +228,7 @@ 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 tda9887_tuner_init(struct i2c_client *c);
#define tuner_warn(fmt, arg...) do {\
printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment