Commit 5cb88ca8 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] mb86a20s: Use 'layer' instead of 'i' on all places

We're using the anonymous 'i' to indicate the layer number
on several places on the driver. That's not good, as some
cut-and-paste type of change might be doing the wrong thing.
So, call it as "layer" everywhere.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 41c6e9dd
...@@ -650,7 +650,7 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) ...@@ -650,7 +650,7 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
{ {
struct mb86a20s_state *state = fe->demodulator_priv; struct mb86a20s_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int i, rc; int layer, rc;
dev_dbg(&state->i2c->dev, "%s called.\n", __func__); dev_dbg(&state->i2c->dev, "%s called.\n", __func__);
...@@ -668,43 +668,43 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) ...@@ -668,43 +668,43 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
/* Get per-layer data */ /* Get per-layer data */
for (i = 0; i < NUM_LAYERS; i++) { for (layer = 0; layer < NUM_LAYERS; layer++) {
dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n", dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n",
__func__, 'A' + i); __func__, 'A' + layer);
rc = mb86a20s_get_segment_count(state, i); rc = mb86a20s_get_segment_count(state, layer);
if (rc < 0) if (rc < 0)
goto noperlayer_error; goto noperlayer_error;
if (rc >= 0 && rc < 14) { if (rc >= 0 && rc < 14) {
c->layer[i].segment_count = rc; c->layer[layer].segment_count = rc;
} else { } else {
c->layer[i].segment_count = 0; c->layer[layer].segment_count = 0;
state->estimated_rate[i] = 0; state->estimated_rate[layer] = 0;
continue; continue;
} }
c->isdbt_layer_enabled |= 1 << i; c->isdbt_layer_enabled |= 1 << layer;
rc = mb86a20s_get_modulation(state, i); rc = mb86a20s_get_modulation(state, layer);
if (rc < 0) if (rc < 0)
goto noperlayer_error; goto noperlayer_error;
dev_dbg(&state->i2c->dev, "%s: modulation %d.\n", dev_dbg(&state->i2c->dev, "%s: modulation %d.\n",
__func__, rc); __func__, rc);
c->layer[i].modulation = rc; c->layer[layer].modulation = rc;
rc = mb86a20s_get_fec(state, i); rc = mb86a20s_get_fec(state, layer);
if (rc < 0) if (rc < 0)
goto noperlayer_error; goto noperlayer_error;
dev_dbg(&state->i2c->dev, "%s: FEC %d.\n", dev_dbg(&state->i2c->dev, "%s: FEC %d.\n",
__func__, rc); __func__, rc);
c->layer[i].fec = rc; c->layer[layer].fec = rc;
rc = mb86a20s_get_interleaving(state, i); rc = mb86a20s_get_interleaving(state, layer);
if (rc < 0) if (rc < 0)
goto noperlayer_error; goto noperlayer_error;
dev_dbg(&state->i2c->dev, "%s: interleaving %d.\n", dev_dbg(&state->i2c->dev, "%s: interleaving %d.\n",
__func__, rc); __func__, rc);
c->layer[i].interleaving = rc; c->layer[layer].interleaving = rc;
mb86a20s_layer_bitrate(fe, i, c->layer[i].modulation, mb86a20s_layer_bitrate(fe, layer, c->layer[layer].modulation,
c->layer[i].fec, c->layer[layer].fec,
c->layer[i].interleaving, c->layer[layer].interleaving,
c->layer[i].segment_count); c->layer[layer].segment_count);
} }
rc = mb86a20s_writereg(state, 0x6d, 0x84); rc = mb86a20s_writereg(state, 0x6d, 0x84);
...@@ -1456,7 +1456,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe) ...@@ -1456,7 +1456,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
struct mb86a20s_state *state = fe->demodulator_priv; struct mb86a20s_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
u32 mer, cnr; u32 mer, cnr;
int rc, val, i; int rc, val, layer;
struct linear_segments *segs; struct linear_segments *segs;
unsigned segs_len; unsigned segs_len;
...@@ -1478,27 +1478,27 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe) ...@@ -1478,27 +1478,27 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
} }
/* Read all layers */ /* Read all layers */
for (i = 0; i < NUM_LAYERS; i++) { for (layer = 0; layer < NUM_LAYERS; layer++) {
if (!(c->isdbt_layer_enabled & (1 << i))) { if (!(c->isdbt_layer_enabled & (1 << layer))) {
c->cnr.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->cnr.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
continue; continue;
} }
rc = mb86a20s_writereg(state, 0x50, 0x52 + i * 3); rc = mb86a20s_writereg(state, 0x50, 0x52 + layer * 3);
if (rc < 0) if (rc < 0)
return rc; return rc;
rc = mb86a20s_readreg(state, 0x51); rc = mb86a20s_readreg(state, 0x51);
if (rc < 0) if (rc < 0)
return rc; return rc;
mer = rc << 16; mer = rc << 16;
rc = mb86a20s_writereg(state, 0x50, 0x53 + i * 3); rc = mb86a20s_writereg(state, 0x50, 0x53 + layer * 3);
if (rc < 0) if (rc < 0)
return rc; return rc;
rc = mb86a20s_readreg(state, 0x51); rc = mb86a20s_readreg(state, 0x51);
if (rc < 0) if (rc < 0)
return rc; return rc;
mer |= rc << 8; mer |= rc << 8;
rc = mb86a20s_writereg(state, 0x50, 0x54 + i * 3); rc = mb86a20s_writereg(state, 0x50, 0x54 + layer * 3);
if (rc < 0) if (rc < 0)
return rc; return rc;
rc = mb86a20s_readreg(state, 0x51); rc = mb86a20s_readreg(state, 0x51);
...@@ -1506,7 +1506,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe) ...@@ -1506,7 +1506,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
return rc; return rc;
mer |= rc; mer |= rc;
switch (c->layer[i].modulation) { switch (c->layer[layer].modulation) {
case DQPSK: case DQPSK:
case QPSK: case QPSK:
segs = cnr_qpsk_table; segs = cnr_qpsk_table;
...@@ -1524,12 +1524,12 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe) ...@@ -1524,12 +1524,12 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
} }
cnr = interpolate_value(mer, segs, segs_len); cnr = interpolate_value(mer, segs, segs_len);
c->cnr.stat[1 + i].scale = FE_SCALE_DECIBEL; c->cnr.stat[1 + layer].scale = FE_SCALE_DECIBEL;
c->cnr.stat[1 + i].svalue = cnr; c->cnr.stat[1 + layer].svalue = cnr;
dev_dbg(&state->i2c->dev, dev_dbg(&state->i2c->dev,
"%s: CNR for layer %c is %d.%03d dB (MER = %d).\n", "%s: CNR for layer %c is %d.%03d dB (MER = %d).\n",
__func__, 'A' + i, cnr / 1000, cnr % 1000, mer); __func__, 'A' + layer, cnr / 1000, cnr % 1000, mer);
} }
...@@ -1557,7 +1557,7 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe) ...@@ -1557,7 +1557,7 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe)
{ {
struct mb86a20s_state *state = fe->demodulator_priv; struct mb86a20s_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int i; int layer;
dev_dbg(&state->i2c->dev, "%s called.\n", __func__); dev_dbg(&state->i2c->dev, "%s called.\n", __func__);
...@@ -1580,14 +1580,14 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe) ...@@ -1580,14 +1580,14 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe)
c->strength.stat[0].uvalue = 0; c->strength.stat[0].uvalue = 0;
/* Put all of them at FE_SCALE_NOT_AVAILABLE */ /* Put all of them at FE_SCALE_NOT_AVAILABLE */
for (i = 0; i < NUM_LAYERS + 1; i++) { for (layer = 0; layer < NUM_LAYERS + 1; layer++) {
c->cnr.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->cnr.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->pre_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->pre_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->block_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->block_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
c->block_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; c->block_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
} }
} }
...@@ -1595,7 +1595,7 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr) ...@@ -1595,7 +1595,7 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr)
{ {
struct mb86a20s_state *state = fe->demodulator_priv; struct mb86a20s_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int rc = 0, i; int rc = 0, layer;
u32 bit_error = 0, bit_count = 0; u32 bit_error = 0, bit_count = 0;
u32 t_pre_bit_error = 0, t_pre_bit_count = 0; u32 t_pre_bit_error = 0, t_pre_bit_count = 0;
u32 t_post_bit_error = 0, t_post_bit_count = 0; u32 t_post_bit_error = 0, t_post_bit_count = 0;
...@@ -1619,90 +1619,90 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr) ...@@ -1619,90 +1619,90 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr)
if (status_nr < 9) if (status_nr < 9)
return 0; return 0;
for (i = 0; i < NUM_LAYERS; i++) { for (layer = 0; layer < NUM_LAYERS; layer++) {
if (c->isdbt_layer_enabled & (1 << i)) { if (c->isdbt_layer_enabled & (1 << layer)) {
/* Layer is active and has rc segments */ /* Layer is active and has rc segments */
active_layers++; active_layers++;
/* Handle BER before vterbi */ /* Handle BER before vterbi */
rc = mb86a20s_get_pre_ber(fe, i, rc = mb86a20s_get_pre_ber(fe, layer,
&bit_error, &bit_count); &bit_error, &bit_count);
if (rc >= 0) { if (rc >= 0) {
c->pre_bit_error.stat[1 + i].scale = FE_SCALE_COUNTER; c->pre_bit_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->pre_bit_error.stat[1 + i].uvalue += bit_error; c->pre_bit_error.stat[1 + layer].uvalue += bit_error;
c->pre_bit_count.stat[1 + i].scale = FE_SCALE_COUNTER; c->pre_bit_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->pre_bit_count.stat[1 + i].uvalue += bit_count; c->pre_bit_count.stat[1 + layer].uvalue += bit_count;
} else if (rc != -EBUSY) { } else if (rc != -EBUSY) {
/* /*
* If an I/O error happened, * If an I/O error happened,
* measures are now unavailable * measures are now unavailable
*/ */
c->pre_bit_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
c->pre_bit_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->pre_bit_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
dev_err(&state->i2c->dev, dev_err(&state->i2c->dev,
"%s: Can't get BER for layer %c (error %d).\n", "%s: Can't get BER for layer %c (error %d).\n",
__func__, 'A' + i, rc); __func__, 'A' + layer, rc);
} }
if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
pre_ber_layers++; pre_ber_layers++;
/* Handle BER post vterbi */ /* Handle BER post vterbi */
rc = mb86a20s_get_post_ber(fe, i, rc = mb86a20s_get_post_ber(fe, layer,
&bit_error, &bit_count); &bit_error, &bit_count);
if (rc >= 0) { if (rc >= 0) {
c->post_bit_error.stat[1 + i].scale = FE_SCALE_COUNTER; c->post_bit_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->post_bit_error.stat[1 + i].uvalue += bit_error; c->post_bit_error.stat[1 + layer].uvalue += bit_error;
c->post_bit_count.stat[1 + i].scale = FE_SCALE_COUNTER; c->post_bit_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->post_bit_count.stat[1 + i].uvalue += bit_count; c->post_bit_count.stat[1 + layer].uvalue += bit_count;
} else if (rc != -EBUSY) { } else if (rc != -EBUSY) {
/* /*
* If an I/O error happened, * If an I/O error happened,
* measures are now unavailable * measures are now unavailable
*/ */
c->post_bit_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
c->post_bit_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->post_bit_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
dev_err(&state->i2c->dev, dev_err(&state->i2c->dev,
"%s: Can't get BER for layer %c (error %d).\n", "%s: Can't get BER for layer %c (error %d).\n",
__func__, 'A' + i, rc); __func__, 'A' + layer, rc);
} }
if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
post_ber_layers++; post_ber_layers++;
/* Handle Block errors for PER/UCB reports */ /* Handle Block errors for PER/UCB reports */
rc = mb86a20s_get_blk_error(fe, i, rc = mb86a20s_get_blk_error(fe, layer,
&block_error, &block_error,
&block_count); &block_count);
if (rc >= 0) { if (rc >= 0) {
c->block_error.stat[1 + i].scale = FE_SCALE_COUNTER; c->block_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->block_error.stat[1 + i].uvalue += block_error; c->block_error.stat[1 + layer].uvalue += block_error;
c->block_count.stat[1 + i].scale = FE_SCALE_COUNTER; c->block_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
c->block_count.stat[1 + i].uvalue += block_count; c->block_count.stat[1 + layer].uvalue += block_count;
} else if (rc != -EBUSY) { } else if (rc != -EBUSY) {
/* /*
* If an I/O error happened, * If an I/O error happened,
* measures are now unavailable * measures are now unavailable
*/ */
c->block_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->block_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
c->block_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; c->block_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
dev_err(&state->i2c->dev, dev_err(&state->i2c->dev,
"%s: Can't get PER for layer %c (error %d).\n", "%s: Can't get PER for layer %c (error %d).\n",
__func__, 'A' + i, rc); __func__, 'A' + layer, rc);
} }
if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
per_layers++; per_layers++;
/* Update total preBER */ /* Update total preBER */
t_pre_bit_error += c->pre_bit_error.stat[1 + i].uvalue; t_pre_bit_error += c->pre_bit_error.stat[1 + layer].uvalue;
t_pre_bit_count += c->pre_bit_count.stat[1 + i].uvalue; t_pre_bit_count += c->pre_bit_count.stat[1 + layer].uvalue;
/* Update total postBER */ /* Update total postBER */
t_post_bit_error += c->post_bit_error.stat[1 + i].uvalue; t_post_bit_error += c->post_bit_error.stat[1 + layer].uvalue;
t_post_bit_count += c->post_bit_count.stat[1 + i].uvalue; t_post_bit_count += c->post_bit_count.stat[1 + layer].uvalue;
/* Update total PER */ /* Update total PER */
t_block_error += c->block_error.stat[1 + i].uvalue; t_block_error += c->block_error.stat[1 + layer].uvalue;
t_block_count += c->block_count.stat[1 + i].uvalue; t_block_count += c->block_count.stat[1 + layer].uvalue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment