|
@@ -11,6 +11,7 @@
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/mutex.h>
|
|
|
|
+#include <asm/div64.h>
|
|
|
|
|
|
#include "dvb_math.h"
|
|
#include "dvb_math.h"
|
|
|
|
|
|
@@ -1002,7 +1003,7 @@ static void dib8000_reset_stats(struct dvb_frontend *fe)
|
|
c->post_bit_error.len = 1;
|
|
c->post_bit_error.len = 1;
|
|
c->post_bit_count.len = 1;
|
|
c->post_bit_count.len = 1;
|
|
|
|
|
|
- c->strength.stat[0].scale = FE_SCALE_RELATIVE;
|
|
|
|
|
|
+ c->strength.stat[0].scale = FE_SCALE_DECIBEL;
|
|
c->strength.stat[0].uvalue = 0;
|
|
c->strength.stat[0].uvalue = 0;
|
|
|
|
|
|
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
|
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
|
@@ -3847,12 +3848,30 @@ static int dib8000_get_stats(struct dvb_frontend *fe, fe_status_t stat)
|
|
struct dib8000_state *state = fe->demodulator_priv;
|
|
struct dib8000_state *state = fe->demodulator_priv;
|
|
struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache;
|
|
struct dtv_frontend_properties *c = &state->fe[0]->dtv_property_cache;
|
|
int i, lock;
|
|
int i, lock;
|
|
|
|
+ u64 tmp;
|
|
u32 snr, val;
|
|
u32 snr, val;
|
|
u16 strength;
|
|
u16 strength;
|
|
|
|
|
|
/* Get Signal strength */
|
|
/* Get Signal strength */
|
|
dib8000_read_signal_strength(fe, &strength);
|
|
dib8000_read_signal_strength(fe, &strength);
|
|
- c->strength.stat[0].uvalue = strength;
|
|
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Estimate it in dBm
|
|
|
|
+ * This calculus was empirically determinated by measuring the signal
|
|
|
|
+ * strength generated by a DTA-2111 RF generator directly connected into
|
|
|
|
+ * a dib8076 device. The real value can actually be different on other
|
|
|
|
+ * devices, depending if LNA is enabled or not, if diversity is enabled,
|
|
|
|
+ * etc.
|
|
|
|
+ */
|
|
|
|
+ if (strength == 65535) {
|
|
|
|
+ c->strength.stat[0].svalue = -22000;
|
|
|
|
+ } else {
|
|
|
|
+ tmp = strength * 25000L;
|
|
|
|
+ do_div(tmp, 11646);
|
|
|
|
+ c->strength.stat[0].svalue = tmp - 142569;
|
|
|
|
+ if (c->strength.stat[0].svalue > -22000)
|
|
|
|
+ c->strength.stat[0].svalue = -22000;
|
|
|
|
+ }
|
|
|
|
|
|
/* Check if 1 second was elapsed */
|
|
/* Check if 1 second was elapsed */
|
|
if (!time_after(jiffies, state->get_stats_time))
|
|
if (!time_after(jiffies, state->get_stats_time))
|