diff options
author | Antti Palosaari <crope@iki.fi> | 2014-08-31 21:57:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 18:39:47 -0400 |
commit | a781edd16c9da9c3cd9ceea36c780895b87417d2 (patch) | |
tree | 6e1be9edac4f3907a960622594c2d7bf0d755655 /drivers/media | |
parent | ee36381ee8cec66ff976ad2c91e85dbee4a02859 (diff) |
[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: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb-frontends/af9033.h | 9 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 29 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.h | 1 |
3 files changed, 19 insertions, 20 deletions
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h index 1b968d0fcb17..6ad22b69a636 100644 --- a/drivers/media/dvb-frontends/af9033.h +++ b/drivers/media/dvb-frontends/af9033.h | |||
@@ -24,13 +24,12 @@ | |||
24 | 24 | ||
25 | #include <linux/kconfig.h> | 25 | #include <linux/kconfig.h> |
26 | 26 | ||
27 | /* | ||
28 | * I2C address (TODO: are these in 8-bit format?) | ||
29 | * 0x38, 0x3a, 0x3c, 0x3e | ||
30 | */ | ||
27 | struct af9033_config { | 31 | struct af9033_config { |
28 | /* | 32 | /* |
29 | * I2C address | ||
30 | */ | ||
31 | u8 i2c_addr; | ||
32 | |||
33 | /* | ||
34 | * clock Hz | 33 | * clock Hz |
35 | * 12000000, 22000000, 24000000, 34000000, 32000000, 28000000, 26000000, | 34 | * 12000000, 22000000, 24000000, 34000000, 32000000, 28000000, 26000000, |
36 | * 30000000, 36000000, 20480000, 16384000 | 35 | * 30000000, 36000000, 20480000, 16384000 |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index ec621338a6ef..b49170754a7c 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -330,15 +330,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
330 | if (msg[0].len > 40 || msg[1].len > 40) { | 330 | if (msg[0].len > 40 || msg[1].len > 40) { |
331 | /* TODO: correct limits > 40 */ | 331 | /* TODO: correct limits > 40 */ |
332 | ret = -EOPNOTSUPP; | 332 | ret = -EOPNOTSUPP; |
333 | } else if ((msg[0].addr == state->af9033_config[0].i2c_addr) || | 333 | } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || |
334 | (msg[0].addr == state->af9033_config[1].i2c_addr) || | 334 | (msg[0].addr == state->af9033_i2c_addr[1]) || |
335 | (state->chip_type == 0x9135)) { | 335 | (state->chip_type == 0x9135)) { |
336 | /* demod access via firmware interface */ | 336 | /* demod access via firmware interface */ |
337 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | | 337 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | |
338 | msg[0].buf[2]; | 338 | msg[0].buf[2]; |
339 | 339 | ||
340 | if (msg[0].addr == state->af9033_config[1].i2c_addr || | 340 | if (msg[0].addr == state->af9033_i2c_addr[1] || |
341 | msg[0].addr == (state->af9033_config[1].i2c_addr >> 1)) | 341 | msg[0].addr == (state->af9033_i2c_addr[1] >> 1)) |
342 | reg |= 0x100000; | 342 | reg |= 0x100000; |
343 | 343 | ||
344 | ret = af9035_rd_regs(d, reg, &msg[1].buf[0], | 344 | 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 | if (msg[0].len > 40) { | 362 | if (msg[0].len > 40) { |
363 | /* TODO: correct limits > 40 */ | 363 | /* TODO: correct limits > 40 */ |
364 | ret = -EOPNOTSUPP; | 364 | ret = -EOPNOTSUPP; |
365 | } else if ((msg[0].addr == state->af9033_config[0].i2c_addr) || | 365 | } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || |
366 | (msg[0].addr == state->af9033_config[1].i2c_addr) || | 366 | (msg[0].addr == state->af9033_i2c_addr[1]) || |
367 | (state->chip_type == 0x9135)) { | 367 | (state->chip_type == 0x9135)) { |
368 | /* demod access via firmware interface */ | 368 | /* demod access via firmware interface */ |
369 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | | 369 | u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | |
370 | msg[0].buf[2]; | 370 | msg[0].buf[2]; |
371 | 371 | ||
372 | if (msg[0].addr == state->af9033_config[1].i2c_addr || | 372 | if (msg[0].addr == state->af9033_i2c_addr[1] || |
373 | msg[0].addr == (state->af9033_config[1].i2c_addr >> 1)) | 373 | msg[0].addr == (state->af9033_i2c_addr[1] >> 1)) |
374 | reg |= 0x100000; | 374 | reg |= 0x100000; |
375 | 375 | ||
376 | ret = af9035_wr_regs(d, reg, &msg[0].buf[3], | 376 | 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 | u16 tmp16, addr; | 736 | u16 tmp16, addr; |
737 | 737 | ||
738 | /* demod I2C "address" */ | 738 | /* demod I2C "address" */ |
739 | state->af9033_config[0].i2c_addr = 0x38; | 739 | state->af9033_i2c_addr[0] = 0x38; |
740 | state->af9033_config[1].i2c_addr = 0x3a; | 740 | state->af9033_i2c_addr[1] = 0x3a; |
741 | state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; | 741 | state->af9033_config[0].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; |
742 | state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; | 742 | state->af9033_config[1].adc_multiplier = AF9033_ADC_MULTIPLIER_2X; |
743 | state->af9033_config[0].ts_mode = AF9033_TS_MODE_USB; | 743 | 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 | goto err; | 789 | goto err; |
790 | 790 | ||
791 | if (tmp) | 791 | if (tmp) |
792 | state->af9033_config[1].i2c_addr = tmp; | 792 | state->af9033_i2c_addr[1] = tmp; |
793 | 793 | ||
794 | dev_dbg(&d->udev->dev, "%s: 2nd demod I2C addr=%02x\n", | 794 | dev_dbg(&d->udev->dev, "%s: 2nd demod I2C addr=%02x\n", |
795 | __func__, tmp); | 795 | __func__, tmp); |
@@ -1092,8 +1092,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap) | |||
1092 | 1092 | ||
1093 | state->af9033_config[adap->id].fe = &adap->fe[0]; | 1093 | state->af9033_config[adap->id].fe = &adap->fe[0]; |
1094 | state->af9033_config[adap->id].ops = &state->ops; | 1094 | state->af9033_config[adap->id].ops = &state->ops; |
1095 | ret = af9035_add_i2c_dev(d, "af9033", | 1095 | ret = af9035_add_i2c_dev(d, "af9033", state->af9033_i2c_addr[adap->id], |
1096 | state->af9033_config[adap->id].i2c_addr, | ||
1097 | &state->af9033_config[adap->id]); | 1096 | &state->af9033_config[adap->id]); |
1098 | if (ret) | 1097 | if (ret) |
1099 | goto err; | 1098 | goto err; |
@@ -1348,7 +1347,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) | |||
1348 | } | 1347 | } |
1349 | 1348 | ||
1350 | ret = af9035_add_i2c_dev(d, "it913x", | 1349 | ret = af9035_add_i2c_dev(d, "it913x", |
1351 | state->af9033_config[adap->id].i2c_addr >> 1, | 1350 | state->af9033_i2c_addr[adap->id] >> 1, |
1352 | &it913x_config); | 1351 | &it913x_config); |
1353 | if (ret) | 1352 | if (ret) |
1354 | goto err; | 1353 | goto err; |
@@ -1373,7 +1372,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap) | |||
1373 | } | 1372 | } |
1374 | 1373 | ||
1375 | ret = af9035_add_i2c_dev(d, "it913x", | 1374 | ret = af9035_add_i2c_dev(d, "it913x", |
1376 | state->af9033_config[adap->id].i2c_addr >> 1, | 1375 | state->af9033_i2c_addr[adap->id] >> 1, |
1377 | &it913x_config); | 1376 | &it913x_config); |
1378 | if (ret) | 1377 | if (ret) |
1379 | goto err; | 1378 | goto err; |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h index 21960773df05..edb3871c50ea 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.h +++ b/drivers/media/usb/dvb-usb-v2/af9035.h | |||
@@ -61,6 +61,7 @@ struct state { | |||
61 | u16 chip_type; | 61 | u16 chip_type; |
62 | u8 dual_mode:1; | 62 | u8 dual_mode:1; |
63 | u16 eeprom_addr; | 63 | u16 eeprom_addr; |
64 | u8 af9033_i2c_addr[2]; | ||
64 | struct af9033_config af9033_config[2]; | 65 | struct af9033_config af9033_config[2]; |
65 | struct af9033_ops ops; | 66 | struct af9033_ops ops; |
66 | #define AF9035_I2C_CLIENT_MAX 4 | 67 | #define AF9035_I2C_CLIENT_MAX 4 |