public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Regel <andreas.regel@gmx.de>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: abraham.manu@gmail.com, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/3] stv090x: use error counter 1 for BER estimation
Date: Sun, 11 Mar 2012 19:01:15 +0100	[thread overview]
Message-ID: <4F5CE86B.8040403@gmx.de> (raw)
In-Reply-To: <4F5CADF2.80902@redhat.com>

---
 drivers/media/dvb/frontends/stv090x.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index 6c3c095..afbd50c 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -3512,6 +3512,33 @@ static int stv090x_read_status(struct dvb_frontend *fe, enum fe_status *status)
 	return 0;
 }
 
+static int stv090x_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
+	struct stv090x_state *state = fe->demodulator_priv;
+
+	u32 reg, h, m, l;
+	enum fe_status status;
+
+	stv090x_read_status(fe, &status);
+	if (!(status & FE_HAS_LOCK)) {
+		*ber = 1 << 23; /* Max BER */
+	} else {
+		/* Counter 1 */
+		reg = STV090x_READ_DEMOD(state, ERRCNT12);
+		h = STV090x_GETFIELD_Px(reg, ERR_CNT12_FIELD);
+
+		reg = STV090x_READ_DEMOD(state, ERRCNT11);
+		m = STV090x_GETFIELD_Px(reg, ERR_CNT11_FIELD);
+
+		reg = STV090x_READ_DEMOD(state, ERRCNT10);
+		l = STV090x_GETFIELD_Px(reg, ERR_CNT10_FIELD);
+
+		*ber = ((h << 16) | (m << 8) | l);
+	}
+	return 0;
+}
+
+#if 0
 static int stv090x_read_per(struct dvb_frontend *fe, u32 *per)
 {
 	struct stv090x_state *state = fe->demodulator_priv;
@@ -3562,6 +3589,7 @@ err:
 	dprintk(FE_ERROR, 1, "I/O error");
 	return -1;
 }
+#endif
 
 static int stv090x_table_lookup(const struct stv090x_tab *tab, int max, int val)
 {
@@ -4740,7 +4768,7 @@ static struct dvb_frontend_ops stv090x_ops = {
 
 	.search				= stv090x_search,
 	.read_status			= stv090x_read_status,
-	.read_ber			= stv090x_read_per,
+	.read_ber			= stv090x_read_ber,
 	.read_signal_strength		= stv090x_read_signal_strength,
 	.read_snr			= stv090x_read_cnr,
 };
-- 
1.7.2.5
 

      reply	other threads:[~2012-03-11 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 20:42 [PATCH 2/3] stv090x: use error counter 1 for BER estimation Andreas Regel
2012-03-11 13:51 ` Mauro Carvalho Chehab
2012-03-11 18:01   ` Andreas Regel [this message]

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=4F5CE86B.8040403@gmx.de \
    --to=andreas.regel@gmx.de \
    --cc=abraham.manu@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /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