Commit 95a2fdb6 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (7458): saa7134: Adds analog support for Avermedia A16D

Thanks to timf <timf@iinet.net.au>, "Richard (MQ)" <osl2008@googlemail.com> and
gian luca rasponi <lucarasp@inwind.it> for their tests.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent cf8267ff
...@@ -5217,6 +5217,13 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev, ...@@ -5217,6 +5217,13 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev,
case XC2028_TUNER_RESET: case XC2028_TUNER_RESET:
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000);
mdelay(250);
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0);
mdelay(250);
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000);
mdelay(250);
saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02); saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02);
saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81); saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81);
saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7); saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7);
...@@ -5413,10 +5420,15 @@ int saa7134_board_init1(struct saa7134_dev *dev) ...@@ -5413,10 +5420,15 @@ int saa7134_board_init1(struct saa7134_dev *dev)
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
case SAA7134_BOARD_AVERMEDIA_M115: case SAA7134_BOARD_AVERMEDIA_M115:
case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
case SAA7134_BOARD_AVERMEDIA_A16D:
/* power-down tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0);
msleep(10);
/* power-up tuner chip */ /* power-up tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
msleep(1); msleep(10);
break; break;
case SAA7134_BOARD_RTD_VFG7350: case SAA7134_BOARD_RTD_VFG7350:
...@@ -5709,9 +5721,14 @@ int saa7134_board_init2(struct saa7134_dev *dev) ...@@ -5709,9 +5721,14 @@ int saa7134_board_init2(struct saa7134_dev *dev)
ctl.fname = XC2028_DEFAULT_FIRMWARE; ctl.fname = XC2028_DEFAULT_FIRMWARE;
ctl.max_len = 64; ctl.max_len = 64;
/* FIXME: This should be device-dependent */ switch (dev->board) {
case SAA7134_BOARD_AVERMEDIA_A16D:
ctl.demod = XC3028_FE_ZARLINK456;
break;
default:
ctl.demod = XC3028_FE_OREN538; ctl.demod = XC3028_FE_OREN538;
ctl.mts = 1; ctl.mts = 1;
}
xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.tuner = TUNER_XC2028;
xc2028_cfg.priv = &ctl; xc2028_cfg.priv = &ctl;
......
...@@ -151,6 +151,26 @@ static int mt352_aver777_init(struct dvb_frontend* fe) ...@@ -151,6 +151,26 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
return 0; return 0;
} }
static int mt352_aver_a16d_init(struct dvb_frontend *fe)
{
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
static u8 reset [] = { RESET, 0x80 };
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
mt352_write(fe, clock_config, sizeof(clock_config));
udelay(200);
mt352_write(fe, reset, sizeof(reset));
mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
mt352_write(fe, agc_cfg, sizeof(agc_cfg));
mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
return 0;
}
static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
struct dvb_frontend_parameters* params) struct dvb_frontend_parameters* params)
{ {
...@@ -193,6 +213,11 @@ static struct mt352_config avermedia_777 = { ...@@ -193,6 +213,11 @@ static struct mt352_config avermedia_777 = {
.demod_init = mt352_aver777_init, .demod_init = mt352_aver777_init,
}; };
static struct mt352_config avermedia_16d = {
.demod_address = 0xf,
.demod_init = mt352_aver_a16d_init,
};
static struct mt352_config avermedia_e506r_mt352_dev = { static struct mt352_config avermedia_e506r_mt352_dev = {
.demod_address = (0x1e >> 1), .demod_address = (0x1e >> 1),
.no_tuner = 1, .no_tuner = 1,
...@@ -935,6 +960,12 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -935,6 +960,12 @@ static int dvb_init(struct saa7134_dev *dev)
TUNER_PHILIPS_TD1316); TUNER_PHILIPS_TD1316);
} }
break; break;
case SAA7134_BOARD_AVERMEDIA_A16D:
dprintk("avertv A16D dvb setup\n");
dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_16d,
&dev->i2c_adap);
attach_xc3028 = 1;
break;
case SAA7134_BOARD_MD7134: case SAA7134_BOARD_MD7134:
dev->dvb.frontend = dvb_attach(tda10046_attach, dev->dvb.frontend = dvb_attach(tda10046_attach,
&medion_cardbus, &medion_cardbus,
...@@ -1205,6 +1236,10 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1205,6 +1236,10 @@ static int dvb_init(struct saa7134_dev *dev)
.i2c_adap = &dev->i2c_adap, .i2c_adap = &dev->i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
}; };
if (!dev->dvb.frontend)
return -1;
fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg);
if (!fe) { if (!fe) {
printk(KERN_ERR "%s/2: xc3028 attach failed\n", printk(KERN_ERR "%s/2: xc3028 attach failed\n",
......
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