diff options
Diffstat (limited to 'drivers/media/common/tuners/tda18271-fe.c')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 1b48b5d0bf1e..b10935630154 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -818,6 +818,38 @@ fail: | |||
818 | return ret; | 818 | return ret; |
819 | } | 819 | } |
820 | 820 | ||
821 | /* ------------------------------------------------------------------ */ | ||
822 | |||
823 | static int tda18271_agc(struct dvb_frontend *fe) | ||
824 | { | ||
825 | struct tda18271_priv *priv = fe->tuner_priv; | ||
826 | int ret = 0; | ||
827 | |||
828 | switch (priv->config) { | ||
829 | case 0: | ||
830 | /* no LNA */ | ||
831 | tda_dbg("no agc configuration provided\n"); | ||
832 | break; | ||
833 | case 3: | ||
834 | /* switch with GPIO of saa713x */ | ||
835 | tda_dbg("invoking callback\n"); | ||
836 | if (fe->callback) | ||
837 | ret = fe->callback(priv->i2c_props.adap->algo_data, | ||
838 | DVB_FRONTEND_COMPONENT_TUNER, | ||
839 | TDA18271_CALLBACK_CMD_AGC_ENABLE, | ||
840 | priv->mode); | ||
841 | break; | ||
842 | case 1: | ||
843 | case 2: | ||
844 | default: | ||
845 | /* n/a - currently not supported */ | ||
846 | tda_err("unsupported configuration: %d\n", priv->config); | ||
847 | ret = -EINVAL; | ||
848 | break; | ||
849 | } | ||
850 | return ret; | ||
851 | } | ||
852 | |||
821 | static int tda18271_tune(struct dvb_frontend *fe, | 853 | static int tda18271_tune(struct dvb_frontend *fe, |
822 | struct tda18271_std_map_item *map, u32 freq, u32 bw) | 854 | struct tda18271_std_map_item *map, u32 freq, u32 bw) |
823 | { | 855 | { |
@@ -827,6 +859,10 @@ static int tda18271_tune(struct dvb_frontend *fe, | |||
827 | tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", | 859 | tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n", |
828 | freq, map->if_freq, bw, map->agc_mode, map->std); | 860 | freq, map->if_freq, bw, map->agc_mode, map->std); |
829 | 861 | ||
862 | ret = tda18271_agc(fe); | ||
863 | if (tda_fail(ret)) | ||
864 | tda_warn("failed to configure agc\n"); | ||
865 | |||
830 | ret = tda18271_init(fe); | 866 | ret = tda18271_init(fe); |
831 | if (tda_fail(ret)) | 867 | if (tda_fail(ret)) |
832 | goto fail; | 868 | goto fail; |
@@ -1159,6 +1195,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1159 | /* new tuner instance */ | 1195 | /* new tuner instance */ |
1160 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; | 1196 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; |
1161 | priv->role = (cfg) ? cfg->role : TDA18271_MASTER; | 1197 | priv->role = (cfg) ? cfg->role : TDA18271_MASTER; |
1198 | priv->config = (cfg) ? cfg->config : 0; | ||
1162 | priv->cal_initialized = false; | 1199 | priv->cal_initialized = false; |
1163 | mutex_init(&priv->lock); | 1200 | mutex_init(&priv->lock); |
1164 | 1201 | ||