Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366615
b: refs/heads/master
c: f5de95e
h: refs/heads/master
i:
  366613: 0489bdc
  366611: e8a65ea
  366607: ee338ea
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Mar 21, 2013
1 parent 926e4c3 commit 5c98352
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9b9fbdf0a6a65359cd97254a282526822de5257
refs/heads/master: f5de95e2467b7b6b968e6c67489425265dd2a1c2
57 changes: 35 additions & 22 deletions trunk/drivers/media/common/siano/smsdvb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,23 @@ static void smsdvb_stats_not_ready(struct dvb_frontend *fe)
n_layers = 1;
}

/* Fill the length of each status counter */

/* Only global stats */
/* Global stats */
c->strength.len = 1;
c->cnr.len = 1;
c->strength.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;

/* Per-layer stats */
c->post_bit_error.len = n_layers;
c->post_bit_count.len = n_layers;
c->block_error.len = n_layers;
c->block_count.len = n_layers;

/* Signal is always available */
c->strength.stat[0].scale = FE_SCALE_RELATIVE;
c->strength.stat[0].uvalue = 0;

/* Put all of them at FE_SCALE_NOT_AVAILABLE */
/*
* Put all of them at FE_SCALE_NOT_AVAILABLE. They're dynamically
* changed when the stats become available.
*/
for (i = 0; i < n_layers; i++) {
c->cnr.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
c->block_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE;
Expand Down Expand Up @@ -261,6 +259,16 @@ static void smsdvb_update_per_slices(struct smsdvb_client_t *client,
client->fe_status = sms_to_status(p->IsDemodLocked, p->IsRfLocked);
c->modulation = sms_to_modulation(p->constellation);

/* Signal Strength, in DBm */
c->strength.stat[0].uvalue = p->inBandPower * 1000;

/* Carrier to Noise ratio, in DB */
c->cnr.stat[0].svalue = p->snr * 1000;

/* PER/BER requires demod lock */
if (!p->IsDemodLocked)
return;

/* TS PER */
client->last_per = c->block_error.stat[0].uvalue;
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
Expand All @@ -277,13 +285,6 @@ static void smsdvb_update_per_slices(struct smsdvb_client_t *client,
/* Legacy PER/BER */
client->legacy_per = (p->etsPackets * 65535) /
(p->tsPackets + p->etsPackets);

/* Signal Strength, in DBm */
c->strength.stat[0].uvalue = p->RSSI * 1000;

/* Carrier to Noise ratio, in DB */
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].svalue = p->snr * 1000;
}

static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client,
Expand Down Expand Up @@ -312,11 +313,14 @@ static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client,
c->lna = p->IsExternalLNAOn ? 1 : 0;

/* Carrier to Noise ratio, in DB */
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].svalue = p->SNR * 1000;

/* Signal Strength, in DBm */
c->strength.stat[0].uvalue = p->RSSI * 1000;
c->strength.stat[0].uvalue = p->InBandPwr * 1000;

/* PER/BER requires demod lock */
if (!p->IsDemodLocked)
return;

/* TS PER */
client->last_per = c->block_error.stat[0].uvalue;
Expand Down Expand Up @@ -364,11 +368,14 @@ static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client,
c->lna = p->IsExternalLNAOn ? 1 : 0;

/* Carrier to Noise ratio, in DB */
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].svalue = p->SNR * 1000;

/* Signal Strength, in DBm */
c->strength.stat[0].uvalue = p->RSSI * 1000;
c->strength.stat[0].uvalue = p->InBandPwr * 1000;

/* PER/BER and per-layer stats require demod lock */
if (!p->IsDemodLocked)
return;

client->last_per = c->block_error.stat[0].uvalue;

Expand Down Expand Up @@ -441,11 +448,14 @@ static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client,
c->lna = p->IsExternalLNAOn ? 1 : 0;

/* Carrier to Noise ratio, in DB */
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
c->cnr.stat[0].svalue = p->SNR * 1000;

/* Signal Strength, in DBm */
c->strength.stat[0].uvalue = p->RSSI * 1000;
c->strength.stat[0].uvalue = p->InBandPwr * 1000;

/* PER/BER and per-layer stats require demod lock */
if (!p->IsDemodLocked)
return;

client->last_per = c->block_error.stat[0].uvalue;

Expand Down Expand Up @@ -943,11 +953,14 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)

static int smsdvb_set_frontend(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
struct smscore_device_t *coredev = client->coredev;

smsdvb_stats_not_ready(fe);
c->strength.stat[0].uvalue = 0;
c->cnr.stat[0].uvalue = 0;

switch (smscore_get_device_mode(coredev)) {
case DEVICE_MODE_DVBT:
Expand Down

0 comments on commit 5c98352

Please sign in to comment.