zl10353.c 16 KB

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