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

[media] af9015: use correct 7-bit i2c addresses

Driver was using wrong "8-bit" i2c addresses for demods and tuners.
Internal demod i2c address was not set at all. These are needed
to be fixed before proper i2c client binding is used.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 88c0530f
...@@ -36,7 +36,7 @@ static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req) ...@@ -36,7 +36,7 @@ static int af9015_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
state->buf[0] = req->cmd; state->buf[0] = req->cmd;
state->buf[1] = state->seq++; state->buf[1] = state->seq++;
state->buf[2] = req->i2c_addr; state->buf[2] = req->i2c_addr << 1;
state->buf[3] = req->addr >> 8; state->buf[3] = req->addr >> 8;
state->buf[4] = req->addr & 0xff; state->buf[4] = req->addr & 0xff;
state->buf[5] = req->mbox; state->buf[5] = req->mbox;
...@@ -472,6 +472,8 @@ static int af9015_read_config(struct dvb_usb_device *d) ...@@ -472,6 +472,8 @@ static int af9015_read_config(struct dvb_usb_device *d)
if (d->udev->speed == USB_SPEED_FULL) if (d->udev->speed == USB_SPEED_FULL)
state->dual_mode = 0; state->dual_mode = 0;
state->af9013_config[0].i2c_addr = AF9015_I2C_DEMOD;
if (state->dual_mode) { if (state->dual_mode) {
/* read 2nd demodulator I2C address */ /* read 2nd demodulator I2C address */
req.addr = AF9015_EEPROM_DEMOD2_I2C; req.addr = AF9015_EEPROM_DEMOD2_I2C;
...@@ -479,7 +481,7 @@ static int af9015_read_config(struct dvb_usb_device *d) ...@@ -479,7 +481,7 @@ static int af9015_read_config(struct dvb_usb_device *d)
if (ret) if (ret)
goto error; goto error;
state->af9013_config[1].i2c_addr = val; state->af9013_config[1].i2c_addr = val >> 1;
} }
for (i = 0; i < state->dual_mode + 1; i++) { for (i = 0; i < state->dual_mode + 1; i++) {
...@@ -871,12 +873,12 @@ static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -871,12 +873,12 @@ static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap)
} }
static struct mt2060_config af9015_mt2060_config = { static struct mt2060_config af9015_mt2060_config = {
.i2c_address = 0xc0, .i2c_address = 0x60,
.clock_out = 0, .clock_out = 0,
}; };
static struct qt1010_config af9015_qt1010_config = { static struct qt1010_config af9015_qt1010_config = {
.i2c_address = 0xc4, .i2c_address = 0x62,
}; };
static struct tda18271_config af9015_tda18271_config = { static struct tda18271_config af9015_tda18271_config = {
...@@ -885,7 +887,7 @@ static struct tda18271_config af9015_tda18271_config = { ...@@ -885,7 +887,7 @@ static struct tda18271_config af9015_tda18271_config = {
}; };
static struct mxl5005s_config af9015_mxl5003_config = { static struct mxl5005s_config af9015_mxl5003_config = {
.i2c_address = 0xc6, .i2c_address = 0x63,
.if_freq = IF_FREQ_4570000HZ, .if_freq = IF_FREQ_4570000HZ,
.xtal_freq = CRYSTAL_FREQ_16000000HZ, .xtal_freq = CRYSTAL_FREQ_16000000HZ,
.agc_mode = MXL_SINGLE_AGC, .agc_mode = MXL_SINGLE_AGC,
...@@ -902,7 +904,7 @@ static struct mxl5005s_config af9015_mxl5003_config = { ...@@ -902,7 +904,7 @@ static struct mxl5005s_config af9015_mxl5003_config = {
}; };
static struct mxl5005s_config af9015_mxl5005_config = { static struct mxl5005s_config af9015_mxl5005_config = {
.i2c_address = 0xc6, .i2c_address = 0x63,
.if_freq = IF_FREQ_4570000HZ, .if_freq = IF_FREQ_4570000HZ,
.xtal_freq = CRYSTAL_FREQ_16000000HZ, .xtal_freq = CRYSTAL_FREQ_16000000HZ,
.agc_mode = MXL_SINGLE_AGC, .agc_mode = MXL_SINGLE_AGC,
...@@ -919,12 +921,12 @@ static struct mxl5005s_config af9015_mxl5005_config = { ...@@ -919,12 +921,12 @@ static struct mxl5005s_config af9015_mxl5005_config = {
}; };
static struct mc44s803_config af9015_mc44s803_config = { static struct mc44s803_config af9015_mc44s803_config = {
.i2c_address = 0xc0, .i2c_address = 0x60,
.dig_out = 1, .dig_out = 1,
}; };
static struct tda18218_config af9015_tda18218_config = { static struct tda18218_config af9015_tda18218_config = {
.i2c_address = 0xc0, .i2c_address = 0x60,
.i2c_wr_max = 21, /* max wr bytes AF9015 I2C adap can handle at once */ .i2c_wr_max = 21, /* max wr bytes AF9015 I2C adap can handle at once */
}; };
...@@ -955,7 +957,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -955,7 +957,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
&af9015_qt1010_config) == NULL ? -ENODEV : 0; &af9015_qt1010_config) == NULL ? -ENODEV : 0;
break; break;
case AF9013_TUNER_TDA18271: case AF9013_TUNER_TDA18271:
ret = dvb_attach(tda18271_attach, adap->fe[0], 0xc0, ret = dvb_attach(tda18271_attach, adap->fe[0], 0x60,
&adap_to_d(adap)->i2c_adap, &adap_to_d(adap)->i2c_adap,
&af9015_tda18271_config) == NULL ? -ENODEV : 0; &af9015_tda18271_config) == NULL ? -ENODEV : 0;
break; break;
...@@ -976,7 +978,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -976,7 +978,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
&af9015_mxl5005_config) == NULL ? -ENODEV : 0; &af9015_mxl5005_config) == NULL ? -ENODEV : 0;
break; break;
case AF9013_TUNER_ENV77H11D5: case AF9013_TUNER_ENV77H11D5:
ret = dvb_attach(dvb_pll_attach, adap->fe[0], 0xc0, ret = dvb_attach(dvb_pll_attach, adap->fe[0], 0x60,
&adap_to_d(adap)->i2c_adap, &adap_to_d(adap)->i2c_adap,
DVB_PLL_TDA665X) == NULL ? -ENODEV : 0; DVB_PLL_TDA665X) == NULL ? -ENODEV : 0;
break; break;
...@@ -988,7 +990,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -988,7 +990,7 @@ static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
case AF9013_TUNER_MXL5007T: case AF9013_TUNER_MXL5007T:
ret = dvb_attach(mxl5007t_attach, adap->fe[0], ret = dvb_attach(mxl5007t_attach, adap->fe[0],
&adap_to_d(adap)->i2c_adap, &adap_to_d(adap)->i2c_adap,
0xc0, &af9015_mxl5007t_config) == NULL ? -ENODEV : 0; 0x60, &af9015_mxl5007t_config) == NULL ? -ENODEV : 0;
break; break;
case AF9013_TUNER_UNKNOWN: case AF9013_TUNER_UNKNOWN:
default: default:
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
#define TS_USB20_MAX_PACKET_SIZE 512 #define TS_USB20_MAX_PACKET_SIZE 512
#define TS_USB11_MAX_PACKET_SIZE 64 #define TS_USB11_MAX_PACKET_SIZE 64
#define AF9015_I2C_EEPROM 0xa0 #define AF9015_I2C_EEPROM 0x50
#define AF9015_I2C_DEMOD 0x38 #define AF9015_I2C_DEMOD 0x1c
#define AF9015_USB_TIMEOUT 2000 #define AF9015_USB_TIMEOUT 2000
/* EEPROM locations */ /* EEPROM locations */
......
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