aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dibusb-common.c
diff options
context:
space:
mode:
authorOlivier DANET <odanet@caramail.com>2006-08-08 14:48:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-09-26 10:53:41 -0400
commita16bf5d5603184dc1db88f37051881b2eeacfd17 (patch)
treedbb50cc4d2e8ec9d7e57853e391181735b2ae809 /drivers/media/dvb/dvb-usb/dibusb-common.c
parent47922e9c3f583adf05a23842ff98f3b0bf7eec6d (diff)
V4L/DVB: Adding support for MT2060 and thus for some DVB-USB-devices based on it
- MT2060 tuner driver - Added support for some USB DVB-T devices based on Dib3000P Signed-off-by: Olivier DANET <odanet@caramail.com> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dibusb-common.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c68
1 files changed, 61 insertions, 7 deletions
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index abd75b4a350d..4d3d0d3dab95 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -168,15 +168,63 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)
168} 168}
169EXPORT_SYMBOL(dibusb_read_eeprom_byte); 169EXPORT_SYMBOL(dibusb_read_eeprom_byte);
170 170
171static struct mt2060_config default_mt2060_config = {
172 .i2c_address = 0x60,
173};
174
175static int dibusb_tuner_init(struct dvb_frontend *fe)
176{
177 int ret;
178 struct dvb_usb_device *d = fe->dvb->priv;
179 struct dibusb_state *st = d->priv;
180
181 if (d->tuner_pass_ctrl) {
182 if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) { // Microtune MT2060
183 d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address);
184 ret=mt2060_init(&st->mt2060);
185 }
186 else { // Panasonic whatever
187 d->tuner_pass_ctrl(d->fe,1,d->pll_addr);
188 ret=dvb_usb_pll_init_i2c(fe);
189 }
190 d->tuner_pass_ctrl(d->fe,0,0);
191 return ret;
192 }
193 return -ENODEV;
194}
195
196static int dibusb_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
197{
198 int ret;
199 struct dvb_usb_device *d = fe->dvb->priv;
200 struct dibusb_state *st = d->priv;
201
202 if (d->tuner_pass_ctrl) {
203 if ((int)d->fe->misc_priv==DIBUSB_TUNER_MT2060) {
204 d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address);
205 ret=mt2060_set(&st->mt2060,fep);
206 }
207 else {
208 d->tuner_pass_ctrl(d->fe,1,d->pll_addr);
209 ret=dvb_usb_pll_set_i2c(fe,fep);
210 }
211 d->tuner_pass_ctrl(d->fe,0,0);
212 return ret;
213 }
214 return -ENODEV;
215}
216
171int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) 217int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d)
172{ 218{
173 struct dib3000_config demod_cfg; 219 struct dib3000_config demod_cfg;
174 struct dibusb_state *st = d->priv; 220 struct dibusb_state *st = d->priv;
175 221
222 demod_cfg.pll_set = dibusb_tuner_set;
223 demod_cfg.pll_init = dibusb_tuner_init;
224
176 for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) 225 for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++)
177 if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { 226 if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) {
178 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; 227 d->fe->misc_priv=(void *)DIBUSB_TUNER_DEFAULT;
179 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
180 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; 228 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
181 return 0; 229 return 0;
182 } 230 }
@@ -187,13 +235,19 @@ EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
187 235
188int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) 236int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
189{ 237{
238 int ret;
190 d->pll_addr = 0x60; 239 d->pll_addr = 0x60;
191 d->pll_desc = &dvb_pll_env57h1xd5; 240 d->pll_desc = &dvb_pll_env57h1xd5;
192 241 if (d->tuner_pass_ctrl) {
193 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; 242 struct dibusb_state *st = d->priv;
194 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; 243 d->tuner_pass_ctrl(d->fe,1,default_mt2060_config.i2c_address);
195 244 if ((ret = mt2060_attach(&st->mt2060,&default_mt2060_config, &d->i2c_adap)) == 0) {
196 return 0; 245 d->fe->misc_priv=(void *)DIBUSB_TUNER_MT2060;
246 }
247 d->tuner_pass_ctrl(d->fe,0,0);
248 return 0;
249 }
250 return -ENODEV;
197} 251}
198EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); 252EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
199 253