aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-29 13:44:57 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-06-17 11:04:51 -0400
commit3926d91a6b93e42519a48325bf360a5b65460c14 (patch)
treedf1db0ae51f0846af0a58f786e1e8d3831b9b6d0
parent041ad449683bb2d54a7f082d78ec15bbc958a175 (diff)
[media] dib7000p: Callibrate signal strength
Calibrate the signal strength to dB. For this callibration, I used adapter 0 (antenna 1), connected via a normal cable to a DTF-2111 generator. The same cabling and RF generator connected to adapter 1 (antenna 2) has a difference of +3dBm (signal was stronger there). Yet, changing the RF for a difference of, let's say, 6dB reflected on a 6dB difference at the measured signal, with is good. So, the signal strengh can indeed be used to measure the antenna gain, if the antenna is repositioned. It is not precise to measure the absolute dBm value, however. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/dvb-frontends/dib7000p.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index c41f90da6e1a..661760d60232 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -1693,13 +1693,56 @@ struct linear_segments {
1693 * This table should be empirically determinated by measuring the signal 1693 * This table should be empirically determinated by measuring the signal
1694 * strength generated by a RF generator directly connected into 1694 * strength generated by a RF generator directly connected into
1695 * a device. 1695 * a device.
1696 * This table was determinated by measuring the signal strength generated
1697 * by a DTA-2111 RF generator directly connected into a dib7000p device
1698 * (a Hauppauge Nova-TD stick), using a good quality 3 meters length
1699 * RC6 cable and good RC6 connectors, connected directly to antenna 1.
1700 * As the minimum output power of DTA-2111 is -31dBm, a 16 dBm attenuator
1701 * were used, for the lower power values.
1702 * The real value can actually be on other devices, or even at the
1703 * second antena input, depending on several factors, like if LNA
1704 * is enabled or not, if diversity is enabled, type of connectors, etc.
1705 * Yet, it is better to use this measure in dB than a random non-linear
1706 * percentage value, especially for antenna adjustments.
1707 * On my tests, the precision of the measure using this table is about
1708 * 0.5 dB, with sounds reasonable enough to adjust antennas.
1696 */ 1709 */
1697/* FIXME: Calibrate the table */ 1710#define DB_OFFSET 131000
1698
1699#define DB_OFFSET 0
1700 1711
1701static struct linear_segments strength_to_db_table[] = { 1712static struct linear_segments strength_to_db_table[] = {
1702 { 65535, 65535}, 1713 { 63630, DB_OFFSET - 20500},
1714 { 62273, DB_OFFSET - 21000},
1715 { 60162, DB_OFFSET - 22000},
1716 { 58730, DB_OFFSET - 23000},
1717 { 58294, DB_OFFSET - 24000},
1718 { 57778, DB_OFFSET - 25000},
1719 { 57320, DB_OFFSET - 26000},
1720 { 56779, DB_OFFSET - 27000},
1721 { 56293, DB_OFFSET - 28000},
1722 { 55724, DB_OFFSET - 29000},
1723 { 55145, DB_OFFSET - 30000},
1724 { 54680, DB_OFFSET - 31000},
1725 { 54293, DB_OFFSET - 32000},
1726 { 53813, DB_OFFSET - 33000},
1727 { 53427, DB_OFFSET - 34000},
1728 { 52981, DB_OFFSET - 35000},
1729
1730 { 52636, DB_OFFSET - 36000},
1731 { 52014, DB_OFFSET - 37000},
1732 { 51674, DB_OFFSET - 38000},
1733 { 50692, DB_OFFSET - 39000},
1734 { 49824, DB_OFFSET - 40000},
1735 { 49052, DB_OFFSET - 41000},
1736 { 48436, DB_OFFSET - 42000},
1737 { 47836, DB_OFFSET - 43000},
1738 { 47368, DB_OFFSET - 44000},
1739 { 46468, DB_OFFSET - 45000},
1740 { 45597, DB_OFFSET - 46000},
1741 { 44586, DB_OFFSET - 47000},
1742 { 43667, DB_OFFSET - 48000},
1743 { 42673, DB_OFFSET - 49000},
1744 { 41816, DB_OFFSET - 50000},
1745 { 40876, DB_OFFSET - 51000},
1703 { 0, 0}, 1746 { 0, 0},
1704}; 1747};
1705 1748
@@ -1853,9 +1896,6 @@ static int dib7000p_get_stats(struct dvb_frontend *demod, fe_status_t stat)
1853 ARRAY_SIZE(strength_to_db_table)) - DB_OFFSET; 1896 ARRAY_SIZE(strength_to_db_table)) - DB_OFFSET;
1854 c->strength.stat[0].svalue = db; 1897 c->strength.stat[0].svalue = db;
1855 1898
1856 /* FIXME: Remove this when calibrated to DB */
1857 c->strength.stat[0].scale = FE_SCALE_COUNTER;
1858
1859 /* UCB/BER/CNR measures require lock */ 1899 /* UCB/BER/CNR measures require lock */
1860 if (!(stat & FE_HAS_LOCK)) { 1900 if (!(stat & FE_HAS_LOCK)) {
1861 c->cnr.len = 1; 1901 c->cnr.len = 1;