diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2009-03-04 17:42:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:11 -0400 |
commit | adcc4b3e75c5f0293806766bcc5ed0bb62d5cda0 (patch) | |
tree | c13980e43addd1dacead20ae0c35a858fe5afbfe /drivers/media/common | |
parent | 3160fbc556aa2e60404fa4da35b3e13dd741a5a2 (diff) |
V4L/DVB (10876): tda18271: add support for AGC configuration via tuner callback
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.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 37 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271-priv.h | 6 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271.h | 10 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda8290.c | 1 |
4 files changed, 49 insertions, 5 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 | ||
diff --git a/drivers/media/common/tuners/tda18271-priv.h b/drivers/media/common/tuners/tda18271-priv.h index 81a739365f8c..74beb28806f8 100644 --- a/drivers/media/common/tuners/tda18271-priv.h +++ b/drivers/media/common/tuners/tda18271-priv.h | |||
@@ -91,11 +91,6 @@ enum tda18271_pll { | |||
91 | TDA18271_CAL_PLL, | 91 | TDA18271_CAL_PLL, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | enum tda18271_mode { | ||
95 | TDA18271_ANALOG, | ||
96 | TDA18271_DIGITAL, | ||
97 | }; | ||
98 | |||
99 | struct tda18271_map_layout; | 94 | struct tda18271_map_layout; |
100 | 95 | ||
101 | enum tda18271_ver { | 96 | enum tda18271_ver { |
@@ -114,6 +109,7 @@ struct tda18271_priv { | |||
114 | enum tda18271_i2c_gate gate; | 109 | enum tda18271_i2c_gate gate; |
115 | enum tda18271_ver id; | 110 | enum tda18271_ver id; |
116 | 111 | ||
112 | unsigned int config; /* interface to saa713x / tda829x */ | ||
117 | unsigned int tm_rfcal; | 113 | unsigned int tm_rfcal; |
118 | unsigned int cal_initialized:1; | 114 | unsigned int cal_initialized:1; |
119 | unsigned int small_i2c:1; | 115 | unsigned int small_i2c:1; |
diff --git a/drivers/media/common/tuners/tda18271.h b/drivers/media/common/tuners/tda18271.h index 7db9831c0cb0..53a9892a18d0 100644 --- a/drivers/media/common/tuners/tda18271.h +++ b/drivers/media/common/tuners/tda18271.h | |||
@@ -79,6 +79,16 @@ struct tda18271_config { | |||
79 | 79 | ||
80 | /* some i2c providers cant write all 39 registers at once */ | 80 | /* some i2c providers cant write all 39 registers at once */ |
81 | unsigned int small_i2c:1; | 81 | unsigned int small_i2c:1; |
82 | |||
83 | /* interface to saa713x / tda829x */ | ||
84 | unsigned int config; | ||
85 | }; | ||
86 | |||
87 | #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0 | ||
88 | |||
89 | enum tda18271_mode { | ||
90 | TDA18271_ANALOG = 0, | ||
91 | TDA18271_DIGITAL, | ||
82 | }; | 92 | }; |
83 | 93 | ||
84 | #if defined(CONFIG_MEDIA_TUNER_TDA18271) || (defined(CONFIG_MEDIA_TUNER_TDA18271_MODULE) && defined(MODULE)) | 94 | #if defined(CONFIG_MEDIA_TUNER_TDA18271) || (defined(CONFIG_MEDIA_TUNER_TDA18271_MODULE) && defined(MODULE)) |
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index a88e67632c52..064d14c8d7b2 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c | |||
@@ -624,6 +624,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) | |||
624 | 624 | ||
625 | if ((data == 0x83) || (data == 0x84)) { | 625 | if ((data == 0x83) || (data == 0x84)) { |
626 | priv->ver |= TDA18271; | 626 | priv->ver |= TDA18271; |
627 | tda829x_tda18271_config.config = priv->cfg.config; | ||
627 | dvb_attach(tda18271_attach, fe, priv->tda827x_addr, | 628 | dvb_attach(tda18271_attach, fe, priv->tda827x_addr, |
628 | priv->i2c_props.adap, &tda829x_tda18271_config); | 629 | priv->i2c_props.adap, &tda829x_tda18271_config); |
629 | } else { | 630 | } else { |