}
/* scan mode need mute */
- if (priv->state == ATVDEMOD_STATE_WORK && !priv->scanning) {
+ if (priv->state == ATVDEMOD_STATE_WORK
+ && !priv->scanning
+ && !priv->standby) {
retrieve_vpll_carrier_lock(&vpll_lock);
retrieve_vpll_carrier_line_lock(&line_lock);
if ((vpll_lock == 0) && (line_lock == 0)) {
}
} else {
*state = 0;
- pr_audio("%s, atv is not work, atv_state: %d.\n",
- __func__, priv->state);
+ pr_audio("%s, ATV in state[%d], scanning[%d], standby[%d].\n",
+ __func__, priv->state,
+ priv->scanning, priv->standby);
}
/* If the atv signal is locked, it means there is audio data,
{
struct atv_demod_priv *priv = fe->analog_demod_priv;
+ priv->state = ATVDEMOD_STATE_IDEL;
+
if (priv->afc.disable)
priv->afc.disable(&priv->afc);
amlatvdemod_devp->audmode = 0;
amlatvdemod_devp->soundsys = 0xFF;
- priv->state = ATVDEMOD_STATE_IDEL;
-
pr_info("%s: OK.\n", __func__);
return 0;
struct aml_atvdemod_parameters *p = &priv->atvdemod_param;
bool reconfig = false;
- priv->standby = false;
+ priv->standby = true;
/* afc tune disable,must cancel wq before set tuner freq*/
if (priv->afc.disable)
if (priv->monitor.enable)
priv->monitor.enable(&priv->monitor);
}
+
+ priv->standby = false;
}
static int atv_demod_has_signal(struct dvb_frontend *fe, u16 *signal)
if (priv->state != ATVDEMOD_STATE_IDEL) {
atv_demod_leave_mode(fe);
priv->state = ATVDEMOD_STATE_SLEEP;
+ priv->standby = true;
}
pr_info("%s: OK.\n", __func__);
case AML_ATVDEMOD_RESUME:
if (priv->state == ATVDEMOD_STATE_SLEEP) {
- if (!atv_demod_enter_mode(fe))
+ if (!atv_demod_enter_mode(fe)) {
priv->state = ATVDEMOD_STATE_WORK;
+ priv->standby = false;
+ }
}
break;
}
+static int v4l2_frontend_check_mode(struct v4l2_frontend *v4l2_fe)
+{
+ if (v4l2_fe->mode != V4L2_TUNER_ANALOG_TV)
+ return -EINVAL;
+
+ return 0;
+}
+
static int v4l2_set_frontend(struct v4l2_frontend *v4l2_fe,
struct v4l2_analog_parameters *params)
{
pr_dbg("%s.\n", __func__);
+ if (v4l2_frontend_check_mode(v4l2_fe) < 0)
+ return -EINVAL;
+
freq_min = fe->ops.tuner_ops.info.frequency_min;
freq_max = fe->ops.tuner_ops.info.frequency_max;
analog_ops = &v4l2_fe->fe.ops.analog_ops;
- if (params)
+ if (params) {
priv_cfg = AML_ATVDEMOD_INIT;
- else
+ v4l2_fe->mode = V4L2_TUNER_ANALOG_TV;
+ } else {
priv_cfg = AML_ATVDEMOD_UNINIT;
+ v4l2_fe->mode = V4L2_TUNER_RF;
+ }
if (analog_ops && analog_ops->set_config)
ret = analog_ops->set_config(&v4l2_fe->fe, &priv_cfg);