aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/tuners/xc5000.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 7189e06fb35f..06f66fedfff3 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -717,11 +717,9 @@ static int xc5000_set_params(struct dvb_frontend *fe)
717 u32 freq = fe->dtv_property_cache.frequency; 717 u32 freq = fe->dtv_property_cache.frequency;
718 u32 delsys = fe->dtv_property_cache.delivery_system; 718 u32 delsys = fe->dtv_property_cache.delivery_system;
719 719
720 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { 720 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
721 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { 721 dprintk(1, "Unable to load firmware and init tuner\n");
722 dprintk(1, "Unable to load firmware and init tuner\n"); 722 return -EINVAL;
723 return -EINVAL;
724 }
725 } 723 }
726 724
727 dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq); 725 dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq);
@@ -1002,11 +1000,9 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
1002 if (priv->i2c_props.adap == NULL) 1000 if (priv->i2c_props.adap == NULL)
1003 return -EINVAL; 1001 return -EINVAL;
1004 1002
1005 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { 1003 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
1006 if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { 1004 dprintk(1, "Unable to load firmware and init tuner\n");
1007 dprintk(1, "Unable to load firmware and init tuner\n"); 1005 return -EINVAL;
1008 return -EINVAL;
1009 }
1010 } 1006 }
1011 1007
1012 switch (params->mode) { 1008 switch (params->mode) {
@@ -1065,26 +1061,26 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)
1065static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe) 1061static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
1066{ 1062{
1067 struct xc5000_priv *priv = fe->tuner_priv; 1063 struct xc5000_priv *priv = fe->tuner_priv;
1068 int ret = 0; 1064 int ret = XC_RESULT_SUCCESS;
1069 1065
1070 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { 1066 if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
1071 ret = xc5000_fwupload(fe); 1067 ret = xc5000_fwupload(fe);
1072 if (ret != XC_RESULT_SUCCESS) 1068 if (ret != XC_RESULT_SUCCESS)
1073 return ret; 1069 return ret;
1074 }
1075 1070
1076 /* Start the tuner self-calibration process */ 1071 /* Start the tuner self-calibration process */
1077 ret |= xc_initialize(priv); 1072 ret |= xc_initialize(priv);
1078 1073
1079 /* Wait for calibration to complete. 1074 /* Wait for calibration to complete.
1080 * We could continue but XC5000 will clock stretch subsequent 1075 * We could continue but XC5000 will clock stretch subsequent
1081 * I2C transactions until calibration is complete. This way we 1076 * I2C transactions until calibration is complete. This way we
1082 * don't have to rely on clock stretching working. 1077 * don't have to rely on clock stretching working.
1083 */ 1078 */
1084 xc_wait(100); 1079 xc_wait(100);
1085 1080
1086 /* Default to "CABLE" mode */ 1081 /* Default to "CABLE" mode */
1087 ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); 1082 ret |= xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE);
1083 }
1088 1084
1089 return ret; 1085 return ret;
1090} 1086}