summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/m88rs2000.c
diff options
context:
space:
mode:
authorIgor M. Liplianin <liplianin@me.by>2012-12-28 23:40:16 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-29 00:29:42 +0100
commit38f7889cea9d5754493fa601a2d466ba33f13f55 (patch)
treef7e9c6451cce59699c3309bb75c5705517a05c09 /drivers/media/dvb-frontends/m88rs2000.c
parent[media] dw2102: autoselect DVB_M88RS2000 (diff)
downloadlinux-38f7889cea9d5754493fa601a2d466ba33f13f55.tar.xz
linux-38f7889cea9d5754493fa601a2d466ba33f13f55.zip
[media] m88rs2000: SNR, BER implemented
Trivial patch to implement SNR, BER, UCB counter for Montage rs2000 demod. Signed-off-by: Igor M. Liplianin <liplianin@me.by> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to '')
-rw-r--r--drivers/media/dvb-frontends/m88rs2000.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c
index 5d3d5dd62daa..df9e7dd6fe74 100644
--- a/drivers/media/dvb-frontends/m88rs2000.c
+++ b/drivers/media/dvb-frontends/m88rs2000.c
@@ -492,12 +492,29 @@ static int m88rs2000_read_status(struct dvb_frontend *fe, fe_status_t *status)
return 0;
}
-/* Extact code for these unknown but lmedm04 driver uses interupt callbacks */
-
static int m88rs2000_read_ber(struct dvb_frontend *fe, u32 *ber)
{
- deb_info("m88rs2000_read_ber %d\n", *ber);
- *ber = 0;
+ struct m88rs2000_state *state = fe->demodulator_priv;
+ u8 tmp0, tmp1;
+
+ m88rs2000_demod_write(state, 0x9a, 0x30);
+ tmp0 = m88rs2000_demod_read(state, 0xd8);
+ if ((tmp0 & 0x10) != 0) {
+ m88rs2000_demod_write(state, 0x9a, 0xb0);
+ *ber = 0xffffffff;
+ return 0;
+ }
+
+ *ber = (m88rs2000_demod_read(state, 0xd7) << 8) |
+ m88rs2000_demod_read(state, 0xd6);
+
+ tmp1 = m88rs2000_demod_read(state, 0xd9);
+ m88rs2000_demod_write(state, 0xd9, (tmp1 & ~7) | 4);
+ /* needs twice */
+ m88rs2000_demod_write(state, 0xd8, (tmp0 & ~8) | 0x30);
+ m88rs2000_demod_write(state, 0xd8, (tmp0 & ~8) | 0x30);
+ m88rs2000_demod_write(state, 0x9a, 0xb0);
+
return 0;
}
@@ -510,15 +527,26 @@ static int m88rs2000_read_signal_strength(struct dvb_frontend *fe,
static int m88rs2000_read_snr(struct dvb_frontend *fe, u16 *snr)
{
- deb_info("m88rs2000_read_snr %d\n", *snr);
- *snr = 0;
+ struct m88rs2000_state *state = fe->demodulator_priv;
+
+ *snr = 512 * m88rs2000_demod_read(state, 0x65);
+
return 0;
}
static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
- deb_info("m88rs2000_read_ber %d\n", *ucblocks);
- *ucblocks = 0;
+ struct m88rs2000_state *state = fe->demodulator_priv;
+ u8 tmp;
+
+ *ucblocks = (m88rs2000_demod_read(state, 0xd5) << 8) |
+ m88rs2000_demod_read(state, 0xd4);
+ tmp = m88rs2000_demod_read(state, 0xd8);
+ m88rs2000_demod_write(state, 0xd8, tmp & ~0x20);
+ /* needs two times */
+ m88rs2000_demod_write(state, 0xd8, tmp | 0x20);
+ m88rs2000_demod_write(state, 0xd8, tmp | 0x20);
+
return 0;
}