Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357371
b: refs/heads/master
c: ad0abbf
h: refs/heads/master
i:
  357369: f9b4ee7
  357367: 008479f
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Jan 24, 2013
1 parent b3f21b6 commit b3eca4b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 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: 593ae89a3f2ea69b0cffb8d8ca63549c6c02ec19
refs/heads/master: ad0abbf118519c14fee5256395f9c104e8023e9b
51 changes: 39 additions & 12 deletions trunk/drivers/media/dvb-frontends/mb86a20s.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,12 @@ static int mb86a20s_reset_counters(struct dvb_frontend *fe)
return rc;
}

static int mb86a20s_get_ber_before_vterbi(struct dvb_frontend *fe,
unsigned layer,
u32 *error, u32 *count)
static int mb86a20s_get_pre_ber(struct dvb_frontend *fe,
unsigned layer,
u32 *error, u32 *count)
{
struct mb86a20s_state *state = fe->demodulator_priv;
int rc;
int rc, val;

dev_dbg(&state->i2c->dev, "%s called.\n", __func__);

Expand All @@ -805,7 +805,7 @@ static int mb86a20s_get_ber_before_vterbi(struct dvb_frontend *fe,
/* Check if data is available for that layer */
if (!(rc & (1 << layer))) {
dev_dbg(&state->i2c->dev,
"%s: BER for layer %c is not available yet.\n",
"%s: preBER for layer %c is not available yet.\n",
__func__, 'A' + layer);
return -EBUSY;
}
Expand Down Expand Up @@ -866,8 +866,13 @@ static int mb86a20s_get_ber_before_vterbi(struct dvb_frontend *fe,
if (state->estimated_rate[layer]
&& state->estimated_rate[layer] != *count) {
dev_dbg(&state->i2c->dev,
"%s: updating layer %c counter to %d.\n",
"%s: updating layer %c preBER counter to %d.\n",
__func__, 'A' + layer, state->estimated_rate[layer]);

/* Turn off BER before Viterbi */
rc = mb86a20s_writereg(state, 0x52, 0x00);

/* Update counter for this layer */
rc = mb86a20s_writereg(state, 0x50, 0xa7 + layer * 3);
if (rc < 0)
return rc;
Expand All @@ -889,16 +894,39 @@ static int mb86a20s_get_ber_before_vterbi(struct dvb_frontend *fe,
state->estimated_rate[layer]);
if (rc < 0)
return rc;

/* Turn on BER before Viterbi */
rc = mb86a20s_writereg(state, 0x52, 0x01);

/* Reset all preBER counters */
rc = mb86a20s_writereg(state, 0x53, 0x00);
if (rc < 0)
return rc;
rc = mb86a20s_writereg(state, 0x53, 0x07);
} else {
/* Reset counter to collect new data */
rc = mb86a20s_readreg(state, 0x53);
if (rc < 0)
return rc;
val = rc;
rc = mb86a20s_writereg(state, 0x53, val & ~(1 << layer));
if (rc < 0)
return rc;
rc = mb86a20s_writereg(state, 0x53, val | (1 << layer));
}


/* Reset counter to collect new data */
rc = mb86a20s_writereg(state, 0x53, 0x07 & ~(1 << layer));
rc = mb86a20s_readreg(state, 0x5f);
if (rc < 0)
return rc;
rc = mb86a20s_writereg(state, 0x53, 0x07);
val = rc;
rc = mb86a20s_writereg(state, 0x5f, val & ~(1 << layer));
if (rc < 0)
return rc;
rc = mb86a20s_writereg(state, 0x5f, val);

return 0;
return rc;
}

static int mb86a20s_get_blk_error(struct dvb_frontend *fe,
Expand Down Expand Up @@ -1401,9 +1429,8 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe)

/* Read per-layer BER */
/* Handle BER before vterbi */
rc = mb86a20s_get_ber_before_vterbi(fe, i,
&bit_error,
&bit_count);
rc = mb86a20s_get_pre_ber(fe, i,
&bit_error, &bit_count);
if (rc >= 0) {
c->pre_bit_error.stat[1 + i].scale = FE_SCALE_COUNTER;
c->pre_bit_error.stat[1 + i].uvalue += bit_error;
Expand Down

0 comments on commit b3eca4b

Please sign in to comment.