return -EAGAIN;
ret = priv->init[adap->id](fe);
+ if (ret)
+ goto err_unlock;
+
+ if (priv->tuner_ops_init[adap->id]) {
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+ ret = priv->tuner_ops_init[adap->id](fe);
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0);
+ }
+err_unlock:
mutex_unlock(&adap->dev->usb_mutex);
return ret;
if (mutex_lock_interruptible(&adap->dev->usb_mutex))
return -EAGAIN;
+ if (priv->tuner_ops_sleep[adap->id]) {
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+ ret = priv->tuner_ops_sleep[adap->id](fe);
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0);
+ if (ret)
+ goto err_unlock;
+ }
+
ret = priv->sleep[adap->id](fe);
+err_unlock:
mutex_unlock(&adap->dev->usb_mutex);
return ret;
static int af9015_tuner_attach(struct dvb_usb_adapter *adap)
{
int ret;
+ struct af9015_state *state = adap->dev->priv;
deb_info("%s:\n", __func__);
switch (af9015_af9013_config[adap->id].tuner) {
err("Unknown tuner id:%d",
af9015_af9013_config[adap->id].tuner);
}
+
+ state->tuner_ops_sleep[adap->id] =
+ adap->fe_adap[0].fe->ops.tuner_ops.sleep;
+ adap->fe_adap[0].fe->ops.tuner_ops.sleep = 0;
+
+ state->tuner_ops_init[adap->id] =
+ adap->fe_adap[0].fe->ops.tuner_ops.init;
+ adap->fe_adap[0].fe->ops.tuner_ops.init = 0;
return ret;
}
int (*read_status[2]) (struct dvb_frontend *fe, fe_status_t *status);
int (*init[2]) (struct dvb_frontend *fe);
int (*sleep[2]) (struct dvb_frontend *fe);
+ int (*tuner_ops_init[2]) (struct dvb_frontend *fe);
+ int (*tuner_ops_sleep[2]) (struct dvb_frontend *fe);
};
struct af9015_config {