From fa5527cd3f428845d7950e6b2bab6babcbcd907b Mon Sep 17 00:00:00 2001 From: Ivan Kalvachev Date: Mon, 19 Mar 2012 20:09:55 -0300 Subject: [media] em28xx: support for 2304:0242 PCTV QuatroStick (510e) It is mostly copy/paste of the 520e code with setting GPIO7 removed (no LED light). I've worked on just released vanilla linux-3.3.0 kernel, so there may be 1/2 lines offset to the internal working source, but most of the code should apply cleanly. I was able to get the DVB-C working (tuned and watched TV). Haven't tested DVB-T (no signal atm). Special thanks to everybody who worked on the code and to Antti Palosaari and Devin Heitmueller who provided essential support on irc. Hardware is based of: Empia EM2884 Micronas DRX 3926K NXP TDA18271HDC2 AVF4910 (not used atm) Signed-off-by: Ivan Kalvachev Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-dvb.c | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'drivers/media/video/em28xx/em28xx-dvb.c') diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index 398d71377930..d8dd971ad644 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c @@ -338,6 +338,13 @@ struct drxk_config pctv_520e_drxk = { .chunk_size = 58, }; +struct drxk_config pctv_520e_drxk = { + .adr = 0x29, + .single_master = 1, + .microcode_name = "dvb-demod-drxk-pctv.fw", + .chunk_size = 58, +}; + static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) { struct em28xx_dvb *dvb = fe->sec_priv; @@ -498,6 +505,33 @@ static void pctv_520e_init(struct em28xx *dev) i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); }; +static void pctv_520e_init(struct em28xx *dev) +{ + /* + * Init TDA8295(?) analog demodulator. Looks like I2C traffic to + * digital demodulator and tuner are routed via TDA8295. + */ + int i; + struct { + unsigned char r[4]; + int len; + } regs[] = { + {{ 0x06, 0x02, 0x00, 0x31 }, 4}, + {{ 0x01, 0x02 }, 2}, + {{ 0x01, 0x02, 0x00, 0xc6 }, 4}, + {{ 0x01, 0x00 }, 2}, + {{ 0x01, 0x00, 0xff, 0xaf }, 4}, + {{ 0x01, 0x00, 0x03, 0xa0 }, 4}, + {{ 0x01, 0x00 }, 2}, + {{ 0x01, 0x00, 0x73, 0xaf }, 4}, + }; + + dev->i2c_client.addr = 0x82 >> 1; /* 0x41 */ + + for (i = 0; i < ARRAY_SIZE(regs); i++) + i2c_master_send(&dev->i2c_client, regs[i].r, regs[i].len); +}; + static int em28xx_mt352_terratec_xs_init(struct dvb_frontend *fe) { /* Values extracted from a USB trace of the Terratec Windows driver */ @@ -1002,6 +1036,25 @@ static int em28xx_dvb_init(struct em28xx *dev) case EM2884_BOARD_PCTV_520E: pctv_520e_init(dev); + /* attach demodulator */ + dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, + &dev->i2c_adap); + + if (dvb->fe[0]) { + /* attach tuner */ + if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, + &dev->i2c_adap, + &em28xx_cxd2820r_tda18271_config)) { + dvb_frontend_detach(dvb->fe[0]); + result = -EINVAL; + goto out_free; + } + } + break; + case EM2884_BOARD_PCTV_510E: + case EM2884_BOARD_PCTV_520E: + pctv_520e_init(dev); + /* attach demodulator */ dvb->fe[0] = dvb_attach(drxk_attach, &pctv_520e_drxk, &dev->i2c_adap); -- cgit v1.2.3