aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/nxt6000.c
diff options
context:
space:
mode:
authorJohannes Stezenbach <js@linuxtv.org>2005-05-17 00:54:29 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-17 10:59:29 -0400
commit3a4a571124cdd04215e0f78bc53fe16bab58f32d (patch)
treec1faa0ab53d80ab3f7a00c05b080de72981cd9e8 /drivers/media/dvb/frontends/nxt6000.c
parent3165dcb300ff60e794909f02b1fd3a41908682ea (diff)
[PATCH] dvb: nxt6000: support frontend status reads
add support for read_ber, read_signal_strength and read_status (Greg Wickham) Signed-off-by: Johannes Stezenbach <js@linuxtv.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/frontends/nxt6000.c')
-rw-r--r--drivers/media/dvb/frontends/nxt6000.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c
index a41f7da8b842..f79a69d0eb07 100644
--- a/drivers/media/dvb/frontends/nxt6000.c
+++ b/drivers/media/dvb/frontends/nxt6000.c
@@ -180,7 +180,12 @@ static void nxt6000_setup(struct dvb_frontend* fe)
180 180
181 nxt6000_writereg(state, RS_COR_SYNC_PARAM, SYNC_PARAM); 181 nxt6000_writereg(state, RS_COR_SYNC_PARAM, SYNC_PARAM);
182 nxt6000_writereg(state, BER_CTRL, /*(1 << 2) | */ (0x01 << 1) | 0x01); 182 nxt6000_writereg(state, BER_CTRL, /*(1 << 2) | */ (0x01 << 1) | 0x01);
183 nxt6000_writereg(state, VIT_COR_CTL, VIT_COR_RESYNC); 183 nxt6000_writereg(state, VIT_BERTIME_2, 0x00); // BER Timer = 0x000200 * 256 = 131072 bits
184 nxt6000_writereg(state, VIT_BERTIME_1, 0x02); //
185 nxt6000_writereg(state, VIT_BERTIME_0, 0x00); //
186 nxt6000_writereg(state, VIT_COR_INTEN, 0x98); // Enable BER interrupts
187 nxt6000_writereg(state, VIT_COR_CTL, 0x82); // Enable BER measurement
188 nxt6000_writereg(state, VIT_COR_CTL, VIT_COR_RESYNC | 0x02 );
184 nxt6000_writereg(state, OFDM_COR_CTL, (0x01 << 5) | (nxt6000_readreg(state, OFDM_COR_CTL) & 0x0F)); 189 nxt6000_writereg(state, OFDM_COR_CTL, (0x01 << 5) | (nxt6000_readreg(state, OFDM_COR_CTL) & 0x0F));
185 nxt6000_writereg(state, OFDM_COR_MODEGUARD, FORCEMODE8K | 0x02); 190 nxt6000_writereg(state, OFDM_COR_MODEGUARD, FORCEMODE8K | 0x02);
186 nxt6000_writereg(state, OFDM_AGC_CTL, AGCLAST | INITIAL_AGC_BW); 191 nxt6000_writereg(state, OFDM_AGC_CTL, AGCLAST | INITIAL_AGC_BW);
@@ -486,6 +491,40 @@ static void nxt6000_release(struct dvb_frontend* fe)
486 kfree(state); 491 kfree(state);
487} 492}
488 493
494static int nxt6000_read_snr(struct dvb_frontend* fe, u16* snr)
495{
496 struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv;
497
498 *snr = nxt6000_readreg( state, OFDM_CHC_SNR) / 8;
499
500 return 0;
501}
502
503static int nxt6000_read_ber(struct dvb_frontend* fe, u32* ber)
504{
505 struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv;
506
507 nxt6000_writereg( state, VIT_COR_INTSTAT, 0x18 );
508
509 *ber = (nxt6000_readreg( state, VIT_BER_1 ) << 8 ) |
510 nxt6000_readreg( state, VIT_BER_0 );
511
512 nxt6000_writereg( state, VIT_COR_INTSTAT, 0x18); // Clear BER Done interrupts
513
514 return 0;
515}
516
517static int nxt6000_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
518{
519 struct nxt6000_state* state = (struct nxt6000_state*) fe->demodulator_priv;
520
521 *signal_strength = (short) (511 -
522 (nxt6000_readreg(state, AGC_GAIN_1) +
523 ((nxt6000_readreg(state, AGC_GAIN_2) & 0x03) << 8)));
524
525 return 0;
526}
527
489static struct dvb_frontend_ops nxt6000_ops; 528static struct dvb_frontend_ops nxt6000_ops;
490 529
491struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, 530struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config,
@@ -542,6 +581,9 @@ static struct dvb_frontend_ops nxt6000_ops = {
542 .set_frontend = nxt6000_set_frontend, 581 .set_frontend = nxt6000_set_frontend,
543 582
544 .read_status = nxt6000_read_status, 583 .read_status = nxt6000_read_status,
584 .read_ber = nxt6000_read_ber,
585 .read_signal_strength = nxt6000_read_signal_strength,
586 .read_snr = nxt6000_read_snr,
545}; 587};
546 588
547module_param(debug, int, 0644); 589module_param(debug, int, 0644);