From: e9hack <e9hack@googlemail.com>
To: linux-dvb@linuxtv.org
Subject: [linux-dvb] [PATCH] Fix the unc for the frontends tda10021 and stv0297
Date: Sat, 10 May 2008 10:46:35 +0200 [thread overview]
Message-ID: <482560EB.2000306@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 546 bytes --]
Hi,
the uncorrected block count is reset on a read request for the tda10021 and stv0297. This
makes the UNC value of the femon plugin useless. The attached patch will fix this issue.
It is simple for the stv0297. For the tda10021, the uncorrected block count must be read
cyclical, because the resolution of the counter is very low. This can be done within
tda10021_read_status. The read-status-function is called cyclical from the frontend-thread.
Some other frontends have the same problem (tda10023, ves1820, ves1x93, ...).
-Hartmut
[-- Attachment #2: tda10021-unc-fix.diff --]
[-- Type: text/x-diff, Size: 2209 bytes --]
signed-off-by: Hartmut Birr <e9hack@gmail.com>
- The uncorrected block counter shouldn't be reset on read. The tda10021 contains
an uncorrected block counter, which has only a resoltion of 7 bits and
which isn't able wrap to zero. The driver must manage the block counter by itself.
diff -r 4c4fd6b8755c linux/drivers/media/dvb/frontends/tda10021.c
--- a/linux/drivers/media/dvb/frontends/tda10021.c Fri May 02 07:51:27 2008 -0300
+++ b/linux/drivers/media/dvb/frontends/tda10021.c Sat May 03 18:55:09 2008 +0200
@@ -41,6 +41,8 @@ struct tda10021_state {
u8 pwm;
u8 reg0;
+ u8 last_lock : 1;
+ u32 ucblocks;
};
@@ -266,6 +268,10 @@ static int tda10021_set_parameters (stru
tda10021_setup_reg0 (state, reg0x00[qam], p->inversion);
+ /* reset uncorrected block counter */
+ state->last_lock = 0;
+ state->ucblocks = 0;
+
return 0;
}
@@ -273,6 +279,7 @@ static int tda10021_read_status(struct d
{
struct tda10021_state* state = fe->demodulator_priv;
int sync;
+ u32 ucblocks;
*status = 0;
//0x11[0] == EQALGO -> Equalizer algorithms state
@@ -291,6 +298,22 @@ static int tda10021_read_status(struct d
if (sync & 8)
*status |= FE_HAS_LOCK;
+ /* read uncorrected block counter */
+ ucblocks = tda10021_readreg(state, 0x13) & 0x7f;
+
+ /* reset uncorrected block counter */
+ _tda10021_writereg(state, 0x10, tda10021_inittab[0x10] & 0xdf);
+ _tda10021_writereg(state, 0x10, tda10021_inittab[0x10]);
+
+ if (sync & 8) {
+ if (state->last_lock)
+ /* update ucblocks */
+ state->ucblocks += ucblocks;
+ state->last_lock = 1;
+ } else {
+ state->last_lock = 0;
+ }
+
return 0;
}
@@ -335,14 +358,10 @@ static int tda10021_read_ucblocks(struct
static int tda10021_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
{
struct tda10021_state* state = fe->demodulator_priv;
-
- *ucblocks = tda10021_readreg (state, 0x13) & 0x7f;
- if (*ucblocks == 0x7f)
- *ucblocks = 0xffffffff;
-
- /* reset uncorrected block counter */
- _tda10021_writereg (state, 0x10, tda10021_inittab[0x10] & 0xdf);
- _tda10021_writereg (state, 0x10, tda10021_inittab[0x10]);
+ fe_status_t status;
+
+ tda10021_read_status(fe, &status);
+ *ucblocks = state->ucblocks;
return 0;
}
[-- Attachment #3: stv0297-unc-fix.diff --]
[-- Type: text/x-diff, Size: 653 bytes --]
signed-off-by: Hartmut Birr <e9hack@gmail.com>
- Don't reset the uncorrected block counter on a read request.
diff -r 4c4fd6b8755c linux/drivers/media/dvb/frontends/stv0297.c
--- a/linux/drivers/media/dvb/frontends/stv0297.c Fri May 02 07:51:27 2008 -0300
+++ b/linux/drivers/media/dvb/frontends/stv0297.c Sat May 03 15:43:48 2008 +0200
@@ -398,7 +398,6 @@ static int stv0297_read_ucblocks(struct
*ucblocks = (stv0297_readreg(state, 0xD5) << 8)
| stv0297_readreg(state, 0xD4);
- stv0297_writereg_mask(state, 0xDF, 0x03, 0x02); /* clear the counters */
stv0297_writereg_mask(state, 0xDF, 0x03, 0x01); /* re-enable the counters */
return 0;
[-- Attachment #4: Type: text/plain, Size: 150 bytes --]
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next reply other threads:[~2008-05-10 8:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-10 8:46 e9hack [this message]
2008-05-10 15:17 ` [linux-dvb] [PATCH] Fix the unc for the frontends tda10021 and stv0297 Oliver Endriss
2008-05-10 15:27 ` Oliver Endriss
2008-05-10 15:48 ` Michael Krufky
2008-05-12 13:29 ` Oliver Endriss
2008-05-10 16:02 ` e9hack
2008-05-10 16:39 ` Oliver Endriss
2008-05-10 21:53 ` Andy Walls
2008-05-10 22:16 ` Manu Abraham
2008-05-10 23:44 ` Andy Walls
2008-05-11 6:14 ` Manu Abraham
2008-05-11 18:35 ` Andy Walls
2008-05-11 19:33 ` Manu Abraham
2008-05-11 21:32 ` Andy Walls
2008-05-12 13:16 ` Oliver Endriss
2008-05-12 13:47 ` P. van Gaans
2008-05-12 16:02 ` Oliver Endriss
2008-05-12 17:03 ` P. van Gaans
2008-05-12 22:42 ` Andy Walls
2008-05-11 23:45 ` P. van Gaans
2008-05-12 6:47 ` e9hack
2008-05-12 14:26 ` Luca Olivetti
2008-05-10 16:12 ` e9hack
2008-05-30 23:46 ` Oliver Endriss
2008-05-31 0:01 ` Manu Abraham
2008-05-31 7:19 ` e9hack
2008-05-31 12:45 ` Oliver Endriss
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=482560EB.2000306@gmail.com \
--to=e9hack@googlemail.com \
--cc=linux-dvb@linuxtv.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