tda10048.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. /*
  2. NXP TDA10048HN DVB OFDM demodulator driver
  3. Copyright (C) 2009 Steven Toth <stoth@kernellabs.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/module.h>
  19. #include <linux/string.h>
  20. #include <linux/slab.h>
  21. #include <linux/delay.h>
  22. #include <linux/math64.h>
  23. #include <asm/div64.h>
  24. #include "dvb_frontend.h"
  25. #include "dvb_math.h"
  26. #include "tda10048.h"
  27. #define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw"
  28. #define TDA10048_DEFAULT_FIRMWARE_SIZE 24878
  29. /* Register name definitions */
  30. #define TDA10048_IDENTITY 0x00
  31. #define TDA10048_VERSION 0x01
  32. #define TDA10048_DSP_CODE_CPT 0x0C
  33. #define TDA10048_DSP_CODE_IN 0x0E
  34. #define TDA10048_IN_CONF1 0x10
  35. #define TDA10048_IN_CONF2 0x11
  36. #define TDA10048_IN_CONF3 0x12
  37. #define TDA10048_OUT_CONF1 0x14
  38. #define TDA10048_OUT_CONF2 0x15
  39. #define TDA10048_OUT_CONF3 0x16
  40. #define TDA10048_AUTO 0x18
  41. #define TDA10048_SYNC_STATUS 0x1A
  42. #define TDA10048_CONF_C4_1 0x1E
  43. #define TDA10048_CONF_C4_2 0x1F
  44. #define TDA10048_CODE_IN_RAM 0x20
  45. #define TDA10048_CHANNEL_INFO1_R 0x22
  46. #define TDA10048_CHANNEL_INFO2_R 0x23
  47. #define TDA10048_CHANNEL_INFO1 0x24
  48. #define TDA10048_CHANNEL_INFO2 0x25
  49. #define TDA10048_TIME_ERROR_R 0x26
  50. #define TDA10048_TIME_ERROR 0x27
  51. #define TDA10048_FREQ_ERROR_LSB_R 0x28
  52. #define TDA10048_FREQ_ERROR_MSB_R 0x29
  53. #define TDA10048_FREQ_ERROR_LSB 0x2A
  54. #define TDA10048_FREQ_ERROR_MSB 0x2B
  55. #define TDA10048_IT_SEL 0x30
  56. #define TDA10048_IT_STAT 0x32
  57. #define TDA10048_DSP_AD_LSB 0x3C
  58. #define TDA10048_DSP_AD_MSB 0x3D
  59. #define TDA10048_DSP_REG_LSB 0x3E
  60. #define TDA10048_DSP_REG_MSB 0x3F
  61. #define TDA10048_CONF_TRISTATE1 0x44
  62. #define TDA10048_CONF_TRISTATE2 0x45
  63. #define TDA10048_CONF_POLARITY 0x46
  64. #define TDA10048_GPIO_SP_DS0 0x48
  65. #define TDA10048_GPIO_SP_DS1 0x49
  66. #define TDA10048_GPIO_SP_DS2 0x4A
  67. #define TDA10048_GPIO_SP_DS3 0x4B
  68. #define TDA10048_GPIO_OUT_SEL 0x4C
  69. #define TDA10048_GPIO_SELECT 0x4D
  70. #define TDA10048_IC_MODE 0x4E
  71. #define TDA10048_CONF_XO 0x50
  72. #define TDA10048_CONF_PLL1 0x51
  73. #define TDA10048_CONF_PLL2 0x52
  74. #define TDA10048_CONF_PLL3 0x53
  75. #define TDA10048_CONF_ADC 0x54
  76. #define TDA10048_CONF_ADC_2 0x55
  77. #define TDA10048_CONF_C1_1 0x60
  78. #define TDA10048_CONF_C1_3 0x62
  79. #define TDA10048_AGC_CONF 0x70
  80. #define TDA10048_AGC_THRESHOLD_LSB 0x72
  81. #define TDA10048_AGC_THRESHOLD_MSB 0x73
  82. #define TDA10048_AGC_RENORM 0x74
  83. #define TDA10048_AGC_GAINS 0x76
  84. #define TDA10048_AGC_TUN_MIN 0x78
  85. #define TDA10048_AGC_TUN_MAX 0x79
  86. #define TDA10048_AGC_IF_MIN 0x7A
  87. #define TDA10048_AGC_IF_MAX 0x7B
  88. #define TDA10048_AGC_TUN_LEVEL 0x7E
  89. #define TDA10048_AGC_IF_LEVEL 0x7F
  90. #define TDA10048_DIG_AGC_LEVEL 0x81
  91. #define TDA10048_FREQ_PHY2_LSB 0x86
  92. #define TDA10048_FREQ_PHY2_MSB 0x87
  93. #define TDA10048_TIME_INVWREF_LSB 0x88
  94. #define TDA10048_TIME_INVWREF_MSB 0x89
  95. #define TDA10048_TIME_WREF_LSB 0x8A
  96. #define TDA10048_TIME_WREF_MID1 0x8B
  97. #define TDA10048_TIME_WREF_MID2 0x8C
  98. #define TDA10048_TIME_WREF_MSB 0x8D
  99. #define TDA10048_NP_OUT 0xA2
  100. #define TDA10048_CELL_ID_LSB 0xA4
  101. #define TDA10048_CELL_ID_MSB 0xA5
  102. #define TDA10048_EXTTPS_ODD 0xAA
  103. #define TDA10048_EXTTPS_EVEN 0xAB
  104. #define TDA10048_TPS_LENGTH 0xAC
  105. #define TDA10048_FREE_REG_1 0xB2
  106. #define TDA10048_FREE_REG_2 0xB3
  107. #define TDA10048_CONF_C3_1 0xC0
  108. #define TDA10048_CVBER_CTRL 0xC2
  109. #define TDA10048_CBER_NMAX_LSB 0xC4
  110. #define TDA10048_CBER_NMAX_MSB 0xC5
  111. #define TDA10048_CBER_LSB 0xC6
  112. #define TDA10048_CBER_MSB 0xC7
  113. #define TDA10048_VBER_LSB 0xC8
  114. #define TDA10048_VBER_MID 0xC9
  115. #define TDA10048_VBER_MSB 0xCA
  116. #define TDA10048_CVBER_LUT 0xCC
  117. #define TDA10048_UNCOR_CTRL 0xCD
  118. #define TDA10048_UNCOR_CPT_LSB 0xCE
  119. #define TDA10048_UNCOR_CPT_MSB 0xCF
  120. #define TDA10048_SOFT_IT_C3 0xD6
  121. #define TDA10048_CONF_TS2 0xE0
  122. #define TDA10048_CONF_TS1 0xE1
  123. static unsigned int debug;
  124. #define dprintk(level, fmt, arg...)\
  125. do { if (debug >= level)\
  126. printk(KERN_DEBUG "tda10048: " fmt, ## arg);\
  127. } while (0)
  128. struct tda10048_state {
  129. struct i2c_adapter *i2c;
  130. /* We'll cache and update the attach config settings */
  131. struct tda10048_config config;
  132. struct dvb_frontend frontend;
  133. int fwloaded;
  134. u32 freq_if_hz;
  135. u32 xtal_hz;
  136. u32 pll_mfactor;
  137. u32 pll_nfactor;
  138. u32 pll_pfactor;
  139. u32 sample_freq;
  140. enum fe_bandwidth bandwidth;
  141. };
  142. static struct init_tab {
  143. u8 reg;
  144. u16 data;
  145. } init_tab[] = {
  146. { TDA10048_CONF_PLL1, 0x08 },
  147. { TDA10048_CONF_ADC_2, 0x00 },
  148. { TDA10048_CONF_C4_1, 0x00 },
  149. { TDA10048_CONF_PLL1, 0x0f },
  150. { TDA10048_CONF_PLL2, 0x0a },
  151. { TDA10048_CONF_PLL3, 0x43 },
  152. { TDA10048_FREQ_PHY2_LSB, 0x02 },
  153. { TDA10048_FREQ_PHY2_MSB, 0x0a },
  154. { TDA10048_TIME_WREF_LSB, 0xbd },
  155. { TDA10048_TIME_WREF_MID1, 0xe4 },
  156. { TDA10048_TIME_WREF_MID2, 0xa8 },
  157. { TDA10048_TIME_WREF_MSB, 0x02 },
  158. { TDA10048_TIME_INVWREF_LSB, 0x04 },
  159. { TDA10048_TIME_INVWREF_MSB, 0x06 },
  160. { TDA10048_CONF_C4_1, 0x00 },
  161. { TDA10048_CONF_C1_1, 0xa8 },
  162. { TDA10048_AGC_CONF, 0x16 },
  163. { TDA10048_CONF_C1_3, 0x0b },
  164. { TDA10048_AGC_TUN_MIN, 0x00 },
  165. { TDA10048_AGC_TUN_MAX, 0xff },
  166. { TDA10048_AGC_IF_MIN, 0x00 },
  167. { TDA10048_AGC_IF_MAX, 0xff },
  168. { TDA10048_AGC_THRESHOLD_MSB, 0x00 },
  169. { TDA10048_AGC_THRESHOLD_LSB, 0x70 },
  170. { TDA10048_CVBER_CTRL, 0x38 },
  171. { TDA10048_AGC_GAINS, 0x12 },
  172. { TDA10048_CONF_XO, 0x00 },
  173. { TDA10048_CONF_TS1, 0x07 },
  174. { TDA10048_IC_MODE, 0x00 },
  175. { TDA10048_CONF_TS2, 0xc0 },
  176. { TDA10048_CONF_TRISTATE1, 0x21 },
  177. { TDA10048_CONF_TRISTATE2, 0x00 },
  178. { TDA10048_CONF_POLARITY, 0x00 },
  179. { TDA10048_CONF_C4_2, 0x04 },
  180. { TDA10048_CONF_ADC, 0x60 },
  181. { TDA10048_CONF_ADC_2, 0x10 },
  182. { TDA10048_CONF_ADC, 0x60 },
  183. { TDA10048_CONF_ADC_2, 0x00 },
  184. { TDA10048_CONF_C1_1, 0xa8 },
  185. { TDA10048_UNCOR_CTRL, 0x00 },
  186. { TDA10048_CONF_C4_2, 0x04 },
  187. };
  188. static struct pll_tab {
  189. u32 clk_freq_khz;
  190. u32 if_freq_khz;
  191. } pll_tab[] = {
  192. { TDA10048_CLK_4000, TDA10048_IF_36130 },
  193. { TDA10048_CLK_16000, TDA10048_IF_3300 },
  194. { TDA10048_CLK_16000, TDA10048_IF_3500 },
  195. { TDA10048_CLK_16000, TDA10048_IF_3800 },
  196. { TDA10048_CLK_16000, TDA10048_IF_4000 },
  197. { TDA10048_CLK_16000, TDA10048_IF_4300 },
  198. { TDA10048_CLK_16000, TDA10048_IF_4500 },
  199. { TDA10048_CLK_16000, TDA10048_IF_5000 },
  200. { TDA10048_CLK_16000, TDA10048_IF_36130 },
  201. };
  202. static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data)
  203. {
  204. struct tda10048_config *config = &state->config;
  205. int ret;
  206. u8 buf[] = { reg, data };
  207. struct i2c_msg msg = {
  208. .addr = config->demod_address,
  209. .flags = 0, .buf = buf, .len = 2 };
  210. dprintk(2, "%s(reg = 0x%02x, data = 0x%02x)\n", __func__, reg, data);
  211. ret = i2c_transfer(state->i2c, &msg, 1);
  212. if (ret != 1)
  213. printk("%s: writereg error (ret == %i)\n", __func__, ret);
  214. return (ret != 1) ? -1 : 0;
  215. }
  216. static u8 tda10048_readreg(struct tda10048_state *state, u8 reg)
  217. {
  218. struct tda10048_config *config = &state->config;
  219. int ret;
  220. u8 b0[] = { reg };
  221. u8 b1[] = { 0 };
  222. struct i2c_msg msg[] = {
  223. { .addr = config->demod_address,
  224. .flags = 0, .buf = b0, .len = 1 },
  225. { .addr = config->demod_address,
  226. .flags = I2C_M_RD, .buf = b1, .len = 1 } };
  227. dprintk(2, "%s(reg = 0x%02x)\n", __func__, reg);
  228. ret = i2c_transfer(state->i2c, msg, 2);
  229. if (ret != 2)
  230. printk(KERN_ERR "%s: readreg error (ret == %i)\n",
  231. __func__, ret);
  232. return b1[0];
  233. }
  234. static int tda10048_writeregbulk(struct tda10048_state *state, u8 reg,
  235. const u8 *data, u16 len)
  236. {
  237. struct tda10048_config *config = &state->config;
  238. int ret = -EREMOTEIO;
  239. struct i2c_msg msg;
  240. u8 *buf;
  241. dprintk(2, "%s(%d, ?, len = %d)\n", __func__, reg, len);
  242. buf = kmalloc(len + 1, GFP_KERNEL);
  243. if (buf == NULL) {
  244. ret = -ENOMEM;
  245. goto error;
  246. }
  247. *buf = reg;
  248. memcpy(buf + 1, data, len);
  249. msg.addr = config->demod_address;
  250. msg.flags = 0;
  251. msg.buf = buf;
  252. msg.len = len + 1;
  253. dprintk(2, "%s(): write len = %d\n",
  254. __func__, msg.len);
  255. ret = i2c_transfer(state->i2c, &msg, 1);
  256. if (ret != 1) {
  257. printk(KERN_ERR "%s(): writereg error err %i\n",
  258. __func__, ret);
  259. ret = -EREMOTEIO;
  260. }
  261. error:
  262. kfree(buf);
  263. return ret;
  264. }
  265. static int tda10048_set_phy2(struct dvb_frontend *fe, u32 sample_freq_hz,
  266. u32 if_hz)
  267. {
  268. struct tda10048_state *state = fe->demodulator_priv;
  269. u64 t;
  270. dprintk(1, "%s()\n", __func__);
  271. if (sample_freq_hz == 0)
  272. return -EINVAL;
  273. if (if_hz < (sample_freq_hz / 2)) {
  274. /* PHY2 = (if2/fs) * 2^15 */
  275. t = if_hz;
  276. t *= 10;
  277. t *= 32768;
  278. do_div(t, sample_freq_hz);
  279. t += 5;
  280. do_div(t, 10);
  281. } else {
  282. /* PHY2 = ((IF1-fs)/fs) * 2^15 */
  283. t = sample_freq_hz - if_hz;
  284. t *= 10;
  285. t *= 32768;
  286. do_div(t, sample_freq_hz);
  287. t += 5;
  288. do_div(t, 10);
  289. t = ~t + 1;
  290. }
  291. tda10048_writereg(state, TDA10048_FREQ_PHY2_LSB, (u8)t);
  292. tda10048_writereg(state, TDA10048_FREQ_PHY2_MSB, (u8)(t >> 8));
  293. return 0;
  294. }
  295. static int tda10048_set_wref(struct dvb_frontend *fe, u32 sample_freq_hz,
  296. u32 bw)
  297. {
  298. struct tda10048_state *state = fe->demodulator_priv;
  299. u64 t, z;
  300. u32 b = 8000000;
  301. dprintk(1, "%s()\n", __func__);
  302. if (sample_freq_hz == 0)
  303. return -EINVAL;
  304. if (bw == BANDWIDTH_6_MHZ)
  305. b = 6000000;
  306. else
  307. if (bw == BANDWIDTH_7_MHZ)
  308. b = 7000000;
  309. /* WREF = (B / (7 * fs)) * 2^31 */
  310. t = b * 10;
  311. /* avoid warning: this decimal constant is unsigned only in ISO C90 */
  312. /* t *= 2147483648 on 32bit platforms */
  313. t *= (2048 * 1024);
  314. t *= 1024;
  315. z = 7 * sample_freq_hz;
  316. do_div(t, z);
  317. t += 5;
  318. do_div(t, 10);
  319. tda10048_writereg(state, TDA10048_TIME_WREF_LSB, (u8)t);
  320. tda10048_writereg(state, TDA10048_TIME_WREF_MID1, (u8)(t >> 8));
  321. tda10048_writereg(state, TDA10048_TIME_WREF_MID2, (u8)(t >> 16));
  322. tda10048_writereg(state, TDA10048_TIME_WREF_MSB, (u8)(t >> 24));
  323. return 0;
  324. }
  325. static int tda10048_set_invwref(struct dvb_frontend *fe, u32 sample_freq_hz,
  326. u32 bw)
  327. {
  328. struct tda10048_state *state = fe->demodulator_priv;
  329. u64 t;
  330. u32 b = 8000000;
  331. dprintk(1, "%s()\n", __func__);
  332. if (sample_freq_hz == 0)
  333. return -EINVAL;
  334. if (bw == BANDWIDTH_6_MHZ)
  335. b = 6000000;
  336. else
  337. if (bw == BANDWIDTH_7_MHZ)
  338. b = 7000000;
  339. /* INVWREF = ((7 * fs) / B) * 2^5 */
  340. t = sample_freq_hz;
  341. t *= 7;
  342. t *= 32;
  343. t *= 10;
  344. do_div(t, b);
  345. t += 5;
  346. do_div(t, 10);
  347. tda10048_writereg(state, TDA10048_TIME_INVWREF_LSB, (u8)t);
  348. tda10048_writereg(state, TDA10048_TIME_INVWREF_MSB, (u8)(t >> 8));
  349. return 0;
  350. }
  351. static int tda10048_set_bandwidth(struct dvb_frontend *fe,
  352. enum fe_bandwidth bw)
  353. {
  354. struct tda10048_state *state = fe->demodulator_priv;
  355. dprintk(1, "%s(bw=%d)\n", __func__, bw);
  356. /* Bandwidth setting may need to be adjusted */
  357. switch (bw) {
  358. case BANDWIDTH_6_MHZ:
  359. case BANDWIDTH_7_MHZ:
  360. case BANDWIDTH_8_MHZ:
  361. tda10048_set_wref(fe, state->sample_freq, bw);
  362. tda10048_set_invwref(fe, state->sample_freq, bw);
  363. break;
  364. default:
  365. printk(KERN_ERR "%s() invalid bandwidth\n", __func__);
  366. return -EINVAL;
  367. }
  368. state->bandwidth = bw;
  369. return 0;
  370. }
  371. static int tda10048_set_if(struct dvb_frontend *fe, enum fe_bandwidth bw)
  372. {
  373. struct tda10048_state *state = fe->demodulator_priv;
  374. struct tda10048_config *config = &state->config;
  375. int i;
  376. u32 if_freq_khz;
  377. dprintk(1, "%s(bw = %d)\n", __func__, bw);
  378. /* based on target bandwidth and clk we calculate pll factors */
  379. switch (bw) {
  380. case BANDWIDTH_6_MHZ:
  381. if_freq_khz = config->dtv6_if_freq_khz;
  382. break;
  383. case BANDWIDTH_7_MHZ:
  384. if_freq_khz = config->dtv7_if_freq_khz;
  385. break;
  386. case BANDWIDTH_8_MHZ:
  387. if_freq_khz = config->dtv8_if_freq_khz;
  388. break;
  389. default:
  390. printk(KERN_ERR "%s() no default\n", __func__);
  391. return -EINVAL;
  392. }
  393. for (i = 0; i < ARRAY_SIZE(pll_tab); i++) {
  394. if ((pll_tab[i].clk_freq_khz == config->clk_freq_khz) &&
  395. (pll_tab[i].if_freq_khz == if_freq_khz)) {
  396. state->freq_if_hz = pll_tab[i].if_freq_khz * 1000;
  397. state->xtal_hz = pll_tab[i].clk_freq_khz * 1000;
  398. break;
  399. }
  400. }
  401. if (i == ARRAY_SIZE(pll_tab)) {
  402. printk(KERN_ERR "%s() Incorrect attach settings\n",
  403. __func__);
  404. return -EINVAL;
  405. }
  406. dprintk(1, "- freq_if_hz = %d\n", state->freq_if_hz);
  407. dprintk(1, "- xtal_hz = %d\n", state->xtal_hz);
  408. dprintk(1, "- pll_mfactor = %d\n", state->pll_mfactor);
  409. dprintk(1, "- pll_nfactor = %d\n", state->pll_nfactor);
  410. dprintk(1, "- pll_pfactor = %d\n", state->pll_pfactor);
  411. /* Calculate the sample frequency */
  412. state->sample_freq = state->xtal_hz * (state->pll_mfactor + 45);
  413. state->sample_freq /= (state->pll_nfactor + 1);
  414. state->sample_freq /= (state->pll_pfactor + 4);
  415. dprintk(1, "- sample_freq = %d\n", state->sample_freq);
  416. /* Update the I/F */
  417. tda10048_set_phy2(fe, state->sample_freq, state->freq_if_hz);
  418. return 0;
  419. }
  420. static int tda10048_firmware_upload(struct dvb_frontend *fe)
  421. {
  422. struct tda10048_state *state = fe->demodulator_priv;
  423. struct tda10048_config *config = &state->config;
  424. const struct firmware *fw;
  425. int ret;
  426. int pos = 0;
  427. int cnt;
  428. u8 wlen = config->fwbulkwritelen;
  429. if ((wlen != TDA10048_BULKWRITE_200) && (wlen != TDA10048_BULKWRITE_50))
  430. wlen = TDA10048_BULKWRITE_200;
  431. /* request the firmware, this will block and timeout */
  432. printk(KERN_INFO "%s: waiting for firmware upload (%s)...\n",
  433. __func__,
  434. TDA10048_DEFAULT_FIRMWARE);
  435. ret = request_firmware(&fw, TDA10048_DEFAULT_FIRMWARE,
  436. state->i2c->dev.parent);
  437. if (ret) {
  438. printk(KERN_ERR "%s: Upload failed. (file not found?)\n",
  439. __func__);
  440. return -EIO;
  441. } else {
  442. printk(KERN_INFO "%s: firmware read %Zu bytes.\n",
  443. __func__,
  444. fw->size);
  445. ret = 0;
  446. }
  447. if (fw->size != TDA10048_DEFAULT_FIRMWARE_SIZE) {
  448. printk(KERN_ERR "%s: firmware incorrect size\n", __func__);
  449. ret = -EIO;
  450. } else {
  451. printk(KERN_INFO "%s: firmware uploading\n", __func__);
  452. /* Soft reset */
  453. tda10048_writereg(state, TDA10048_CONF_TRISTATE1,
  454. tda10048_readreg(state, TDA10048_CONF_TRISTATE1)
  455. & 0xfe);
  456. tda10048_writereg(state, TDA10048_CONF_TRISTATE1,
  457. tda10048_readreg(state, TDA10048_CONF_TRISTATE1)
  458. | 0x01);
  459. /* Put the demod into host download mode */
  460. tda10048_writereg(state, TDA10048_CONF_C4_1,
  461. tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xf9);
  462. /* Boot the DSP */
  463. tda10048_writereg(state, TDA10048_CONF_C4_1,
  464. tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x08);
  465. /* Prepare for download */
  466. tda10048_writereg(state, TDA10048_DSP_CODE_CPT, 0);
  467. /* Download the firmware payload */
  468. while (pos < fw->size) {
  469. if ((fw->size - pos) > wlen)
  470. cnt = wlen;
  471. else
  472. cnt = fw->size - pos;
  473. tda10048_writeregbulk(state, TDA10048_DSP_CODE_IN,
  474. &fw->data[pos], cnt);
  475. pos += cnt;
  476. }
  477. ret = -EIO;
  478. /* Wait up to 250ms for the DSP to boot */
  479. for (cnt = 0; cnt < 250 ; cnt += 10) {
  480. msleep(10);
  481. if (tda10048_readreg(state, TDA10048_SYNC_STATUS)
  482. & 0x40) {
  483. ret = 0;
  484. break;
  485. }
  486. }
  487. }
  488. release_firmware(fw);
  489. if (ret == 0) {
  490. printk(KERN_INFO "%s: firmware uploaded\n", __func__);
  491. state->fwloaded = 1;
  492. } else
  493. printk(KERN_ERR "%s: firmware upload failed\n", __func__);
  494. return ret;
  495. }
  496. static int tda10048_set_inversion(struct dvb_frontend *fe, int inversion)
  497. {
  498. struct tda10048_state *state = fe->demodulator_priv;
  499. dprintk(1, "%s(%d)\n", __func__, inversion);
  500. if (inversion == TDA10048_INVERSION_ON)
  501. tda10048_writereg(state, TDA10048_CONF_C1_1,
  502. tda10048_readreg(state, TDA10048_CONF_C1_1) | 0x20);
  503. else
  504. tda10048_writereg(state, TDA10048_CONF_C1_1,
  505. tda10048_readreg(state, TDA10048_CONF_C1_1) & 0xdf);
  506. return 0;
  507. }
  508. /* Retrieve the demod settings */
  509. static int tda10048_get_tps(struct tda10048_state *state,
  510. struct dvb_ofdm_parameters *p)
  511. {
  512. u8 val;
  513. /* Make sure the TPS regs are valid */
  514. if (!(tda10048_readreg(state, TDA10048_AUTO) & 0x01))
  515. return -EAGAIN;
  516. val = tda10048_readreg(state, TDA10048_OUT_CONF2);
  517. switch ((val & 0x60) >> 5) {
  518. case 0:
  519. p->constellation = QPSK;
  520. break;
  521. case 1:
  522. p->constellation = QAM_16;
  523. break;
  524. case 2:
  525. p->constellation = QAM_64;
  526. break;
  527. }
  528. switch ((val & 0x18) >> 3) {
  529. case 0:
  530. p->hierarchy_information = HIERARCHY_NONE;
  531. break;
  532. case 1:
  533. p->hierarchy_information = HIERARCHY_1;
  534. break;
  535. case 2:
  536. p->hierarchy_information = HIERARCHY_2;
  537. break;
  538. case 3:
  539. p->hierarchy_information = HIERARCHY_4;
  540. break;
  541. }
  542. switch (val & 0x07) {
  543. case 0:
  544. p->code_rate_HP = FEC_1_2;
  545. break;
  546. case 1:
  547. p->code_rate_HP = FEC_2_3;
  548. break;
  549. case 2:
  550. p->code_rate_HP = FEC_3_4;
  551. break;
  552. case 3:
  553. p->code_rate_HP = FEC_5_6;
  554. break;
  555. case 4:
  556. p->code_rate_HP = FEC_7_8;
  557. break;
  558. }
  559. val = tda10048_readreg(state, TDA10048_OUT_CONF3);
  560. switch (val & 0x07) {
  561. case 0:
  562. p->code_rate_LP = FEC_1_2;
  563. break;
  564. case 1:
  565. p->code_rate_LP = FEC_2_3;
  566. break;
  567. case 2:
  568. p->code_rate_LP = FEC_3_4;
  569. break;
  570. case 3:
  571. p->code_rate_LP = FEC_5_6;
  572. break;
  573. case 4:
  574. p->code_rate_LP = FEC_7_8;
  575. break;
  576. }
  577. val = tda10048_readreg(state, TDA10048_OUT_CONF1);
  578. switch ((val & 0x0c) >> 2) {
  579. case 0:
  580. p->guard_interval = GUARD_INTERVAL_1_32;
  581. break;
  582. case 1:
  583. p->guard_interval = GUARD_INTERVAL_1_16;
  584. break;
  585. case 2:
  586. p->guard_interval = GUARD_INTERVAL_1_8;
  587. break;
  588. case 3:
  589. p->guard_interval = GUARD_INTERVAL_1_4;
  590. break;
  591. }
  592. switch (val & 0x03) {
  593. case 0:
  594. p->transmission_mode = TRANSMISSION_MODE_2K;
  595. break;
  596. case 1:
  597. p->transmission_mode = TRANSMISSION_MODE_8K;
  598. break;
  599. }
  600. return 0;
  601. }
  602. static int tda10048_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
  603. {
  604. struct tda10048_state *state = fe->demodulator_priv;
  605. struct tda10048_config *config = &state->config;
  606. dprintk(1, "%s(%d)\n", __func__, enable);
  607. if (config->disable_gate_access)
  608. return 0;
  609. if (enable)
  610. return tda10048_writereg(state, TDA10048_CONF_C4_1,
  611. tda10048_readreg(state, TDA10048_CONF_C4_1) | 0x02);
  612. else
  613. return tda10048_writereg(state, TDA10048_CONF_C4_1,
  614. tda10048_readreg(state, TDA10048_CONF_C4_1) & 0xfd);
  615. }
  616. static int tda10048_output_mode(struct dvb_frontend *fe, int serial)
  617. {
  618. struct tda10048_state *state = fe->demodulator_priv;
  619. dprintk(1, "%s(%d)\n", __func__, serial);
  620. /* Ensure pins are out of tri-state */
  621. tda10048_writereg(state, TDA10048_CONF_TRISTATE1, 0x21);
  622. tda10048_writereg(state, TDA10048_CONF_TRISTATE2, 0x00);
  623. if (serial) {
  624. tda10048_writereg(state, TDA10048_IC_MODE, 0x80 | 0x20);
  625. tda10048_writereg(state, TDA10048_CONF_TS2, 0xc0);
  626. } else {
  627. tda10048_writereg(state, TDA10048_IC_MODE, 0x00);
  628. tda10048_writereg(state, TDA10048_CONF_TS2, 0x01);
  629. }
  630. return 0;
  631. }
  632. /* Talk to the demod, set the FEC, GUARD, QAM settings etc */
  633. /* TODO: Support manual tuning with specific params */
  634. static int tda10048_set_frontend(struct dvb_frontend *fe,
  635. struct dvb_frontend_parameters *p)
  636. {
  637. struct tda10048_state *state = fe->demodulator_priv;
  638. dprintk(1, "%s(frequency=%d)\n", __func__, p->frequency);
  639. /* Update the I/F pll's if the bandwidth changes */
  640. if (p->u.ofdm.bandwidth != state->bandwidth) {
  641. tda10048_set_if(fe, p->u.ofdm.bandwidth);
  642. tda10048_set_bandwidth(fe, p->u.ofdm.bandwidth);
  643. }
  644. if (fe->ops.tuner_ops.set_params) {
  645. if (fe->ops.i2c_gate_ctrl)
  646. fe->ops.i2c_gate_ctrl(fe, 1);
  647. fe->ops.tuner_ops.set_params(fe);
  648. if (fe->ops.i2c_gate_ctrl)
  649. fe->ops.i2c_gate_ctrl(fe, 0);
  650. }
  651. /* Enable demod TPS auto detection and begin acquisition */
  652. tda10048_writereg(state, TDA10048_AUTO, 0x57);
  653. /* trigger cber and vber acquisition */
  654. tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x3B);
  655. return 0;
  656. }
  657. /* Establish sane defaults and load firmware. */
  658. static int tda10048_init(struct dvb_frontend *fe)
  659. {
  660. struct tda10048_state *state = fe->demodulator_priv;
  661. struct tda10048_config *config = &state->config;
  662. int ret = 0, i;
  663. dprintk(1, "%s()\n", __func__);
  664. /* PLL */
  665. init_tab[4].data = (u8)(state->pll_mfactor);
  666. init_tab[5].data = (u8)(state->pll_nfactor) | 0x40;
  667. /* Apply register defaults */
  668. for (i = 0; i < ARRAY_SIZE(init_tab); i++)
  669. tda10048_writereg(state, init_tab[i].reg, init_tab[i].data);
  670. if (state->fwloaded == 0)
  671. ret = tda10048_firmware_upload(fe);
  672. /* Set either serial or parallel */
  673. tda10048_output_mode(fe, config->output_mode);
  674. /* Set inversion */
  675. tda10048_set_inversion(fe, config->inversion);
  676. /* Establish default RF values */
  677. tda10048_set_if(fe, BANDWIDTH_8_MHZ);
  678. tda10048_set_bandwidth(fe, BANDWIDTH_8_MHZ);
  679. /* Ensure we leave the gate closed */
  680. tda10048_i2c_gate_ctrl(fe, 0);
  681. return ret;
  682. }
  683. static int tda10048_read_status(struct dvb_frontend *fe, fe_status_t *status)
  684. {
  685. struct tda10048_state *state = fe->demodulator_priv;
  686. u8 reg;
  687. *status = 0;
  688. reg = tda10048_readreg(state, TDA10048_SYNC_STATUS);
  689. dprintk(1, "%s() status =0x%02x\n", __func__, reg);
  690. if (reg & 0x02)
  691. *status |= FE_HAS_CARRIER;
  692. if (reg & 0x04)
  693. *status |= FE_HAS_SIGNAL;
  694. if (reg & 0x08) {
  695. *status |= FE_HAS_LOCK;
  696. *status |= FE_HAS_VITERBI;
  697. *status |= FE_HAS_SYNC;
  698. }
  699. return 0;
  700. }
  701. static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber)
  702. {
  703. struct tda10048_state *state = fe->demodulator_priv;
  704. static u32 cber_current;
  705. u32 cber_nmax;
  706. u64 cber_tmp;
  707. dprintk(1, "%s()\n", __func__);
  708. /* update cber on interrupt */
  709. if (tda10048_readreg(state, TDA10048_SOFT_IT_C3) & 0x01) {
  710. cber_tmp = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 |
  711. tda10048_readreg(state, TDA10048_CBER_LSB);
  712. cber_nmax = tda10048_readreg(state, TDA10048_CBER_NMAX_MSB) << 8 |
  713. tda10048_readreg(state, TDA10048_CBER_NMAX_LSB);
  714. cber_tmp *= 100000000;
  715. cber_tmp *= 2;
  716. cber_tmp = div_u64(cber_tmp, (cber_nmax * 32) + 1);
  717. cber_current = (u32)cber_tmp;
  718. /* retrigger cber acquisition */
  719. tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x39);
  720. }
  721. /* actual cber is (*ber)/1e8 */
  722. *ber = cber_current;
  723. return 0;
  724. }
  725. static int tda10048_read_signal_strength(struct dvb_frontend *fe,
  726. u16 *signal_strength)
  727. {
  728. struct tda10048_state *state = fe->demodulator_priv;
  729. u8 v;
  730. dprintk(1, "%s()\n", __func__);
  731. *signal_strength = 65535;
  732. v = tda10048_readreg(state, TDA10048_NP_OUT);
  733. if (v > 0)
  734. *signal_strength -= (v << 8) | v;
  735. return 0;
  736. }
  737. /* SNR lookup table */
  738. static struct snr_tab {
  739. u8 val;
  740. u8 data;
  741. } snr_tab[] = {
  742. { 0, 0 },
  743. { 1, 246 },
  744. { 2, 215 },
  745. { 3, 198 },
  746. { 4, 185 },
  747. { 5, 176 },
  748. { 6, 168 },
  749. { 7, 161 },
  750. { 8, 155 },
  751. { 9, 150 },
  752. { 10, 146 },
  753. { 11, 141 },
  754. { 12, 138 },
  755. { 13, 134 },
  756. { 14, 131 },
  757. { 15, 128 },
  758. { 16, 125 },
  759. { 17, 122 },
  760. { 18, 120 },
  761. { 19, 118 },
  762. { 20, 115 },
  763. { 21, 113 },
  764. { 22, 111 },
  765. { 23, 109 },
  766. { 24, 107 },
  767. { 25, 106 },
  768. { 26, 104 },
  769. { 27, 102 },
  770. { 28, 101 },
  771. { 29, 99 },
  772. { 30, 98 },
  773. { 31, 96 },
  774. { 32, 95 },
  775. { 33, 94 },
  776. { 34, 92 },
  777. { 35, 91 },
  778. { 36, 90 },
  779. { 37, 89 },
  780. { 38, 88 },
  781. { 39, 86 },
  782. { 40, 85 },
  783. { 41, 84 },
  784. { 42, 83 },
  785. { 43, 82 },
  786. { 44, 81 },
  787. { 45, 80 },
  788. { 46, 79 },
  789. { 47, 78 },
  790. { 48, 77 },
  791. { 49, 76 },
  792. { 50, 76 },
  793. { 51, 75 },
  794. { 52, 74 },
  795. { 53, 73 },
  796. { 54, 72 },
  797. { 56, 71 },
  798. { 57, 70 },
  799. { 58, 69 },
  800. { 60, 68 },
  801. { 61, 67 },
  802. { 63, 66 },
  803. { 64, 65 },
  804. { 66, 64 },
  805. { 67, 63 },
  806. { 68, 62 },
  807. { 69, 62 },
  808. { 70, 61 },
  809. { 72, 60 },
  810. { 74, 59 },
  811. { 75, 58 },
  812. { 77, 57 },
  813. { 79, 56 },
  814. { 81, 55 },
  815. { 83, 54 },
  816. { 85, 53 },
  817. { 87, 52 },
  818. { 89, 51 },
  819. { 91, 50 },
  820. { 93, 49 },
  821. { 95, 48 },
  822. { 97, 47 },
  823. { 100, 46 },
  824. { 102, 45 },
  825. { 104, 44 },
  826. { 107, 43 },
  827. { 109, 42 },
  828. { 112, 41 },
  829. { 114, 40 },
  830. { 117, 39 },
  831. { 120, 38 },
  832. { 123, 37 },
  833. { 125, 36 },
  834. { 128, 35 },
  835. { 131, 34 },
  836. { 134, 33 },
  837. { 138, 32 },
  838. { 141, 31 },
  839. { 144, 30 },
  840. { 147, 29 },
  841. { 151, 28 },
  842. { 154, 27 },
  843. { 158, 26 },
  844. { 162, 25 },
  845. { 165, 24 },
  846. { 169, 23 },
  847. { 173, 22 },
  848. { 177, 21 },
  849. { 181, 20 },
  850. { 186, 19 },
  851. { 190, 18 },
  852. { 194, 17 },
  853. { 199, 16 },
  854. { 204, 15 },
  855. { 208, 14 },
  856. { 213, 13 },
  857. { 218, 12 },
  858. { 223, 11 },
  859. { 229, 10 },
  860. { 234, 9 },
  861. { 239, 8 },
  862. { 245, 7 },
  863. { 251, 6 },
  864. { 255, 5 },
  865. };
  866. static int tda10048_read_snr(struct dvb_frontend *fe, u16 *snr)
  867. {
  868. struct tda10048_state *state = fe->demodulator_priv;
  869. u8 v;
  870. int i, ret = -EINVAL;
  871. dprintk(1, "%s()\n", __func__);
  872. v = tda10048_readreg(state, TDA10048_NP_OUT);
  873. for (i = 0; i < ARRAY_SIZE(snr_tab); i++) {
  874. if (v <= snr_tab[i].val) {
  875. *snr = snr_tab[i].data;
  876. ret = 0;
  877. break;
  878. }
  879. }
  880. return ret;
  881. }
  882. static int tda10048_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
  883. {
  884. struct tda10048_state *state = fe->demodulator_priv;
  885. dprintk(1, "%s()\n", __func__);
  886. *ucblocks = tda10048_readreg(state, TDA10048_UNCOR_CPT_MSB) << 8 |
  887. tda10048_readreg(state, TDA10048_UNCOR_CPT_LSB);
  888. /* clear the uncorrected TS packets counter when saturated */
  889. if (*ucblocks == 0xFFFF)
  890. tda10048_writereg(state, TDA10048_UNCOR_CTRL, 0x80);
  891. return 0;
  892. }
  893. static int tda10048_get_frontend(struct dvb_frontend *fe,
  894. struct dvb_frontend_parameters *p)
  895. {
  896. struct tda10048_state *state = fe->demodulator_priv;
  897. dprintk(1, "%s()\n", __func__);
  898. p->inversion = tda10048_readreg(state, TDA10048_CONF_C1_1)
  899. & 0x20 ? INVERSION_ON : INVERSION_OFF;
  900. return tda10048_get_tps(state, &p->u.ofdm);
  901. }
  902. static int tda10048_get_tune_settings(struct dvb_frontend *fe,
  903. struct dvb_frontend_tune_settings *tune)
  904. {
  905. tune->min_delay_ms = 1000;
  906. return 0;
  907. }
  908. static void tda10048_release(struct dvb_frontend *fe)
  909. {
  910. struct tda10048_state *state = fe->demodulator_priv;
  911. dprintk(1, "%s()\n", __func__);
  912. kfree(state);
  913. }
  914. static void tda10048_establish_defaults(struct dvb_frontend *fe)
  915. {
  916. struct tda10048_state *state = fe->demodulator_priv;
  917. struct tda10048_config *config = &state->config;
  918. /* Validate/default the config */
  919. if (config->dtv6_if_freq_khz == 0) {
  920. config->dtv6_if_freq_khz = TDA10048_IF_4300;
  921. printk(KERN_WARNING "%s() tda10048_config.dtv6_if_freq_khz "
  922. "is not set (defaulting to %d)\n",
  923. __func__,
  924. config->dtv6_if_freq_khz);
  925. }
  926. if (config->dtv7_if_freq_khz == 0) {
  927. config->dtv7_if_freq_khz = TDA10048_IF_4300;
  928. printk(KERN_WARNING "%s() tda10048_config.dtv7_if_freq_khz "
  929. "is not set (defaulting to %d)\n",
  930. __func__,
  931. config->dtv7_if_freq_khz);
  932. }
  933. if (config->dtv8_if_freq_khz == 0) {
  934. config->dtv8_if_freq_khz = TDA10048_IF_4300;
  935. printk(KERN_WARNING "%s() tda10048_config.dtv8_if_freq_khz "
  936. "is not set (defaulting to %d)\n",
  937. __func__,
  938. config->dtv8_if_freq_khz);
  939. }
  940. if (config->clk_freq_khz == 0) {
  941. config->clk_freq_khz = TDA10048_CLK_16000;
  942. printk(KERN_WARNING "%s() tda10048_config.clk_freq_khz "
  943. "is not set (defaulting to %d)\n",
  944. __func__,
  945. config->clk_freq_khz);
  946. }
  947. }
  948. static struct dvb_frontend_ops tda10048_ops;
  949. struct dvb_frontend *tda10048_attach(const struct tda10048_config *config,
  950. struct i2c_adapter *i2c)
  951. {
  952. struct tda10048_state *state = NULL;
  953. dprintk(1, "%s()\n", __func__);
  954. /* allocate memory for the internal state */
  955. state = kzalloc(sizeof(struct tda10048_state), GFP_KERNEL);
  956. if (state == NULL)
  957. goto error;
  958. /* setup the state and clone the config */
  959. memcpy(&state->config, config, sizeof(*config));
  960. state->i2c = i2c;
  961. state->fwloaded = config->no_firmware;
  962. state->bandwidth = BANDWIDTH_8_MHZ;
  963. /* check if the demod is present */
  964. if (tda10048_readreg(state, TDA10048_IDENTITY) != 0x048)
  965. goto error;
  966. /* create dvb_frontend */
  967. memcpy(&state->frontend.ops, &tda10048_ops,
  968. sizeof(struct dvb_frontend_ops));
  969. state->frontend.demodulator_priv = state;
  970. /* set pll */
  971. if (config->set_pll) {
  972. state->pll_mfactor = config->pll_m;
  973. state->pll_nfactor = config->pll_n;
  974. state->pll_pfactor = config->pll_p;
  975. } else {
  976. state->pll_mfactor = 10;
  977. state->pll_nfactor = 3;
  978. state->pll_pfactor = 0;
  979. }
  980. /* Establish any defaults the the user didn't pass */
  981. tda10048_establish_defaults(&state->frontend);
  982. /* Set the xtal and freq defaults */
  983. if (tda10048_set_if(&state->frontend, BANDWIDTH_8_MHZ) != 0)
  984. goto error;
  985. /* Default bandwidth */
  986. if (tda10048_set_bandwidth(&state->frontend, BANDWIDTH_8_MHZ) != 0)
  987. goto error;
  988. /* Leave the gate closed */
  989. tda10048_i2c_gate_ctrl(&state->frontend, 0);
  990. return &state->frontend;
  991. error:
  992. kfree(state);
  993. return NULL;
  994. }
  995. EXPORT_SYMBOL(tda10048_attach);
  996. static struct dvb_frontend_ops tda10048_ops = {
  997. .info = {
  998. .name = "NXP TDA10048HN DVB-T",
  999. .type = FE_OFDM,
  1000. .frequency_min = 177000000,
  1001. .frequency_max = 858000000,
  1002. .frequency_stepsize = 166666,
  1003. .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
  1004. FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
  1005. FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
  1006. FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
  1007. FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER
  1008. },
  1009. .release = tda10048_release,
  1010. .init = tda10048_init,
  1011. .i2c_gate_ctrl = tda10048_i2c_gate_ctrl,
  1012. .set_frontend = tda10048_set_frontend,
  1013. .get_frontend = tda10048_get_frontend,
  1014. .get_tune_settings = tda10048_get_tune_settings,
  1015. .read_status = tda10048_read_status,
  1016. .read_ber = tda10048_read_ber,
  1017. .read_signal_strength = tda10048_read_signal_strength,
  1018. .read_snr = tda10048_read_snr,
  1019. .read_ucblocks = tda10048_read_ucblocks,
  1020. };
  1021. module_param(debug, int, 0644);
  1022. MODULE_PARM_DESC(debug, "Enable verbose debug messages");
  1023. MODULE_DESCRIPTION("NXP TDA10048HN DVB-T Demodulator driver");
  1024. MODULE_AUTHOR("Steven Toth");
  1025. MODULE_LICENSE("GPL");