blob: 6707832bdcab00fc26ed2344362ca38a5b0bdb22 [file] [log] [blame]
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001/*
2 NXP TDA10048HN DVB OFDM demodulator driver
3
Steven Toth9e081992009-05-15 21:01:57 -03004 Copyright (C) 2009 Steven Toth <stoth@kernellabs.com>
Steven Toth7bbb1ce2008-04-19 01:06:25 -03005
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
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/string.h>
26#include <linux/slab.h>
27#include <linux/delay.h>
Steven Tothd1141532009-05-02 11:07:29 -030028#include <asm/div64.h>
Steven Toth7bbb1ce2008-04-19 01:06:25 -030029#include "dvb_frontend.h"
Steven Tothd5b3d9f2008-04-22 22:52:01 -030030#include "dvb_math.h"
Steven Toth7bbb1ce2008-04-19 01:06:25 -030031#include "tda10048.h"
32
33#define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw"
34#define TDA10048_DEFAULT_FIRMWARE_SIZE 24878
35
36/* Register name definitions */
37#define TDA10048_IDENTITY 0x00
38#define TDA10048_VERSION 0x01
39#define TDA10048_DSP_CODE_CPT 0x0C
40#define TDA10048_DSP_CODE_IN 0x0E
41#define TDA10048_IN_CONF1 0x10
42#define TDA10048_IN_CONF2 0x11
43#define TDA10048_IN_CONF3 0x12
44#define TDA10048_OUT_CONF1 0x14
45#define TDA10048_OUT_CONF2 0x15
46#define TDA10048_OUT_CONF3 0x16
47#define TDA10048_AUTO 0x18
48#define TDA10048_SYNC_STATUS 0x1A
49#define TDA10048_CONF_C4_1 0x1E
50#define TDA10048_CONF_C4_2 0x1F
51#define TDA10048_CODE_IN_RAM 0x20
52#define TDA10048_CHANNEL_INFO_1_R 0x22
53#define TDA10048_CHANNEL_INFO_2_R 0x23
54#define TDA10048_CHANNEL_INFO1 0x24
55#define TDA10048_CHANNEL_INFO2 0x25
56#define TDA10048_TIME_ERROR_R 0x26
57#define TDA10048_TIME_ERROR 0x27
58#define TDA10048_FREQ_ERROR_LSB_R 0x28
59#define TDA10048_FREQ_ERROR_MSB_R 0x29
60#define TDA10048_FREQ_ERROR_LSB 0x2A
61#define TDA10048_FREQ_ERROR_MSB 0x2B
62#define TDA10048_IT_SEL 0x30
63#define TDA10048_IT_STAT 0x32
64#define TDA10048_DSP_AD_LSB 0x3C
65#define TDA10048_DSP_AD_MSB 0x3D
66#define TDA10048_DSP_REF_LSB 0x3E
67#define TDA10048_DSP_REF_MSB 0x3F
68#define TDA10048_CONF_TRISTATE1 0x44
69#define TDA10048_CONF_TRISTATE2 0x45
70#define TDA10048_CONF_POLARITY 0x46
71#define TDA10048_GPIO_SP_DS0 0x48
72#define TDA10048_GPIO_SP_DS1 0x49
73#define TDA10048_GPIO_SP_DS2 0x4A
74#define TDA10048_GPIO_SP_DS3 0x4B
75#define TDA10048_GPIO_OUT_SEL 0x4C
76#define TDA10048_GPIO_SELECT 0x4D
77#define TDA10048_IC_MODE 0x4E
78#define TDA10048_CONF_XO 0x50
79#define TDA10048_CONF_PLL1 0x51
80#define TDA10048_CONF_PLL2 0x52
81#define TDA10048_CONF_PLL3 0x53
82#define TDA10048_CONF_ADC 0x54
83#define TDA10048_CONF_ADC_2 0x55
84#define TDA10048_CONF_C1_1 0x60
85#define TDA10048_CONF_C1_3 0x62
86#define TDA10048_AGC_CONF 0x70
87#define TDA10048_AGC_THRESHOLD_LSB 0x72
88#define TDA10048_AGC_THRESHOLD_MSB 0x73
89#define TDA10048_AGC_RENORM 0x74
90#define TDA10048_AGC_GAINS 0x76
91#define TDA10048_AGC_TUN_MIN 0x78
92#define TDA10048_AGC_TUN_MAX 0x79
93#define TDA10048_AGC_IF_MIN 0x7A
94#define TDA10048_AGC_IF_MAX 0x7B
95#define TDA10048_AGC_TUN_LEVEL 0x7E
96#define TDA10048_AGC_IF_LEVEL 0x7F
97#define TDA10048_DIG_AGC_LEVEL 0x81
98#define TDA10048_FREQ_PHY2_LSB 0x86
99#define TDA10048_FREQ_PHY2_MSB 0x87
100#define TDA10048_TIME_INVWREF_LSB 0x88
101#define TDA10048_TIME_INVWREF_MSB 0x89
102#define TDA10048_TIME_WREF_LSB 0x8A
103#define TDA10048_TIME_WREF_MID1 0x8B
104#define TDA10048_TIME_WREF_MID2 0x8C
105#define TDA10048_TIME_WREF_MSB 0x8D
106#define TDA10048_NP_OUT 0xA2
107#define TDA10048_CELL_ID_LSB 0xA4
108#define TDA10048_CELL_ID_MSB 0xA5
109#define TDA10048_EXTTPS_ODD 0xAA
110#define TDA10048_EXTTPS_EVEN 0xAB
111#define TDA10048_TPS_LENGTH 0xAC
112#define TDA10048_FREE_REG_1 0xB2
113#define TDA10048_FREE_REG_2 0xB3
114#define TDA10048_CONF_C3_1 0xC0
115#define TDA10048_CYBER_CTRL 0xC2
116#define TDA10048_CBER_NMAX_LSB 0xC4
117#define TDA10048_CBER_NMAX_MSB 0xC5
118#define TDA10048_CBER_LSB 0xC6
119#define TDA10048_CBER_MSB 0xC7
120#define TDA10048_VBER_LSB 0xC8
121#define TDA10048_VBER_MID 0xC9
122#define TDA10048_VBER_MSB 0xCA
123#define TDA10048_CYBER_LUT 0xCC
124#define TDA10048_UNCOR_CTRL 0xCD
125#define TDA10048_UNCOR_CPT_LSB 0xCE
126#define TDA10048_UNCOR_CPT_MSB 0xCF
127#define TDA10048_SOFT_IT_C3 0xD6
128#define TDA10048_CONF_TS2 0xE0
129#define TDA10048_CONF_TS1 0xE1
130
131static unsigned int debug;
132
133#define dprintk(level, fmt, arg...)\
134 do { if (debug >= level)\
135 printk(KERN_DEBUG "tda10048: " fmt, ## arg);\
136 } while (0)
137
138struct tda10048_state {
139
140 struct i2c_adapter *i2c;
141
Steven Toth9e081992009-05-15 21:01:57 -0300142 /* We'll cache and update the attach config settings */
143 struct tda10048_config config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300144 struct dvb_frontend frontend;
145
146 int fwloaded;
Steven Tothd1141532009-05-02 11:07:29 -0300147
148 u32 freq_if_hz;
149 u32 xtal_hz;
150 u32 pll_mfactor;
151 u32 pll_nfactor;
152 u32 pll_pfactor;
153 u32 sample_freq;
154
155 enum fe_bandwidth bandwidth;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300156};
157
158static struct init_tab {
159 u8 reg;
160 u16 data;
161} init_tab[] = {
162 { TDA10048_CONF_PLL1, 0x08 },
163 { TDA10048_CONF_ADC_2, 0x00 },
164 { TDA10048_CONF_C4_1, 0x00 },
165 { TDA10048_CONF_PLL1, 0x0f },
166 { TDA10048_CONF_PLL2, 0x0a },
167 { TDA10048_CONF_PLL3, 0x43 },
168 { TDA10048_FREQ_PHY2_LSB, 0x02 },
169 { TDA10048_FREQ_PHY2_MSB, 0x0a },
170 { TDA10048_TIME_WREF_LSB, 0xbd },
171 { TDA10048_TIME_WREF_MID1, 0xe4 },
172 { TDA10048_TIME_WREF_MID2, 0xa8 },
173 { TDA10048_TIME_WREF_MSB, 0x02 },
174 { TDA10048_TIME_INVWREF_LSB, 0x04 },
175 { TDA10048_TIME_INVWREF_MSB, 0x06 },
176 { TDA10048_CONF_C4_1, 0x00 },
177 { TDA10048_CONF_C1_1, 0xa8 },
178 { TDA10048_AGC_CONF, 0x16 },
179 { TDA10048_CONF_C1_3, 0x0b },
180 { TDA10048_AGC_TUN_MIN, 0x00 },
181 { TDA10048_AGC_TUN_MAX, 0xff },
182 { TDA10048_AGC_IF_MIN, 0x00 },
183 { TDA10048_AGC_IF_MAX, 0xff },
184 { TDA10048_AGC_THRESHOLD_MSB, 0x00 },
185 { TDA10048_AGC_THRESHOLD_LSB, 0x70 },
186 { TDA10048_CYBER_CTRL, 0x38 },
187 { TDA10048_AGC_GAINS, 0x12 },
188 { TDA10048_CONF_XO, 0x00 },
189 { TDA10048_CONF_TS1, 0x07 },
190 { TDA10048_IC_MODE, 0x00 },
191 { TDA10048_CONF_TS2, 0xc0 },
192 { TDA10048_CONF_TRISTATE1, 0x21 },
193 { TDA10048_CONF_TRISTATE2, 0x00 },
194 { TDA10048_CONF_POLARITY, 0x00 },
195 { TDA10048_CONF_C4_2, 0x04 },
196 { TDA10048_CONF_ADC, 0x60 },
197 { TDA10048_CONF_ADC_2, 0x10 },
198 { TDA10048_CONF_ADC, 0x60 },
199 { TDA10048_CONF_ADC_2, 0x00 },
200 { TDA10048_CONF_C1_1, 0xa8 },
201 { TDA10048_UNCOR_CTRL, 0x00 },
202 { TDA10048_CONF_C4_2, 0x04 },
203};
204
Steven Toth9e081992009-05-15 21:01:57 -0300205static struct pll_tab {
206 u32 clk_freq_khz;
207 u32 if_freq_khz;
208 u8 m, n, p;
209} pll_tab[] = {
210 { TDA10048_CLK_4000, TDA10048_IF_36130, 10, 0, 0 },
211 { TDA10048_CLK_16000, TDA10048_IF_4300, 10, 3, 0 },
212 { TDA10048_CLK_16000, TDA10048_IF_4000, 10, 3, 0 },
213 { TDA10048_CLK_16000, TDA10048_IF_36130, 10, 3, 0 },
214};
215
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300216static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data)
217{
Steven Toth9e081992009-05-15 21:01:57 -0300218 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300219 int ret;
Steven Toth5c2a1642008-10-16 20:22:57 -0300220 u8 buf[] = { reg, data };
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300221 struct i2c_msg msg = {
Steven Toth9e081992009-05-15 21:01:57 -0300222 .addr = config->demod_address,
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300223 .flags = 0, .buf = buf, .len = 2 };
224
225 dprintk(2, "%s(reg = 0x%02x, data = 0x%02x)\n", __func__, reg, data);
226
227 ret = i2c_transfer(state->i2c, &msg, 1);
228
229 if (ret != 1)
230 printk("%s: writereg error (ret == %i)\n", __func__, ret);
231
232 return (ret != 1) ? -1 : 0;
233}
234
235static u8 tda10048_readreg(struct tda10048_state *state, u8 reg)
236{
Steven Toth9e081992009-05-15 21:01:57 -0300237 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300238 int ret;
Steven Toth5c2a1642008-10-16 20:22:57 -0300239 u8 b0[] = { reg };
240 u8 b1[] = { 0 };
241 struct i2c_msg msg[] = {
Steven Toth9e081992009-05-15 21:01:57 -0300242 { .addr = config->demod_address,
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300243 .flags = 0, .buf = b0, .len = 1 },
Steven Toth9e081992009-05-15 21:01:57 -0300244 { .addr = config->demod_address,
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300245 .flags = I2C_M_RD, .buf = b1, .len = 1 } };
246
247 dprintk(2, "%s(reg = 0x%02x)\n", __func__, reg);
248
249 ret = i2c_transfer(state->i2c, msg, 2);
250
251 if (ret != 2)
252 printk(KERN_ERR "%s: readreg error (ret == %i)\n",
253 __func__, ret);
254
255 return b1[0];
256}
257
258static int tda10048_writeregbulk(struct tda10048_state *state, u8 reg,
David Woodhousebc179152008-05-24 00:12:23 +0100259 const u8 *data, u16 len)
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300260{
Steven Toth9e081992009-05-15 21:01:57 -0300261 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300262 int ret = -EREMOTEIO;
263 struct i2c_msg msg;
264 u8 *buf;
265
266 dprintk(2, "%s(%d, ?, len = %d)\n", __func__, reg, len);
267
268 buf = kmalloc(len + 1, GFP_KERNEL);
269 if (buf == NULL) {
270 ret = -ENOMEM;
271 goto error;
272 }
273
274 *buf = reg;
275 memcpy(buf + 1, data, len);
276
Steven Toth9e081992009-05-15 21:01:57 -0300277 msg.addr = config->demod_address;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300278 msg.flags = 0;
279 msg.buf = buf;
280 msg.len = len + 1;
281
282 dprintk(2, "%s(): write len = %d\n",
283 __func__, msg.len);
284
285 ret = i2c_transfer(state->i2c, &msg, 1);
286 if (ret != 1) {
287 printk(KERN_ERR "%s(): writereg error err %i\n",
288 __func__, ret);
289 ret = -EREMOTEIO;
290 }
291
292error:
293 kfree(buf);
294
295 return ret;
296}
297
Steven Tothd1141532009-05-02 11:07:29 -0300298static int tda10048_set_phy2(struct dvb_frontend *fe, u32 sample_freq_hz,
299 u32 if_hz)
300{
301 struct tda10048_state *state = fe->demodulator_priv;
302 u64 t;
303
304 dprintk(1, "%s()\n", __func__);
305
306 if (sample_freq_hz == 0)
307 return -EINVAL;
308
309 if (if_hz < (sample_freq_hz / 2)) {
310 /* PHY2 = (if2/fs) * 2^15 */
311 t = if_hz;
312 t *= 10;
313 t *= 32768;
314 do_div(t, sample_freq_hz);
315 t += 5;
316 do_div(t, 10);
317 } else {
318 /* PHY2 = ((IF1-fs)/fs) * 2^15 */
319 t = sample_freq_hz - if_hz;
320 t *= 10;
321 t *= 32768;
322 do_div(t, sample_freq_hz);
323 t += 5;
324 do_div(t, 10);
325 t = ~t + 1;
326 }
327
328 tda10048_writereg(state, TDA10048_FREQ_PHY2_LSB, (u8)t);
329 tda10048_writereg(state, TDA10048_FREQ_PHY2_MSB, (u8)(t >> 8));
330
331 return 0;
332}
333
334static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz,
335 u32 bw)
336{
337 struct tda10048_state *state = fe->demodulator_priv;
338 u64 t, z;
339 u32 b = 8000000;
340
341 dprintk(1, "%s()\n", __func__);
342
343 if (sample_freq_hz == 0)
344 return -EINVAL;
345
346 if (bw == BANDWIDTH_6_MHZ)
347 b = 6000000;
348 else
349 if (bw == BANDWIDTH_7_MHZ)
350 b = 7000000;
351
352 /* WREF = (B / (7 * fs)) * 2^31 */
353 t = b * 10;
354 /* avoid warning: this decimal constant is unsigned only in ISO C90 */
355 /* t *= 2147483648 on 32bit platforms */
356 t *= (2048 * 1024);
357 t *= 1024;
358 z = 7 * sample_freq_hz;
359 do_div(t, z);
360 t += 5;
361 do_div(t, 10);
362
363 tda10048_writereg(state, TDA10048_TIME_WREF_LSB, (u8)t);
364 tda10048_writereg(state, TDA10048_TIME_WREF_MID1, (u8)(t >> 8));
365 tda10048_writereg(state, TDA10048_TIME_WREF_MID2, (u8)(t >> 16));
366 tda10048_writereg(state, TDA10048_TIME_WREF_MSB, (u8)(t >> 24));
367
368 return 0;
369}
370
371static int tda10048_set_invwref(struct dvb_frontend *fe, u32 sample_freq_hz,
372 u32 bw)
373{
374 struct tda10048_state *state = fe->demodulator_priv;
375 u64 t;
376 u32 b = 8000000;
377
378 dprintk(1, "%s()\n", __func__);
379
380 if (sample_freq_hz == 0)
381 return -EINVAL;
382
383 if (bw == BANDWIDTH_6_MHZ)
384 b = 6000000;
385 else
386 if (bw == BANDWIDTH_7_MHZ)
387 b = 7000000;
388
389 /* INVWREF = ((7 * fs) / B) * 2^5 */
390 t = sample_freq_hz;
391 t *= 7;
392 t *= 32;
393 t *= 10;
394 do_div(t, b);
395 t += 5;
396 do_div(t, 10);
397
398 tda10048_writereg(state, TDA10048_TIME_INVWREF_LSB, (u8)t);
399 tda10048_writereg(state, TDA10048_TIME_INVWREF_MSB, (u8)(t >> 8));
400
401 return 0;
402}
403
404static int tda10048_set_bandwidth(struct dvb_frontend *fe,
405 enum fe_bandwidth bw)
406{
407 struct tda10048_state *state = fe->demodulator_priv;
408 dprintk(1, "%s(bw=%d)\n", __func__, bw);
409
410 /* Bandwidth setting may need to be adjusted */
411 switch (bw) {
412 case BANDWIDTH_6_MHZ:
413 case BANDWIDTH_7_MHZ:
414 case BANDWIDTH_8_MHZ:
415 tda10048_set_wref(fe, state->sample_freq, bw);
416 tda10048_set_invwref(fe, state->sample_freq, bw);
417 break;
418 default:
419 printk(KERN_ERR "%s() invalid bandwidth\n", __func__);
420 return -EINVAL;
421 }
422
423 state->bandwidth = bw;
424
425 return 0;
426}
427
Steven Toth9e081992009-05-15 21:01:57 -0300428static int tda10048_set_if(struct dvb_frontend *fe, enum fe_bandwidth bw)
Steven Tothd1141532009-05-02 11:07:29 -0300429{
430 struct tda10048_state *state = fe->demodulator_priv;
Steven Toth9e081992009-05-15 21:01:57 -0300431 struct tda10048_config *config = &state->config;
432 int i;
433 u32 if_freq_khz;
Steven Tothd1141532009-05-02 11:07:29 -0300434
Steven Toth9e081992009-05-15 21:01:57 -0300435 dprintk(1, "%s(bw = %d)\n", __func__, bw);
Steven Tothd1141532009-05-02 11:07:29 -0300436
Steven Toth9e081992009-05-15 21:01:57 -0300437 /* based on target bandwidth and clk we calculate pll factors */
438 switch (bw) {
439 case BANDWIDTH_6_MHZ:
440 if_freq_khz = config->dtv6_if_freq_khz;
441 break;
442 case BANDWIDTH_7_MHZ:
443 if_freq_khz = config->dtv7_if_freq_khz;
444 break;
445 case BANDWIDTH_8_MHZ:
446 if_freq_khz = config->dtv8_if_freq_khz;
447 break;
448 default:
449 printk(KERN_ERR "%s() no default\n", __func__);
450 return -EINVAL;
451 }
452
453 for (i = 0; i < ARRAY_SIZE(pll_tab); i++) {
454 if ((pll_tab[i].clk_freq_khz == config->clk_freq_khz) &&
455 (pll_tab[i].if_freq_khz == if_freq_khz)) {
456
457 state->freq_if_hz = pll_tab[i].if_freq_khz * 1000;
458 state->xtal_hz = pll_tab[i].clk_freq_khz * 1000;
459 state->pll_mfactor = pll_tab[i].m;
460 state->pll_nfactor = pll_tab[i].n;
461 state->pll_pfactor = pll_tab[i].p;
462 break;
463 }
464 }
465 if (i == ARRAY_SIZE(pll_tab)) {
466 printk(KERN_ERR "%s() Incorrect attach settings\n",
467 __func__);
468 return -EINVAL;
Steven Tothd1141532009-05-02 11:07:29 -0300469 }
470
471 dprintk(1, "- freq_if_hz = %d\n", state->freq_if_hz);
472 dprintk(1, "- xtal_hz = %d\n", state->xtal_hz);
473 dprintk(1, "- pll_mfactor = %d\n", state->pll_mfactor);
474 dprintk(1, "- pll_nfactor = %d\n", state->pll_nfactor);
475 dprintk(1, "- pll_pfactor = %d\n", state->pll_pfactor);
476
477 /* Calculate the sample frequency */
478 state->sample_freq = state->xtal_hz * (state->pll_mfactor + 45);
479 state->sample_freq /= (state->pll_nfactor + 1);
480 state->sample_freq /= (state->pll_pfactor + 4);
481 dprintk(1, "- sample_freq = %d\n", state->sample_freq);
482
Steven Toth9e081992009-05-15 21:01:57 -0300483 /* Update the I/F */
484 tda10048_set_phy2(fe, state->sample_freq, state->freq_if_hz);
Steven Tothd1141532009-05-02 11:07:29 -0300485
Steven Toth9e081992009-05-15 21:01:57 -0300486 return 0;
Steven Tothd1141532009-05-02 11:07:29 -0300487}
488
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300489static int tda10048_firmware_upload(struct dvb_frontend *fe)
490{
491 struct tda10048_state *state = fe->demodulator_priv;
Steven Toth9e081992009-05-15 21:01:57 -0300492 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300493 const struct firmware *fw;
494 int ret;
495 int pos = 0;
496 int cnt;
Steven Toth9e081992009-05-15 21:01:57 -0300497 u8 wlen = config->fwbulkwritelen;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300498
499 if ((wlen != TDA10048_BULKWRITE_200) && (wlen != TDA10048_BULKWRITE_50))
500 wlen = TDA10048_BULKWRITE_200;
501
502 /* request the firmware, this will block and timeout */
503 printk(KERN_INFO "%s: waiting for firmware upload (%s)...\n",
504 __func__,
505 TDA10048_DEFAULT_FIRMWARE);
506
507 ret = request_firmware(&fw, TDA10048_DEFAULT_FIRMWARE,
Jean Delvaree9785252009-04-26 05:43:59 -0300508 state->i2c->dev.parent);
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300509 if (ret) {
510 printk(KERN_ERR "%s: Upload failed. (file not found?)\n",
511 __func__);
512 return -EIO;
513 } else {
514 printk(KERN_INFO "%s: firmware read %Zu bytes.\n",
515 __func__,
516 fw->size);
517 ret = 0;
518 }
519
520 if (fw->size != TDA10048_DEFAULT_FIRMWARE_SIZE) {
521 printk(KERN_ERR "%s: firmware incorrect size\n", __func__);
Adrian Bunk877b5f42008-09-03 17:12:25 -0300522 ret = -EIO;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300523 } else {
524 printk(KERN_INFO "%s: firmware uploading\n", __func__);
525
526 /* Soft reset */
527 tda10048_writereg(state, TDA10048_CONF_TRISTATE1,
528 tda10048_readreg(state, TDA10048_CONF_TRISTATE1)
529 & 0xfe);
530 tda10048_writereg(state, TDA10048_CONF_TRISTATE1,
531 tda10048_readreg(state, TDA10048_CONF_TRISTATE1)
532 | 0x01);
533
534 /* Put the demod into host download mode */
535 tda10048_writereg(state, TDA10048_CONF_C4_1,
536 tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xf9);
537
538 /* Boot the DSP */
539 tda10048_writereg(state, TDA10048_CONF_C4_1,
540 tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x08);
541
542 /* Prepare for download */
543 tda10048_writereg(state, TDA10048_DSP_CODE_CPT, 0);
544
545 /* Download the firmware payload */
546 while (pos < fw->size) {
547
548 if ((fw->size - pos) > wlen)
549 cnt = wlen;
550 else
551 cnt = fw->size - pos;
552
553 tda10048_writeregbulk(state, TDA10048_DSP_CODE_IN,
554 &fw->data[pos], cnt);
555
556 pos += cnt;
557 }
558
559 ret = -EIO;
560 /* Wait up to 250ms for the DSP to boot */
561 for (cnt = 0; cnt < 250 ; cnt += 10) {
562
563 msleep(10);
564
565 if (tda10048_readreg(state, TDA10048_SYNC_STATUS)
566 & 0x40) {
567 ret = 0;
568 break;
569 }
570 }
571 }
572
573 release_firmware(fw);
574
575 if (ret == 0) {
576 printk(KERN_INFO "%s: firmware uploaded\n", __func__);
577 state->fwloaded = 1;
578 } else
579 printk(KERN_ERR "%s: firmware upload failed\n", __func__);
580
581 return ret;
582}
583
584static int tda10048_set_inversion(struct dvb_frontend *fe, int inversion)
585{
586 struct tda10048_state *state = fe->demodulator_priv;
587
588 dprintk(1, "%s(%d)\n", __func__, inversion);
589
590 if (inversion == TDA10048_INVERSION_ON)
591 tda10048_writereg(state, TDA10048_CONF_C1_1,
592 tda10048_readreg(state, TDA10048_CONF_C1_1) | 0x20);
593 else
594 tda10048_writereg(state, TDA10048_CONF_C1_1,
595 tda10048_readreg(state, TDA10048_CONF_C1_1) & 0xdf);
596
597 return 0;
598}
599
600/* Retrieve the demod settings */
601static int tda10048_get_tps(struct tda10048_state *state,
602 struct dvb_ofdm_parameters *p)
603{
604 u8 val;
605
606 /* Make sure the TPS regs are valid */
607 if (!(tda10048_readreg(state, TDA10048_AUTO) & 0x01))
608 return -EAGAIN;
609
610 val = tda10048_readreg(state, TDA10048_OUT_CONF2);
611 switch ((val & 0x60) >> 5) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300612 case 0:
613 p->constellation = QPSK;
614 break;
615 case 1:
616 p->constellation = QAM_16;
617 break;
618 case 2:
619 p->constellation = QAM_64;
620 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300621 }
622 switch ((val & 0x18) >> 3) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300623 case 0:
624 p->hierarchy_information = HIERARCHY_NONE;
625 break;
626 case 1:
627 p->hierarchy_information = HIERARCHY_1;
628 break;
629 case 2:
630 p->hierarchy_information = HIERARCHY_2;
631 break;
632 case 3:
633 p->hierarchy_information = HIERARCHY_4;
634 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300635 }
636 switch (val & 0x07) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300637 case 0:
638 p->code_rate_HP = FEC_1_2;
639 break;
640 case 1:
641 p->code_rate_HP = FEC_2_3;
642 break;
643 case 2:
644 p->code_rate_HP = FEC_3_4;
645 break;
646 case 3:
647 p->code_rate_HP = FEC_5_6;
648 break;
649 case 4:
650 p->code_rate_HP = FEC_7_8;
651 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300652 }
653
654 val = tda10048_readreg(state, TDA10048_OUT_CONF3);
655 switch (val & 0x07) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300656 case 0:
657 p->code_rate_LP = FEC_1_2;
658 break;
659 case 1:
660 p->code_rate_LP = FEC_2_3;
661 break;
662 case 2:
663 p->code_rate_LP = FEC_3_4;
664 break;
665 case 3:
666 p->code_rate_LP = FEC_5_6;
667 break;
668 case 4:
669 p->code_rate_LP = FEC_7_8;
670 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300671 }
672
673 val = tda10048_readreg(state, TDA10048_OUT_CONF1);
674 switch ((val & 0x0c) >> 2) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300675 case 0:
676 p->guard_interval = GUARD_INTERVAL_1_32;
677 break;
678 case 1:
679 p->guard_interval = GUARD_INTERVAL_1_16;
680 break;
681 case 2:
682 p->guard_interval = GUARD_INTERVAL_1_8;
683 break;
684 case 3:
685 p->guard_interval = GUARD_INTERVAL_1_4;
686 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300687 }
688 switch (val & 0x02) {
Steven Toth5c2a1642008-10-16 20:22:57 -0300689 case 0:
690 p->transmission_mode = TRANSMISSION_MODE_2K;
691 break;
692 case 1:
693 p->transmission_mode = TRANSMISSION_MODE_8K;
694 break;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300695 }
696
697 return 0;
698}
699
700static int tda10048_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
701{
702 struct tda10048_state *state = fe->demodulator_priv;
Steven Toth9e081992009-05-15 21:01:57 -0300703 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300704 dprintk(1, "%s(%d)\n", __func__, enable);
705
Steven Toth9e081992009-05-15 21:01:57 -0300706 if (config->disable_gate_access)
Steven Toth8153c3b2009-05-05 19:30:27 -0300707 return 0;
708
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300709 if (enable)
710 return tda10048_writereg(state, TDA10048_CONF_C4_1,
711 tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x02);
712 else
713 return tda10048_writereg(state, TDA10048_CONF_C4_1,
714 tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xfd);
715}
716
717static int tda10048_output_mode(struct dvb_frontend *fe, int serial)
718{
719 struct tda10048_state *state = fe->demodulator_priv;
720 dprintk(1, "%s(%d)\n", __func__, serial);
721
722 /* Ensure pins are out of tri-state */
723 tda10048_writereg(state, TDA10048_CONF_TRISTATE1, 0x21);
724 tda10048_writereg(state, TDA10048_CONF_TRISTATE2, 0x00);
725
726 if (serial) {
727 tda10048_writereg(state, TDA10048_IC_MODE, 0x80 | 0x20);
728 tda10048_writereg(state, TDA10048_CONF_TS2, 0xc0);
729 } else {
730 tda10048_writereg(state, TDA10048_IC_MODE, 0x00);
731 tda10048_writereg(state, TDA10048_CONF_TS2, 0x01);
732 }
733
734 return 0;
735}
736
737/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
738/* TODO: Support manual tuning with specific params */
739static int tda10048_set_frontend(struct dvb_frontend *fe,
740 struct dvb_frontend_parameters *p)
741{
742 struct tda10048_state *state = fe->demodulator_priv;
743
744 dprintk(1, "%s(frequency=%d)\n", __func__, p->frequency);
745
Steven Toth9e081992009-05-15 21:01:57 -0300746 /* Update the I/F pll's if the bandwidth changes */
747 if (p->u.ofdm.bandwidth != state->bandwidth) {
748 tda10048_set_if(fe, p->u.ofdm.bandwidth);
Steven Tothd1141532009-05-02 11:07:29 -0300749 tda10048_set_bandwidth(fe, p->u.ofdm.bandwidth);
Steven Toth9e081992009-05-15 21:01:57 -0300750 }
Steven Tothd1141532009-05-02 11:07:29 -0300751
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300752 if (fe->ops.tuner_ops.set_params) {
753
754 if (fe->ops.i2c_gate_ctrl)
755 fe->ops.i2c_gate_ctrl(fe, 1);
756
757 fe->ops.tuner_ops.set_params(fe, p);
758
759 if (fe->ops.i2c_gate_ctrl)
760 fe->ops.i2c_gate_ctrl(fe, 0);
761 }
762
763 /* Enable demod TPS auto detection and begin acquisition */
764 tda10048_writereg(state, TDA10048_AUTO, 0x57);
765
766 return 0;
767}
768
769/* Establish sane defaults and load firmware. */
770static int tda10048_init(struct dvb_frontend *fe)
771{
772 struct tda10048_state *state = fe->demodulator_priv;
Steven Toth9e081992009-05-15 21:01:57 -0300773 struct tda10048_config *config = &state->config;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300774 int ret = 0, i;
775
776 dprintk(1, "%s()\n", __func__);
777
778 /* Apply register defaults */
779 for (i = 0; i < ARRAY_SIZE(init_tab); i++)
780 tda10048_writereg(state, init_tab[i].reg, init_tab[i].data);
781
782 if (state->fwloaded == 0)
783 ret = tda10048_firmware_upload(fe);
784
785 /* Set either serial or parallel */
Steven Toth9e081992009-05-15 21:01:57 -0300786 tda10048_output_mode(fe, config->output_mode);
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300787
Steven Tothd1141532009-05-02 11:07:29 -0300788 /* Set inversion */
Steven Toth9e081992009-05-15 21:01:57 -0300789 tda10048_set_inversion(fe, config->inversion);
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300790
Steven Toth9e081992009-05-15 21:01:57 -0300791 /* Establish default RF values */
792 tda10048_set_if(fe, BANDWIDTH_8_MHZ);
Steven Tothd1141532009-05-02 11:07:29 -0300793 tda10048_set_bandwidth(fe, BANDWIDTH_8_MHZ);
794
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300795 /* Ensure we leave the gate closed */
796 tda10048_i2c_gate_ctrl(fe, 0);
797
798 return ret;
799}
800
801static int tda10048_read_status(struct dvb_frontend *fe, fe_status_t *status)
802{
803 struct tda10048_state *state = fe->demodulator_priv;
804 u8 reg;
805
806 *status = 0;
807
808 reg = tda10048_readreg(state, TDA10048_SYNC_STATUS);
809
810 dprintk(1, "%s() status =0x%02x\n", __func__, reg);
811
812 if (reg & 0x02)
813 *status |= FE_HAS_CARRIER;
814
815 if (reg & 0x04)
816 *status |= FE_HAS_SIGNAL;
817
818 if (reg & 0x08) {
819 *status |= FE_HAS_LOCK;
820 *status |= FE_HAS_VITERBI;
821 *status |= FE_HAS_SYNC;
822 }
823
824 return 0;
825}
826
827static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber)
828{
829 struct tda10048_state *state = fe->demodulator_priv;
830
831 dprintk(1, "%s()\n", __func__);
832
833 /* TODO: A reset may be required here */
834 *ber = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 |
835 tda10048_readreg(state, TDA10048_CBER_LSB);
836
837 return 0;
838}
839
840static int tda10048_read_signal_strength(struct dvb_frontend *fe,
841 u16 *signal_strength)
842{
843 struct tda10048_state *state = fe->demodulator_priv;
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300844 u8 v;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300845
846 dprintk(1, "%s()\n", __func__);
847
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300848 *signal_strength = 65535;
849
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300850 v = tda10048_readreg(state, TDA10048_NP_OUT);
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300851 if (v > 0)
852 *signal_strength -= (v << 8) | v;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300853
854 return 0;
855}
856
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300857/* SNR lookup table */
858static struct snr_tab {
859 u8 val;
860 u8 data;
861} snr_tab[] = {
862 { 0, 0 },
863 { 1, 246 },
864 { 2, 215 },
865 { 3, 198 },
866 { 4, 185 },
867 { 5, 176 },
868 { 6, 168 },
869 { 7, 161 },
870 { 8, 155 },
871 { 9, 150 },
872 { 10, 146 },
873 { 11, 141 },
874 { 12, 138 },
875 { 13, 134 },
876 { 14, 131 },
877 { 15, 128 },
878 { 16, 125 },
879 { 17, 122 },
880 { 18, 120 },
881 { 19, 118 },
882 { 20, 115 },
883 { 21, 113 },
884 { 22, 111 },
885 { 23, 109 },
886 { 24, 107 },
887 { 25, 106 },
888 { 26, 104 },
889 { 27, 102 },
890 { 28, 101 },
891 { 29, 99 },
892 { 30, 98 },
893 { 31, 96 },
894 { 32, 95 },
895 { 33, 94 },
896 { 34, 92 },
897 { 35, 91 },
898 { 36, 90 },
899 { 37, 89 },
900 { 38, 88 },
901 { 39, 86 },
902 { 40, 85 },
903 { 41, 84 },
904 { 42, 83 },
905 { 43, 82 },
906 { 44, 81 },
907 { 45, 80 },
908 { 46, 79 },
909 { 47, 78 },
910 { 48, 77 },
911 { 49, 76 },
912 { 50, 76 },
913 { 51, 75 },
914 { 52, 74 },
915 { 53, 73 },
916 { 54, 72 },
917 { 56, 71 },
918 { 57, 70 },
919 { 58, 69 },
920 { 60, 68 },
921 { 61, 67 },
922 { 63, 66 },
923 { 64, 65 },
924 { 66, 64 },
925 { 67, 63 },
926 { 68, 62 },
927 { 69, 62 },
928 { 70, 61 },
929 { 72, 60 },
930 { 74, 59 },
931 { 75, 58 },
932 { 77, 57 },
933 { 79, 56 },
934 { 81, 55 },
935 { 83, 54 },
936 { 85, 53 },
937 { 87, 52 },
938 { 89, 51 },
939 { 91, 50 },
940 { 93, 49 },
941 { 95, 48 },
942 { 97, 47 },
943 { 100, 46 },
944 { 102, 45 },
945 { 104, 44 },
946 { 107, 43 },
947 { 109, 42 },
948 { 112, 41 },
949 { 114, 40 },
950 { 117, 39 },
951 { 120, 38 },
952 { 123, 37 },
953 { 125, 36 },
954 { 128, 35 },
955 { 131, 34 },
956 { 134, 33 },
957 { 138, 32 },
958 { 141, 31 },
959 { 144, 30 },
960 { 147, 29 },
961 { 151, 28 },
962 { 154, 27 },
963 { 158, 26 },
964 { 162, 25 },
965 { 165, 24 },
966 { 169, 23 },
967 { 173, 22 },
968 { 177, 21 },
969 { 181, 20 },
970 { 186, 19 },
971 { 190, 18 },
972 { 194, 17 },
973 { 199, 16 },
974 { 204, 15 },
975 { 208, 14 },
976 { 213, 13 },
977 { 218, 12 },
978 { 223, 11 },
979 { 229, 10 },
980 { 234, 9 },
981 { 239, 8 },
982 { 245, 7 },
983 { 251, 6 },
984 { 255, 5 },
985};
986
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300987static int tda10048_read_snr(struct dvb_frontend *fe, u16 *snr)
988{
989 struct tda10048_state *state = fe->demodulator_priv;
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300990 u8 v;
991 int i, ret = -EINVAL;
Steven Toth7bbb1ce2008-04-19 01:06:25 -0300992
993 dprintk(1, "%s()\n", __func__);
994
Steven Tothd5b3d9f2008-04-22 22:52:01 -0300995 v = tda10048_readreg(state, TDA10048_NP_OUT);
996 for (i = 0; i < ARRAY_SIZE(snr_tab); i++) {
997 if (v <= snr_tab[i].val) {
998 *snr = snr_tab[i].data;
999 ret = 0;
1000 break;
1001 }
1002 }
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001003
Steven Tothd5b3d9f2008-04-22 22:52:01 -03001004 return ret;
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001005}
1006
1007static int tda10048_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
1008{
1009 struct tda10048_state *state = fe->demodulator_priv;
1010
1011 dprintk(1, "%s()\n", __func__);
1012
1013 *ucblocks = tda10048_readreg(state, TDA10048_UNCOR_CPT_MSB) << 8 |
1014 tda10048_readreg(state, TDA10048_UNCOR_CPT_LSB);
1015
1016 return 0;
1017}
1018
1019static int tda10048_get_frontend(struct dvb_frontend *fe,
1020 struct dvb_frontend_parameters *p)
1021{
1022 struct tda10048_state *state = fe->demodulator_priv;
1023
1024 dprintk(1, "%s()\n", __func__);
1025
1026 p->inversion = tda10048_readreg(state, TDA10048_CONF_C1_1)
1027 & 0x20 ? INVERSION_ON : INVERSION_OFF;
1028
1029 return tda10048_get_tps(state, &p->u.ofdm);
1030}
1031
1032static int tda10048_get_tune_settings(struct dvb_frontend *fe,
1033 struct dvb_frontend_tune_settings *tune)
1034{
1035 tune->min_delay_ms = 1000;
1036 return 0;
1037}
1038
1039static void tda10048_release(struct dvb_frontend *fe)
1040{
1041 struct tda10048_state *state = fe->demodulator_priv;
1042 dprintk(1, "%s()\n", __func__);
1043 kfree(state);
1044}
1045
Steven Toth9e081992009-05-15 21:01:57 -03001046static void tda10048_establish_defaults(struct dvb_frontend *fe)
1047{
1048 struct tda10048_state *state = fe->demodulator_priv;
1049 struct tda10048_config *config = &state->config;
1050
1051 /* Validate/default the config */
1052 if (config->dtv6_if_freq_khz == 0) {
1053 config->dtv6_if_freq_khz = TDA10048_IF_4300;
1054 printk(KERN_WARNING "%s() tda10048_config.dtv6_if_freq_khz "
1055 "is not set (defaulting to %d)\n",
1056 __func__,
1057 config->dtv6_if_freq_khz);
1058 }
1059
1060 if (config->dtv7_if_freq_khz == 0) {
1061 config->dtv7_if_freq_khz = TDA10048_IF_4300;
1062 printk(KERN_WARNING "%s() tda10048_config.dtv7_if_freq_khz "
1063 "is not set (defaulting to %d)\n",
1064 __func__,
1065 config->dtv7_if_freq_khz);
1066 }
1067
1068 if (config->dtv8_if_freq_khz == 0) {
1069 config->dtv8_if_freq_khz = TDA10048_IF_4300;
1070 printk(KERN_WARNING "%s() tda10048_config.dtv8_if_freq_khz "
1071 "is not set (defaulting to %d)\n",
1072 __func__,
1073 config->dtv8_if_freq_khz);
1074 }
1075
1076 if (config->clk_freq_khz == 0) {
1077 config->clk_freq_khz = TDA10048_CLK_16000;
1078 printk(KERN_WARNING "%s() tda10048_config.clk_freq_khz "
1079 "is not set (defaulting to %d)\n",
1080 __func__,
1081 config->clk_freq_khz);
1082 }
1083}
1084
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001085static struct dvb_frontend_ops tda10048_ops;
1086
1087struct dvb_frontend *tda10048_attach(const struct tda10048_config *config,
1088 struct i2c_adapter *i2c)
1089{
1090 struct tda10048_state *state = NULL;
1091
1092 dprintk(1, "%s()\n", __func__);
1093
1094 /* allocate memory for the internal state */
1095 state = kmalloc(sizeof(struct tda10048_state), GFP_KERNEL);
1096 if (state == NULL)
1097 goto error;
1098
Steven Toth9e081992009-05-15 21:01:57 -03001099 /* setup the state and clone the config */
1100 memcpy(&state->config, config, sizeof(*config));
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001101 state->i2c = i2c;
1102 state->fwloaded = 0;
Steven Tothd1141532009-05-02 11:07:29 -03001103 state->bandwidth = BANDWIDTH_8_MHZ;
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001104
1105 /* check if the demod is present */
1106 if (tda10048_readreg(state, TDA10048_IDENTITY) != 0x048)
1107 goto error;
1108
1109 /* create dvb_frontend */
1110 memcpy(&state->frontend.ops, &tda10048_ops,
1111 sizeof(struct dvb_frontend_ops));
1112 state->frontend.demodulator_priv = state;
1113
Steven Toth9e081992009-05-15 21:01:57 -03001114 /* Establish any defaults the the user didn't pass */
1115 tda10048_establish_defaults(&state->frontend);
1116
Steven Tothd1141532009-05-02 11:07:29 -03001117 /* Set the xtal and freq defaults */
Steven Toth9e081992009-05-15 21:01:57 -03001118 if (tda10048_set_if(&state->frontend, BANDWIDTH_8_MHZ) != 0)
1119 goto error;
1120
1121 /* Default bandwidth */
1122 if (tda10048_set_bandwidth(&state->frontend, BANDWIDTH_8_MHZ) != 0)
Steven Tothd1141532009-05-02 11:07:29 -03001123 goto error;
1124
Steven Toth7bbb1ce2008-04-19 01:06:25 -03001125 /* Leave the gate closed */
1126 tda10048_i2c_gate_ctrl(&state->frontend, 0);
1127
1128 return &state->frontend;
1129
1130error:
1131 kfree(state);
1132 return NULL;
1133}
1134EXPORT_SYMBOL(tda10048_attach);
1135
1136static struct dvb_frontend_ops tda10048_ops = {
1137
1138 .info = {
1139 .name = "NXP TDA10048HN DVB-T",
1140 .type = FE_OFDM,
1141 .frequency_min = 177000000,
1142 .frequency_max = 858000000,
1143 .frequency_stepsize = 166666,
1144 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
1145 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
1146 FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
1147 FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
1148 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER
1149 },
1150
1151 .release = tda10048_release,
1152 .init = tda10048_init,
1153 .i2c_gate_ctrl = tda10048_i2c_gate_ctrl,
1154 .set_frontend = tda10048_set_frontend,
1155 .get_frontend = tda10048_get_frontend,
1156 .get_tune_settings = tda10048_get_tune_settings,
1157 .read_status = tda10048_read_status,
1158 .read_ber = tda10048_read_ber,
1159 .read_signal_strength = tda10048_read_signal_strength,
1160 .read_snr = tda10048_read_snr,
1161 .read_ucblocks = tda10048_read_ucblocks,
1162};
1163
1164module_param(debug, int, 0644);
1165MODULE_PARM_DESC(debug, "Enable verbose debug messages");
1166
1167MODULE_DESCRIPTION("NXP TDA10048HN DVB-T Demodulator driver");
1168MODULE_AUTHOR("Steven Toth");
1169MODULE_LICENSE("GPL");