Commit a781edd1 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] af9033: remove I2C addr from config

I2C driver address is passed as a i2c_new_device() parameter when
device is created. Thus no need to keep it in config struct.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent ee36381e
...@@ -24,12 +24,11 @@ ...@@ -24,12 +24,11 @@
#include <linux/kconfig.h> #include <linux/kconfig.h>
struct af9033_config { /*
/* * I2C address (TODO: are these in 8-bit format?)
* I2C address * 0x38, 0x3a, 0x3c, 0x3e
*/ */
u8 i2c_addr; struct af9033_config {
/* /*
* clock Hz * clock Hz
* 12000000, 22000000, 24000000, 34000000, 32000000, 28000000, 26000000, * 12000000, 22000000, 24000000, 34000000, 32000000, 28000000, 26000000,
......
...@@ -330,15 +330,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -330,15 +330,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
if (msg[0].len > 40 || msg[1].len > 40) { if (msg[0].len > 40 || msg[1].len > 40) {
/* TODO: correct limits > 40 */ /* TODO: correct limits > 40 */
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
} else if ((msg[0].addr == state->af9033_config[0].i2c_addr) || } else if ((msg[0].addr == state->af9033_i2c_addr[0]) ||
(msg[0].addr == state->af9033_config[1].i2c_addr) || (msg[0].addr == state->af9033_i2c_addr[1]) ||
(state->chip_type == 0x9135)) { (state->chip_type == 0x9135)) {
/* demod access via firmware interface */ /* demod access via firmware interface */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2]; msg[0].buf[2];
if (msg[0].addr == state->af9033_config[1].i2c_addr || if (msg[0].addr == state->af9033_i2c_addr[1] ||
msg[0].addr == (state->af9033_config[1].i2c_addr >> 1)) msg[0].addr == (state->af9033_i2c_addr[1] >> 1))
reg |= 0x100000; reg |= 0x100000;
ret = af9035_rd_regs(d, reg, &msg[1].buf[0], ret = af9035_rd_regs(d, reg, &msg[1].buf[0],
...@@ -362,15 +362,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -362,15 +362,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
if (msg[0].len > 40) { if (msg[0].len > 40) {
/* TODO: correct limits > 40 */ /* TODO: correct limits > 40 */
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
} else if ((msg[0].addr == state->af9033_config[0].i2c_addr) || } else if ((msg[0].addr == state->af9033_i2c_addr[0]) ||
(msg[0].addr == state->af9033_config[1].i2c_addr) || (msg[0].addr == state->af9033_i2c_addr[1]) ||
(state->chip_type == 0x9135)) { (state->chip_type == 0x9135)) {
/* demod access via firmware interface */ /* demod access via firmware interface */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2]; msg[0].buf[2];
if (msg[0].addr == state->af9033_config[1].i2c_addr || if (msg[0].addr == state->af9033_i2c_addr[1] ||
msg[0].addr == (state->af9033_config[1].i2c_addr >> 1)) msg[0].addr == (state->af9033_i2c_addr[1] >> 1))
reg |= 0x100000; reg |= 0x100000;
ret = af9035_wr_regs(d, reg, &msg[0].buf[3], ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
...@@ -736,8 +736,8 @@ static int af9035_read_config(struct dvb_usb_device *d) ...@@ -736,8 +736,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
u16 tmp16, addr; u16 tmp16, addr;
/* demod I2C "address" */ /* demod I2C "address" */
state->af9033_config[0].i2c_addr = 0x38; state->af9033_i2c_addr[0] = 0x38;
state->af9033_config[1].i2c_addr = 0x3a; state->af9033_i2c_addr[1] = 0x3a;
state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X;
state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB; state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB;
...@@ -789,7 +789,7 @@ static int af9035_read_config(struct dvb_usb_device *d) ...@@ -789,7 +789,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
goto err; goto err;
if (tmp) if (tmp)
state->af9033_config[1].i2c_addr = tmp; state->af9033_i2c_addr[1] = tmp;
dev_dbg(&d->udev->dev, "%s: 2nd demod I2C addr=%02x\n", dev_dbg(&d->udev->dev, "%s: 2nd demod I2C addr=%02x\n",
__func__, tmp); __func__, tmp);
...@@ -1092,8 +1092,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -1092,8 +1092,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
state->af9033_config[adap->id].fe = &adap->fe[0]; state->af9033_config[adap->id].fe = &adap->fe[0];
state->af9033_config[adap->id].ops = &state->ops; state->af9033_config[adap->id].ops = &state->ops;
ret = af9035_add_i2c_dev(d, "af9033", ret = af9035_add_i2c_dev(d, "af9033", state->af9033_i2c_addr[adap->id],
state->af9033_config[adap->id].i2c_addr,
&state->af9033_config[adap->id]); &state->af9033_config[adap->id]);
if (ret) if (ret)
goto err; goto err;
...@@ -1348,7 +1347,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1348,7 +1347,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
} }
ret = af9035_add_i2c_dev(d, "it913x", ret = af9035_add_i2c_dev(d, "it913x",
state->af9033_config[adap->id].i2c_addr >> 1, state->af9033_i2c_addr[adap->id] >> 1,
&it913x_config); &it913x_config);
if (ret) if (ret)
goto err; goto err;
...@@ -1373,7 +1372,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1373,7 +1372,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
} }
ret = af9035_add_i2c_dev(d, "it913x", ret = af9035_add_i2c_dev(d, "it913x",
state->af9033_config[adap->id].i2c_addr >> 1, state->af9033_i2c_addr[adap->id] >> 1,
&it913x_config); &it913x_config);
if (ret) if (ret)
goto err; goto err;
......
...@@ -61,6 +61,7 @@ struct state { ...@@ -61,6 +61,7 @@ struct state {
u16 chip_type; u16 chip_type;
u8 dual_mode:1; u8 dual_mode:1;
u16 eeprom_addr; u16 eeprom_addr;
u8 af9033_i2c_addr[2];
struct af9033_config af9033_config[2]; struct af9033_config af9033_config[2];
struct af9033_ops ops; struct af9033_ops ops;
#define AF9035_I2C_CLIENT_MAX 4 #define AF9035_I2C_CLIENT_MAX 4
......
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