aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/s5h1409.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-13 08:04:10 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:44 -0500
commit2b03238a79295aff30afc3d9a82afa617fd33971 (patch)
treeb0fbd55c5a2a9c7543d4dde925ef8be8233e4d82 /drivers/media/dvb/frontends/s5h1409.c
parent18ff605a18b29ab1b52d31f96e2ecbaf7a042a3e (diff)
V4L/DVB (6821): s5h1409: fix IF frequency configuration
On the s5h1409 demod, the IF frequency for VSB is limited to 44 / 5.38 MHz. Hardcode VSB IF frequency within the driver to 44 / 5.38 MHz. QAM IF frequency remains configurable via attach-time configuration. Acked-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/s5h1409.c')
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c14
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
351static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) 355static 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)