tda10048.c 29 KB

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