aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-11-23 14:52:15 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:02:59 -0500
commit6ca04de36b05aaf2f8122d0e566940969c6df801 (patch)
tree33433eed465b98bb5eb05a130441185a7e4483eb
parent63c254805e38bad4c64b5f5b0e135a2a357fa0bf (diff)
V4L/DVB (6680): tda18271: move tda18271_map tables to a separate source file
Move tda18271_map tables to a separate source file, to improve code readability and ease maintenance. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/Makefile2
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c (renamed from drivers/media/dvb/frontends/tda18271.c)305
-rw-r--r--drivers/media/dvb/frontends/tda18271-priv.h96
-rw-r--r--drivers/media/dvb/frontends/tda18271-tables.c253
4 files changed, 362 insertions, 294 deletions
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index 57e5fa80589b..784565208fb4 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -5,6 +5,8 @@
5EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ 5EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
6EXTRA_CFLAGS += -Idrivers/media/video/ 6EXTRA_CFLAGS += -Idrivers/media/video/
7 7
8tda18271-objs := tda18271-tables.o tda18271-fe.o
9
8obj-$(CONFIG_DVB_PLL) += dvb-pll.o 10obj-$(CONFIG_DVB_PLL) += dvb-pll.o
9obj-$(CONFIG_DVB_STV0299) += stv0299.o 11obj-$(CONFIG_DVB_STV0299) += stv0299.o
10obj-$(CONFIG_DVB_SP8870) += sp8870.o 12obj-$(CONFIG_DVB_SP8870) += sp8870.o
diff --git a/drivers/media/dvb/frontends/tda18271.c b/drivers/media/dvb/frontends/tda18271-fe.c
index ad72ff69ce92..ba980cf5811b 100644
--- a/drivers/media/dvb/frontends/tda18271.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -1,5 +1,5 @@
1/* 1/*
2 tda18271.c - driver for the Philips / NXP TDA18271 silicon tuner 2 tda18271-fe.c - driver for the Philips / NXP TDA18271 silicon tuner
3 3
4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org) 4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org)
5 5
@@ -18,12 +18,12 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 19*/
20 20
21#include <linux/i2c.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/videodev2.h> 22#include <linux/videodev2.h>
24#include "tuner-driver.h" 23#include "tuner-driver.h"
25 24
26#include "tda18271.h" 25#include "tda18271.h"
26#include "tda18271-priv.h"
27 27
28static int debug; 28static int debug;
29module_param(debug, int, 0644); 29module_param(debug, int, 0644);
@@ -33,285 +33,8 @@ MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
33 if (debug >= level) \ 33 if (debug >= level) \
34 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0) 34 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0)
35 35
36#define R_ID 0x00 /* ID byte */
37#define R_TM 0x01 /* Thermo byte */
38#define R_PL 0x02 /* Power level byte */
39#define R_EP1 0x03 /* Easy Prog byte 1 */
40#define R_EP2 0x04 /* Easy Prog byte 2 */
41#define R_EP3 0x05 /* Easy Prog byte 3 */
42#define R_EP4 0x06 /* Easy Prog byte 4 */
43#define R_EP5 0x07 /* Easy Prog byte 5 */
44#define R_CPD 0x08 /* Cal Post-Divider byte */
45#define R_CD1 0x09 /* Cal Divider byte 1 */
46#define R_CD2 0x0a /* Cal Divider byte 2 */
47#define R_CD3 0x0b /* Cal Divider byte 3 */
48#define R_MPD 0x0c /* Main Post-Divider byte */
49#define R_MD1 0x0d /* Main Divider byte 1 */
50#define R_MD2 0x0e /* Main Divider byte 2 */
51#define R_MD3 0x0f /* Main Divider byte 3 */
52#define R_EB1 0x10 /* Extended byte 1 */
53#define R_EB2 0x11 /* Extended byte 2 */
54#define R_EB3 0x12 /* Extended byte 3 */
55#define R_EB4 0x13 /* Extended byte 4 */
56#define R_EB5 0x14 /* Extended byte 5 */
57#define R_EB6 0x15 /* Extended byte 6 */
58#define R_EB7 0x16 /* Extended byte 7 */
59#define R_EB8 0x17 /* Extended byte 8 */
60#define R_EB9 0x18 /* Extended byte 9 */
61#define R_EB10 0x19 /* Extended byte 10 */
62#define R_EB11 0x1a /* Extended byte 11 */
63#define R_EB12 0x1b /* Extended byte 12 */
64#define R_EB13 0x1c /* Extended byte 13 */
65#define R_EB14 0x1d /* Extended byte 14 */
66#define R_EB15 0x1e /* Extended byte 15 */
67#define R_EB16 0x1f /* Extended byte 16 */
68#define R_EB17 0x20 /* Extended byte 17 */
69#define R_EB18 0x21 /* Extended byte 18 */
70#define R_EB19 0x22 /* Extended byte 19 */
71#define R_EB20 0x23 /* Extended byte 20 */
72#define R_EB21 0x24 /* Extended byte 21 */
73#define R_EB22 0x25 /* Extended byte 22 */
74#define R_EB23 0x26 /* Extended byte 23 */
75
76struct tda18271_pll_map {
77 u32 lomax;
78 u8 pd; /* post div */
79 u8 d; /* div */
80};
81
82static struct tda18271_pll_map tda18271_main_pll[] = {
83 { .lomax = 32000, .pd = 0x5f, .d = 0xf0 },
84 { .lomax = 35000, .pd = 0x5e, .d = 0xe0 },
85 { .lomax = 37000, .pd = 0x5d, .d = 0xd0 },
86 { .lomax = 41000, .pd = 0x5c, .d = 0xc0 },
87 { .lomax = 44000, .pd = 0x5b, .d = 0xb0 },
88 { .lomax = 49000, .pd = 0x5a, .d = 0xa0 },
89 { .lomax = 54000, .pd = 0x59, .d = 0x90 },
90 { .lomax = 61000, .pd = 0x58, .d = 0x80 },
91 { .lomax = 65000, .pd = 0x4f, .d = 0x78 },
92 { .lomax = 70000, .pd = 0x4e, .d = 0x70 },
93 { .lomax = 75000, .pd = 0x4d, .d = 0x68 },
94 { .lomax = 82000, .pd = 0x4c, .d = 0x60 },
95 { .lomax = 89000, .pd = 0x4b, .d = 0x58 },
96 { .lomax = 98000, .pd = 0x4a, .d = 0x50 },
97 { .lomax = 109000, .pd = 0x49, .d = 0x48 },
98 { .lomax = 123000, .pd = 0x48, .d = 0x40 },
99 { .lomax = 131000, .pd = 0x3f, .d = 0x3c },
100 { .lomax = 141000, .pd = 0x3e, .d = 0x38 },
101 { .lomax = 151000, .pd = 0x3d, .d = 0x34 },
102 { .lomax = 164000, .pd = 0x3c, .d = 0x30 },
103 { .lomax = 179000, .pd = 0x3b, .d = 0x2c },
104 { .lomax = 197000, .pd = 0x3a, .d = 0x28 },
105 { .lomax = 219000, .pd = 0x39, .d = 0x24 },
106 { .lomax = 246000, .pd = 0x38, .d = 0x20 },
107 { .lomax = 263000, .pd = 0x2f, .d = 0x1e },
108 { .lomax = 282000, .pd = 0x2e, .d = 0x1c },
109 { .lomax = 303000, .pd = 0x2d, .d = 0x1a },
110 { .lomax = 329000, .pd = 0x2c, .d = 0x18 },
111 { .lomax = 359000, .pd = 0x2b, .d = 0x16 },
112 { .lomax = 395000, .pd = 0x2a, .d = 0x14 },
113 { .lomax = 438000, .pd = 0x29, .d = 0x12 },
114 { .lomax = 493000, .pd = 0x28, .d = 0x10 },
115 { .lomax = 526000, .pd = 0x1f, .d = 0x0f },
116 { .lomax = 564000, .pd = 0x1e, .d = 0x0e },
117 { .lomax = 607000, .pd = 0x1d, .d = 0x0d },
118 { .lomax = 658000, .pd = 0x1c, .d = 0x0c },
119 { .lomax = 718000, .pd = 0x1b, .d = 0x0b },
120 { .lomax = 790000, .pd = 0x1a, .d = 0x0a },
121 { .lomax = 877000, .pd = 0x19, .d = 0x09 },
122 { .lomax = 987000, .pd = 0x18, .d = 0x08 },
123 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
124};
125
126static struct tda18271_pll_map tda18271_cal_pll[] = {
127 { .lomax = 33000, .pd = 0xdd, .d = 0xd0 },
128 { .lomax = 36000, .pd = 0xdc, .d = 0xc0 },
129 { .lomax = 40000, .pd = 0xdb, .d = 0xb0 },
130 { .lomax = 44000, .pd = 0xda, .d = 0xa0 },
131 { .lomax = 49000, .pd = 0xd9, .d = 0x90 },
132 { .lomax = 55000, .pd = 0xd8, .d = 0x80 },
133 { .lomax = 63000, .pd = 0xd3, .d = 0x70 },
134 { .lomax = 67000, .pd = 0xcd, .d = 0x68 },
135 { .lomax = 73000, .pd = 0xcc, .d = 0x60 },
136 { .lomax = 80000, .pd = 0xcb, .d = 0x58 },
137 { .lomax = 88000, .pd = 0xca, .d = 0x50 },
138 { .lomax = 98000, .pd = 0xc9, .d = 0x48 },
139 { .lomax = 110000, .pd = 0xc8, .d = 0x40 },
140 { .lomax = 126000, .pd = 0xc3, .d = 0x38 },
141 { .lomax = 135000, .pd = 0xbd, .d = 0x34 },
142 { .lomax = 147000, .pd = 0xbc, .d = 0x30 },
143 { .lomax = 160000, .pd = 0xbb, .d = 0x2c },
144 { .lomax = 176000, .pd = 0xba, .d = 0x28 },
145 { .lomax = 196000, .pd = 0xb9, .d = 0x24 },
146 { .lomax = 220000, .pd = 0xb8, .d = 0x20 },
147 { .lomax = 252000, .pd = 0xb3, .d = 0x1c },
148 { .lomax = 271000, .pd = 0xad, .d = 0x1a },
149 { .lomax = 294000, .pd = 0xac, .d = 0x18 },
150 { .lomax = 321000, .pd = 0xab, .d = 0x16 },
151 { .lomax = 353000, .pd = 0xaa, .d = 0x14 },
152 { .lomax = 392000, .pd = 0xa9, .d = 0x12 },
153 { .lomax = 441000, .pd = 0xa8, .d = 0x10 },
154 { .lomax = 505000, .pd = 0xa3, .d = 0x0e },
155 { .lomax = 543000, .pd = 0x9d, .d = 0x0d },
156 { .lomax = 589000, .pd = 0x9c, .d = 0x0c },
157 { .lomax = 642000, .pd = 0x9b, .d = 0x0b },
158 { .lomax = 707000, .pd = 0x9a, .d = 0x0a },
159 { .lomax = 785000, .pd = 0x99, .d = 0x09 },
160 { .lomax = 883000, .pd = 0x98, .d = 0x08 },
161 { .lomax = 1010000, .pd = 0x93, .d = 0x07 },
162 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
163};
164
165struct tda18271_map {
166 u32 rfmax;
167 u8 val;
168};
169
170static struct tda18271_map tda18271_bp_filter[] = {
171 { .rfmax = 62000, .val = 0x00 },
172 { .rfmax = 84000, .val = 0x01 },
173 { .rfmax = 100000, .val = 0x02 },
174 { .rfmax = 140000, .val = 0x03 },
175 { .rfmax = 170000, .val = 0x04 },
176 { .rfmax = 180000, .val = 0x05 },
177 { .rfmax = 865000, .val = 0x06 },
178 { .rfmax = 0, .val = 0x00 }, /* end */
179};
180
181static struct tda18271_map tda18271_km[] = {
182 { .rfmax = 61100, .val = 0x74 },
183 { .rfmax = 350000, .val = 0x40 },
184 { .rfmax = 720000, .val = 0x30 },
185 { .rfmax = 865000, .val = 0x40 },
186 { .rfmax = 0, .val = 0x00 }, /* end */
187};
188
189static struct tda18271_map tda18271_rf_band[] = {
190 { .rfmax = 47900, .val = 0x00 },
191 { .rfmax = 61100, .val = 0x01 },
192/* { .rfmax = 152600, .val = 0x02 }, */
193 { .rfmax = 121200, .val = 0x02 },
194 { .rfmax = 164700, .val = 0x03 },
195 { .rfmax = 203500, .val = 0x04 },
196 { .rfmax = 457800, .val = 0x05 },
197 { .rfmax = 865000, .val = 0x06 },
198 { .rfmax = 0, .val = 0x00 }, /* end */
199};
200
201static struct tda18271_map tda18271_gain_taper[] = {
202 { .rfmax = 45400, .val = 0x1f },
203 { .rfmax = 45800, .val = 0x1e },
204 { .rfmax = 46200, .val = 0x1d },
205 { .rfmax = 46700, .val = 0x1c },
206 { .rfmax = 47100, .val = 0x1b },
207 { .rfmax = 47500, .val = 0x1a },
208 { .rfmax = 47900, .val = 0x19 },
209 { .rfmax = 49600, .val = 0x17 },
210 { .rfmax = 51200, .val = 0x16 },
211 { .rfmax = 52900, .val = 0x15 },
212 { .rfmax = 54500, .val = 0x14 },
213 { .rfmax = 56200, .val = 0x13 },
214 { .rfmax = 57800, .val = 0x12 },
215 { .rfmax = 59500, .val = 0x11 },
216 { .rfmax = 61100, .val = 0x10 },
217 { .rfmax = 67600, .val = 0x0d },
218 { .rfmax = 74200, .val = 0x0c },
219 { .rfmax = 80700, .val = 0x0b },
220 { .rfmax = 87200, .val = 0x0a },
221 { .rfmax = 93800, .val = 0x09 },
222 { .rfmax = 100300, .val = 0x08 },
223 { .rfmax = 106900, .val = 0x07 },
224 { .rfmax = 113400, .val = 0x06 },
225 { .rfmax = 119900, .val = 0x05 },
226 { .rfmax = 126500, .val = 0x04 },
227 { .rfmax = 133000, .val = 0x03 },
228 { .rfmax = 139500, .val = 0x02 },
229 { .rfmax = 146100, .val = 0x01 },
230 { .rfmax = 152600, .val = 0x00 },
231 { .rfmax = 154300, .val = 0x1f },
232 { .rfmax = 156100, .val = 0x1e },
233 { .rfmax = 157800, .val = 0x1d },
234 { .rfmax = 159500, .val = 0x1c },
235 { .rfmax = 161200, .val = 0x1b },
236 { .rfmax = 163000, .val = 0x1a },
237 { .rfmax = 164700, .val = 0x19 },
238 { .rfmax = 170200, .val = 0x17 },
239 { .rfmax = 175800, .val = 0x16 },
240 { .rfmax = 181300, .val = 0x15 },
241 { .rfmax = 186900, .val = 0x14 },
242 { .rfmax = 192400, .val = 0x13 },
243 { .rfmax = 198000, .val = 0x12 },
244 { .rfmax = 203500, .val = 0x11 },
245 { .rfmax = 216200, .val = 0x14 },
246 { .rfmax = 228900, .val = 0x13 },
247 { .rfmax = 241600, .val = 0x12 },
248 { .rfmax = 254400, .val = 0x11 },
249 { .rfmax = 267100, .val = 0x10 },
250 { .rfmax = 279800, .val = 0x0f },
251 { .rfmax = 292500, .val = 0x0e },
252 { .rfmax = 305200, .val = 0x0d },
253 { .rfmax = 317900, .val = 0x0c },
254 { .rfmax = 330700, .val = 0x0b },
255 { .rfmax = 343400, .val = 0x0a },
256 { .rfmax = 356100, .val = 0x09 },
257 { .rfmax = 368800, .val = 0x08 },
258 { .rfmax = 381500, .val = 0x07 },
259 { .rfmax = 394200, .val = 0x06 },
260 { .rfmax = 406900, .val = 0x05 },
261 { .rfmax = 419700, .val = 0x04 },
262 { .rfmax = 432400, .val = 0x03 },
263 { .rfmax = 445100, .val = 0x02 },
264 { .rfmax = 457800, .val = 0x01 },
265 { .rfmax = 476300, .val = 0x19 },
266 { .rfmax = 494800, .val = 0x18 },
267 { .rfmax = 513300, .val = 0x17 },
268 { .rfmax = 531800, .val = 0x16 },
269 { .rfmax = 550300, .val = 0x15 },
270 { .rfmax = 568900, .val = 0x14 },
271 { .rfmax = 587400, .val = 0x13 },
272 { .rfmax = 605900, .val = 0x12 },
273 { .rfmax = 624400, .val = 0x11 },
274 { .rfmax = 642900, .val = 0x10 },
275 { .rfmax = 661400, .val = 0x0f },
276 { .rfmax = 679900, .val = 0x0e },
277 { .rfmax = 698400, .val = 0x0d },
278 { .rfmax = 716900, .val = 0x0c },
279 { .rfmax = 735400, .val = 0x0b },
280 { .rfmax = 753900, .val = 0x0a },
281 { .rfmax = 772500, .val = 0x09 },
282 { .rfmax = 791000, .val = 0x08 },
283 { .rfmax = 809500, .val = 0x07 },
284 { .rfmax = 828000, .val = 0x06 },
285 { .rfmax = 846500, .val = 0x05 },
286 { .rfmax = 865000, .val = 0x04 },
287 { .rfmax = 0, .val = 0x00 }, /* end */
288};
289
290static struct tda18271_map tda18271_rf_cal[] = {
291 { .rfmax = 41000, .val = 0x1e },
292 { .rfmax = 43000, .val = 0x30 },
293 { .rfmax = 45000, .val = 0x43 },
294 { .rfmax = 46000, .val = 0x4d },
295 { .rfmax = 47000, .val = 0x54 },
296 { .rfmax = 47900, .val = 0x64 },
297 { .rfmax = 49100, .val = 0x20 },
298 { .rfmax = 50000, .val = 0x22 },
299 { .rfmax = 51000, .val = 0x2a },
300 { .rfmax = 53000, .val = 0x32 },
301 { .rfmax = 55000, .val = 0x35 },
302 { .rfmax = 56000, .val = 0x3c },
303 { .rfmax = 57000, .val = 0x3f },
304 { .rfmax = 58000, .val = 0x48 },
305 { .rfmax = 59000, .val = 0x4d },
306 { .rfmax = 60000, .val = 0x58 },
307 { .rfmax = 61100, .val = 0x5f },
308 { .rfmax = 0, .val = 0x00 }, /* end */
309};
310
311/*---------------------------------------------------------------------*/ 36/*---------------------------------------------------------------------*/
312 37
313#define TDA18271_NUM_REGS 39
314
315#define TDA18271_ANALOG 0 38#define TDA18271_ANALOG 0
316#define TDA18271_DIGITAL 1 39#define TDA18271_DIGITAL 1
317 40
@@ -395,7 +118,7 @@ static void tda18271_read_regs(struct dvb_frontend *fe)
395 printk("ERROR: %s: i2c_transfer returned: %d\n", 118 printk("ERROR: %s: i2c_transfer returned: %d\n",
396 __FUNCTION__, ret); 119 __FUNCTION__, ret);
397 120
398 if (debug > 1) 121 if (debug > 2)
399 tda18271_dump_regs(fe); 122 tda18271_dump_regs(fe);
400} 123}
401 124
@@ -823,16 +546,6 @@ static int tda18271_tune(struct dvb_frontend *fe,
823 /* see table 22 */ 546 /* see table 22 */
824 regs[R_EP3] |= std; 547 regs[R_EP3] |= std;
825 548
826 /* TO DO: *
827 * ================ *
828 * FM radio, 0x18 *
829 * ATSC 6MHz, 0x1c *
830 * DVB-T 6MHz, 0x1c *
831 * DVB-T 7MHz, 0x1d *
832 * DVB-T 8MHz, 0x1e *
833 * QAM 6MHz, 0x1d *
834 * QAM 8MHz, 0x1f */
835
836 regs[R_EP4] &= ~0x03; /* set cal mode to normal */ 549 regs[R_EP4] &= ~0x03; /* set cal mode to normal */
837 550
838 regs[R_EP4] &= ~0x1c; /* clear if level bits */ 551 regs[R_EP4] &= ~0x1c; /* clear if level bits */
@@ -879,6 +592,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
879 592
880 tda18271_write_regs(fe, R_TM, 15); 593 tda18271_write_regs(fe, R_TM, 15);
881 msleep(5); 594 msleep(5);
595
882 return 0; 596 return 0;
883} 597}
884 598
@@ -918,16 +632,19 @@ static int tda18271_set_params(struct dvb_frontend *fe,
918 } else if (fe->ops.info.type == FE_OFDM) { 632 } else if (fe->ops.info.type == FE_OFDM) {
919 switch (params->u.ofdm.bandwidth) { 633 switch (params->u.ofdm.bandwidth) {
920 case BANDWIDTH_6_MHZ: 634 case BANDWIDTH_6_MHZ:
921 std = 0x1c; 635 std = 0x1b; /* device-specific (spec says 0x1c) */
922 bw = 6000000; 636 bw = 6000000;
637 sgIF = 3300000;
923 break; 638 break;
924 case BANDWIDTH_7_MHZ: 639 case BANDWIDTH_7_MHZ:
925 std = 0x1d; 640 std = 0x19; /* device-specific (spec says 0x1d) */
926 bw = 7000000; 641 bw = 7000000;
642 sgIF = 3800000;
927 break; 643 break;
928 case BANDWIDTH_8_MHZ: 644 case BANDWIDTH_8_MHZ:
929 std = 0x1e; 645 std = 0x1a; /* device-specific (spec says 0x1e) */
930 bw = 8000000; 646 bw = 8000000;
647 sgIF = 4300000;
931 break; 648 break;
932 default: 649 default:
933 printk(KERN_WARNING "%s: bandwidth not set!\n", 650 printk(KERN_WARNING "%s: bandwidth not set!\n",
@@ -1038,7 +755,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1038{ 755{
1039 struct tda18271_priv *priv = NULL; 756 struct tda18271_priv *priv = NULL;
1040 757
1041 dprintk(1, "@ 0x%x\n", addr); 758 dprintk(1, "@ %d-%04x\n", i2c_adapter_id(i2c), addr);
1042 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL); 759 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL);
1043 if (priv == NULL) 760 if (priv == NULL)
1044 return NULL; 761 return NULL;
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h
new file mode 100644
index 000000000000..71b4d7963699
--- /dev/null
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -0,0 +1,96 @@
1/*
2 tda18271-priv.h - private header for the NXP TDA18271 silicon tuner
3
4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef __TDA18271_PRIV_H__
22#define __TDA18271_PRIV_H__
23
24#include <linux/types.h>
25
26#define R_ID 0x00 /* ID byte */
27#define R_TM 0x01 /* Thermo byte */
28#define R_PL 0x02 /* Power level byte */
29#define R_EP1 0x03 /* Easy Prog byte 1 */
30#define R_EP2 0x04 /* Easy Prog byte 2 */
31#define R_EP3 0x05 /* Easy Prog byte 3 */
32#define R_EP4 0x06 /* Easy Prog byte 4 */
33#define R_EP5 0x07 /* Easy Prog byte 5 */
34#define R_CPD 0x08 /* Cal Post-Divider byte */
35#define R_CD1 0x09 /* Cal Divider byte 1 */
36#define R_CD2 0x0a /* Cal Divider byte 2 */
37#define R_CD3 0x0b /* Cal Divider byte 3 */
38#define R_MPD 0x0c /* Main Post-Divider byte */
39#define R_MD1 0x0d /* Main Divider byte 1 */
40#define R_MD2 0x0e /* Main Divider byte 2 */
41#define R_MD3 0x0f /* Main Divider byte 3 */
42#define R_EB1 0x10 /* Extended byte 1 */
43#define R_EB2 0x11 /* Extended byte 2 */
44#define R_EB3 0x12 /* Extended byte 3 */
45#define R_EB4 0x13 /* Extended byte 4 */
46#define R_EB5 0x14 /* Extended byte 5 */
47#define R_EB6 0x15 /* Extended byte 6 */
48#define R_EB7 0x16 /* Extended byte 7 */
49#define R_EB8 0x17 /* Extended byte 8 */
50#define R_EB9 0x18 /* Extended byte 9 */
51#define R_EB10 0x19 /* Extended byte 10 */
52#define R_EB11 0x1a /* Extended byte 11 */
53#define R_EB12 0x1b /* Extended byte 12 */
54#define R_EB13 0x1c /* Extended byte 13 */
55#define R_EB14 0x1d /* Extended byte 14 */
56#define R_EB15 0x1e /* Extended byte 15 */
57#define R_EB16 0x1f /* Extended byte 16 */
58#define R_EB17 0x20 /* Extended byte 17 */
59#define R_EB18 0x21 /* Extended byte 18 */
60#define R_EB19 0x22 /* Extended byte 19 */
61#define R_EB20 0x23 /* Extended byte 20 */
62#define R_EB21 0x24 /* Extended byte 21 */
63#define R_EB22 0x25 /* Extended byte 22 */
64#define R_EB23 0x26 /* Extended byte 23 */
65
66#define TDA18271_NUM_REGS 39
67
68struct tda18271_pll_map {
69 u32 lomax;
70 u8 pd; /* post div */
71 u8 d; /* div */
72};
73
74extern struct tda18271_pll_map tda18271_main_pll[];
75extern struct tda18271_pll_map tda18271_cal_pll[];
76
77struct tda18271_map {
78 u32 rfmax;
79 u8 val;
80};
81
82extern struct tda18271_map tda18271_bp_filter[];
83extern struct tda18271_map tda18271_km[];
84extern struct tda18271_map tda18271_rf_band[];
85extern struct tda18271_map tda18271_gain_taper[];
86extern struct tda18271_map tda18271_rf_cal[];
87
88#endif /* __TDA18271_PRIV_H__ */
89
90/*
91 * Overrides for Emacs so that we follow Linus's tabbing style.
92 * ---------------------------------------------------------------------------
93 * Local variables:
94 * c-basic-offset: 8
95 * End:
96 */
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c
new file mode 100644
index 000000000000..a018b5140873
--- /dev/null
+++ b/drivers/media/dvb/frontends/tda18271-tables.c
@@ -0,0 +1,253 @@
1/*
2 tda18271-tables.c - driver for the Philips / NXP TDA18271 silicon tuner
3
4 Copyright (C) 2007 Michael Krufky (mkrufky@linuxtv.org)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#include "tda18271-priv.h"
22
23struct tda18271_pll_map tda18271_main_pll[] = {
24 { .lomax = 32000, .pd = 0x5f, .d = 0xf0 },
25 { .lomax = 35000, .pd = 0x5e, .d = 0xe0 },
26 { .lomax = 37000, .pd = 0x5d, .d = 0xd0 },
27 { .lomax = 41000, .pd = 0x5c, .d = 0xc0 },
28 { .lomax = 44000, .pd = 0x5b, .d = 0xb0 },
29 { .lomax = 49000, .pd = 0x5a, .d = 0xa0 },
30 { .lomax = 54000, .pd = 0x59, .d = 0x90 },
31 { .lomax = 61000, .pd = 0x58, .d = 0x80 },
32 { .lomax = 65000, .pd = 0x4f, .d = 0x78 },
33 { .lomax = 70000, .pd = 0x4e, .d = 0x70 },
34 { .lomax = 75000, .pd = 0x4d, .d = 0x68 },
35 { .lomax = 82000, .pd = 0x4c, .d = 0x60 },
36 { .lomax = 89000, .pd = 0x4b, .d = 0x58 },
37 { .lomax = 98000, .pd = 0x4a, .d = 0x50 },
38 { .lomax = 109000, .pd = 0x49, .d = 0x48 },
39 { .lomax = 123000, .pd = 0x48, .d = 0x40 },
40 { .lomax = 131000, .pd = 0x3f, .d = 0x3c },
41 { .lomax = 141000, .pd = 0x3e, .d = 0x38 },
42 { .lomax = 151000, .pd = 0x3d, .d = 0x34 },
43 { .lomax = 164000, .pd = 0x3c, .d = 0x30 },
44 { .lomax = 179000, .pd = 0x3b, .d = 0x2c },
45 { .lomax = 197000, .pd = 0x3a, .d = 0x28 },
46 { .lomax = 219000, .pd = 0x39, .d = 0x24 },
47 { .lomax = 246000, .pd = 0x38, .d = 0x20 },
48 { .lomax = 263000, .pd = 0x2f, .d = 0x1e },
49 { .lomax = 282000, .pd = 0x2e, .d = 0x1c },
50 { .lomax = 303000, .pd = 0x2d, .d = 0x1a },
51 { .lomax = 329000, .pd = 0x2c, .d = 0x18 },
52 { .lomax = 359000, .pd = 0x2b, .d = 0x16 },
53 { .lomax = 395000, .pd = 0x2a, .d = 0x14 },
54 { .lomax = 438000, .pd = 0x29, .d = 0x12 },
55 { .lomax = 493000, .pd = 0x28, .d = 0x10 },
56 { .lomax = 526000, .pd = 0x1f, .d = 0x0f },
57 { .lomax = 564000, .pd = 0x1e, .d = 0x0e },
58 { .lomax = 607000, .pd = 0x1d, .d = 0x0d },
59 { .lomax = 658000, .pd = 0x1c, .d = 0x0c },
60 { .lomax = 718000, .pd = 0x1b, .d = 0x0b },
61 { .lomax = 790000, .pd = 0x1a, .d = 0x0a },
62 { .lomax = 877000, .pd = 0x19, .d = 0x09 },
63 { .lomax = 987000, .pd = 0x18, .d = 0x08 },
64 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
65};
66
67struct tda18271_pll_map tda18271_cal_pll[] = {
68 { .lomax = 33000, .pd = 0xdd, .d = 0xd0 },
69 { .lomax = 36000, .pd = 0xdc, .d = 0xc0 },
70 { .lomax = 40000, .pd = 0xdb, .d = 0xb0 },
71 { .lomax = 44000, .pd = 0xda, .d = 0xa0 },
72 { .lomax = 49000, .pd = 0xd9, .d = 0x90 },
73 { .lomax = 55000, .pd = 0xd8, .d = 0x80 },
74 { .lomax = 63000, .pd = 0xd3, .d = 0x70 },
75 { .lomax = 67000, .pd = 0xcd, .d = 0x68 },
76 { .lomax = 73000, .pd = 0xcc, .d = 0x60 },
77 { .lomax = 80000, .pd = 0xcb, .d = 0x58 },
78 { .lomax = 88000, .pd = 0xca, .d = 0x50 },
79 { .lomax = 98000, .pd = 0xc9, .d = 0x48 },
80 { .lomax = 110000, .pd = 0xc8, .d = 0x40 },
81 { .lomax = 126000, .pd = 0xc3, .d = 0x38 },
82 { .lomax = 135000, .pd = 0xbd, .d = 0x34 },
83 { .lomax = 147000, .pd = 0xbc, .d = 0x30 },
84 { .lomax = 160000, .pd = 0xbb, .d = 0x2c },
85 { .lomax = 176000, .pd = 0xba, .d = 0x28 },
86 { .lomax = 196000, .pd = 0xb9, .d = 0x24 },
87 { .lomax = 220000, .pd = 0xb8, .d = 0x20 },
88 { .lomax = 252000, .pd = 0xb3, .d = 0x1c },
89 { .lomax = 271000, .pd = 0xad, .d = 0x1a },
90 { .lomax = 294000, .pd = 0xac, .d = 0x18 },
91 { .lomax = 321000, .pd = 0xab, .d = 0x16 },
92 { .lomax = 353000, .pd = 0xaa, .d = 0x14 },
93 { .lomax = 392000, .pd = 0xa9, .d = 0x12 },
94 { .lomax = 441000, .pd = 0xa8, .d = 0x10 },
95 { .lomax = 505000, .pd = 0xa3, .d = 0x0e },
96 { .lomax = 543000, .pd = 0x9d, .d = 0x0d },
97 { .lomax = 589000, .pd = 0x9c, .d = 0x0c },
98 { .lomax = 642000, .pd = 0x9b, .d = 0x0b },
99 { .lomax = 707000, .pd = 0x9a, .d = 0x0a },
100 { .lomax = 785000, .pd = 0x99, .d = 0x09 },
101 { .lomax = 883000, .pd = 0x98, .d = 0x08 },
102 { .lomax = 1010000, .pd = 0x93, .d = 0x07 },
103 { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
104};
105
106struct tda18271_map tda18271_bp_filter[] = {
107 { .rfmax = 62000, .val = 0x00 },
108 { .rfmax = 84000, .val = 0x01 },
109 { .rfmax = 100000, .val = 0x02 },
110 { .rfmax = 140000, .val = 0x03 },
111 { .rfmax = 170000, .val = 0x04 },
112 { .rfmax = 180000, .val = 0x05 },
113 { .rfmax = 865000, .val = 0x06 },
114 { .rfmax = 0, .val = 0x00 }, /* end */
115};
116
117struct tda18271_map tda18271_km[] = {
118 { .rfmax = 61100, .val = 0x74 },
119 { .rfmax = 350000, .val = 0x40 },
120 { .rfmax = 720000, .val = 0x30 },
121 { .rfmax = 865000, .val = 0x40 },
122 { .rfmax = 0, .val = 0x00 }, /* end */
123};
124
125struct tda18271_map tda18271_rf_band[] = {
126 { .rfmax = 47900, .val = 0x00 },
127 { .rfmax = 61100, .val = 0x01 },
128/* { .rfmax = 152600, .val = 0x02 }, */
129 { .rfmax = 121200, .val = 0x02 },
130 { .rfmax = 164700, .val = 0x03 },
131 { .rfmax = 203500, .val = 0x04 },
132 { .rfmax = 457800, .val = 0x05 },
133 { .rfmax = 865000, .val = 0x06 },
134 { .rfmax = 0, .val = 0x00 }, /* end */
135};
136
137struct tda18271_map tda18271_gain_taper[] = {
138 { .rfmax = 45400, .val = 0x1f },
139 { .rfmax = 45800, .val = 0x1e },
140 { .rfmax = 46200, .val = 0x1d },
141 { .rfmax = 46700, .val = 0x1c },
142 { .rfmax = 47100, .val = 0x1b },
143 { .rfmax = 47500, .val = 0x1a },
144 { .rfmax = 47900, .val = 0x19 },
145 { .rfmax = 49600, .val = 0x17 },
146 { .rfmax = 51200, .val = 0x16 },
147 { .rfmax = 52900, .val = 0x15 },
148 { .rfmax = 54500, .val = 0x14 },
149 { .rfmax = 56200, .val = 0x13 },
150 { .rfmax = 57800, .val = 0x12 },
151 { .rfmax = 59500, .val = 0x11 },
152 { .rfmax = 61100, .val = 0x10 },
153 { .rfmax = 67600, .val = 0x0d },
154 { .rfmax = 74200, .val = 0x0c },
155 { .rfmax = 80700, .val = 0x0b },
156 { .rfmax = 87200, .val = 0x0a },
157 { .rfmax = 93800, .val = 0x09 },
158 { .rfmax = 100300, .val = 0x08 },
159 { .rfmax = 106900, .val = 0x07 },
160 { .rfmax = 113400, .val = 0x06 },
161 { .rfmax = 119900, .val = 0x05 },
162 { .rfmax = 126500, .val = 0x04 },
163 { .rfmax = 133000, .val = 0x03 },
164 { .rfmax = 139500, .val = 0x02 },
165 { .rfmax = 146100, .val = 0x01 },
166 { .rfmax = 152600, .val = 0x00 },
167 { .rfmax = 154300, .val = 0x1f },
168 { .rfmax = 156100, .val = 0x1e },
169 { .rfmax = 157800, .val = 0x1d },
170 { .rfmax = 159500, .val = 0x1c },
171 { .rfmax = 161200, .val = 0x1b },
172 { .rfmax = 163000, .val = 0x1a },
173 { .rfmax = 164700, .val = 0x19 },
174 { .rfmax = 170200, .val = 0x17 },
175 { .rfmax = 175800, .val = 0x16 },
176 { .rfmax = 181300, .val = 0x15 },
177 { .rfmax = 186900, .val = 0x14 },
178 { .rfmax = 192400, .val = 0x13 },
179 { .rfmax = 198000, .val = 0x12 },
180 { .rfmax = 203500, .val = 0x11 },
181 { .rfmax = 216200, .val = 0x14 },
182 { .rfmax = 228900, .val = 0x13 },
183 { .rfmax = 241600, .val = 0x12 },
184 { .rfmax = 254400, .val = 0x11 },
185 { .rfmax = 267100, .val = 0x10 },
186 { .rfmax = 279800, .val = 0x0f },
187 { .rfmax = 292500, .val = 0x0e },
188 { .rfmax = 305200, .val = 0x0d },
189 { .rfmax = 317900, .val = 0x0c },
190 { .rfmax = 330700, .val = 0x0b },
191 { .rfmax = 343400, .val = 0x0a },
192 { .rfmax = 356100, .val = 0x09 },
193 { .rfmax = 368800, .val = 0x08 },
194 { .rfmax = 381500, .val = 0x07 },
195 { .rfmax = 394200, .val = 0x06 },
196 { .rfmax = 406900, .val = 0x05 },
197 { .rfmax = 419700, .val = 0x04 },
198 { .rfmax = 432400, .val = 0x03 },
199 { .rfmax = 445100, .val = 0x02 },
200 { .rfmax = 457800, .val = 0x01 },
201 { .rfmax = 476300, .val = 0x19 },
202 { .rfmax = 494800, .val = 0x18 },
203 { .rfmax = 513300, .val = 0x17 },
204 { .rfmax = 531800, .val = 0x16 },
205 { .rfmax = 550300, .val = 0x15 },
206 { .rfmax = 568900, .val = 0x14 },
207 { .rfmax = 587400, .val = 0x13 },
208 { .rfmax = 605900, .val = 0x12 },
209 { .rfmax = 624400, .val = 0x11 },
210 { .rfmax = 642900, .val = 0x10 },
211 { .rfmax = 661400, .val = 0x0f },
212 { .rfmax = 679900, .val = 0x0e },
213 { .rfmax = 698400, .val = 0x0d },
214 { .rfmax = 716900, .val = 0x0c },
215 { .rfmax = 735400, .val = 0x0b },
216 { .rfmax = 753900, .val = 0x0a },
217 { .rfmax = 772500, .val = 0x09 },
218 { .rfmax = 791000, .val = 0x08 },
219 { .rfmax = 809500, .val = 0x07 },
220 { .rfmax = 828000, .val = 0x06 },
221 { .rfmax = 846500, .val = 0x05 },
222 { .rfmax = 865000, .val = 0x04 },
223 { .rfmax = 0, .val = 0x00 }, /* end */
224};
225
226struct tda18271_map tda18271_rf_cal[] = {
227 { .rfmax = 41000, .val = 0x1e },
228 { .rfmax = 43000, .val = 0x30 },
229 { .rfmax = 45000, .val = 0x43 },
230 { .rfmax = 46000, .val = 0x4d },
231 { .rfmax = 47000, .val = 0x54 },
232 { .rfmax = 47900, .val = 0x64 },
233 { .rfmax = 49100, .val = 0x20 },
234 { .rfmax = 50000, .val = 0x22 },
235 { .rfmax = 51000, .val = 0x2a },
236 { .rfmax = 53000, .val = 0x32 },
237 { .rfmax = 55000, .val = 0x35 },
238 { .rfmax = 56000, .val = 0x3c },
239 { .rfmax = 57000, .val = 0x3f },
240 { .rfmax = 58000, .val = 0x48 },
241 { .rfmax = 59000, .val = 0x4d },
242 { .rfmax = 60000, .val = 0x58 },
243 { .rfmax = 61100, .val = 0x5f },
244 { .rfmax = 0, .val = 0x00 }, /* end */
245};
246
247/*
248 * Overrides for Emacs so that we follow Linus's tabbing style.
249 * ---------------------------------------------------------------------------
250 * Local variables:
251 * c-basic-offset: 8
252 * End:
253 */