Commit fc7a74ba authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] xc5000: don't invoke auto calibration unless we really did reset tuner

The current code invokes the auto calibration of the tuner whenever the
init routine is called (whenever the DVB frontend opens the device).
However we should really only be invoking the calibration if we actually
did reset the device and reload the firmware.

Rework the routine to only do calibration if reset and firmware load was
performed.  Also because the called function is now a no-op if the
firmware is already loaded, the caller no longer needs to invoke
is_firmware_loaded().
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d6b82678
...@@ -717,12 +717,10 @@ static int xc5000_set_params(struct dvb_frontend *fe) ...@@ -717,12 +717,10 @@ static int xc5000_set_params(struct dvb_frontend *fe)
u32 freq = fe->dtv_property_cache.frequency; u32 freq = fe->dtv_property_cache.frequency;
u32 delsys = fe->dtv_property_cache.delivery_system; u32 delsys = fe->dtv_property_cache.delivery_system;
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
dprintk(1, "Unable to load firmware and init tuner\n"); dprintk(1, "Unable to load firmware and init tuner\n");
return -EINVAL; return -EINVAL;
} }
}
dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq); dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq);
...@@ -1002,12 +1000,10 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, ...@@ -1002,12 +1000,10 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
if (priv->i2c_props.adap == NULL) if (priv->i2c_props.adap == NULL)
return -EINVAL; return -EINVAL;
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
dprintk(1, "Unable to load firmware and init tuner\n"); dprintk(1, "Unable to load firmware and init tuner\n");
return -EINVAL; return -EINVAL;
} }
}
switch (params->mode) { switch (params->mode) {
case V4L2_TUNER_RADIO: case V4L2_TUNER_RADIO:
...@@ -1065,13 +1061,12 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status) ...@@ -1065,13 +1061,12 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)
static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
{ {
struct xc5000_priv *priv = fe->tuner_priv; struct xc5000_priv *priv = fe->tuner_priv;
int ret = 0; int ret = XC_RESULT_SUCCESS;
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
ret = xc5000_fwupload(fe); ret = xc5000_fwupload(fe);
if (ret != XC_RESULT_SUCCESS) if (ret != XC_RESULT_SUCCESS)
return ret; return ret;
}
/* Start the tuner self-calibration process */ /* Start the tuner self-calibration process */
ret |= xc_initialize(priv); ret |= xc_initialize(priv);
...@@ -1085,6 +1080,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) ...@@ -1085,6 +1080,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
/* Default to "CABLE" mode */ /* Default to "CABLE" mode */
ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE);
}
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