aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-04-07 19:52:16 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-08 06:10:53 -0400
commit5cb88ca84aa8dc4efcabd8482fff6002774c7f03 (patch)
treef811409ac13ae522bbc1d6f567cac91f7f96d9f2 /drivers/media/dvb-frontends
parent41c6e9dd0915741051e813cafa14f2e7f88b71d9 (diff)
[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: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/mb86a20s.c148
1 files changed, 74 insertions, 74 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index 70158aae1886..f2565896ce42 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -650,7 +650,7 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
650{ 650{
651 struct mb86a20s_state *state = fe->demodulator_priv; 651 struct mb86a20s_state *state = fe->demodulator_priv;
652 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 652 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
653 int i, rc; 653 int layer, rc;
654 654
655 dev_dbg(&state->i2c->dev, "%s called.\n", __func__); 655 dev_dbg(&state->i2c->dev, "%s called.\n", __func__);
656 656
@@ -668,43 +668,43 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
668 668
669 /* Get per-layer data */ 669 /* Get per-layer data */
670 670
671 for (i = 0; i < NUM_LAYERS; i++) { 671 for (layer = 0; layer < NUM_LAYERS; layer++) {
672 dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n", 672 dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n",
673 __func__, 'A' + i); 673 __func__, 'A' + layer);
674 674
675 rc = mb86a20s_get_segment_count(state, i); 675 rc = mb86a20s_get_segment_count(state, layer);
676 if (rc < 0) 676 if (rc < 0)
677 goto noperlayer_error; 677 goto noperlayer_error;
678 if (rc >= 0 && rc < 14) { 678 if (rc >= 0 && rc < 14) {
679 c->layer[i].segment_count = rc; 679 c->layer[layer].segment_count = rc;
680 } else { 680 } else {
681 c->layer[i].segment_count = 0; 681 c->layer[layer].segment_count = 0;
682 state->estimated_rate[i] = 0; 682 state->estimated_rate[layer] = 0;
683 continue; 683 continue;
684 } 684 }
685 c->isdbt_layer_enabled |= 1 << i; 685 c->isdbt_layer_enabled |= 1 << layer;
686 rc = mb86a20s_get_modulation(state, i); 686 rc = mb86a20s_get_modulation(state, layer);
687 if (rc < 0) 687 if (rc < 0)
688 goto noperlayer_error; 688 goto noperlayer_error;
689 dev_dbg(&state->i2c->dev, "%s: modulation %d.\n", 689 dev_dbg(&state->i2c->dev, "%s: modulation %d.\n",
690 __func__, rc); 690 __func__, rc);
691 c->layer[i].modulation = rc; 691 c->layer[layer].modulation = rc;
692 rc = mb86a20s_get_fec(state, i); 692 rc = mb86a20s_get_fec(state, layer);
693 if (rc < 0) 693 if (rc < 0)
694 goto noperlayer_error; 694 goto noperlayer_error;
695 dev_dbg(&state->i2c->dev, "%s: FEC %d.\n", 695 dev_dbg(&state->i2c->dev, "%s: FEC %d.\n",
696 __func__, rc); 696 __func__, rc);
697 c->layer[i].fec = rc; 697 c->layer[layer].fec = rc;
698 rc = mb86a20s_get_interleaving(state, i); 698 rc = mb86a20s_get_interleaving(state, layer);
699 if (rc < 0) 699 if (rc < 0)
700 goto noperlayer_error; 700 goto noperlayer_error;
701 dev_dbg(&state->i2c->dev, "%s: interleaving %d.\n", 701 dev_dbg(&state->i2c->dev, "%s: interleaving %d.\n",
702 __func__, rc); 702 __func__, rc);
703 c->layer[i].interleaving = rc; 703 c->layer[layer].interleaving = rc;
704 mb86a20s_layer_bitrate(fe, i, c->layer[i].modulation, 704 mb86a20s_layer_bitrate(fe, layer, c->layer[layer].modulation,
705 c->layer[i].fec, 705 c->layer[layer].fec,
706 c->layer[i].interleaving, 706 c->layer[layer].interleaving,
707 c->layer[i].segment_count); 707 c->layer[layer].segment_count);
708 } 708 }
709 709
710 rc = mb86a20s_writereg(state, 0x6d, 0x84); 710 rc = mb86a20s_writereg(state, 0x6d, 0x84);
@@ -1456,7 +1456,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
1456 struct mb86a20s_state *state = fe->demodulator_priv; 1456 struct mb86a20s_state *state = fe->demodulator_priv;
1457 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1457 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1458 u32 mer, cnr; 1458 u32 mer, cnr;
1459 int rc, val, i; 1459 int rc, val, layer;
1460 struct linear_segments *segs; 1460 struct linear_segments *segs;
1461 unsigned segs_len; 1461 unsigned segs_len;
1462 1462
@@ -1478,27 +1478,27 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
1478 } 1478 }
1479 1479
1480 /* Read all layers */ 1480 /* Read all layers */
1481 for (i = 0; i < NUM_LAYERS; i++) { 1481 for (layer = 0; layer < NUM_LAYERS; layer++) {
1482 if (!(c->isdbt_layer_enabled & (1 << i))) { 1482 if (!(c->isdbt_layer_enabled & (1 << layer))) {
1483 c->cnr.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1483 c->cnr.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1484 continue; 1484 continue;
1485 } 1485 }
1486 1486
1487 rc = mb86a20s_writereg(state, 0x50, 0x52 + i * 3); 1487 rc = mb86a20s_writereg(state, 0x50, 0x52 + layer * 3);
1488 if (rc < 0) 1488 if (rc < 0)
1489 return rc; 1489 return rc;
1490 rc = mb86a20s_readreg(state, 0x51); 1490 rc = mb86a20s_readreg(state, 0x51);
1491 if (rc < 0) 1491 if (rc < 0)
1492 return rc; 1492 return rc;
1493 mer = rc << 16; 1493 mer = rc << 16;
1494 rc = mb86a20s_writereg(state, 0x50, 0x53 + i * 3); 1494 rc = mb86a20s_writereg(state, 0x50, 0x53 + layer * 3);
1495 if (rc < 0) 1495 if (rc < 0)
1496 return rc; 1496 return rc;
1497 rc = mb86a20s_readreg(state, 0x51); 1497 rc = mb86a20s_readreg(state, 0x51);
1498 if (rc < 0) 1498 if (rc < 0)
1499 return rc; 1499 return rc;
1500 mer |= rc << 8; 1500 mer |= rc << 8;
1501 rc = mb86a20s_writereg(state, 0x50, 0x54 + i * 3); 1501 rc = mb86a20s_writereg(state, 0x50, 0x54 + layer * 3);
1502 if (rc < 0) 1502 if (rc < 0)
1503 return rc; 1503 return rc;
1504 rc = mb86a20s_readreg(state, 0x51); 1504 rc = mb86a20s_readreg(state, 0x51);
@@ -1506,7 +1506,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
1506 return rc; 1506 return rc;
1507 mer |= rc; 1507 mer |= rc;
1508 1508
1509 switch (c->layer[i].modulation) { 1509 switch (c->layer[layer].modulation) {
1510 case DQPSK: 1510 case DQPSK:
1511 case QPSK: 1511 case QPSK:
1512 segs = cnr_qpsk_table; 1512 segs = cnr_qpsk_table;
@@ -1524,12 +1524,12 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe)
1524 } 1524 }
1525 cnr = interpolate_value(mer, segs, segs_len); 1525 cnr = interpolate_value(mer, segs, segs_len);
1526 1526
1527 c->cnr.stat[1 + i].scale = FE_SCALE_DECIBEL; 1527 c->cnr.stat[1 + layer].scale = FE_SCALE_DECIBEL;
1528 c->cnr.stat[1 + i].svalue = cnr; 1528 c->cnr.stat[1 + layer].svalue = cnr;
1529 1529
1530 dev_dbg(&state->i2c->dev, 1530 dev_dbg(&state->i2c->dev,
1531 "%s: CNR for layer %c is %d.%03d dB (MER = %d).\n", 1531 "%s: CNR for layer %c is %d.%03d dB (MER = %d).\n",
1532 __func__, 'A' + i, cnr / 1000, cnr % 1000, mer); 1532 __func__, 'A' + layer, cnr / 1000, cnr % 1000, mer);
1533 1533
1534 } 1534 }
1535 1535
@@ -1557,7 +1557,7 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe)
1557{ 1557{
1558 struct mb86a20s_state *state = fe->demodulator_priv; 1558 struct mb86a20s_state *state = fe->demodulator_priv;
1559 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1559 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1560 int i; 1560 int layer;
1561 1561
1562 dev_dbg(&state->i2c->dev, "%s called.\n", __func__); 1562 dev_dbg(&state->i2c->dev, "%s called.\n", __func__);
1563 1563
@@ -1580,14 +1580,14 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe)
1580 c->strength.stat[0].uvalue = 0; 1580 c->strength.stat[0].uvalue = 0;
1581 1581
1582 /* Put all of them at FE_SCALE_NOT_AVAILABLE */ 1582 /* Put all of them at FE_SCALE_NOT_AVAILABLE */
1583 for (i = 0; i < NUM_LAYERS + 1; i++) { 1583 for (layer = 0; layer < NUM_LAYERS + 1; layer++) {
1584 c->cnr.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1584 c->cnr.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1585 c->pre_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1585 c->pre_bit_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1586 c->pre_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1586 c->pre_bit_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1587 c->post_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1587 c->post_bit_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1588 c->post_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1588 c->post_bit_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1589 c->block_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1589 c->block_error.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1590 c->block_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; 1590 c->block_count.stat[layer].scale = FE_SCALE_NOT_AVAILABLE;
1591 } 1591 }
1592} 1592}
1593 1593
@@ -1595,7 +1595,7 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr)
1595{ 1595{
1596 struct mb86a20s_state *state = fe->demodulator_priv; 1596 struct mb86a20s_state *state = fe->demodulator_priv;
1597 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1597 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1598 int rc = 0, i; 1598 int rc = 0, layer;
1599 u32 bit_error = 0, bit_count = 0; 1599 u32 bit_error = 0, bit_count = 0;
1600 u32 t_pre_bit_error = 0, t_pre_bit_count = 0; 1600 u32 t_pre_bit_error = 0, t_pre_bit_count = 0;
1601 u32 t_post_bit_error = 0, t_post_bit_count = 0; 1601 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 if (status_nr < 9) 1619 if (status_nr < 9)
1620 return 0; 1620 return 0;
1621 1621
1622 for (i = 0; i < NUM_LAYERS; i++) { 1622 for (layer = 0; layer < NUM_LAYERS; layer++) {
1623 if (c->isdbt_layer_enabled & (1 << i)) { 1623 if (c->isdbt_layer_enabled & (1 << layer)) {
1624 /* Layer is active and has rc segments */ 1624 /* Layer is active and has rc segments */
1625 active_layers++; 1625 active_layers++;
1626 1626
1627 /* Handle BER before vterbi */ 1627 /* Handle BER before vterbi */
1628 rc = mb86a20s_get_pre_ber(fe, i, 1628 rc = mb86a20s_get_pre_ber(fe, layer,
1629 &bit_error, &bit_count); 1629 &bit_error, &bit_count);
1630 if (rc >= 0) { 1630 if (rc >= 0) {
1631 c->pre_bit_error.stat[1 + i].scale = FE_SCALE_COUNTER; 1631 c->pre_bit_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
1632 c->pre_bit_error.stat[1 + i].uvalue += bit_error; 1632 c->pre_bit_error.stat[1 + layer].uvalue += bit_error;
1633 c->pre_bit_count.stat[1 + i].scale = FE_SCALE_COUNTER; 1633 c->pre_bit_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
1634 c->pre_bit_count.stat[1 + i].uvalue += bit_count; 1634 c->pre_bit_count.stat[1 + layer].uvalue += bit_count;
1635 } else if (rc != -EBUSY) { 1635 } else if (rc != -EBUSY) {
1636 /* 1636 /*
1637 * If an I/O error happened, 1637 * If an I/O error happened,
1638 * measures are now unavailable 1638 * measures are now unavailable
1639 */ 1639 */
1640 c->pre_bit_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1640 c->pre_bit_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1641 c->pre_bit_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1641 c->pre_bit_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1642 dev_err(&state->i2c->dev, 1642 dev_err(&state->i2c->dev,
1643 "%s: Can't get BER for layer %c (error %d).\n", 1643 "%s: Can't get BER for layer %c (error %d).\n",
1644 __func__, 'A' + i, rc); 1644 __func__, 'A' + layer, rc);
1645 } 1645 }
1646 if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) 1646 if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
1647 pre_ber_layers++; 1647 pre_ber_layers++;
1648 1648
1649 /* Handle BER post vterbi */ 1649 /* Handle BER post vterbi */
1650 rc = mb86a20s_get_post_ber(fe, i, 1650 rc = mb86a20s_get_post_ber(fe, layer,
1651 &bit_error, &bit_count); 1651 &bit_error, &bit_count);
1652 if (rc >= 0) { 1652 if (rc >= 0) {
1653 c->post_bit_error.stat[1 + i].scale = FE_SCALE_COUNTER; 1653 c->post_bit_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
1654 c->post_bit_error.stat[1 + i].uvalue += bit_error; 1654 c->post_bit_error.stat[1 + layer].uvalue += bit_error;
1655 c->post_bit_count.stat[1 + i].scale = FE_SCALE_COUNTER; 1655 c->post_bit_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
1656 c->post_bit_count.stat[1 + i].uvalue += bit_count; 1656 c->post_bit_count.stat[1 + layer].uvalue += bit_count;
1657 } else if (rc != -EBUSY) { 1657 } else if (rc != -EBUSY) {
1658 /* 1658 /*
1659 * If an I/O error happened, 1659 * If an I/O error happened,
1660 * measures are now unavailable 1660 * measures are now unavailable
1661 */ 1661 */
1662 c->post_bit_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1662 c->post_bit_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1663 c->post_bit_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1663 c->post_bit_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1664 dev_err(&state->i2c->dev, 1664 dev_err(&state->i2c->dev,
1665 "%s: Can't get BER for layer %c (error %d).\n", 1665 "%s: Can't get BER for layer %c (error %d).\n",
1666 __func__, 'A' + i, rc); 1666 __func__, 'A' + layer, rc);
1667 } 1667 }
1668 if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) 1668 if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
1669 post_ber_layers++; 1669 post_ber_layers++;
1670 1670
1671 /* Handle Block errors for PER/UCB reports */ 1671 /* Handle Block errors for PER/UCB reports */
1672 rc = mb86a20s_get_blk_error(fe, i, 1672 rc = mb86a20s_get_blk_error(fe, layer,
1673 &block_error, 1673 &block_error,
1674 &block_count); 1674 &block_count);
1675 if (rc >= 0) { 1675 if (rc >= 0) {
1676 c->block_error.stat[1 + i].scale = FE_SCALE_COUNTER; 1676 c->block_error.stat[1 + layer].scale = FE_SCALE_COUNTER;
1677 c->block_error.stat[1 + i].uvalue += block_error; 1677 c->block_error.stat[1 + layer].uvalue += block_error;
1678 c->block_count.stat[1 + i].scale = FE_SCALE_COUNTER; 1678 c->block_count.stat[1 + layer].scale = FE_SCALE_COUNTER;
1679 c->block_count.stat[1 + i].uvalue += block_count; 1679 c->block_count.stat[1 + layer].uvalue += block_count;
1680 } else if (rc != -EBUSY) { 1680 } else if (rc != -EBUSY) {
1681 /* 1681 /*
1682 * If an I/O error happened, 1682 * If an I/O error happened,
1683 * measures are now unavailable 1683 * measures are now unavailable
1684 */ 1684 */
1685 c->block_error.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1685 c->block_error.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1686 c->block_count.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; 1686 c->block_count.stat[1 + layer].scale = FE_SCALE_NOT_AVAILABLE;
1687 dev_err(&state->i2c->dev, 1687 dev_err(&state->i2c->dev,
1688 "%s: Can't get PER for layer %c (error %d).\n", 1688 "%s: Can't get PER for layer %c (error %d).\n",
1689 __func__, 'A' + i, rc); 1689 __func__, 'A' + layer, rc);
1690 1690
1691 } 1691 }
1692 if (c->block_error.stat[1 + i].scale != FE_SCALE_NOT_AVAILABLE) 1692 if (c->block_error.stat[1 + layer].scale != FE_SCALE_NOT_AVAILABLE)
1693 per_layers++; 1693 per_layers++;
1694 1694
1695 /* Update total preBER */ 1695 /* Update total preBER */
1696 t_pre_bit_error += c->pre_bit_error.stat[1 + i].uvalue; 1696 t_pre_bit_error += c->pre_bit_error.stat[1 + layer].uvalue;
1697 t_pre_bit_count += c->pre_bit_count.stat[1 + i].uvalue; 1697 t_pre_bit_count += c->pre_bit_count.stat[1 + layer].uvalue;
1698 1698
1699 /* Update total postBER */ 1699 /* Update total postBER */
1700 t_post_bit_error += c->post_bit_error.stat[1 + i].uvalue; 1700 t_post_bit_error += c->post_bit_error.stat[1 + layer].uvalue;
1701 t_post_bit_count += c->post_bit_count.stat[1 + i].uvalue; 1701 t_post_bit_count += c->post_bit_count.stat[1 + layer].uvalue;
1702 1702
1703 /* Update total PER */ 1703 /* Update total PER */
1704 t_block_error += c->block_error.stat[1 + i].uvalue; 1704 t_block_error += c->block_error.stat[1 + layer].uvalue;
1705 t_block_count += c->block_count.stat[1 + i].uvalue; 1705 t_block_count += c->block_count.stat[1 + layer].uvalue;
1706 } 1706 }
1707 } 1707 }
1708 1708