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

[media] anysee: I2C gate control DNOD44CDH086A tuner module

DNOD44CDH086A (NXP TDA18212) tuner module is not connected to
demodulator I2C gate. Instead demodulator gate it uses external
GPIO driven gate. Override demodulator I2C gate control with
own in that case.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 608add85
...@@ -478,6 +478,16 @@ static struct cxd2820r_config anysee_cxd2820r_config = { ...@@ -478,6 +478,16 @@ static struct cxd2820r_config anysee_cxd2820r_config = {
* IOE[5] STV0903 1=enabled * IOE[5] STV0903 1=enabled
*/ */
/* external I2C gate used for DNOD44CDH086A(TDA18212) tuner module */
static int anysee_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct dvb_usb_adapter *adap = fe->dvb->priv;
/* enable / disable tuner access on IOE[4] */
return anysee_wr_reg_mask(adap->dev, REG_IOE, (enable << 4), 0x10);
}
static int anysee_frontend_ctrl(struct dvb_frontend *fe, int onoff) static int anysee_frontend_ctrl(struct dvb_frontend *fe, int onoff)
{ {
struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_adapter *adap = fe->dvb->priv;
...@@ -779,6 +789,13 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -779,6 +789,13 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
} }
} }
/* I2C gate for DNOD44CDH086A(TDA18212) tuner module */
if (tmp == 0xc7) {
if (adap->fe_adap[state->fe_id].fe)
adap->fe_adap[state->fe_id].fe->ops.i2c_gate_ctrl =
anysee_i2c_gate_ctrl;
}
break; break;
case ANYSEE_HW_508TC: /* 18 */ case ANYSEE_HW_508TC: /* 18 */
case ANYSEE_HW_508PTC: /* 21 */ case ANYSEE_HW_508PTC: /* 21 */
...@@ -826,6 +843,11 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -826,6 +843,11 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
&adap->dev->i2c_adap); &adap->dev->i2c_adap);
} }
/* I2C gate for DNOD44CDH086A(TDA18212) tuner module */
if (adap->fe_adap[state->fe_id].fe)
adap->fe_adap[state->fe_id].fe->ops.i2c_gate_ctrl =
anysee_i2c_gate_ctrl;
break; break;
case ANYSEE_HW_508S2: /* 19 */ case ANYSEE_HW_508S2: /* 19 */
case ANYSEE_HW_508PS2: /* 22 */ case ANYSEE_HW_508PS2: /* 22 */
...@@ -865,14 +887,14 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap) ...@@ -865,14 +887,14 @@ static int anysee_frontend_attach(struct dvb_usb_adapter *adap)
if (state->fe_id == 0) { if (state->fe_id == 0) {
/* DVB-T/T2 */ /* DVB-T/T2 */
adap->fe[0] = dvb_attach(cxd2820r_attach, adap->fe_adap[state->fe_id].fe = dvb_attach(cxd2820r_attach,
&anysee_cxd2820r_config, &anysee_cxd2820r_config,
&adap->dev->i2c_adap, NULL); &adap->dev->i2c_adap, NULL);
} else { } else {
/* DVB-C */ /* DVB-C */
adap->fe[1] = dvb_attach(cxd2820r_attach, adap->fe_adap[state->fe_id].fe = dvb_attach(cxd2820r_attach,
&anysee_cxd2820r_config, &anysee_cxd2820r_config,
&adap->dev->i2c_adap, adap->fe[0]); &adap->dev->i2c_adap, adap->fe_adap[0].fe);
} }
break; break;
...@@ -935,22 +957,12 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -935,22 +957,12 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
/* Try first attach TDA18212 silicon tuner on IOE[4], if that /* Try first attach TDA18212 silicon tuner on IOE[4], if that
* fails attach old simple PLL. */ * fails attach old simple PLL. */
/* enable tuner on IOE[4] */
ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
if (ret)
goto error;
/* attach tuner */ /* attach tuner */
fe = dvb_attach(tda18212_attach, adap->fe_adap[state->fe_id].fe, fe = dvb_attach(tda18212_attach, adap->fe_adap[state->fe_id].fe,
&adap->dev->i2c_adap, &anysee_tda18212_config); &adap->dev->i2c_adap, &anysee_tda18212_config);
if (fe) if (fe)
break; break;
/* disable tuner on IOE[4] */
ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (0 << 4), 0x10);
if (ret)
goto error;
/* attach tuner */ /* attach tuner */
fe = dvb_attach(dvb_pll_attach, adap->fe_adap[state->fe_id].fe, fe = dvb_attach(dvb_pll_attach, adap->fe_adap[state->fe_id].fe,
(0xc0 >> 1), &adap->dev->i2c_adap, (0xc0 >> 1), &adap->dev->i2c_adap,
...@@ -962,11 +974,6 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -962,11 +974,6 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
/* E7 TC */ /* E7 TC */
/* E7 PTC */ /* E7 PTC */
/* enable tuner on IOE[4] */
ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 4), 0x10);
if (ret)
goto error;
/* attach tuner */ /* attach tuner */
fe = dvb_attach(tda18212_attach, adap->fe_adap[state->fe_id].fe, fe = dvb_attach(tda18212_attach, adap->fe_adap[state->fe_id].fe,
&adap->dev->i2c_adap, &anysee_tda18212_config); &adap->dev->i2c_adap, &anysee_tda18212_config);
...@@ -993,7 +1000,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -993,7 +1000,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
/* E7 T2C */ /* E7 T2C */
/* attach tuner */ /* attach tuner */
fe = dvb_attach(tda18212_attach, adap->fe[state->fe_id], fe = dvb_attach(tda18212_attach, adap->fe_adap[state->fe_id].fe,
&adap->dev->i2c_adap, &anysee_tda18212_config2); &adap->dev->i2c_adap, &anysee_tda18212_config2);
break; break;
...@@ -1006,7 +1013,6 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -1006,7 +1013,6 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
else else
ret = -ENODEV; ret = -ENODEV;
error:
return ret; return ret;
} }
......
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