aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHartmut Hackmann <hartmut.hackmann@t-online.de>2008-04-13 21:41:19 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:44 -0400
commit3ff9a81b21c673fd91ad8456242ca68922f77ac4 (patch)
tree6fdeec0587c21432139865308d80822e095f7d42 /drivers/media
parentb1c54fe2aed3e2812f5b42916894f15e84b484b5 (diff)
V4L/DVB (7656): tda826x: Calculate cut off fequency from symbol rate
This patch makes the tuner work with transonders providing higher symbol rates. It was contributed by Oliver Endriss. Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/tda826x.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/tda826x.c b/drivers/media/dvb/frontends/tda826x.c
index 5a15bb4263fb..a051554b5e25 100644
--- a/drivers/media/dvb/frontends/tda826x.c
+++ b/drivers/media/dvb/frontends/tda826x.c
@@ -75,6 +75,8 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
75 struct tda826x_priv *priv = fe->tuner_priv; 75 struct tda826x_priv *priv = fe->tuner_priv;
76 int ret; 76 int ret;
77 u32 div; 77 u32 div;
78 u32 ksyms;
79 u32 bandwidth;
78 u8 buf [11]; 80 u8 buf [11];
79 struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 11 }; 81 struct i2c_msg msg = { .addr = priv->i2c_address, .flags = 0, .buf = buf, .len = 11 };
80 82
@@ -82,6 +84,15 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
82 84
83 div = (params->frequency + (1000-1)) / 1000; 85 div = (params->frequency + (1000-1)) / 1000;
84 86
87 /* BW = ((1 + RO) * SR/2 + 5) * 1.3 [SR in MSPS, BW in MHz] */
88 /* with R0 = 0.35 and some transformations: */
89 ksyms = params->u.qpsk.symbol_rate / 1000;
90 bandwidth = (878 * ksyms + 6500000) / 1000000 + 1;
91 if (bandwidth < 5)
92 bandwidth = 5;
93 else if (bandwidth > 36)
94 bandwidth = 36;
95
85 buf[0] = 0x00; // subaddress 96 buf[0] = 0x00; // subaddress
86 buf[1] = 0x09; // powerdown RSSI + the magic value 1 97 buf[1] = 0x09; // powerdown RSSI + the magic value 1
87 if (!priv->has_loopthrough) 98 if (!priv->has_loopthrough)
@@ -89,7 +100,7 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
89 buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO 100 buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO
90 buf[3] = div >> 7; 101 buf[3] = div >> 7;
91 buf[4] = div << 1; 102 buf[4] = div << 1;
92 buf[5] = 0x77; // baseband cut-off 19 MHz 103 buf[5] = ((bandwidth - 5) << 3) | 7; /* baseband cut-off */
93 buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation 104 buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation
94 buf[7] = 0x83; // charge pumps at high, tests off 105 buf[7] = 0x83; // charge pumps at high, tests off
95 buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. 106 buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports.