diff options
Diffstat (limited to 'drivers/media/dvb/frontends/s5h1409.c')
-rw-r--r-- | drivers/media/dvb/frontends/s5h1409.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 562d9208857a..b80a3ee91ba4 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -42,6 +42,7 @@ struct s5h1409_state { | |||
42 | fe_modulation_t current_modulation; | 42 | fe_modulation_t current_modulation; |
43 | 43 | ||
44 | u32 current_frequency; | 44 | u32 current_frequency; |
45 | int if_freq; | ||
45 | 46 | ||
46 | u32 is_qam_locked; | 47 | u32 is_qam_locked; |
47 | u32 qam_state; | 48 | u32 qam_state; |
@@ -348,6 +349,9 @@ static int s5h1409_softreset(struct dvb_frontend* fe) | |||
348 | return 0; | 349 | return 0; |
349 | } | 350 | } |
350 | 351 | ||
352 | #define S5H1409_VSB_IF_FREQ 5380 | ||
353 | #define S5H1409_QAM_IF_FREQ state->config->qam_if | ||
354 | |||
351 | static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) | 355 | static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) |
352 | { | 356 | { |
353 | struct s5h1409_state* state = fe->demodulator_priv; | 357 | struct s5h1409_state* state = fe->demodulator_priv; |
@@ -369,6 +373,9 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) | |||
369 | ret = -1; | 373 | ret = -1; |
370 | } | 374 | } |
371 | 375 | ||
376 | if (0 == ret) | ||
377 | state->if_freq = KHz; | ||
378 | |||
372 | return ret; | 379 | return ret; |
373 | } | 380 | } |
374 | 381 | ||
@@ -394,11 +401,15 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe, | |||
394 | switch(m) { | 401 | switch(m) { |
395 | case VSB_8: | 402 | case VSB_8: |
396 | dprintk("%s() VSB_8\n", __FUNCTION__); | 403 | dprintk("%s() VSB_8\n", __FUNCTION__); |
404 | if (state->if_freq != S5H1409_VSB_IF_FREQ) | ||
405 | s5h1409_set_if_freq(fe, S5H1409_VSB_IF_FREQ); | ||
397 | s5h1409_writereg(state, 0xf4, 0); | 406 | s5h1409_writereg(state, 0xf4, 0); |
398 | break; | 407 | break; |
399 | case QAM_64: | 408 | case QAM_64: |
400 | case QAM_256: | 409 | case QAM_256: |
401 | dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__); | 410 | dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__); |
411 | if (state->if_freq != S5H1409_QAM_IF_FREQ) | ||
412 | s5h1409_set_if_freq(fe, S5H1409_QAM_IF_FREQ); | ||
402 | s5h1409_writereg(state, 0xf4, 1); | 413 | s5h1409_writereg(state, 0xf4, 1); |
403 | s5h1409_writereg(state, 0x85, 0x110); | 414 | s5h1409_writereg(state, 0x85, 0x110); |
404 | break; | 415 | break; |
@@ -571,7 +582,7 @@ static int s5h1409_init (struct dvb_frontend* fe) | |||
571 | s5h1409_writereg(state, 0xab, 0x0); /* Parallel */ | 582 | s5h1409_writereg(state, 0xab, 0x0); /* Parallel */ |
572 | 583 | ||
573 | s5h1409_set_spectralinversion(fe, state->config->inversion); | 584 | s5h1409_set_spectralinversion(fe, state->config->inversion); |
574 | s5h1409_set_if_freq(fe, state->config->if_freq); | 585 | s5h1409_set_if_freq(fe, state->if_freq); |
575 | s5h1409_set_gpio(fe, state->config->gpio); | 586 | s5h1409_set_gpio(fe, state->config->gpio); |
576 | s5h1409_softreset(fe); | 587 | s5h1409_softreset(fe); |
577 | 588 | ||
@@ -751,6 +762,7 @@ struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, | |||
751 | state->config = config; | 762 | state->config = config; |
752 | state->i2c = i2c; | 763 | state->i2c = i2c; |
753 | state->current_modulation = 0; | 764 | state->current_modulation = 0; |
765 | state->if_freq = S5H1409_VSB_IF_FREQ; | ||
754 | 766 | ||
755 | /* check if the demod exists */ | 767 | /* check if the demod exists */ |
756 | if (s5h1409_readreg(state, 0x04) != 0x0066) | 768 | if (s5h1409_readreg(state, 0x04) != 0x0066) |