zl10353.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /*
  2. * Driver for Zarlink DVB-T ZL10353 demodulator
  3. *
  4. * Copyright (C) 2006, 2007 Christopher Pascoe <c.pascoe@itee.uq.edu.au>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. *
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include <linux/init.h>
  24. #include <linux/delay.h>
  25. #include <linux/string.h>
  26. #include <linux/slab.h>
  27. #include <asm/div64.h>
  28. #include "dvb_frontend.h"
  29. #include "zl10353_priv.h"
  30. #include "zl10353.h"
  31. struct zl10353_state {
  32. struct i2c_adapter *i2c;
  33. struct dvb_frontend frontend;
  34. struct zl10353_config config;
  35. enum fe_bandwidth bandwidth;
  36. };
  37. static int debug;
  38. #define dprintk(args...) \
  39. do { \
  40. if (debug) printk(KERN_DEBUG "zl10353: " args); \
  41. } while (0)
  42. static int debug_regs;
  43. static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
  44. {
  45. struct zl10353_state *state = fe->demodulator_priv;
  46. u8 buf[2] = { reg, val };
  47. struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
  48. .buf = buf, .len = 2 };
  49. int err = i2c_transfer(state->i2c, &msg, 1);
  50. if (err != 1) {
  51. printk("zl10353: write to reg %x failed (err = %d)!\n", reg, err);
  52. return err;
  53. }
  54. return 0;
  55. }
  56. static int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen)
  57. {
  58. int err, i;
  59. for (i = 0; i < ilen - 1; i++)
  60. if ((err = zl10353_single_write(fe, ibuf[0] + i, ibuf[i + 1])))
  61. return err;
  62. return 0;
  63. }
  64. static int zl10353_read_register(struct zl10353_state *state, u8 reg)
  65. {
  66. int ret;
  67. u8 b0[1] = { reg };
  68. u8 b1[1] = { 0 };
  69. struct i2c_msg msg[2] = { { .addr = state->config.demod_address,
  70. .flags = 0,
  71. .buf = b0, .len = 1 },
  72. { .addr = state->config.demod_address,
  73. .flags = I2C_M_RD,
  74. .buf = b1, .len = 1 } };
  75. ret = i2c_transfer(state->i2c, msg, 2);
  76. if (ret != 2) {
  77. printk("%s: readreg error (reg=%d, ret==%i)\n",
  78. __func__, reg, ret);
  79. return ret;
  80. }
  81. return b1[0];
  82. }
  83. static void zl10353_dump_regs(struct dvb_frontend *fe)
  84. {
  85. struct zl10353_state *state = fe->demodulator_priv;
  86. int ret;
  87. u8 reg;
  88. /* Dump all registers. */
  89. for (reg = 0; ; reg++) {
  90. if (reg % 16 == 0) {
  91. if (reg)
  92. printk(KERN_CONT "\n");
  93. printk(KERN_DEBUG "%02x:", reg);
  94. }
  95. ret = zl10353_read_register(state, reg);
  96. if (ret >= 0)
  97. printk(KERN_CONT " %02x", (u8)ret);
  98. else
  99. printk(KERN_CONT " --");
  100. if (reg == 0xff)
  101. break;
  102. }
  103. printk(KERN_CONT "\n");
  104. }
  105. static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
  106. enum fe_bandwidth bandwidth,
  107. u16 *nominal_rate)
  108. {
  109. struct zl10353_state *state = fe->demodulator_priv;
  110. u32 adc_clock = 450560; /* 45.056 MHz */
  111. u64 value;
  112. u8 bw;
  113. if (state->config.adc_clock)
  114. adc_clock = state->config.adc_clock;
  115. switch (bandwidth) {
  116. case BANDWIDTH_6_MHZ:
  117. bw = 6;
  118. break;
  119. case BANDWIDTH_7_MHZ:
  120. bw = 7;
  121. break;
  122. case BANDWIDTH_8_MHZ:
  123. default:
  124. bw = 8;
  125. break;
  126. }
  127. value = (u64)10 * (1 << 23) / 7 * 125;
  128. value = (bw * value) + adc_clock / 2;
  129. do_div(value, adc_clock);
  130. *nominal_rate = value;
  131. dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
  132. __func__, bw, adc_clock, *nominal_rate);
  133. }
  134. static void zl10353_calc_input_freq(struct dvb_frontend *fe,
  135. u16 *input_freq)
  136. {
  137. struct zl10353_state *state = fe->demodulator_priv;
  138. u32 adc_clock = 450560; /* 45.056 MHz */
  139. int if2 = 361667; /* 36.1667 MHz */
  140. int ife;
  141. u64 value;
  142. if (state->config.adc_clock)
  143. adc_clock = state->config.adc_clock;
  144. if (state->config.if2)
  145. if2 = state->config.if2;
  146. if (adc_clock >= if2 * 2)
  147. ife = if2;
  148. else {
  149. ife = adc_clock - (if2 % adc_clock);
  150. if (ife > adc_clock / 2)
  151. ife = adc_clock - ife;
  152. }
  153. value = (u64)65536 * ife + adc_clock / 2;
  154. do_div(value, adc_clock);
  155. *input_freq = -value;
  156. dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",
  157. __func__, if2, ife, adc_clock, -(int)value, *input_freq);
  158. }
  159. static int zl10353_sleep(struct dvb_frontend *fe)
  160. {
  161. static u8 zl10353_softdown[] = { 0x50, 0x0C, 0x44 };
  162. zl10353_write(fe, zl10353_softdown, sizeof(zl10353_softdown));
  163. return 0;
  164. }
  165. static int zl10353_set_parameters(struct dvb_frontend *fe,
  166. struct dvb_frontend_parameters *param)
  167. {
  168. struct zl10353_state *state = fe->demodulator_priv;
  169. u16 nominal_rate, input_freq;
  170. u8 pllbuf[6] = { 0x67 }, acq_ctl = 0;
  171. u16 tps = 0;
  172. struct dvb_ofdm_parameters *op = &param->u.ofdm;
  173. zl10353_single_write(fe, RESET, 0x80);
  174. udelay(200);
  175. zl10353_single_write(fe, 0xEA, 0x01);
  176. udelay(200);
  177. zl10353_single_write(fe, 0xEA, 0x00);
  178. zl10353_single_write(fe, AGC_TARGET, 0x28);
  179. if (op->transmission_mode != TRANSMISSION_MODE_AUTO)
  180. acq_ctl |= (1 << 0);
  181. if (op->guard_interval != GUARD_INTERVAL_AUTO)
  182. acq_ctl |= (1 << 1);
  183. zl10353_single_write(fe, ACQ_CTL, acq_ctl);
  184. switch (op->bandwidth) {
  185. case BANDWIDTH_6_MHZ:
  186. /* These are extrapolated from the 7 and 8MHz values */
  187. zl10353_single_write(fe, MCLK_RATIO, 0x97);
  188. zl10353_single_write(fe, 0x64, 0x34);
  189. zl10353_single_write(fe, 0xcc, 0xdd);
  190. break;
  191. case BANDWIDTH_7_MHZ:
  192. zl10353_single_write(fe, MCLK_RATIO, 0x86);
  193. zl10353_single_write(fe, 0x64, 0x35);
  194. zl10353_single_write(fe, 0xcc, 0x73);
  195. break;
  196. case BANDWIDTH_8_MHZ:
  197. default:
  198. zl10353_single_write(fe, MCLK_RATIO, 0x75);
  199. zl10353_single_write(fe, 0x64, 0x36);
  200. zl10353_single_write(fe, 0xcc, 0x73);
  201. }
  202. zl10353_calc_nominal_rate(fe, op->bandwidth, &nominal_rate);
  203. zl10353_single_write(fe, TRL_NOMINAL_RATE_1, msb(nominal_rate));
  204. zl10353_single_write(fe, TRL_NOMINAL_RATE_0, lsb(nominal_rate));
  205. state->bandwidth = op->bandwidth;
  206. zl10353_calc_input_freq(fe, &input_freq);
  207. zl10353_single_write(fe, INPUT_FREQ_1, msb(input_freq));
  208. zl10353_single_write(fe, INPUT_FREQ_0, lsb(input_freq));
  209. /* Hint at TPS settings */
  210. switch (op->code_rate_HP) {
  211. case FEC_2_3:
  212. tps |= (1 << 7);
  213. break;
  214. case FEC_3_4:
  215. tps |= (2 << 7);
  216. break;
  217. case FEC_5_6:
  218. tps |= (3 << 7);
  219. break;
  220. case FEC_7_8:
  221. tps |= (4 << 7);
  222. break;
  223. case FEC_1_2:
  224. case FEC_AUTO:
  225. break;
  226. default:
  227. return -EINVAL;
  228. }
  229. switch (op->code_rate_LP) {
  230. case FEC_2_3:
  231. tps |= (1 << 4);
  232. break;
  233. case FEC_3_4:
  234. tps |= (2 << 4);
  235. break;
  236. case FEC_5_6:
  237. tps |= (3 << 4);
  238. break;
  239. case FEC_7_8:
  240. tps |= (4 << 4);
  241. break;
  242. case FEC_1_2:
  243. case FEC_AUTO:
  244. break;
  245. case FEC_NONE:
  246. if (op->hierarchy_information == HIERARCHY_AUTO ||
  247. op->hierarchy_information == HIERARCHY_NONE)
  248. break;
  249. default:
  250. return -EINVAL;
  251. }
  252. switch (op->constellation) {
  253. case QPSK:
  254. break;
  255. case QAM_AUTO:
  256. case QAM_16:
  257. tps |= (1 << 13);
  258. break;
  259. case QAM_64:
  260. tps |= (2 << 13);
  261. break;
  262. default:
  263. return -EINVAL;
  264. }
  265. switch (op->transmission_mode) {
  266. case TRANSMISSION_MODE_2K:
  267. case TRANSMISSION_MODE_AUTO:
  268. break;
  269. case TRANSMISSION_MODE_8K:
  270. tps |= (1 << 0);
  271. break;
  272. default:
  273. return -EINVAL;
  274. }
  275. switch (op->guard_interval) {
  276. case GUARD_INTERVAL_1_32:
  277. case GUARD_INTERVAL_AUTO:
  278. break;
  279. case GUARD_INTERVAL_1_16:
  280. tps |= (1 << 2);
  281. break;
  282. case GUARD_INTERVAL_1_8:
  283. tps |= (2 << 2);
  284. break;
  285. case GUARD_INTERVAL_1_4:
  286. tps |= (3 << 2);
  287. break;
  288. default:
  289. return -EINVAL;
  290. }
  291. switch (op->hierarchy_information) {
  292. case HIERARCHY_AUTO:
  293. case HIERARCHY_NONE:
  294. break;
  295. case HIERARCHY_1:
  296. tps |= (1 << 10);
  297. break;
  298. case HIERARCHY_2:
  299. tps |= (2 << 10);
  300. break;
  301. case HIERARCHY_4:
  302. tps |= (3 << 10);
  303. break;
  304. default:
  305. return -EINVAL;
  306. }
  307. zl10353_single_write(fe, TPS_GIVEN_1, msb(tps));
  308. zl10353_single_write(fe, TPS_GIVEN_0, lsb(tps));
  309. if (fe->ops.i2c_gate_ctrl)
  310. fe->ops.i2c_gate_ctrl(fe, 0);
  311. /*
  312. * If there is no tuner attached to the secondary I2C bus, we call
  313. * set_params to program a potential tuner attached somewhere else.
  314. * Otherwise, we update the PLL registers via calc_regs.
  315. */
  316. if (state->config.no_tuner) {
  317. if (fe->ops.tuner_ops.set_params) {
  318. fe->ops.tuner_ops.set_params(fe, param);
  319. if (fe->ops.i2c_gate_ctrl)
  320. fe->ops.i2c_gate_ctrl(fe, 0);
  321. }
  322. } else if (fe->ops.tuner_ops.calc_regs) {
  323. fe->ops.tuner_ops.calc_regs(fe, param, pllbuf + 1, 5);
  324. pllbuf[1] <<= 1;
  325. zl10353_write(fe, pllbuf, sizeof(pllbuf));
  326. }
  327. zl10353_single_write(fe, 0x5F, 0x13);
  328. /* If no attached tuner or invalid PLL registers, just start the FSM. */
  329. if (state->config.no_tuner || fe->ops.tuner_ops.calc_regs == NULL)
  330. zl10353_single_write(fe, FSM_GO, 0x01);
  331. else
  332. zl10353_single_write(fe, TUNER_GO, 0x01);
  333. return 0;
  334. }
  335. static int zl10353_get_parameters(struct dvb_frontend *fe,
  336. struct dvb_frontend_parameters *param)
  337. {
  338. struct zl10353_state *state = fe->demodulator_priv;
  339. struct dvb_ofdm_parameters *op = &param->u.ofdm;
  340. int s6, s9;
  341. u16 tps;
  342. static const u8 tps_fec_to_api[8] = {
  343. FEC_1_2,
  344. FEC_2_3,
  345. FEC_3_4,
  346. FEC_5_6,
  347. FEC_7_8,
  348. FEC_AUTO,
  349. FEC_AUTO,
  350. FEC_AUTO
  351. };
  352. s6 = zl10353_read_register(state, STATUS_6);
  353. s9 = zl10353_read_register(state, STATUS_9);
  354. if (s6 < 0 || s9 < 0)
  355. return -EREMOTEIO;
  356. if ((s6 & (1 << 5)) == 0 || (s9 & (1 << 4)) == 0)
  357. return -EINVAL; /* no FE or TPS lock */
  358. tps = zl10353_read_register(state, TPS_RECEIVED_1) << 8 |
  359. zl10353_read_register(state, TPS_RECEIVED_0);
  360. op->code_rate_HP = tps_fec_to_api[(tps >> 7) & 7];
  361. op->code_rate_LP = tps_fec_to_api[(tps >> 4) & 7];
  362. switch ((tps >> 13) & 3) {
  363. case 0:
  364. op->constellation = QPSK;
  365. break;
  366. case 1:
  367. op->constellation = QAM_16;
  368. break;
  369. case 2:
  370. op->constellation = QAM_64;
  371. break;
  372. default:
  373. op->constellation = QAM_AUTO;
  374. break;
  375. }
  376. op->transmission_mode = (tps & 0x01) ? TRANSMISSION_MODE_8K :
  377. TRANSMISSION_MODE_2K;
  378. switch ((tps >> 2) & 3) {
  379. case 0:
  380. op->guard_interval = GUARD_INTERVAL_1_32;
  381. break;
  382. case 1:
  383. op->guard_interval = GUARD_INTERVAL_1_16;
  384. break;
  385. case 2:
  386. op->guard_interval = GUARD_INTERVAL_1_8;
  387. break;
  388. case 3:
  389. op->guard_interval = GUARD_INTERVAL_1_4;
  390. break;
  391. default:
  392. op->guard_interval = GUARD_INTERVAL_AUTO;
  393. break;
  394. }
  395. switch ((tps >> 10) & 7) {
  396. case 0:
  397. op->hierarchy_information = HIERARCHY_NONE;
  398. break;
  399. case 1:
  400. op->hierarchy_information = HIERARCHY_1;
  401. break;
  402. case 2:
  403. op->hierarchy_information = HIERARCHY_2;
  404. break;
  405. case 3:
  406. op->hierarchy_information = HIERARCHY_4;
  407. break;
  408. default:
  409. op->hierarchy_information = HIERARCHY_AUTO;
  410. break;
  411. }
  412. param->frequency = 0;
  413. op->bandwidth = state->bandwidth;
  414. param->inversion = INVERSION_AUTO;
  415. return 0;
  416. }
  417. static int zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status)
  418. {
  419. struct zl10353_state *state = fe->demodulator_priv;
  420. int s6, s7, s8;
  421. if ((s6 = zl10353_read_register(state, STATUS_6)) < 0)
  422. return -EREMOTEIO;
  423. if ((s7 = zl10353_read_register(state, STATUS_7)) < 0)
  424. return -EREMOTEIO;
  425. if ((s8 = zl10353_read_register(state, STATUS_8)) < 0)
  426. return -EREMOTEIO;
  427. *status = 0;
  428. if (s6 & (1 << 2))
  429. *status |= FE_HAS_CARRIER;
  430. if (s6 & (1 << 1))
  431. *status |= FE_HAS_VITERBI;
  432. if (s6 & (1 << 5))
  433. *status |= FE_HAS_LOCK;
  434. if (s7 & (1 << 4))
  435. *status |= FE_HAS_SYNC;
  436. if (s8 & (1 << 6))
  437. *status |= FE_HAS_SIGNAL;
  438. if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
  439. (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC))
  440. *status &= ~FE_HAS_LOCK;
  441. return 0;
  442. }
  443. static int zl10353_read_ber(struct dvb_frontend *fe, u32 *ber)
  444. {
  445. struct zl10353_state *state = fe->demodulator_priv;
  446. *ber = zl10353_read_register(state, RS_ERR_CNT_2) << 16 |
  447. zl10353_read_register(state, RS_ERR_CNT_1) << 8 |
  448. zl10353_read_register(state, RS_ERR_CNT_0);
  449. return 0;
  450. }
  451. static int zl10353_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
  452. {
  453. struct zl10353_state *state = fe->demodulator_priv;
  454. u16 signal = zl10353_read_register(state, AGC_GAIN_1) << 10 |
  455. zl10353_read_register(state, AGC_GAIN_0) << 2 | 3;
  456. *strength = ~signal;
  457. return 0;
  458. }
  459. static int zl10353_read_snr(struct dvb_frontend *fe, u16 *snr)
  460. {
  461. struct zl10353_state *state = fe->demodulator_priv;
  462. u8 _snr;
  463. if (debug_regs)
  464. zl10353_dump_regs(fe);
  465. _snr = zl10353_read_register(state, SNR);
  466. *snr = (_snr << 8) | _snr;
  467. return 0;
  468. }
  469. static int zl10353_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
  470. {
  471. struct zl10353_state *state = fe->demodulator_priv;
  472. *ucblocks = zl10353_read_register(state, RS_UBC_1) << 8 |
  473. zl10353_read_register(state, RS_UBC_0);
  474. return 0;
  475. }
  476. static int zl10353_get_tune_settings(struct dvb_frontend *fe,
  477. struct dvb_frontend_tune_settings
  478. *fe_tune_settings)
  479. {
  480. fe_tune_settings->min_delay_ms = 1000;
  481. fe_tune_settings->step_size = 0;
  482. fe_tune_settings->max_drift = 0;
  483. return 0;
  484. }
  485. static int zl10353_init(struct dvb_frontend *fe)
  486. {
  487. struct zl10353_state *state = fe->demodulator_priv;
  488. u8 zl10353_reset_attach[6] = { 0x50, 0x03, 0x64, 0x46, 0x15, 0x0F };
  489. int rc = 0;
  490. if (debug_regs)
  491. zl10353_dump_regs(fe);
  492. if (state->config.parallel_ts)
  493. zl10353_reset_attach[2] &= ~0x20;
  494. if (state->config.clock_ctl_1)
  495. zl10353_reset_attach[3] = state->config.clock_ctl_1;
  496. if (state->config.pll_0)
  497. zl10353_reset_attach[4] = state->config.pll_0;
  498. /* Do a "hard" reset if not already done */
  499. if (zl10353_read_register(state, 0x50) != zl10353_reset_attach[1] ||
  500. zl10353_read_register(state, 0x51) != zl10353_reset_attach[2]) {
  501. rc = zl10353_write(fe, zl10353_reset_attach,
  502. sizeof(zl10353_reset_attach));
  503. if (debug_regs)
  504. zl10353_dump_regs(fe);
  505. }
  506. return 0;
  507. }
  508. static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
  509. {
  510. struct zl10353_state *state = fe->demodulator_priv;
  511. u8 val = 0x0a;
  512. if (state->config.disable_i2c_gate_ctrl) {
  513. /* No tuner attached to the internal I2C bus */
  514. /* If set enable I2C bridge, the main I2C bus stopped hardly */
  515. return 0;
  516. }
  517. if (enable)
  518. val |= 0x10;
  519. return zl10353_single_write(fe, 0x62, val);
  520. }
  521. static void zl10353_release(struct dvb_frontend *fe)
  522. {
  523. struct zl10353_state *state = fe->demodulator_priv;
  524. kfree(state);
  525. }
  526. static struct dvb_frontend_ops zl10353_ops;
  527. struct dvb_frontend *zl10353_attach(const struct zl10353_config *config,
  528. struct i2c_adapter *i2c)
  529. {
  530. struct zl10353_state *state = NULL;
  531. int id;
  532. /* allocate memory for the internal state */
  533. state = kzalloc(sizeof(struct zl10353_state), GFP_KERNEL);
  534. if (state == NULL)
  535. goto error;
  536. /* setup the state */
  537. state->i2c = i2c;
  538. memcpy(&state->config, config, sizeof(struct zl10353_config));
  539. /* check if the demod is there */
  540. id = zl10353_read_register(state, CHIP_ID);
  541. if ((id != ID_ZL10353) && (id != ID_CE6230) && (id != ID_CE6231))
  542. goto error;
  543. /* create dvb_frontend */
  544. memcpy(&state->frontend.ops, &zl10353_ops, sizeof(struct dvb_frontend_ops));
  545. state->frontend.demodulator_priv = state;
  546. return &state->frontend;
  547. error:
  548. kfree(state);
  549. return NULL;
  550. }
  551. static struct dvb_frontend_ops zl10353_ops = {
  552. .info = {
  553. .name = "Zarlink ZL10353 DVB-T",
  554. .type = FE_OFDM,
  555. .frequency_min = 174000000,
  556. .frequency_max = 862000000,
  557. .frequency_stepsize = 166667,
  558. .frequency_tolerance = 0,
  559. .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 |
  560. FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
  561. FE_CAN_FEC_AUTO |
  562. FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
  563. FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
  564. FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER |
  565. FE_CAN_MUTE_TS
  566. },
  567. .release = zl10353_release,
  568. .init = zl10353_init,
  569. .sleep = zl10353_sleep,
  570. .i2c_gate_ctrl = zl10353_i2c_gate_ctrl,
  571. .write = zl10353_write,
  572. .set_frontend = zl10353_set_parameters,
  573. .get_frontend = zl10353_get_parameters,
  574. .get_tune_settings = zl10353_get_tune_settings,
  575. .read_status = zl10353_read_status,
  576. .read_ber = zl10353_read_ber,
  577. .read_signal_strength = zl10353_read_signal_strength,
  578. .read_snr = zl10353_read_snr,
  579. .read_ucblocks = zl10353_read_ucblocks,
  580. };
  581. module_param(debug, int, 0644);
  582. MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
  583. module_param(debug_regs, int, 0644);
  584. MODULE_PARM_DESC(debug_regs, "Turn on/off frontend register dumps (default:off).");
  585. MODULE_DESCRIPTION("Zarlink ZL10353 DVB-T demodulator driver");
  586. MODULE_AUTHOR("Chris Pascoe");
  587. MODULE_LICENSE("GPL");
  588. EXPORT_SYMBOL(zl10353_attach);