linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH RFCv10 12/15] mb86a20s: Some improvements for BER measurement
Date: Tue, 15 Jan 2013 00:30:58 -0200	[thread overview]
Message-ID: <1358217061-14982-13-git-send-email-mchehab@redhat.com> (raw)
In-Reply-To: <1358217061-14982-1-git-send-email-mchehab@redhat.com>

Reduce the bit count from 2^24-1 to 2^16-1 to speedup
BER measurement;

Do a per-layer reset, instead of waiting for data on all
layers;

Global stats now start to appear as soon as the first layer
(e. g. the one with the biggest number of segments) start to
have collected data.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/dvb-frontends/mb86a20s.c | 52 +++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index 21e7e68..0d13c87 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -86,16 +86,36 @@ static struct regdata mb86a20s_init[] = {
 	{ 0x04, 0x13 }, { 0x05, 0xff },
 	{ 0x04, 0x15 }, { 0x05, 0x4e },
 	{ 0x04, 0x16 }, { 0x05, 0x20 },
+
+	/*
+	 * On this demod, when the bit count reaches the count below,
+	 * it collects the bit error count.
+	 *
+	 * As FE thread runs on every 3 seconds, adjust the counters to
+	 * provide one collect before 3 seconds, at the worse case (DQPSK,
+	 * 1/4 guard interval, 1/2 FEC, 1-seg rate is 280 Mbps, and
+	 * 3 seconds takes 0xcdb9f bits. Rounds it down to 0xccfff
+	 *
+	 * It should be noticed, however, that, with QAM-64 1/32 guard interval,
+	 * 1 segment bit rate is 1.78 Mbps, and 12-seg is about 21.5 Mbps.
+	 * At such rate, the time to measure BER is about 40 ms.
+	 *
+	 * It makes sense to change the logic there to use TMCC parameters and
+	 * adjust the counters in order to have all of them to take a little
+	 * less than 3 seconds, in order to have a more realistic BER rate,
+	 * instead of having short samples for 12-segs.
+	 */
 	{ 0x52, 0x01 },				/* Turn on BER before Viterbi */
-	{ 0x50, 0xa7 }, { 0x51, 0xff },
-	{ 0x50, 0xa8 }, { 0x51, 0xff },
+	{ 0x50, 0xa7 }, { 0x51, 0x0c },
+	{ 0x50, 0xa8 }, { 0x51, 0xcf },
 	{ 0x50, 0xa9 }, { 0x51, 0xff },
-	{ 0x50, 0xaa }, { 0x51, 0xff },
-	{ 0x50, 0xab }, { 0x51, 0xff },
+	{ 0x50, 0xaa }, { 0x51, 0x0c },
+	{ 0x50, 0xab }, { 0x51, 0xcf },
 	{ 0x50, 0xac }, { 0x51, 0xff },
-	{ 0x50, 0xad }, { 0x51, 0xff },
-	{ 0x50, 0xae }, { 0x51, 0xff },
+	{ 0x50, 0xad }, { 0x51, 0x0c },
+	{ 0x50, 0xae }, { 0x51, 0xcf },
 	{ 0x50, 0xaf }, { 0x51, 0xff },
+
 	{ 0x5e, 0x07 },
 	{ 0x50, 0xdc }, { 0x51, 0x01 },
 	{ 0x50, 0xdd }, { 0x51, 0xf4 },
@@ -711,6 +731,14 @@ static int mb86a20s_get_ber_before_vterbi(struct dvb_frontend *fe,
 		"%s: bit count before Viterbi for layer %c: %d.\n",
 		__func__, 'A' + layer, *count);
 
+	/* Reset counter to collect new data */
+	rc = mb86a20s_writereg(state, 0x53, 0x07 & ~(1 << layer));
+	if (rc < 0)
+		return rc;
+	rc = mb86a20s_writereg(state, 0x53, 0x07);
+	if (rc < 0)
+		return rc;
+
 	return 0;
 }
 
@@ -799,7 +827,11 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe)
 		}
 	}
 
-	if (active_layers == ber_layers) {
+	/*
+	 * Start showing global count if at least one error count is
+	 * available.
+	 */
+	if (ber_layers) {
 		/*
 		 * All BER values are read. We can now calculate the total BER
 		 * And ask for another BER measure
@@ -812,12 +844,6 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe)
 		c->bit_count.stat[0].scale = FE_SCALE_COUNTER;
 		c->bit_count.stat[0].uvalue += t_bit_count;
 
-		/* Reset counters to collect new data */
-		rc = mb86a20s_writeregdata(state, mb86a20s_vber_reset);
-		if (rc < 0)
-			dev_err(&state->i2c->dev,
-				"%s: Can't reset VBER registers.\n", __func__);
-
 		/* All BER measures need to be collected when ready */
 		for (i = 0; i < 3; i++)
 			state->read_ber[i] = true;
-- 
1.7.11.7


  parent reply	other threads:[~2013-01-15  2:31 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15  2:30 [PATCH RFCv10 00/15] DVB QoS statistics API Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 01/15] mb86a20s: improve error handling at get_frontend Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 02/15] dvb: Add DVBv5 stats properties for Quality of Service Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 03/15] dvb: the core logic to handle the DVBv5 QoS properties Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 04/15] mb86a20s: Update QoS statistics at FE read_status Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 05/15] mb86a20s: functions reorder Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 06/15] mb86a20s: Fix i2c gate on error Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 07/15] mb86a20s: improve debug for RF level Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 08/15] mb86a20s: fix interleaving and FEC retrival Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 09/15] mb86a20s: convert it to use dev_info/dev_err/dev_dbg Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 10/15] mb86a20s: -EBUSY is expected when getting QoS measures Mauro Carvalho Chehab
2013-01-15  2:30 ` [PATCH RFCv10 11/15] mb86a20s: make AGC work better Mauro Carvalho Chehab
2013-01-15  2:30 ` Mauro Carvalho Chehab [this message]
2013-01-15  2:30 ` [PATCH RFCv10 13/15] mb86a20s: improve bit error count for BER Mauro Carvalho Chehab
2013-01-15  2:31 ` [PATCH RFCv10 14/15] dvb: increase API version Mauro Carvalho Chehab
2013-01-15  8:20 ` [PATCH RFCv10 00/15] DVB QoS statistics API Johannes Stezenbach
2013-01-15  8:55   ` Antti Palosaari
2013-01-15 12:23     ` Mauro Carvalho Chehab
2013-01-15  9:34 ` Antti Palosaari
2013-01-15 13:10   ` Mauro Carvalho Chehab
2013-01-15 14:49     ` Antti Palosaari
2013-01-15 15:21       ` Mauro Carvalho Chehab
2013-01-15 15:47         ` Devin Heitmueller
2013-01-15 17:02           ` Mauro Carvalho Chehab
2013-01-15 15:26       ` Antti Palosaari
2013-01-15 17:12         ` Mauro Carvalho Chehab
2013-01-15 20:37           ` Antti Palosaari
2013-01-16  4:26             ` Manu Abraham
2013-01-16 11:41               ` Luca Olivetti
2013-01-16 13:56               ` Mauro Carvalho Chehab
2013-01-16 15:19                 ` Manu Abraham
2013-01-16 17:21                   ` Mauro Carvalho Chehab
2013-01-16 18:26                     ` Manu Abraham
2013-01-16 19:22                       ` Mauro Carvalho Chehab
2013-01-16 21:40                         ` Manu Abraham
2013-01-16 19:29                       ` Simon Farnsworth
2013-01-16 21:37                         ` Manu Abraham
2013-01-16 22:11                           ` Mauro Carvalho Chehab
2013-01-17  3:26                             ` Manu Abraham
2013-01-16 22:01                         ` Mauro Carvalho Chehab
2013-01-17  3:40                           ` Manu Abraham
2013-01-17  9:33                             ` Antti Palosaari
2013-01-17 16:50                               ` Mauro Carvalho Chehab
2013-01-17 17:15                                 ` Antti Palosaari
2013-01-17 18:11                                   ` Mauro Carvalho Chehab
2013-01-17 18:27                                     ` Antti Palosaari
2013-01-17 18:37                                       ` Manu Abraham
2013-01-17 18:50                                         ` Mauro Carvalho Chehab
2013-01-17 19:11                                           ` Antti Palosaari
2013-01-17 19:35                                             ` Mauro Carvalho Chehab
2013-01-17 21:29                                             ` Manu Abraham
2013-01-17 22:22                                               ` Antti Palosaari
2013-01-17 22:46                                                 ` Mauro Carvalho Chehab
2013-01-22 12:16                                             ` Mauro Carvalho Chehab
2013-01-23 15:08                                               ` Antti Palosaari
2013-01-23 15:12                                                 ` Antti Palosaari
2013-01-23 18:18                                                 ` Mauro Carvalho Chehab
2013-01-23 18:57                                                   ` Mauro Carvalho Chehab
2013-01-23 19:55                                                     ` Antti Palosaari
2013-01-23 21:00                                                       ` Mauro Carvalho Chehab
2013-01-23 22:02                                                         ` Mauro Carvalho Chehab
2013-01-17 17:16                               ` Manu Abraham
2013-01-17 17:22                                 ` Antti Palosaari
2013-01-17 17:37                                   ` [linux-media] " Klaus Schmidinger
2013-01-17 17:39                                     ` [linux-media] " Klaus Schmidinger
2013-01-17 18:36                                   ` Mauro Carvalho Chehab
2013-01-19 12:04                           ` Mauro Carvalho Chehab
2013-01-16 13:24             ` Mauro Carvalho Chehab
2013-01-15 10:38 ` Manu Abraham
2013-01-15 15:23   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358217061-14982-13-git-send-email-mchehab@redhat.com \
    --to=mchehab@redhat.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).