diff options
-rw-r--r-- | drivers/media/dvb/frontends/au8522.c | 66 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/au8522.h | 9 |
2 files changed, 75 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c index f7b71657f0f6..5741bc930792 100644 --- a/drivers/media/dvb/frontends/au8522.c +++ b/drivers/media/dvb/frontends/au8522.c | |||
@@ -304,6 +304,70 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, | |||
304 | return ret; | 304 | return ret; |
305 | } | 305 | } |
306 | 306 | ||
307 | /* 3.25 MHz IF Frequency table */ | ||
308 | static struct { | ||
309 | u16 reg; | ||
310 | u16 data; | ||
311 | } if_3_25_mhz_tab[] = { | ||
312 | { 0x80b5, 0x00 }, | ||
313 | { 0x80b6, 0x3d }, | ||
314 | { 0x80b7, 0xa0 }, | ||
315 | }; | ||
316 | |||
317 | /* 4.00 MHz IF Frequency table */ | ||
318 | static struct { | ||
319 | u16 reg; | ||
320 | u16 data; | ||
321 | } if_4_mhz_tab[] = { | ||
322 | { 0x80b5, 0x00 }, | ||
323 | { 0x80b6, 0x4b }, | ||
324 | { 0x80b7, 0xd9 }, | ||
325 | }; | ||
326 | |||
327 | /* 6.00 MHz IF Frequency table */ | ||
328 | static struct { | ||
329 | u16 reg; | ||
330 | u16 data; | ||
331 | } if_6_mhz_tab[] = { | ||
332 | { 0x80b5, 0xfb }, | ||
333 | { 0x80b6, 0x8e }, | ||
334 | { 0x80b7, 0x39 }, | ||
335 | }; | ||
336 | |||
337 | static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq) | ||
338 | { | ||
339 | struct au8522_state *state = fe->demodulator_priv; | ||
340 | int i; | ||
341 | |||
342 | switch (if_freq) { | ||
343 | case AU8522_IF_3_25MHZ: | ||
344 | dprintk("%s() 3.25 MHz\n", __func__); | ||
345 | for (i = 0; i < ARRAY_SIZE(if_3_25_mhz_tab); i++) | ||
346 | au8522_writereg(state, | ||
347 | if_3_25_mhz_tab[i].reg, | ||
348 | if_3_25_mhz_tab[i].data); | ||
349 | break; | ||
350 | case AU8522_IF_4MHZ: | ||
351 | dprintk("%s() 4.00 MHz\n", __func__); | ||
352 | for (i = 0; i < ARRAY_SIZE(if_4_mhz_tab); i++) | ||
353 | au8522_writereg(state, | ||
354 | if_4_mhz_tab[i].reg, | ||
355 | if_4_mhz_tab[i].data); | ||
356 | break; | ||
357 | case AU8522_IF_6MHZ: | ||
358 | dprintk("%s() 6.00 MHz\n", __func__); | ||
359 | for (i = 0; i < ARRAY_SIZE(if_6_mhz_tab); i++) | ||
360 | au8522_writereg(state, | ||
361 | if_6_mhz_tab[i].reg, | ||
362 | if_6_mhz_tab[i].data); | ||
363 | break; | ||
364 | default: | ||
365 | dprintk("%s() IF Frequency not supported\n", __func__); | ||
366 | return -EINVAL; | ||
367 | } | ||
368 | return 0; | ||
369 | } | ||
370 | |||
307 | /* VSB Modulation table */ | 371 | /* VSB Modulation table */ |
308 | static struct { | 372 | static struct { |
309 | u16 reg; | 373 | u16 reg; |
@@ -438,6 +502,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
438 | au8522_writereg(state, | 502 | au8522_writereg(state, |
439 | VSB_mod_tab[i].reg, | 503 | VSB_mod_tab[i].reg, |
440 | VSB_mod_tab[i].data); | 504 | VSB_mod_tab[i].data); |
505 | au8522_set_if(fe, state->config->vsb_if); | ||
441 | break; | 506 | break; |
442 | case QAM_64: | 507 | case QAM_64: |
443 | case QAM_256: | 508 | case QAM_256: |
@@ -446,6 +511,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, | |||
446 | au8522_writereg(state, | 511 | au8522_writereg(state, |
447 | QAM_mod_tab[i].reg, | 512 | QAM_mod_tab[i].reg, |
448 | QAM_mod_tab[i].data); | 513 | QAM_mod_tab[i].data); |
514 | au8522_set_if(fe, state->config->qam_if); | ||
449 | break; | 515 | break; |
450 | default: | 516 | default: |
451 | dprintk("%s() Invalid modulation\n", __func__); | 517 | dprintk("%s() Invalid modulation\n", __func__); |
diff --git a/drivers/media/dvb/frontends/au8522.h b/drivers/media/dvb/frontends/au8522.h index d7affa3cdb27..afc9af26e7a2 100644 --- a/drivers/media/dvb/frontends/au8522.h +++ b/drivers/media/dvb/frontends/au8522.h | |||
@@ -24,6 +24,12 @@ | |||
24 | 24 | ||
25 | #include <linux/dvb/frontend.h> | 25 | #include <linux/dvb/frontend.h> |
26 | 26 | ||
27 | enum au8522_if_freq { | ||
28 | AU8522_IF_6MHZ = 0, | ||
29 | AU8522_IF_4MHZ, | ||
30 | AU8522_IF_3_25MHZ, | ||
31 | }; | ||
32 | |||
27 | struct au8522_config { | 33 | struct au8522_config { |
28 | /* the demodulator's i2c address */ | 34 | /* the demodulator's i2c address */ |
29 | u8 demod_address; | 35 | u8 demod_address; |
@@ -32,6 +38,9 @@ struct au8522_config { | |||
32 | #define AU8522_TUNERLOCKING 0 | 38 | #define AU8522_TUNERLOCKING 0 |
33 | #define AU8522_DEMODLOCKING 1 | 39 | #define AU8522_DEMODLOCKING 1 |
34 | u8 status_mode; | 40 | u8 status_mode; |
41 | |||
42 | enum au8522_if_freq vsb_if; | ||
43 | enum au8522_if_freq qam_if; | ||
35 | }; | 44 | }; |
36 | 45 | ||
37 | #if defined(CONFIG_DVB_AU8522) || \ | 46 | #if defined(CONFIG_DVB_AU8522) || \ |