summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.c17
-rw-r--r--linux/drivers/media/dvb/frontends/dib3000mb.h5
2 files changed, 14 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.c b/linux/drivers/media/dvb/frontends/dib3000mb.c
index 4ee48a516..e93123e1b 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.c
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.c
@@ -694,7 +694,7 @@ static int dib3000mb_read_status(struct dib3000mb_state *state,fe_status_t *stat
static int dib3000mb_read_ber(struct dib3000mb_state *state,u32 *ber)
{
*ber =
- (((rd(DIB3000MB_REG_BER_MSB) & 0x1f) << 16) | rd(DIB3000MB_REG_BER_LSB) );
+ ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB) );
return 0;
}
@@ -706,10 +706,17 @@ static int dib3000mb_read_signal_strength(struct dib3000mb_state *state, u16 *st
static int dib3000mb_read_snr(struct dib3000mb_state *state,u16 *snr)
{
-// int sigpow = rd(DIB3000MB_REG_SIGNAL_POWER);
-// u32 icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) |
-// rd(DIB3000MB_REG_NOISE_POWER_LSB);
-// if (sigpow > 0)
+ short sigpow = rd(DIB3000MB_REG_SIGNAL_POWER);
+ int icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) |
+ rd(DIB3000MB_REG_NOISE_POWER_LSB);
+
+ deb_info("sigpow: %d, icipow: %d\n",sigpow,icipow);
+
+ if (sigpow > 0 && icipow > 0) {
+ *snr = (sigpow << 8 / icipow);
+ } else
+ snr = 0;
+
return 0;
}
diff --git a/linux/drivers/media/dvb/frontends/dib3000mb.h b/linux/drivers/media/dvb/frontends/dib3000mb.h
index ef97ebf31..5fd0af6d4 100644
--- a/linux/drivers/media/dvb/frontends/dib3000mb.h
+++ b/linux/drivers/media/dvb/frontends/dib3000mb.h
@@ -350,13 +350,12 @@ static u16 dib3000mb_bandwidth_8mhz[] =
/* vit code rate */
#define DIB3000MB_REG_VIT_CODE_RATE ( 129)
-/* forward error correction code rates TODO check these values */
+/* forward error correction code rates */
#define DIB3000MB_FEC_1_2 ( 1)
#define DIB3000MB_FEC_2_3 ( 2)
#define DIB3000MB_FEC_3_4 ( 3)
-#define DIB3000MB_FEC_4_5 ( 4)
#define DIB3000MB_FEC_5_6 ( 5)
-#define DIB3000MB_FEC_7_8 ( 6)
+#define DIB3000MB_FEC_7_8 ( 7)
/* vit select hp */
#define DIB3000MB_REG_VIT_HP ( 130)