[media] rtl2830: implement .read_ber()
authorAntti Palosaari <crope@iki.fi>
Fri, 18 May 2012 15:23:42 +0000 (12:23 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 20 May 2012 13:24:01 +0000 (10:24 -0300)
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/rtl2830.c

index e6d7c501717ad7a6b60eeb551293aa054d8a149b..266098656c4808e60642a1034da7465f856e8f82 100644 (file)
@@ -450,8 +450,20 @@ err:
 
 static int rtl2830_read_ber(struct dvb_frontend *fe, u32 *ber)
 {
-       *ber = 0;
+       struct rtl2830_priv *priv = fe->demodulator_priv;
+       int ret;
+       u8 buf[2];
+
+       ret = rtl2830_rd_regs(priv, 0x34e, buf, 2);
+       if (ret)
+               goto err;
+
+       *ber = buf[0] << 8 | buf[1];
+
        return 0;
+err:
+       dbg("%s: failed=%d", __func__, ret);
+       return ret;
 }
 
 static int rtl2830_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)