aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dvb-usb-i2c.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 6b611a72509..55ba020386c 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -1,6 +1,6 @@
/* dvb-usb-i2c.c is part of the DVB USB library.
*
- * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
+ * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
* see dvb-usb-init.c for copyright information.
*
* This file contains functions for (de-)initializing an I2C adapter.
@@ -48,48 +48,48 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d)
int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe)
{
- struct dvb_usb_device *d = fe->dvb->priv;
- struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 };
+ struct dvb_usb_adapter *adap = fe->dvb->priv;
+ struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = adap->pll_init, .len = 4 };
int ret = 0;
/* if pll_desc is not used */
- if (d->pll_desc == NULL)
+ if (adap->pll_desc == NULL)
return 0;
- if (d->tuner_pass_ctrl)
- d->tuner_pass_ctrl(fe,1,d->pll_addr);
+ if (adap->tuner_pass_ctrl)
+ adap->tuner_pass_ctrl(fe, 1, adap->pll_addr);
- deb_pll("pll init: %x\n",d->pll_addr);
- deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1],
- d->pll_init[2],d->pll_init[3]);
+ deb_pll("pll init: %x\n",adap->pll_addr);
+ deb_pll("pll-buf: %x %x %x %x\n",adap->pll_init[0], adap->pll_init[1],
+ adap->pll_init[2], adap->pll_init[3]);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
+ if (i2c_transfer (&adap->dev->i2c_adap, &msg, 1) != 1) {
err("tuner i2c write failed for pll_init.");
ret = -EREMOTEIO;
}
msleep(1);
- if (d->tuner_pass_ctrl)
- d->tuner_pass_ctrl(fe,0,d->pll_addr);
+ if (adap->tuner_pass_ctrl)
+ adap->tuner_pass_ctrl(fe,0,adap->pll_addr);
return ret;
}
EXPORT_SYMBOL(dvb_usb_tuner_init_i2c);
int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len)
{
- struct dvb_usb_device *d = fe->dvb->priv;
+ struct dvb_usb_adapter *adap = fe->dvb->priv;
if (buf_len != 5)
return -EINVAL;
- if (d->pll_desc == NULL)
+ if (adap->pll_desc == NULL)
return 0;
- deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc);
+ deb_pll("pll addr: %x, freq: %d %p\n",adap->pll_addr, fep->frequency, adap->pll_desc);
- b[0] = d->pll_addr;
- dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth);
+ b[0] = adap->pll_addr;
+ dvb_pll_configure(adap->pll_desc, &b[1], fep->frequency, fep->u.ofdm.bandwidth);
deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]);
@@ -99,26 +99,27 @@ EXPORT_SYMBOL(dvb_usb_tuner_calc_regs);
int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
{
- struct dvb_usb_device *d = fe->dvb->priv;
+ struct dvb_usb_adapter *adap = fe->dvb->priv;
int ret = 0;
u8 b[5];
- struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 };
+ struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = &b[1], .len = 4 };
dvb_usb_tuner_calc_regs(fe,fep,b,5);
- if (d->tuner_pass_ctrl)
- d->tuner_pass_ctrl(fe,1,d->pll_addr);
+ if (adap->tuner_pass_ctrl)
+ adap->tuner_pass_ctrl(fe, 1, adap->pll_addr);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
- if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
+
+ if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
err("tuner i2c write failed for pll_set.");
ret = -EREMOTEIO;
}
msleep(1);
- if (d->tuner_pass_ctrl)
- d->tuner_pass_ctrl(fe,0,d->pll_addr);
+ if (adap->tuner_pass_ctrl)
+ adap->tuner_pass_ctrl(fe, 0, adap->pll_addr);
return ret;
}