[media] tuner-xc2028: Don't try to sleep twice
Only send a power down command for the device if it is not already in power down state. That prevents a timeout when trying to talk with the device. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
f5f894d19e
commit
ebf044f46f
|
@ -709,6 +709,8 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int xc2028_sleep(struct dvb_frontend *fe);
|
||||||
|
|
||||||
static int check_firmware(struct dvb_frontend *fe, unsigned int type,
|
static int check_firmware(struct dvb_frontend *fe, unsigned int type,
|
||||||
v4l2_std_id std, __u16 int_freq)
|
v4l2_std_id std, __u16 int_freq)
|
||||||
{
|
{
|
||||||
|
@ -881,7 +883,7 @@ read_not_reliable:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
priv->state = XC2028_SLEEP;
|
priv->state = XC2028_NO_FIRMWARE;
|
||||||
|
|
||||||
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
|
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
|
||||||
if (retry_count < 8) {
|
if (retry_count < 8) {
|
||||||
|
@ -891,6 +893,9 @@ fail:
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Firmware didn't load. Put the device to sleep */
|
||||||
|
xc2028_sleep(fe);
|
||||||
|
|
||||||
if (rc == -ENOENT)
|
if (rc == -ENOENT)
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -1276,6 +1281,10 @@ static int xc2028_sleep(struct dvb_frontend *fe)
|
||||||
if (no_poweroff || priv->ctrl.disable_power_mgmt)
|
if (no_poweroff || priv->ctrl.disable_power_mgmt)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Device is already in sleep mode */
|
||||||
|
if (priv->state == XC2028_SLEEP)
|
||||||
|
return 0;
|
||||||
|
|
||||||
tuner_dbg("Putting xc2028/3028 into poweroff mode.\n");
|
tuner_dbg("Putting xc2028/3028 into poweroff mode.\n");
|
||||||
if (debug > 1) {
|
if (debug > 1) {
|
||||||
tuner_dbg("Printing sleep stack trace:\n");
|
tuner_dbg("Printing sleep stack trace:\n");
|
||||||
|
@ -1289,6 +1298,7 @@ static int xc2028_sleep(struct dvb_frontend *fe)
|
||||||
else
|
else
|
||||||
rc = send_seq(priv, {0x80, XREG_POWER_DOWN, 0x00, 0x00});
|
rc = send_seq(priv, {0x80, XREG_POWER_DOWN, 0x00, 0x00});
|
||||||
|
|
||||||
|
if (rc >= 0)
|
||||||
priv->state = XC2028_SLEEP;
|
priv->state = XC2028_SLEEP;
|
||||||
|
|
||||||
mutex_unlock(&priv->lock);
|
mutex_unlock(&priv->lock);
|
||||||
|
@ -1357,7 +1367,7 @@ static void load_firmware_cb(const struct firmware *fw,
|
||||||
|
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return;
|
return;
|
||||||
priv->state = XC2028_SLEEP;
|
priv->state = XC2028_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)
|
static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)
|
||||||
|
|
Loading…
Reference in New Issue