diff options
Diffstat (limited to 'drivers/media/dvb/frontends/au8522.c')
-rw-r--r-- | drivers/media/dvb/frontends/au8522.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c index f7b71657f0f6..0b82cc2a1e16 100644 --- a/drivers/media/dvb/frontends/au8522.c +++ b/drivers/media/dvb/frontends/au8522.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | Auvitek AU8522 QAM/8VSB demodulator driver | 2 | Auvitek AU8522 QAM/8VSB demodulator driver |
3 | 3 | ||
4 | Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> | 4 | Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -304,6 +304,43 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, | |||
304 | return ret; | 304 | return ret; |
305 | } | 305 | } |
306 | 306 | ||
307 | static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq) | ||
308 | { | ||
309 | struct au8522_state *state = fe->demodulator_priv; | ||
310 | u8 r0b5, r0b6, r0b7; | ||
311 | char *ifmhz; | ||
312 | |||
313 | switch (if_freq) { | ||
314 | case AU8522_IF_3_25MHZ: | ||
315 | ifmhz = "3.25"; | ||
316 | r0b5 = 0x00; | ||
317 | r0b6 = 0x3d; | ||
318 | r0b7 = 0xa0; | ||
319 | break; | ||
320 | case AU8522_IF_4MHZ: | ||
321 | ifmhz = "4.00"; | ||
322 | r0b5 = 0x00; | ||
323 | r0b6 = 0x4b; | ||
324 | r0b7 = 0xd9; | ||
325 | break; | ||
326 | case AU8522_IF_6MHZ: | ||
327 | ifmhz = "6.00"; | ||
328 | r0b5 = 0xfb; | ||
329 | r0b6 = 0x8e; | ||
330 | r0b7 = 0x39; | ||
331 | break; | ||
332 | default: | ||
333 | dprintk("%s() IF Frequency not supported\n", __func__); | ||
334 | return -EINVAL; | ||
335 | } | ||
336 | dprintk("%s() %s MHz\n", __func__, ifmhz); | ||
337 | au8522_writereg(state, 0x80b5, r0b5); | ||
338 | au8522_writereg(state, 0x80b6, r0b6); | ||
339 | au8522_writereg(state, 0x80b7, r0b7); | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
307 | /* VSB Modulation table */ | 344 | /* VSB Modulation table */ |
308 | static struct { | 345 | static struct { |
309 | u16 reg; | 346 | u16 reg; |
@@ -334,9 +371,6 @@ static struct { | |||
334 | { 0x80af, 0x66 }, | 371 | { 0x80af, 0x66 }, |
335 | { 0x821b, 0xcc }, | 372 | { 0x821b, 0xcc }, |
336 | { 0x821d, 0x80 }, | 373 | { 0x821d, 0x80 }, |
337 | { 0x80b5, 0xfb }, | ||
338 | { 0x80b6, 0x8e }, | ||
339 | { 0x80b7, 0x39 }, | ||
340 | { 0x80a4, 0xe8 }, | 374 | { 0x80a4, 0xe8 }, |
341 | { 0x8231, 0x13 }, | 375 | { 0x8231, 0x13 }, |
342 | }; | 376 | }; |
@@ -350,9 +384,6 @@ static struct { | |||
350 | { 0x80a4, 0x00 }, | 384 | { 0x80a4, 0x00 }, |
351 | { 0x8081, 0xc4 }, | 385 | { 0x8081, 0xc4 }, |
352 | { 0x80a5, 0x40 }, | 386 | { 0x80a5, 0x40 }, |
353 | { 0x80b5, 0xfb }, | ||
354 | { 0x80b6, 0x8e }, | ||
355 | { 0x80b7, 0x39 }, | ||
356 | { 0x80aa, 0x77 }, | 387 | { 0x80aa, 0x77 }, |
357 | { 0x80ad, 0x77 }, | 388 | { 0x80ad, 0x77 }, |
358 | { 0x80a6, 0x67 }, | 389 | { 0x80a6, 0x67 }, |
@@ -438,6 +469,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
438 | au8522_writereg(state, | 469 | au8522_writereg(state, |
439 | VSB_mod_tab[i].reg, | 470 | VSB_mod_tab[i].reg, |
440 | VSB_mod_tab[i].data); | 471 | VSB_mod_tab[i].data); |
472 | au8522_set_if(fe, state->config->vsb_if); | ||
441 | break; | 473 | break; |
442 | case QAM_64: | 474 | case QAM_64: |
443 | case QAM_256: | 475 | case QAM_256: |
@@ -446,6 +478,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
446 | au8522_writereg(state, | 478 | au8522_writereg(state, |
447 | QAM_mod_tab[i].reg, | 479 | QAM_mod_tab[i].reg, |
448 | QAM_mod_tab[i].data); | 480 | QAM_mod_tab[i].data); |
481 | au8522_set_if(fe, state->config->qam_if); | ||
449 | break; | 482 | break; |
450 | default: | 483 | default: |
451 | dprintk("%s() Invalid modulation\n", __func__); | 484 | dprintk("%s() Invalid modulation\n", __func__); |