blob: 847a9b6d3dcf9ca4ca881004fdcd5d8e7f75e6b8 [file] [log] [blame]
Antti Palosaari4b64bb22012-03-30 08:21:25 -03001/*
2 * Afatech AF9033 demodulator driver
3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22#include "af9033_priv.h"
23
24struct af9033_state {
25 struct i2c_adapter *i2c;
26 struct dvb_frontend fe;
27 struct af9033_config cfg;
28
29 u32 bandwidth_hz;
30 bool ts_mode_parallel;
31 bool ts_mode_serial;
Hans-Frieder Vogt47eafa52012-04-07 10:34:34 -030032
33 u32 ber;
34 u32 ucb;
35 unsigned long last_stat_check;
Antti Palosaari4b64bb22012-03-30 08:21:25 -030036};
37
38/* write multiple registers */
39static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val,
40 int len)
41{
42 int ret;
43 u8 buf[3 + len];
44 struct i2c_msg msg[1] = {
45 {
46 .addr = state->cfg.i2c_addr,
47 .flags = 0,
48 .len = sizeof(buf),
49 .buf = buf,
50 }
51 };
52
53 buf[0] = (reg >> 16) & 0xff;
54 buf[1] = (reg >> 8) & 0xff;
55 buf[2] = (reg >> 0) & 0xff;
56 memcpy(&buf[3], val, len);
57
58 ret = i2c_transfer(state->i2c, msg, 1);
59 if (ret == 1) {
60 ret = 0;
61 } else {
Antti Palosaari0a73f2d2012-09-12 20:23:42 -030062 dev_warn(&state->i2c->dev, "%s: i2c wr failed=%d reg=%06x " \
63 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
Antti Palosaari4b64bb22012-03-30 08:21:25 -030064 ret = -EREMOTEIO;
65 }
66
67 return ret;
68}
69
70/* read multiple registers */
71static int af9033_rd_regs(struct af9033_state *state, u32 reg, u8 *val, int len)
72{
73 int ret;
74 u8 buf[3] = { (reg >> 16) & 0xff, (reg >> 8) & 0xff,
75 (reg >> 0) & 0xff };
76 struct i2c_msg msg[2] = {
77 {
78 .addr = state->cfg.i2c_addr,
79 .flags = 0,
80 .len = sizeof(buf),
81 .buf = buf
82 }, {
83 .addr = state->cfg.i2c_addr,
84 .flags = I2C_M_RD,
85 .len = len,
86 .buf = val
87 }
88 };
89
90 ret = i2c_transfer(state->i2c, msg, 2);
91 if (ret == 2) {
92 ret = 0;
93 } else {
Antti Palosaari0a73f2d2012-09-12 20:23:42 -030094 dev_warn(&state->i2c->dev, "%s: i2c rd failed=%d reg=%06x " \
95 "len=%d\n", KBUILD_MODNAME, ret, reg, len);
Antti Palosaari4b64bb22012-03-30 08:21:25 -030096 ret = -EREMOTEIO;
97 }
98
99 return ret;
100}
101
102
103/* write single register */
104static int af9033_wr_reg(struct af9033_state *state, u32 reg, u8 val)
105{
106 return af9033_wr_regs(state, reg, &val, 1);
107}
108
109/* read single register */
110static int af9033_rd_reg(struct af9033_state *state, u32 reg, u8 *val)
111{
112 return af9033_rd_regs(state, reg, val, 1);
113}
114
115/* write single register with mask */
116static int af9033_wr_reg_mask(struct af9033_state *state, u32 reg, u8 val,
117 u8 mask)
118{
119 int ret;
120 u8 tmp;
121
122 /* no need for read if whole reg is written */
123 if (mask != 0xff) {
124 ret = af9033_rd_regs(state, reg, &tmp, 1);
125 if (ret)
126 return ret;
127
128 val &= mask;
129 tmp &= ~mask;
130 val |= tmp;
131 }
132
133 return af9033_wr_regs(state, reg, &val, 1);
134}
135
136/* read single register with mask */
137static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
138 u8 mask)
139{
140 int ret, i;
141 u8 tmp;
142
143 ret = af9033_rd_regs(state, reg, &tmp, 1);
144 if (ret)
145 return ret;
146
147 tmp &= mask;
148
149 /* find position of the first bit */
150 for (i = 0; i < 8; i++) {
151 if ((mask >> i) & 0x01)
152 break;
153 }
154 *val = tmp >> i;
155
156 return 0;
157}
158
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300159static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x)
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300160{
161 u32 r = 0, c = 0, i;
162
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300163 dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d\n", __func__, a, b, x);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300164
165 if (a > b) {
166 c = a / b;
167 a = a - c * b;
168 }
169
170 for (i = 0; i < x; i++) {
171 if (a >= b) {
172 r += 1;
173 a -= b;
174 }
175 a <<= 1;
176 r <<= 1;
177 }
178 r = (c << (u32)x) + r;
179
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300180 dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d r=%d r=%x\n",
181 __func__, a, b, x, r, r);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300182
183 return r;
184}
185
186static void af9033_release(struct dvb_frontend *fe)
187{
188 struct af9033_state *state = fe->demodulator_priv;
189
190 kfree(state);
191}
192
193static int af9033_init(struct dvb_frontend *fe)
194{
195 struct af9033_state *state = fe->demodulator_priv;
196 int ret, i, len;
197 const struct reg_val *init;
198 u8 buf[4];
199 u32 adc_cw, clock_cw;
200 struct reg_val_mask tab[] = {
201 { 0x80fb24, 0x00, 0x08 },
202 { 0x80004c, 0x00, 0xff },
203 { 0x00f641, state->cfg.tuner, 0xff },
204 { 0x80f5ca, 0x01, 0x01 },
205 { 0x80f715, 0x01, 0x01 },
206 { 0x00f41f, 0x04, 0x04 },
207 { 0x00f41a, 0x01, 0x01 },
208 { 0x80f731, 0x00, 0x01 },
209 { 0x00d91e, 0x00, 0x01 },
210 { 0x00d919, 0x00, 0x01 },
211 { 0x80f732, 0x00, 0x01 },
212 { 0x00d91f, 0x00, 0x01 },
213 { 0x00d91a, 0x00, 0x01 },
214 { 0x80f730, 0x00, 0x01 },
215 { 0x80f778, 0x00, 0xff },
216 { 0x80f73c, 0x01, 0x01 },
217 { 0x80f776, 0x00, 0x01 },
218 { 0x00d8fd, 0x01, 0xff },
219 { 0x00d830, 0x01, 0xff },
220 { 0x00d831, 0x00, 0xff },
221 { 0x00d832, 0x00, 0xff },
222 { 0x80f985, state->ts_mode_serial, 0x01 },
223 { 0x80f986, state->ts_mode_parallel, 0x01 },
224 { 0x00d827, 0x00, 0xff },
225 { 0x00d829, 0x00, 0xff },
Antti Palosaari4902bb32013-01-07 09:48:03 -0300226 { 0x800045, state->cfg.adc_multiplier, 0xff },
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300227 };
228
229 /* program clock control */
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300230 clock_cw = af9033_div(state, state->cfg.clock, 1000000ul, 19ul);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300231 buf[0] = (clock_cw >> 0) & 0xff;
232 buf[1] = (clock_cw >> 8) & 0xff;
233 buf[2] = (clock_cw >> 16) & 0xff;
234 buf[3] = (clock_cw >> 24) & 0xff;
235
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300236 dev_dbg(&state->i2c->dev, "%s: clock=%d clock_cw=%08x\n",
237 __func__, state->cfg.clock, clock_cw);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300238
239 ret = af9033_wr_regs(state, 0x800025, buf, 4);
240 if (ret < 0)
241 goto err;
242
243 /* program ADC control */
244 for (i = 0; i < ARRAY_SIZE(clock_adc_lut); i++) {
245 if (clock_adc_lut[i].clock == state->cfg.clock)
246 break;
247 }
248
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300249 adc_cw = af9033_div(state, clock_adc_lut[i].adc, 1000000ul, 19ul);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300250 buf[0] = (adc_cw >> 0) & 0xff;
251 buf[1] = (adc_cw >> 8) & 0xff;
252 buf[2] = (adc_cw >> 16) & 0xff;
253
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300254 dev_dbg(&state->i2c->dev, "%s: adc=%d adc_cw=%06x\n",
255 __func__, clock_adc_lut[i].adc, adc_cw);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300256
257 ret = af9033_wr_regs(state, 0x80f1cd, buf, 3);
258 if (ret < 0)
259 goto err;
260
261 /* program register table */
262 for (i = 0; i < ARRAY_SIZE(tab); i++) {
263 ret = af9033_wr_reg_mask(state, tab[i].reg, tab[i].val,
264 tab[i].mask);
265 if (ret < 0)
266 goto err;
267 }
268
269 /* settings for TS interface */
270 if (state->cfg.ts_mode == AF9033_TS_MODE_USB) {
271 ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01);
272 if (ret < 0)
273 goto err;
274
275 ret = af9033_wr_reg_mask(state, 0x80f9b5, 0x01, 0x01);
276 if (ret < 0)
277 goto err;
278 } else {
279 ret = af9033_wr_reg_mask(state, 0x80f990, 0x00, 0x01);
280 if (ret < 0)
281 goto err;
282
283 ret = af9033_wr_reg_mask(state, 0x80f9b5, 0x00, 0x01);
284 if (ret < 0)
285 goto err;
286 }
287
Antti Palosaarife8eece2013-02-03 13:39:55 -0300288 /*
289 * FIXME: These inits are logically property of demodulator driver
290 * (that driver), but currently in case of IT9135 those are done by
291 * tuner driver.
292 */
293
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300294 /* load OFSM settings */
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300295 dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
Antti Palosaarife8eece2013-02-03 13:39:55 -0300296 switch (state->cfg.tuner) {
297 case AF9033_TUNER_IT9135_38:
298 case AF9033_TUNER_IT9135_51:
299 case AF9033_TUNER_IT9135_52:
Antti Palosaari463c3992013-03-07 00:03:06 -0300300 len = ARRAY_SIZE(ofsm_init_it9135_v1);
301 init = ofsm_init_it9135_v1;
302 break;
Antti Palosaarife8eece2013-02-03 13:39:55 -0300303 case AF9033_TUNER_IT9135_60:
304 case AF9033_TUNER_IT9135_61:
305 case AF9033_TUNER_IT9135_62:
Antti Palosaari463c3992013-03-07 00:03:06 -0300306 len = ARRAY_SIZE(ofsm_init_it9135_v2);
307 init = ofsm_init_it9135_v2;
Antti Palosaarife8eece2013-02-03 13:39:55 -0300308 break;
309 default:
310 len = ARRAY_SIZE(ofsm_init);
311 init = ofsm_init;
312 break;
313 }
314
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300315 for (i = 0; i < len; i++) {
316 ret = af9033_wr_reg(state, init[i].reg, init[i].val);
317 if (ret < 0)
318 goto err;
319 }
320
321 /* load tuner specific settings */
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300322 dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300323 __func__);
324 switch (state->cfg.tuner) {
325 case AF9033_TUNER_TUA9001:
326 len = ARRAY_SIZE(tuner_init_tua9001);
327 init = tuner_init_tua9001;
328 break;
Michael Büschffc501f2012-04-02 12:18:36 -0300329 case AF9033_TUNER_FC0011:
330 len = ARRAY_SIZE(tuner_init_fc0011);
331 init = tuner_init_fc0011;
332 break;
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300333 case AF9033_TUNER_MXL5007T:
334 len = ARRAY_SIZE(tuner_init_mxl5007t);
335 init = tuner_init_mxl5007t;
336 break;
Gianluca Gennarice1fe372012-04-02 17:25:14 -0300337 case AF9033_TUNER_TDA18218:
338 len = ARRAY_SIZE(tuner_init_tda18218);
339 init = tuner_init_tda18218;
340 break;
Oliver Schinagld67ceb32012-09-20 14:57:17 -0300341 case AF9033_TUNER_FC2580:
342 len = ARRAY_SIZE(tuner_init_fc2580);
343 init = tuner_init_fc2580;
344 break;
Antti Palosaarie713ad12012-12-02 18:47:00 -0300345 case AF9033_TUNER_FC0012:
346 len = ARRAY_SIZE(tuner_init_fc0012);
347 init = tuner_init_fc0012;
348 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300349 case AF9033_TUNER_IT9135_38:
Antti Palosaaria72cbb72013-03-07 21:17:55 -0300350 len = ARRAY_SIZE(tuner_init_it9135_38);
351 init = tuner_init_it9135_38;
352 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300353 case AF9033_TUNER_IT9135_51:
Antti Palosaaribb2e12a2013-03-07 21:25:16 -0300354 len = ARRAY_SIZE(tuner_init_it9135_51);
355 init = tuner_init_it9135_51;
356 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300357 case AF9033_TUNER_IT9135_52:
Antti Palosaari22d729f2013-03-07 21:29:05 -0300358 len = ARRAY_SIZE(tuner_init_it9135_52);
359 init = tuner_init_it9135_52;
360 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300361 case AF9033_TUNER_IT9135_60:
Antti Palosaaria49f53a2013-03-07 21:38:00 -0300362 len = ARRAY_SIZE(tuner_init_it9135_60);
363 init = tuner_init_it9135_60;
364 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300365 case AF9033_TUNER_IT9135_61:
Antti Palosaari85211322013-03-07 21:44:30 -0300366 len = ARRAY_SIZE(tuner_init_it9135_61);
367 init = tuner_init_it9135_61;
368 break;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300369 case AF9033_TUNER_IT9135_62:
Antti Palosaaridc4a2c42013-03-07 21:47:20 -0300370 len = ARRAY_SIZE(tuner_init_it9135_62);
371 init = tuner_init_it9135_62;
Antti Palosaari4902bb32013-01-07 09:48:03 -0300372 break;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300373 default:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300374 dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
375 __func__, state->cfg.tuner);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300376 ret = -ENODEV;
377 goto err;
378 }
379
380 for (i = 0; i < len; i++) {
381 ret = af9033_wr_reg(state, init[i].reg, init[i].val);
382 if (ret < 0)
383 goto err;
384 }
385
Jose Alberto Reguero98059922012-09-23 16:48:47 -0300386 if (state->cfg.ts_mode == AF9033_TS_MODE_SERIAL) {
387 ret = af9033_wr_reg_mask(state, 0x00d91c, 0x01, 0x01);
388 if (ret < 0)
389 goto err;
Antti Palosaaribf97b632012-12-08 22:51:19 -0300390
Jose Alberto Reguero98059922012-09-23 16:48:47 -0300391 ret = af9033_wr_reg_mask(state, 0x00d917, 0x00, 0x01);
392 if (ret < 0)
393 goto err;
Antti Palosaaribf97b632012-12-08 22:51:19 -0300394
Jose Alberto Reguero98059922012-09-23 16:48:47 -0300395 ret = af9033_wr_reg_mask(state, 0x00d916, 0x00, 0x01);
396 if (ret < 0)
397 goto err;
398 }
399
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300400 state->bandwidth_hz = 0; /* force to program all parameters */
401
402 return 0;
403
404err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300405 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300406
407 return ret;
408}
409
410static int af9033_sleep(struct dvb_frontend *fe)
411{
412 struct af9033_state *state = fe->demodulator_priv;
413 int ret, i;
414 u8 tmp;
415
416 ret = af9033_wr_reg(state, 0x80004c, 1);
417 if (ret < 0)
418 goto err;
419
420 ret = af9033_wr_reg(state, 0x800000, 0);
421 if (ret < 0)
422 goto err;
423
424 for (i = 100, tmp = 1; i && tmp; i--) {
425 ret = af9033_rd_reg(state, 0x80004c, &tmp);
426 if (ret < 0)
427 goto err;
428
429 usleep_range(200, 10000);
430 }
431
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300432 dev_dbg(&state->i2c->dev, "%s: loop=%d\n", __func__, i);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300433
434 if (i == 0) {
435 ret = -ETIMEDOUT;
436 goto err;
437 }
438
439 ret = af9033_wr_reg_mask(state, 0x80fb24, 0x08, 0x08);
440 if (ret < 0)
441 goto err;
442
443 /* prevent current leak (?) */
444 if (state->cfg.ts_mode == AF9033_TS_MODE_SERIAL) {
445 /* enable parallel TS */
446 ret = af9033_wr_reg_mask(state, 0x00d917, 0x00, 0x01);
447 if (ret < 0)
448 goto err;
449
450 ret = af9033_wr_reg_mask(state, 0x00d916, 0x01, 0x01);
451 if (ret < 0)
452 goto err;
453 }
454
455 return 0;
456
457err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300458 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300459
460 return ret;
461}
462
463static int af9033_get_tune_settings(struct dvb_frontend *fe,
464 struct dvb_frontend_tune_settings *fesettings)
465{
Antti Palosaarife8eece2013-02-03 13:39:55 -0300466 /* 800 => 2000 because IT9135 v2 is slow to gain lock */
467 fesettings->min_delay_ms = 2000;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300468 fesettings->step_size = 0;
469 fesettings->max_drift = 0;
470
471 return 0;
472}
473
474static int af9033_set_frontend(struct dvb_frontend *fe)
475{
476 struct af9033_state *state = fe->demodulator_priv;
477 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300478 int ret, i, spec_inv, sampling_freq;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300479 u8 tmp, buf[3], bandwidth_reg_val;
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300480 u32 if_frequency, freq_cw, adc_freq;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300481
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300482 dev_dbg(&state->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n",
483 __func__, c->frequency, c->bandwidth_hz);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300484
485 /* check bandwidth */
486 switch (c->bandwidth_hz) {
487 case 6000000:
488 bandwidth_reg_val = 0x00;
489 break;
490 case 7000000:
491 bandwidth_reg_val = 0x01;
492 break;
493 case 8000000:
494 bandwidth_reg_val = 0x02;
495 break;
496 default:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300497 dev_dbg(&state->i2c->dev, "%s: invalid bandwidth_hz\n",
498 __func__);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300499 ret = -EINVAL;
500 goto err;
501 }
502
503 /* program tuner */
504 if (fe->ops.tuner_ops.set_params)
505 fe->ops.tuner_ops.set_params(fe);
506
507 /* program CFOE coefficients */
508 if (c->bandwidth_hz != state->bandwidth_hz) {
509 for (i = 0; i < ARRAY_SIZE(coeff_lut); i++) {
510 if (coeff_lut[i].clock == state->cfg.clock &&
511 coeff_lut[i].bandwidth_hz == c->bandwidth_hz) {
512 break;
513 }
514 }
515 ret = af9033_wr_regs(state, 0x800001,
516 coeff_lut[i].val, sizeof(coeff_lut[i].val));
517 }
518
519 /* program frequency control */
520 if (c->bandwidth_hz != state->bandwidth_hz) {
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300521 spec_inv = state->cfg.spec_inv ? -1 : 1;
522
523 for (i = 0; i < ARRAY_SIZE(clock_adc_lut); i++) {
524 if (clock_adc_lut[i].clock == state->cfg.clock)
525 break;
526 }
527 adc_freq = clock_adc_lut[i].adc;
528
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300529 /* get used IF frequency */
530 if (fe->ops.tuner_ops.get_if_frequency)
531 fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency);
532 else
533 if_frequency = 0;
534
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300535 sampling_freq = if_frequency;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300536
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300537 while (sampling_freq > (adc_freq / 2))
538 sampling_freq -= adc_freq;
539
540 if (sampling_freq >= 0)
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300541 spec_inv *= -1;
542 else
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300543 sampling_freq *= -1;
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300544
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300545 freq_cw = af9033_div(state, sampling_freq, adc_freq, 23ul);
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300546
547 if (spec_inv == -1)
Hans-Frieder Vogt182b9672012-10-03 05:25:40 -0300548 freq_cw = 0x800000 - freq_cw;
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300549
Antti Palosaari4902bb32013-01-07 09:48:03 -0300550 if (state->cfg.adc_multiplier == AF9033_ADC_MULTIPLIER_2X)
Hans-Frieder Vogt540fd4b2012-04-02 14:18:16 -0300551 freq_cw /= 2;
552
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300553 buf[0] = (freq_cw >> 0) & 0xff;
554 buf[1] = (freq_cw >> 8) & 0xff;
555 buf[2] = (freq_cw >> 16) & 0x7f;
Antti Palosaarife8eece2013-02-03 13:39:55 -0300556
557 /* FIXME: there seems to be calculation error here... */
558 if (if_frequency == 0)
559 buf[2] = 0;
560
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300561 ret = af9033_wr_regs(state, 0x800029, buf, 3);
562 if (ret < 0)
563 goto err;
564
565 state->bandwidth_hz = c->bandwidth_hz;
566 }
567
568 ret = af9033_wr_reg_mask(state, 0x80f904, bandwidth_reg_val, 0x03);
569 if (ret < 0)
570 goto err;
571
572 ret = af9033_wr_reg(state, 0x800040, 0x00);
573 if (ret < 0)
574 goto err;
575
576 ret = af9033_wr_reg(state, 0x800047, 0x00);
577 if (ret < 0)
578 goto err;
579
580 ret = af9033_wr_reg_mask(state, 0x80f999, 0x00, 0x01);
581 if (ret < 0)
582 goto err;
583
584 if (c->frequency <= 230000000)
585 tmp = 0x00; /* VHF */
586 else
587 tmp = 0x01; /* UHF */
588
589 ret = af9033_wr_reg(state, 0x80004b, tmp);
590 if (ret < 0)
591 goto err;
592
593 ret = af9033_wr_reg(state, 0x800000, 0x00);
594 if (ret < 0)
595 goto err;
596
597 return 0;
598
599err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300600 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300601
602 return ret;
603}
604
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300605static int af9033_get_frontend(struct dvb_frontend *fe)
606{
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300607 struct af9033_state *state = fe->demodulator_priv;
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300608 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300609 int ret;
610 u8 buf[8];
611
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300612 dev_dbg(&state->i2c->dev, "%s:\n", __func__);
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300613
614 /* read all needed registers */
615 ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf));
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300616 if (ret < 0)
617 goto err;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300618
619 switch ((buf[0] >> 0) & 3) {
620 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300621 c->transmission_mode = TRANSMISSION_MODE_2K;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300622 break;
623 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300624 c->transmission_mode = TRANSMISSION_MODE_8K;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300625 break;
626 }
627
628 switch ((buf[1] >> 0) & 3) {
629 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300630 c->guard_interval = GUARD_INTERVAL_1_32;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300631 break;
632 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300633 c->guard_interval = GUARD_INTERVAL_1_16;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300634 break;
635 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300636 c->guard_interval = GUARD_INTERVAL_1_8;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300637 break;
638 case 3:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300639 c->guard_interval = GUARD_INTERVAL_1_4;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300640 break;
641 }
642
643 switch ((buf[2] >> 0) & 7) {
644 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300645 c->hierarchy = HIERARCHY_NONE;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300646 break;
647 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300648 c->hierarchy = HIERARCHY_1;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300649 break;
650 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300651 c->hierarchy = HIERARCHY_2;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300652 break;
653 case 3:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300654 c->hierarchy = HIERARCHY_4;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300655 break;
656 }
657
658 switch ((buf[3] >> 0) & 3) {
659 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300660 c->modulation = QPSK;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300661 break;
662 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300663 c->modulation = QAM_16;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300664 break;
665 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300666 c->modulation = QAM_64;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300667 break;
668 }
669
670 switch ((buf[4] >> 0) & 3) {
671 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300672 c->bandwidth_hz = 6000000;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300673 break;
674 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300675 c->bandwidth_hz = 7000000;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300676 break;
677 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300678 c->bandwidth_hz = 8000000;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300679 break;
680 }
681
682 switch ((buf[6] >> 0) & 7) {
683 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300684 c->code_rate_HP = FEC_1_2;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300685 break;
686 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300687 c->code_rate_HP = FEC_2_3;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300688 break;
689 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300690 c->code_rate_HP = FEC_3_4;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300691 break;
692 case 3:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300693 c->code_rate_HP = FEC_5_6;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300694 break;
695 case 4:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300696 c->code_rate_HP = FEC_7_8;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300697 break;
698 case 5:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300699 c->code_rate_HP = FEC_NONE;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300700 break;
701 }
702
703 switch ((buf[7] >> 0) & 7) {
704 case 0:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300705 c->code_rate_LP = FEC_1_2;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300706 break;
707 case 1:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300708 c->code_rate_LP = FEC_2_3;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300709 break;
710 case 2:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300711 c->code_rate_LP = FEC_3_4;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300712 break;
713 case 3:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300714 c->code_rate_LP = FEC_5_6;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300715 break;
716 case 4:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300717 c->code_rate_LP = FEC_7_8;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300718 break;
719 case 5:
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300720 c->code_rate_LP = FEC_NONE;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300721 break;
722 }
723
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300724 return 0;
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300725
Antti Palosaaride7f14fc2012-04-05 21:14:32 -0300726err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300727 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Gianluca Gennari0a4df232012-04-05 12:47:19 -0300728
729 return ret;
730}
731
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300732static int af9033_read_status(struct dvb_frontend *fe, fe_status_t *status)
733{
734 struct af9033_state *state = fe->demodulator_priv;
735 int ret;
736 u8 tmp;
737
738 *status = 0;
739
740 /* radio channel status, 0=no result, 1=has signal, 2=no signal */
741 ret = af9033_rd_reg(state, 0x800047, &tmp);
742 if (ret < 0)
743 goto err;
744
745 /* has signal */
746 if (tmp == 0x01)
747 *status |= FE_HAS_SIGNAL;
748
749 if (tmp != 0x02) {
750 /* TPS lock */
751 ret = af9033_rd_reg_mask(state, 0x80f5a9, &tmp, 0x01);
752 if (ret < 0)
753 goto err;
754
755 if (tmp)
756 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
757 FE_HAS_VITERBI;
758
759 /* full lock */
760 ret = af9033_rd_reg_mask(state, 0x80f999, &tmp, 0x01);
761 if (ret < 0)
762 goto err;
763
764 if (tmp)
765 *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER |
766 FE_HAS_VITERBI | FE_HAS_SYNC |
767 FE_HAS_LOCK;
768 }
769
770 return 0;
771
772err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300773 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300774
775 return ret;
776}
777
778static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr)
779{
Antti Palosaarie898ef62012-04-01 12:50:02 -0300780 struct af9033_state *state = fe->demodulator_priv;
781 int ret, i, len;
782 u8 buf[3], tmp;
783 u32 snr_val;
784 const struct val_snr *uninitialized_var(snr_lut);
785
786 /* read value */
787 ret = af9033_rd_regs(state, 0x80002c, buf, 3);
788 if (ret < 0)
789 goto err;
790
791 snr_val = (buf[2] << 16) | (buf[1] << 8) | buf[0];
792
793 /* read current modulation */
794 ret = af9033_rd_reg(state, 0x80f903, &tmp);
795 if (ret < 0)
796 goto err;
797
798 switch ((tmp >> 0) & 3) {
799 case 0:
800 len = ARRAY_SIZE(qpsk_snr_lut);
801 snr_lut = qpsk_snr_lut;
802 break;
803 case 1:
804 len = ARRAY_SIZE(qam16_snr_lut);
805 snr_lut = qam16_snr_lut;
806 break;
807 case 2:
808 len = ARRAY_SIZE(qam64_snr_lut);
809 snr_lut = qam64_snr_lut;
810 break;
811 default:
812 goto err;
813 }
814
815 for (i = 0; i < len; i++) {
816 tmp = snr_lut[i].snr;
817
818 if (snr_val < snr_lut[i].val)
819 break;
820 }
821
822 *snr = tmp * 10; /* dB/10 */
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300823
824 return 0;
Antti Palosaarie898ef62012-04-01 12:50:02 -0300825
826err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300827 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaarie898ef62012-04-01 12:50:02 -0300828
829 return ret;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300830}
831
832static int af9033_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
833{
834 struct af9033_state *state = fe->demodulator_priv;
835 int ret;
836 u8 strength2;
837
838 /* read signal strength of 0-100 scale */
839 ret = af9033_rd_reg(state, 0x800048, &strength2);
840 if (ret < 0)
841 goto err;
842
843 /* scale value to 0x0000-0xffff */
844 *strength = strength2 * 0xffff / 100;
845
846 return 0;
847
848err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300849 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300850
851 return ret;
852}
853
Hans-Frieder Vogt47eafa52012-04-07 10:34:34 -0300854static int af9033_update_ch_stat(struct af9033_state *state)
855{
856 int ret = 0;
857 u32 err_cnt, bit_cnt;
858 u16 abort_cnt;
859 u8 buf[7];
860
861 /* only update data every half second */
862 if (time_after(jiffies, state->last_stat_check + msecs_to_jiffies(500))) {
863 ret = af9033_rd_regs(state, 0x800032, buf, sizeof(buf));
864 if (ret < 0)
865 goto err;
866 /* in 8 byte packets? */
867 abort_cnt = (buf[1] << 8) + buf[0];
868 /* in bits */
869 err_cnt = (buf[4] << 16) + (buf[3] << 8) + buf[2];
870 /* in 8 byte packets? always(?) 0x2710 = 10000 */
871 bit_cnt = (buf[6] << 8) + buf[5];
872
873 if (bit_cnt < abort_cnt) {
874 abort_cnt = 1000;
875 state->ber = 0xffffffff;
876 } else {
877 /* 8 byte packets, that have not been rejected already */
878 bit_cnt -= (u32)abort_cnt;
879 if (bit_cnt == 0) {
880 state->ber = 0xffffffff;
881 } else {
882 err_cnt -= (u32)abort_cnt * 8 * 8;
883 bit_cnt *= 8 * 8;
884 state->ber = err_cnt * (0xffffffff / bit_cnt);
885 }
886 }
887 state->ucb += abort_cnt;
888 state->last_stat_check = jiffies;
889 }
890
891 return 0;
892err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300893 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
894
Hans-Frieder Vogt47eafa52012-04-07 10:34:34 -0300895 return ret;
896}
897
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300898static int af9033_read_ber(struct dvb_frontend *fe, u32 *ber)
899{
Hans-Frieder Vogt47eafa52012-04-07 10:34:34 -0300900 struct af9033_state *state = fe->demodulator_priv;
901 int ret;
902
903 ret = af9033_update_ch_stat(state);
904 if (ret < 0)
905 return ret;
906
907 *ber = state->ber;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300908
909 return 0;
910}
911
912static int af9033_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
913{
Hans-Frieder Vogt47eafa52012-04-07 10:34:34 -0300914 struct af9033_state *state = fe->demodulator_priv;
915 int ret;
916
917 ret = af9033_update_ch_stat(state);
918 if (ret < 0)
919 return ret;
920
921 *ucblocks = state->ucb;
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300922
923 return 0;
924}
925
926static int af9033_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
927{
928 struct af9033_state *state = fe->demodulator_priv;
929 int ret;
930
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300931 dev_dbg(&state->i2c->dev, "%s: enable=%d\n", __func__, enable);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300932
933 ret = af9033_wr_reg_mask(state, 0x00fa04, enable, 0x01);
934 if (ret < 0)
935 goto err;
936
937 return 0;
938
939err:
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300940 dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300941
942 return ret;
943}
944
945static struct dvb_frontend_ops af9033_ops;
946
947struct dvb_frontend *af9033_attach(const struct af9033_config *config,
948 struct i2c_adapter *i2c)
949{
950 int ret;
951 struct af9033_state *state;
952 u8 buf[8];
953
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300954 dev_dbg(&i2c->dev, "%s:\n", __func__);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300955
956 /* allocate memory for the internal state */
957 state = kzalloc(sizeof(struct af9033_state), GFP_KERNEL);
958 if (state == NULL)
959 goto err;
960
961 /* setup the state */
962 state->i2c = i2c;
963 memcpy(&state->cfg, config, sizeof(struct af9033_config));
964
Antti Palosaari8e8a5ac2012-04-01 14:13:36 -0300965 if (state->cfg.clock != 12000000) {
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300966 dev_err(&state->i2c->dev, "%s: af9033: unsupported clock=%d, " \
967 "only 12000000 Hz is supported currently\n",
968 KBUILD_MODNAME, state->cfg.clock);
Antti Palosaari8e8a5ac2012-04-01 14:13:36 -0300969 goto err;
970 }
971
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300972 /* firmware version */
973 ret = af9033_rd_regs(state, 0x0083e9, &buf[0], 4);
974 if (ret < 0)
975 goto err;
976
977 ret = af9033_rd_regs(state, 0x804191, &buf[4], 4);
978 if (ret < 0)
979 goto err;
980
Antti Palosaari0a73f2d2012-09-12 20:23:42 -0300981 dev_info(&state->i2c->dev, "%s: firmware version: LINK=%d.%d.%d.%d " \
982 "OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
983 buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300984
Antti Palosaari12897dc2012-09-16 22:26:57 -0300985
Antti Palosaari4902bb32013-01-07 09:48:03 -0300986 /* FIXME: Do not abuse adc_multiplier for detecting IT9135 */
987 if (state->cfg.adc_multiplier != AF9033_ADC_MULTIPLIER_2X) {
988 /* sleep */
989 ret = af9033_wr_reg(state, 0x80004c, 1);
990 if (ret < 0)
991 goto err;
992
993 ret = af9033_wr_reg(state, 0x800000, 0);
994 if (ret < 0)
995 goto err;
996 }
Antti Palosaari12897dc2012-09-16 22:26:57 -0300997
Antti Palosaari4b64bb22012-03-30 08:21:25 -0300998 /* configure internal TS mode */
999 switch (state->cfg.ts_mode) {
1000 case AF9033_TS_MODE_PARALLEL:
1001 state->ts_mode_parallel = true;
1002 break;
1003 case AF9033_TS_MODE_SERIAL:
1004 state->ts_mode_serial = true;
1005 break;
1006 case AF9033_TS_MODE_USB:
1007 /* usb mode for AF9035 */
1008 default:
1009 break;
1010 }
1011
1012 /* create dvb_frontend */
1013 memcpy(&state->fe.ops, &af9033_ops, sizeof(struct dvb_frontend_ops));
1014 state->fe.demodulator_priv = state;
1015
1016 return &state->fe;
1017
1018err:
1019 kfree(state);
1020 return NULL;
1021}
1022EXPORT_SYMBOL(af9033_attach);
1023
1024static struct dvb_frontend_ops af9033_ops = {
1025 .delsys = { SYS_DVBT },
1026 .info = {
1027 .name = "Afatech AF9033 (DVB-T)",
1028 .frequency_min = 174000000,
1029 .frequency_max = 862000000,
1030 .frequency_stepsize = 250000,
1031 .frequency_tolerance = 0,
1032 .caps = FE_CAN_FEC_1_2 |
1033 FE_CAN_FEC_2_3 |
1034 FE_CAN_FEC_3_4 |
1035 FE_CAN_FEC_5_6 |
1036 FE_CAN_FEC_7_8 |
1037 FE_CAN_FEC_AUTO |
1038 FE_CAN_QPSK |
1039 FE_CAN_QAM_16 |
1040 FE_CAN_QAM_64 |
1041 FE_CAN_QAM_AUTO |
1042 FE_CAN_TRANSMISSION_MODE_AUTO |
1043 FE_CAN_GUARD_INTERVAL_AUTO |
1044 FE_CAN_HIERARCHY_AUTO |
1045 FE_CAN_RECOVER |
1046 FE_CAN_MUTE_TS
1047 },
1048
1049 .release = af9033_release,
1050
1051 .init = af9033_init,
1052 .sleep = af9033_sleep,
1053
1054 .get_tune_settings = af9033_get_tune_settings,
1055 .set_frontend = af9033_set_frontend,
Gianluca Gennari0a4df232012-04-05 12:47:19 -03001056 .get_frontend = af9033_get_frontend,
Antti Palosaari4b64bb22012-03-30 08:21:25 -03001057
1058 .read_status = af9033_read_status,
1059 .read_snr = af9033_read_snr,
1060 .read_signal_strength = af9033_read_signal_strength,
1061 .read_ber = af9033_read_ber,
1062 .read_ucblocks = af9033_read_ucblocks,
1063
1064 .i2c_gate_ctrl = af9033_i2c_gate_ctrl,
1065};
1066
1067MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
1068MODULE_DESCRIPTION("Afatech AF9033 DVB-T demodulator driver");
1069MODULE_LICENSE("GPL");