summaryrefslogtreecommitdiff
path: root/linux/drivers/media/common/tuners/tda18271-fe.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2009-03-04 17:42:06 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2009-03-04 17:42:06 -0500
commitbf1357c00949c25ceaef64b2127f022a870491ca (patch)
tree4ec2ddd4a25d360742cdf4ee5bec63345ca862eb /linux/drivers/media/common/tuners/tda18271-fe.c
parentfa9f1bcf738c7685a6c6ac771f75275cc86a5e85 (diff)
downloadmediapointer-dvb-s2-bf1357c00949c25ceaef64b2127f022a870491ca.tar.gz
mediapointer-dvb-s2-bf1357c00949c25ceaef64b2127f022a870491ca.tar.bz2
tda18271: add support for AGC configuration via tuner callback
From: Michael Krufky <mkrufky@linuxtv.org> The tda827x driver supports a feature that the tda18271 driver was lacking until now. This patch adds support for device-level configuration via the tuner callback configuration interface. Priority: normal Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/common/tuners/tda18271-fe.c')
-rw-r--r--linux/drivers/media/common/tuners/tda18271-fe.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/linux/drivers/media/common/tuners/tda18271-fe.c b/linux/drivers/media/common/tuners/tda18271-fe.c
index 33bc96ea6..85e30af31 100644
--- a/linux/drivers/media/common/tuners/tda18271-fe.c
+++ b/linux/drivers/media/common/tuners/tda18271-fe.c
@@ -819,6 +819,38 @@ fail:
return ret;
}
+/* ------------------------------------------------------------------ */
+
+static int tda18271_agc(struct dvb_frontend *fe)
+{
+ struct tda18271_priv *priv = fe->tuner_priv;
+ int ret = 0;
+
+ switch (priv->config) {
+ case 0:
+ /* no LNA */
+ tda_dbg("no agc configuration provided\n");
+ break;
+ case 3:
+ /* switch with GPIO of saa713x */
+ tda_dbg("invoking callback\n");
+ if (fe->callback)
+ ret = fe->callback(priv->i2c_props.adap->algo_data,
+ DVB_FRONTEND_COMPONENT_TUNER,
+ TDA18271_CALLBACK_CMD_AGC_ENABLE,
+ priv->mode);
+ break;
+ case 1:
+ case 2:
+ default:
+ /* n/a - currently not supported */
+ tda_err("unsupported configuration: %d\n", priv->config);
+ ret = -EINVAL;
+ break;
+ }
+ return ret;
+}
+
static int tda18271_tune(struct dvb_frontend *fe,
struct tda18271_std_map_item *map, u32 freq, u32 bw)
{
@@ -828,6 +860,10 @@ static int tda18271_tune(struct dvb_frontend *fe,
tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
freq, map->if_freq, bw, map->agc_mode, map->std);
+ ret = tda18271_agc(fe);
+ if (tda_fail(ret))
+ tda_warn("failed to configure agc\n");
+
ret = tda18271_init(fe);
if (tda_fail(ret))
goto fail;
@@ -1160,6 +1196,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
/* new tuner instance */
priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
+ priv->config = (cfg) ? cfg->config : 0;
priv->cal_initialized = false;
mutex_init(&priv->lock);