* Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
@ 2011-12-21 21:07 Miroslav Slugeň
2011-12-21 21:29 ` Devin Heitmueller
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Miroslav Slugeň @ 2011-12-21 21:07 UTC (permalink / raw)
To: linux-media
[-- Attachment #1: Type: text/plain, Size: 402 bytes --]
XC4000 based cards are not using AGC control in normal way, so it is
not possible to get signal level from AGC registres of zl10353
demodulator, instead of this i send previous patch to implement signal
level directly in xc4000 tuner and now sending patch for zl10353 to
implement this future for digital mode. Signal reporting is very
accurate and was well tested on 3 different Leadtek XC4000 cards.
[-- Attachment #2: Add-tuner-type-for-zl10353-demodulator.patch --]
[-- Type: text/x-patch, Size: 4340 bytes --]
From 76af396e53c1dcf499f5c016ab8ddd95a4856992 Mon Sep 17 00:00:00 2001
From: Miroslav <thunder.m@email.cz>
Date: Wed, 21 Dec 2011 21:55:58 +0100
Subject: [PATCH] This patch adds tuner_type config value for zl10353 demodulator and
fill it for Leadtek based xc4000 tuners. Extra value should be used
in future for tuner specific functions in zl10353 demodulator, first
usage is now for directly reading signal strength from xc4000 tuner
which is very accurate instead of reading signal from AGC registers.
---
drivers/media/dvb/frontends/zl10353.c | 12 +++++++++---
drivers/media/dvb/frontends/zl10353.h | 3 +++
drivers/media/video/cx23885/cx23885-dvb.c | 10 +++++++++-
drivers/media/video/cx88/cx88-dvb.c | 9 ++++++++-
4 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index adbbf6d..7ea3a2e 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -26,6 +26,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <asm/div64.h>
+#include <media/tuner.h>
#include "dvb_frontend.h"
#include "zl10353_priv.h"
@@ -521,10 +522,15 @@ static int zl10353_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
struct zl10353_state *state = fe->demodulator_priv;
- u16 signal = zl10353_read_register(state, AGC_GAIN_1) << 10 |
- zl10353_read_register(state, AGC_GAIN_0) << 2 | 3;
+ /* for XC4000 we can read exact signal value directly */
+ if (state->config.tuner_type == TUNER_XC4000) {
+ fe->ops.tuner_ops.get_rf_strength(fe, strength);
+ } else {
+ u16 signal = zl10353_read_register(state, AGC_GAIN_1) << 10 |
+ zl10353_read_register(state, AGC_GAIN_0) << 2 | 3;
- *strength = ~signal;
+ *strength = ~signal;
+ }
return 0;
}
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h
index 6e3ca9e..64ecbae 100644
--- a/drivers/media/dvb/frontends/zl10353.h
+++ b/drivers/media/dvb/frontends/zl10353.h
@@ -45,6 +45,9 @@ struct zl10353_config
/* clock control registers (0x51-0x54) */
u8 clock_ctl_1; /* default: 0x46 */
u8 pll_0; /* default: 0x15 */
+
+ /* for tuner specific functions */
+ u8 tuner_type;
};
#if defined(CONFIG_DVB_ZL10353) || (defined(CONFIG_DVB_ZL10353_MODULE) && defined(MODULE))
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index f0482b2..98015fe 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -408,6 +408,14 @@ static struct zl10353_config dvico_fusionhdtv_xc3028 = {
.disable_i2c_gate_ctrl = 1,
};
+static struct zl10353_config leadtek_xc4000_config = {
+ .demod_address = 0x0f,
+ .if2 = 45600,
+ .no_tuner = 1,
+ .disable_i2c_gate_ctrl = 1,
+ .tuner_type = TUNER_XC4000,
+};
+
static struct stv0900_reg stv0900_ts_regs[] = {
{ R0900_TSGENERAL, 0x00 },
{ R0900_P1_TSSPEED, 0x40 },
@@ -926,7 +934,7 @@ static int dvb_register(struct cx23885_tsport *port)
i2c_bus = &dev->i2c_bus[0];
fe0->dvb.frontend = dvb_attach(zl10353_attach,
- &dvico_fusionhdtv_xc3028,
+ &leadtek_xc4000_config,
&i2c_bus->i2c_adap);
if (fe0->dvb.frontend != NULL) {
struct dvb_frontend *fe;
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 592f3aa..a62ca76 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -540,6 +540,13 @@ static const struct zl10353_config cx88_pinnacle_hybrid_pctv = {
.if2 = 45600,
};
+static const struct zl10353_config leadtek_xc4000_config = {
+ .demod_address = (0x1e >> 1),
+ .no_tuner = 1,
+ .if2 = 45600,
+ .tuner_type = TUNER_XC4000,
+};
+
static const struct zl10353_config cx88_geniatech_x8000_mt = {
.demod_address = (0x1e >> 1),
.no_tuner = 1,
@@ -1342,7 +1349,7 @@ static int dvb_register(struct cx8802_dev *dev)
case CX88_BOARD_WINFAST_DTV1800H_XC4000:
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
fe0->dvb.frontend = dvb_attach(zl10353_attach,
- &cx88_pinnacle_hybrid_pctv,
+ &leadtek_xc4000_config,
&core->i2c_adap);
if (fe0->dvb.frontend) {
struct xc4000_config cfg = {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
2011-12-21 21:07 Add tuner_type to zl10353 config and use it for reporting signal directly from tuner Miroslav Slugeň
@ 2011-12-21 21:29 ` Devin Heitmueller
2011-12-21 23:50 ` Miroslav Slugeň
2011-12-22 16:58 ` Antti Palosaari
2011-12-22 23:45 ` Miroslav Slugeň
2 siblings, 1 reply; 8+ messages in thread
From: Devin Heitmueller @ 2011-12-21 21:29 UTC (permalink / raw)
To: Miroslav Slugeň; +Cc: linux-media
2011/12/21 Miroslav Slugeň <thunder.mmm@gmail.com>:
> XC4000 based cards are not using AGC control in normal way, so it is
> not possible to get signal level from AGC registres of zl10353
> demodulator, instead of this i send previous patch to implement signal
> level directly in xc4000 tuner and now sending patch for zl10353 to
> implement this future for digital mode. Signal reporting is very
> accurate and was well tested on 3 different Leadtek XC4000 cards.
For what it's worth, something seems very wrong with this patch. All
the docs I've ever seen for the Xceive components were pretty clear
that the signal level registers are for analog only. And even in te
case of Xceive it's a bit unusual, since most analog tuner designs
don't have an onboard analog demodulator.
If this patch really works then I guess I don't have anything against
it. I just strongly believe that it's the wrong fix and there is
probably some other problem this is obscuring.
Devin
--
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
2011-12-21 21:29 ` Devin Heitmueller
@ 2011-12-21 23:50 ` Miroslav Slugeň
2011-12-21 23:55 ` Miroslav Slugeň
0 siblings, 1 reply; 8+ messages in thread
From: Miroslav Slugeň @ 2011-12-21 23:50 UTC (permalink / raw)
To: linux-media
Hi, I tested it with Leadtek DTV 1800H (xc4000 version), Leadtek DTV
2000H PLUS (xc4000) and Leadtek DVR3200H (xc4000), all have same
issue, register of AGC is always 0x3f 0xff and only if I disconect
input from card it will change for short time like it is trying to
tune AGC, but after that it will always return to 0x3ffff value, so
signal reporting from zl10353 demodulator register can't work. Also i
think it is bad idea to measure signal from AGC control which can't
say anything about real signal level. I tested also older cards with
xc3028 tuners and there is signal information but always about 60%
even when i change antena system gain, but for XC2028 there is no such
think like signal monitoring register, it is present only on XC4000
and XC5000 tuners. If you want e can do some testing together, i can
give you access to my testing server.
Dne 21. prosince 2011 22:29 Devin Heitmueller
<dheitmueller@kernellabs.com> napsal(a):
> 2011/12/21 Miroslav Slugeň <thunder.mmm@gmail.com>:
>> XC4000 based cards are not using AGC control in normal way, so it is
>> not possible to get signal level from AGC registres of zl10353
>> demodulator, instead of this i send previous patch to implement signal
>> level directly in xc4000 tuner and now sending patch for zl10353 to
>> implement this future for digital mode. Signal reporting is very
>> accurate and was well tested on 3 different Leadtek XC4000 cards.
>
> For what it's worth, something seems very wrong with this patch. All
> the docs I've ever seen for the Xceive components were pretty clear
> that the signal level registers are for analog only. And even in te
> case of Xceive it's a bit unusual, since most analog tuner designs
> don't have an onboard analog demodulator.
>
> If this patch really works then I guess I don't have anything against
> it. I just strongly believe that it's the wrong fix and there is
> probably some other problem this is obscuring.
>
> Devin
>
> --
> Devin J. Heitmueller - Kernel Labs
> http://www.kernellabs.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
2011-12-21 23:50 ` Miroslav Slugeň
@ 2011-12-21 23:55 ` Miroslav Slugeň
0 siblings, 0 replies; 8+ messages in thread
From: Miroslav Slugeň @ 2011-12-21 23:55 UTC (permalink / raw)
To: linux-media
I forgot to add that this patch depends on my previous patch "Add
signal information to xc4000 tuner", without it it will not work.
XC4000 tuner can measure signal level in both analog and digital and
in analog mode also noise level.
M.
2011/12/22 Miroslav Slugeň <thunder.mmm@gmail.com>:
> Hi, I tested it with Leadtek DTV 1800H (xc4000 version), Leadtek DTV
> 2000H PLUS (xc4000) and Leadtek DVR3200H (xc4000), all have same
> issue, register of AGC is always 0x3f 0xff and only if I disconect
> input from card it will change for short time like it is trying to
> tune AGC, but after that it will always return to 0x3ffff value, so
> signal reporting from zl10353 demodulator register can't work. Also i
> think it is bad idea to measure signal from AGC control which can't
> say anything about real signal level. I tested also older cards with
> xc3028 tuners and there is signal information but always about 60%
> even when i change antena system gain, but for XC2028 there is no such
> think like signal monitoring register, it is present only on XC4000
> and XC5000 tuners. If you want e can do some testing together, i can
> give you access to my testing server.
>
> Dne 21. prosince 2011 22:29 Devin Heitmueller
> <dheitmueller@kernellabs.com> napsal(a):
>> 2011/12/21 Miroslav Slugeň <thunder.mmm@gmail.com>:
>>> XC4000 based cards are not using AGC control in normal way, so it is
>>> not possible to get signal level from AGC registres of zl10353
>>> demodulator, instead of this i send previous patch to implement signal
>>> level directly in xc4000 tuner and now sending patch for zl10353 to
>>> implement this future for digital mode. Signal reporting is very
>>> accurate and was well tested on 3 different Leadtek XC4000 cards.
>>
>> For what it's worth, something seems very wrong with this patch. All
>> the docs I've ever seen for the Xceive components were pretty clear
>> that the signal level registers are for analog only. And even in te
>> case of Xceive it's a bit unusual, since most analog tuner designs
>> don't have an onboard analog demodulator.
>>
>> If this patch really works then I guess I don't have anything against
>> it. I just strongly believe that it's the wrong fix and there is
>> probably some other problem this is obscuring.
>>
>> Devin
>>
>> --
>> Devin J. Heitmueller - Kernel Labs
>> http://www.kernellabs.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
2011-12-21 21:07 Add tuner_type to zl10353 config and use it for reporting signal directly from tuner Miroslav Slugeň
2011-12-21 21:29 ` Devin Heitmueller
@ 2011-12-22 16:58 ` Antti Palosaari
2011-12-22 23:45 ` Miroslav Slugeň
2 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2011-12-22 16:58 UTC (permalink / raw)
To: Miroslav Slugeň; +Cc: linux-media
On 12/21/2011 11:07 PM, Miroslav Slugeň wrote:
> XC4000 based cards are not using AGC control in normal way, so it is
> not possible to get signal level from AGC registres of zl10353
> demodulator, instead of this i send previous patch to implement signal
> level directly in xc4000 tuner and now sending patch for zl10353 to
> implement this future for digital mode. Signal reporting is very
> accurate and was well tested on 3 different Leadtek XC4000 cards.
I don't like that patch at all. My opinion is that you should put hacks
like to the interface driver. Override demod .read_signal_strength()
callback and route it to the tuner callback. No any changes for the
demod driver should be done.
Estimation of the signal strength is a little bit hard when looking
demod point of view. Demod gets IF as input signal and thus have mainly
idea of IF AGC values. Estimating RF strength is thus very inaccurate
from the IF AGC gain. And those IF AGC values are tuner/demod
combination dependent too. Sometimes there is also RF AGC available for
the demod. With both IF and RF AGC you could estimate more better - but
still very inaccurate.
regards
Antti
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Add tuner_type to zl10353 config and use it for reporting signal directly from tuner.
2011-12-21 21:07 Add tuner_type to zl10353 config and use it for reporting signal directly from tuner Miroslav Slugeň
2011-12-21 21:29 ` Devin Heitmueller
2011-12-22 16:58 ` Antti Palosaari
@ 2011-12-22 23:45 ` Miroslav Slugeň
2011-12-23 8:14 ` Antti Palosaari
2 siblings, 1 reply; 8+ messages in thread
From: Miroslav Slugeň @ 2011-12-22 23:45 UTC (permalink / raw)
To: linux-media
This patch is wrong, please use 8971 instead.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-12-23 8:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-21 21:07 Add tuner_type to zl10353 config and use it for reporting signal directly from tuner Miroslav Slugeň
2011-12-21 21:29 ` Devin Heitmueller
2011-12-21 23:50 ` Miroslav Slugeň
2011-12-21 23:55 ` Miroslav Slugeň
2011-12-22 16:58 ` Antti Palosaari
2011-12-22 23:45 ` Miroslav Slugeň
2011-12-23 8:14 ` Antti Palosaari
2011-12-23 8:19 ` Antti Palosaari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox