Commit 6e501a3f authored by Tim Farrington's avatar Tim Farrington Committed by Mauro Carvalho Chehab

V4L/DVB (8048): saa7134: Fix entries for Avermedia A16d and Avermedia E506

Also, adds IR table for Avermedia A16d
Signed-off-by: default avatarTim Farrington <timf@iinet.net.au>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 74d50724
...@@ -2201,3 +2201,41 @@ IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE] = { ...@@ -2201,3 +2201,41 @@ IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE] = {
[0x25] = KEY_POWER, /* power */ [0x25] = KEY_POWER, /* power */
}; };
EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel); EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel);
IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE] = {
[0x20] = KEY_LIST,
[0x00] = KEY_POWER,
[0x28] = KEY_1,
[0x18] = KEY_2,
[0x38] = KEY_3,
[0x24] = KEY_4,
[0x14] = KEY_5,
[0x34] = KEY_6,
[0x2c] = KEY_7,
[0x1c] = KEY_8,
[0x3c] = KEY_9,
[0x12] = KEY_SUBTITLE,
[0x22] = KEY_0,
[0x32] = KEY_REWIND,
[0x3a] = KEY_SHUFFLE,
[0x02] = KEY_PRINT,
[0x11] = KEY_CHANNELDOWN,
[0x31] = KEY_CHANNELUP,
[0x0c] = KEY_ZOOM,
[0x1e] = KEY_VOLUMEDOWN,
[0x3e] = KEY_VOLUMEUP,
[0x0a] = KEY_MUTE,
[0x04] = KEY_AUDIO,
[0x26] = KEY_RECORD,
[0x06] = KEY_PLAY,
[0x36] = KEY_STOP,
[0x16] = KEY_PAUSE,
[0x2e] = KEY_REWIND,
[0x0e] = KEY_FASTFORWARD,
[0x30] = KEY_TEXT,
[0x21] = KEY_GREEN,
[0x01] = KEY_BLUE,
[0x08] = KEY_EPG,
[0x2a] = KEY_MENU,
};
EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d);
...@@ -4114,11 +4114,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -4114,11 +4114,7 @@ struct saa7134_board saa7134_boards[] = {
.radio_type = UNSET, .radio_type = UNSET,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
/*
TODO:
.mpeg = SAA7134_MPEG_DVB, .mpeg = SAA7134_MPEG_DVB,
*/
.inputs = {{ .inputs = {{
.name = name_tv, .name = name_tv,
.vmux = 1, .vmux = 1,
...@@ -4157,7 +4153,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -4157,7 +4153,7 @@ struct saa7134_board saa7134_boards[] = {
} }, } },
.radio = { .radio = {
.name = name_radio, .name = name_radio,
.amux = LINE1, .amux = TV,
}, },
}, },
[SAA7134_BOARD_AVERMEDIA_M115] = { [SAA7134_BOARD_AVERMEDIA_M115] = {
...@@ -4167,6 +4163,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -4167,6 +4163,7 @@ struct saa7134_board saa7134_boards[] = {
.radio_type = UNSET, .radio_type = UNSET,
.tuner_addr = ADDR_UNSET, .tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET,
.mpeg = SAA7134_MPEG_DVB,
.inputs = {{ .inputs = {{
.name = name_tv, .name = name_tv,
.vmux = 1, .vmux = 1,
...@@ -5351,22 +5348,21 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev, ...@@ -5351,22 +5348,21 @@ static int saa7134_xc2028_callback(struct saa7134_dev *dev,
{ {
switch (command) { switch (command) {
case XC2028_TUNER_RESET: case XC2028_TUNER_RESET:
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00000000);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
mdelay(250); switch (dev->board) {
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0); case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0); saa7134_set_gpio(dev, 23, 0);
mdelay(250); msleep(10);
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x06e20000, 0x06e20000); saa7134_set_gpio(dev, 23, 1);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x06a20000, 0x06a20000); break;
mdelay(250); case SAA7134_BOARD_AVERMEDIA_A16D:
saa_andorl(SAA7133_ANALOG_IO_SELECT >> 2, 0x02, 0x02); saa7134_set_gpio(dev, 21, 0);
saa_andorl(SAA7134_ANALOG_IN_CTRL1 >> 2, 0x81, 0x81); msleep(10);
saa_andorl(SAA7134_AUDIO_CLOCK0 >> 2, 0x03187de7, 0x03187de7); saa7134_set_gpio(dev, 21, 1);
saa_andorl(SAA7134_AUDIO_PLL_CTRL >> 2, 0x03, 0x03); break;
saa_andorl(SAA7134_AUDIO_CLOCKS_PER_FIELD0 >> 2, }
0x0001e000, 0x0001e000); return 0;
return 0;
} }
return -EINVAL; return -EINVAL;
} }
...@@ -5553,9 +5549,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) ...@@ -5553,9 +5549,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x08000000, 0x00000000);
break; break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS: case SAA7134_BOARD_AVERMEDIA_CARDBUS:
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
case SAA7134_BOARD_AVERMEDIA_M115: case SAA7134_BOARD_AVERMEDIA_M115:
case SAA7134_BOARD_AVERMEDIA_A16D:
/* power-down tuner chip */ /* power-down tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0); saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0);
...@@ -5565,6 +5559,18 @@ int saa7134_board_init1(struct saa7134_dev *dev) ...@@ -5565,6 +5559,18 @@ int saa7134_board_init1(struct saa7134_dev *dev)
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff); saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
msleep(10); msleep(10);
break; break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
saa7134_set_gpio(dev, 23, 0);
msleep(10);
saa7134_set_gpio(dev, 23, 1);
break;
case SAA7134_BOARD_AVERMEDIA_A16D:
saa7134_set_gpio(dev, 21, 0);
msleep(10);
saa7134_set_gpio(dev, 21, 1);
msleep(1);
dev->has_remote = SAA7134_REMOTE_GPIO;
break;
case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
/* power-down tuner chip */ /* power-down tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004); saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x000A8004, 0x000A8004);
...@@ -5676,6 +5682,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev) ...@@ -5676,6 +5682,7 @@ static void saa7134_tuner_setup(struct saa7134_dev *dev)
switch (dev->board) { switch (dev->board) {
case SAA7134_BOARD_AVERMEDIA_A16D: case SAA7134_BOARD_AVERMEDIA_A16D:
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
ctl.demod = XC3028_FE_ZARLINK456; ctl.demod = XC3028_FE_ZARLINK456;
break; break;
default: default:
......
...@@ -153,12 +153,12 @@ static int mt352_aver777_init(struct dvb_frontend* fe) ...@@ -153,12 +153,12 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
return 0; return 0;
} }
static int mt352_aver_a16d_init(struct dvb_frontend *fe) static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe)
{ {
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
static u8 reset [] = { RESET, 0x80 }; static u8 reset [] = { RESET, 0x80 };
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; static u8 agc_cfg [] = { AGC_TARGET, 0xe };
static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
mt352_write(fe, clock_config, sizeof(clock_config)); mt352_write(fe, clock_config, sizeof(clock_config));
...@@ -167,12 +167,9 @@ static int mt352_aver_a16d_init(struct dvb_frontend *fe) ...@@ -167,12 +167,9 @@ static int mt352_aver_a16d_init(struct dvb_frontend *fe)
mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
mt352_write(fe, agc_cfg, sizeof(agc_cfg)); mt352_write(fe, agc_cfg, sizeof(agc_cfg));
mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
return 0; 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)
{ {
...@@ -215,14 +212,10 @@ static struct mt352_config avermedia_777 = { ...@@ -215,14 +212,10 @@ static struct mt352_config avermedia_777 = {
.demod_init = mt352_aver777_init, .demod_init = mt352_aver777_init,
}; };
static struct mt352_config avermedia_16d = { static struct mt352_config avermedia_xc3028_mt352_dev = {
.demod_address = 0xf,
.demod_init = mt352_aver_a16d_init,
};
static struct mt352_config avermedia_e506r_mt352_dev = {
.demod_address = (0x1e >> 1), .demod_address = (0x1e >> 1),
.no_tuner = 1, .no_tuner = 1,
.demod_init = mt352_avermedia_xc3028_init,
}; };
/* ================================================================== /* ==================================================================
...@@ -975,9 +968,10 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -975,9 +968,10 @@ static int dvb_init(struct saa7134_dev *dev)
} }
break; break;
case SAA7134_BOARD_AVERMEDIA_A16D: case SAA7134_BOARD_AVERMEDIA_A16D:
dprintk("avertv A16D dvb setup\n"); dprintk("AverMedia A16D dvb setup\n");
dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_16d, dev->dvb.frontend = dvb_attach(mt352_attach,
&dev->i2c_adap); &avermedia_xc3028_mt352_dev,
&dev->i2c_adap);
attach_xc3028 = 1; attach_xc3028 = 1;
break; break;
case SAA7134_BOARD_MD7134: case SAA7134_BOARD_MD7134:
...@@ -1261,11 +1255,14 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1261,11 +1255,14 @@ static int dvb_init(struct saa7134_dev *dev)
goto dettach_frontend; goto dettach_frontend;
break; break;
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
dprintk("AverMedia E506R dvb setup\n");
saa7134_set_gpio(dev, 25, 0);
msleep(10);
saa7134_set_gpio(dev, 25, 1);
dev->dvb.frontend = dvb_attach(mt352_attach, dev->dvb.frontend = dvb_attach(mt352_attach,
&avermedia_e506r_mt352_dev, &avermedia_xc3028_mt352_dev,
&dev->i2c_adap); &dev->i2c_adap);
attach_xc3028 = 1; attach_xc3028 = 1;
break;
case SAA7134_BOARD_MD7134_BRIDGE_2: case SAA7134_BOARD_MD7134_BRIDGE_2:
dev->dvb.frontend = dvb_attach(tda10086_attach, dev->dvb.frontend = dvb_attach(tda10086_attach,
&sd1878_4m, &dev->i2c_adap); &sd1878_4m, &dev->i2c_adap);
......
...@@ -323,6 +323,15 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -323,6 +323,15 @@ int saa7134_input_init1(struct saa7134_dev *dev)
saa_setb(SAA7134_GPIO_GPMODE1, 0x1); saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
break; break;
case SAA7134_BOARD_AVERMEDIA_A16D:
ir_codes = ir_codes_avermedia_a16d;
mask_keycode = 0x02F200;
mask_keydown = 0x000400;
polling = 50; /* ms */
/* Without this we won't receive key up events */
saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
break;
case SAA7134_BOARD_KWORLD_TERMINATOR: case SAA7134_BOARD_KWORLD_TERMINATOR:
ir_codes = ir_codes_pixelview; ir_codes = ir_codes_pixelview;
mask_keycode = 0x00001f; mask_keycode = 0x00001f;
......
...@@ -146,6 +146,7 @@ extern IR_KEYTAB_TYPE ir_codes_behold_columbus[IR_KEYTAB_SIZE]; ...@@ -146,6 +146,7 @@ extern IR_KEYTAB_TYPE ir_codes_behold_columbus[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE];
#endif #endif
......
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