aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dibusb-mb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dibusb-mb.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mb.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c
index 7a6ae8f482e0..043cadae0859 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -14,6 +14,14 @@
14 */ 14 */
15#include "dibusb.h" 15#include "dibusb.h"
16 16
17static int dib3000mb_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
18{
19 struct dvb_usb_adapter *adap = fe->dvb->priv;
20 struct dibusb_state *st = adap->priv;
21
22 return st->ops.tuner_pass_ctrl(fe, enable, st->tuner_addr);
23}
24
17static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap) 25static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap)
18{ 26{
19 struct dib3000_config demod_cfg; 27 struct dib3000_config demod_cfg;
@@ -21,21 +29,34 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap)
21 29
22 demod_cfg.demod_address = 0x8; 30 demod_cfg.demod_address = 0x8;
23 31
24 if ((adap->fe = dib3000mb_attach(&demod_cfg,&adap->dev->i2c_adap,&st->ops)) == NULL) 32 if ((adap->fe = dvb_attach(dib3000mb_attach, &demod_cfg,
33 &adap->dev->i2c_adap, &st->ops)) == NULL)
25 return -ENODEV; 34 return -ENODEV;
26 35
27 adap->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; 36 adap->fe->ops.i2c_gate_ctrl = dib3000mb_i2c_gate_ctrl;
28 adap->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
29
30 adap->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
31 37
32 return 0; 38 return 0;
33} 39}
34 40
35static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap) 41static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap)
36{ 42{
37 adap->pll_addr = 0x61; 43 struct dibusb_state *st = adap->priv;
38 adap->pll_desc = &dvb_pll_tua6010xs; 44
45 st->tuner_addr = 0x61;
46
47 dvb_attach(dvb_pll_attach, adap->fe, 0x61, &adap->dev->i2c_adap,
48 DVB_PLL_TUA6010XS);
49 return 0;
50}
51
52static int dibusb_panasonic_tuner_attach(struct dvb_usb_adapter *adap)
53{
54 struct dibusb_state *st = adap->priv;
55
56 st->tuner_addr = 0x60;
57
58 dvb_attach(dvb_pll_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
59 DVB_PLL_TDA665X);
39 return 0; 60 return 0;
40} 61}
41 62
@@ -50,30 +71,28 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap)
50 { .flags = 0, .buf = b, .len = 2 }, 71 { .flags = 0, .buf = b, .len = 2 },
51 { .flags = I2C_M_RD, .buf = b2, .len = 1 }, 72 { .flags = I2C_M_RD, .buf = b2, .len = 1 },
52 }; 73 };
74 struct dibusb_state *st = adap->priv;
53 75
54 /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */ 76 /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */
55 msg[0].addr = msg[1].addr = 0x60; 77 msg[0].addr = msg[1].addr = st->tuner_addr = 0x60;
56 78
57 if (adap->tuner_pass_ctrl) 79 if (adap->fe->ops.i2c_gate_ctrl)
58 adap->tuner_pass_ctrl(adap->fe,1,msg[0].addr); 80 adap->fe->ops.i2c_gate_ctrl(adap->fe,1);
59 81
60 if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) { 82 if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) {
61 err("tuner i2c write failed."); 83 err("tuner i2c write failed.");
62 ret = -EREMOTEIO; 84 ret = -EREMOTEIO;
63 } 85 }
64 86
65 if (adap->tuner_pass_ctrl) 87 if (adap->fe->ops.i2c_gate_ctrl)
66 adap->tuner_pass_ctrl(adap->fe,0,msg[0].addr); 88 adap->fe->ops.i2c_gate_ctrl(adap->fe,0);
67 89
68 if (b2[0] == 0xfe) { 90 if (b2[0] == 0xfe) {
69 info("This device has the Thomson Cable onboard. Which is default."); 91 info("This device has the Thomson Cable onboard. Which is default.");
70 dibusb_thomson_tuner_attach(adap); 92 ret = dibusb_thomson_tuner_attach(adap);
71 } else { 93 } else {
72 u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab };
73 info("This device has the Panasonic ENV77H11D5 onboard."); 94 info("This device has the Panasonic ENV77H11D5 onboard.");
74 adap->pll_addr = 0x60; 95 ret = dibusb_panasonic_tuner_attach(adap);
75 memcpy(adap->pll_init,bpll,4);
76 adap->pll_desc = &dvb_pll_tda665x;
77 } 96 }
78 97
79 return ret; 98 return ret;