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

[media] af9035: use already detected eeprom base addr

eeprom memory mapped base address is detected at the very first.
Use it everywhere.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8229da50
...@@ -606,18 +606,14 @@ static int af9035_read_config(struct dvb_usb_device *d) ...@@ -606,18 +606,14 @@ static int af9035_read_config(struct dvb_usb_device *d)
if (ret < 0) if (ret < 0)
goto err; goto err;
if (tmp) { if (tmp == 0x00) {
addr = EEPROM_BASE_IT9135;
} else {
dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__); dev_dbg(&d->udev->dev, "%s: no eeprom\n", __func__);
goto skip_eeprom; goto skip_eeprom;
} }
} else {
addr = EEPROM_BASE_AF9035;
} }
/* check if there is dual tuners */ /* check if there is dual tuners */
ret = af9035_rd_reg(d, addr + EEPROM_DUAL_MODE, &tmp); ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_DUAL_MODE, &tmp);
if (ret < 0) if (ret < 0)
goto err; goto err;
...@@ -627,7 +623,9 @@ static int af9035_read_config(struct dvb_usb_device *d) ...@@ -627,7 +623,9 @@ static int af9035_read_config(struct dvb_usb_device *d)
if (state->dual_mode) { if (state->dual_mode) {
/* read 2nd demodulator I2C address */ /* read 2nd demodulator I2C address */
ret = af9035_rd_reg(d, addr + EEPROM_2ND_DEMOD_ADDR, &tmp); ret = af9035_rd_reg(d,
state->eeprom_addr + EEPROM_2ND_DEMOD_ADDR,
&tmp);
if (ret < 0) if (ret < 0)
goto err; goto err;
...@@ -636,6 +634,8 @@ static int af9035_read_config(struct dvb_usb_device *d) ...@@ -636,6 +634,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
__func__, tmp); __func__, tmp);
} }
addr = state->eeprom_addr;
for (i = 0; i < state->dual_mode + 1; i++) { for (i = 0; i < state->dual_mode + 1; i++) {
/* tuner */ /* tuner */
ret = af9035_rd_reg(d, addr + EEPROM_1_TUNER_ID, &tmp); ret = af9035_rd_reg(d, addr + EEPROM_1_TUNER_ID, &tmp);
...@@ -1258,7 +1258,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) ...@@ -1258,7 +1258,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
if (state->chip_type == 0x9135) if (state->chip_type == 0x9135)
return 0; return 0;
ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_MODE, &tmp); ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_MODE, &tmp);
if (ret < 0) if (ret < 0)
goto err; goto err;
...@@ -1266,7 +1266,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) ...@@ -1266,7 +1266,7 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
/* don't activate rc if in HID mode or if not available */ /* don't activate rc if in HID mode or if not available */
if (tmp == 5) { if (tmp == 5) {
ret = af9035_rd_reg(d, EEPROM_BASE_AF9035 + EEPROM_IR_TYPE, ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_IR_TYPE,
&tmp); &tmp);
if (ret < 0) if (ret < 0)
goto err; goto err;
......
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