This patch adds support for FM filter selection. The tda18271 has two rf
inputs RF_IN (45-864 MHz) and FM_IN (65-108 MHz). The code automatically
enables the antialiasing filter for radio reception and depending on the
FM input selected configures EB23 register.
Additional fixes:
- Fixed the temerature comensation, see revision history of TDA18271HD_4
spec.
- Minor cosmetic change in the tda18271_rf_band[]
- Fixed one value and removed a duplicate in tda18271_cid_target[]
Signed-off-by: [email protected]
diff -r 2b49813f8482 linux/drivers/media/common/tuners/tda18271-fe.c
--- a/linux/drivers/media/common/tuners/tda18271-fe.c Thu Sep 03 09:06:34
2009 -0300
+++ b/linux/drivers/media/common/tuners/tda18271-fe.c Mon Sep 14 01:45:49
2009 +0200
@@ -99,6 +99,22 @@
if (tda_fail(ret))
goto fail;
+ /* update FM filter selection */
+ if (map->std == 0) {
+ /* std == FM radio */
+ regs[R_EB23] |= 0x06; /* 1.5 Mhz cut-off freq */
+ } else if (map->fm_rfn) {
+ /* antenna FM_IN, std != FM radio */
+ regs[R_EB23] |= 0x04; /* set FORCELP */
+ regs[R_EB23] &= ~0x02; /* clear LP_FC */
+ } else {
+ /* antenna RF_IN, std != FM radio */
+ regs[R_EB23] &= ~0x06; /* clear FORCELP, LP_FC */
+ }
+ ret = tda18271_write_regs(fe, R_EB23, 1);
+ if (tda_fail(ret))
+ goto fail;
+
/* --------------------------------------------------------------- */
/* disable Power Level Indicator */
@@ -272,7 +288,7 @@
tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt);
/* calculate temperature compensation */
- rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal);
+ rfcal_comp = dc_over_dt * (tm_current - priv->tm_rfcal) / 1000;
regs[R_EB14] = approx + rfcal_comp;
ret = tda18271_write_regs(fe, R_EB14, 1);
diff -r 2b49813f8482 linux/drivers/media/common/tuners/tda18271-maps.c
--- a/linux/drivers/media/common/tuners/tda18271-maps.c Thu Sep 03 09:06:34
2009 -0300
+++ b/linux/drivers/media/common/tuners/tda18271-maps.c Mon Sep 14 01:45:49
2009 +0200
@@ -229,8 +229,8 @@
static struct tda18271_map tda18271_rf_band[] = {
{ .rfmax = 47900, .val = 0x00 },
{ .rfmax = 61100, .val = 0x01 },
+ { .rfmax = 121200, .val = 0x02 },
/* { .rfmax = 152600, .val = 0x02 }, */
- { .rfmax = 121200, .val = 0x02 },
{ .rfmax = 164700, .val = 0x03 },
{ .rfmax = 203500, .val = 0x04 },
{ .rfmax = 457800, .val = 0x05 },
@@ -962,10 +962,10 @@
static struct tda18271_cid_target_map tda18271_cid_target[] = {
{ .rfmax = 46000, .target = 0x04, .limit = 1800 },
{ .rfmax = 52200, .target = 0x0a, .limit = 1500 },
- { .rfmax = 79100, .target = 0x01, .limit = 4000 },
+ { .rfmax = 70100, .target = 0x01, .limit = 4000 },
+/* { .rfmax = 79100, .target = 0x01, .limit = 4000 }, */
{ .rfmax = 136800, .target = 0x18, .limit = 4000 },
{ .rfmax = 156700, .target = 0x18, .limit = 4000 },
- { .rfmax = 156700, .target = 0x18, .limit = 4000 },
{ .rfmax = 186250, .target = 0x0a, .limit = 4000 },
{ .rfmax = 230000, .target = 0x0a, .limit = 4000 },
{ .rfmax = 345000, .target = 0x18, .limit = 4000 },