patch to fix a tuning regression for TeVii S471
Hello,
I recently discovered a regression in the S471 driver. When trying to tune to 10818V on Astra 28E2, the system would tune to 11343V instead. After browsing the code it appears that a divider was changed when the tuning code was moved from ds3000.c to ts2020.c.
The attached patch fixes this regression, but testing turns up more anomalies. For instance I don't seem to be able to tune to 11344H on 28E2 either. The diseqc switches and lnbs are most likely in working order as my Vu+ STB has no problem to tune to this frequency.
Can someone with either a S471 or another card using the ts2020 tuner please verify that it's not a local problem?
Signature · 1 line
Joakim
Quoted 1 line
From
2b546f8e961b3cc1d990eabd3e9ca955b14782b5Mon Sep 17 00:00:00 2001
From: makepkg <[email protected]>
Date: Wed, 22 Jan 2014 19:44:49 +0100
Subject: [PATCH] Fix a TeVii S471 regression introduced when the tuning code
was moved from ds3000,c to ts2020.c. Trying to tune to 10818V, tunes to 11343V instead.
--- drivers/media/pci/cx23885/cx23885-dvb.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/cx23885/cx23885-dvb.c +1 -0
@@ -473,6 +473,7 @@ static struct ds3000_config tevii_ds3000_config = {static struct ts2020_config tevii_ts2020_config = { .tuner_address =0x60 , .clk_out_div =1 , + .frequency_div =1146000 , };static struct cx24116_config dvbworld_cx24116_config = {
Signature · 1 line
1.8.5.3
Quoted 4 lines · On Wed, 22 Jan 2014 20:04:08 +0100 Joakim Hernberg <[email protected]> wrote:
I recently discovered a regression in the S471 driver. When trying to tune to 10818V on Astra 28E2, the system would tune to 11343V instead. After browsing the code it appears that a divider was changed when the tuning code was moved from
ds3000.ctots2020.c.
I decided to test this a bit more thoroughly. I scanned 28E2 with w_scan, compared the listings for 28E2 on King Of Sat with the resulting channels.conf, and came up with the following anomalies. I've also verified the non/existence of the transponders with my VU+ STB.
Some anomalies are common to all tests:
No channels found on 11307H (11307V is OK)
No channels found on 11344H (11344V is OK)
No channels found on 11390V (11389H is OK)
Finds 2 channels on 11097V that aren't in KOS nor found on the STB Transponder on 12000H duplicate of 11992H
With linux v3.8.1 (old tuning code in ds3000.c):
No channels found on 11224V (11222H is OK)
With linux v3.13.0 (new tuning code in ts2020.c):
Shows the channels from 11344V as found on 10818V
No channels found on 11224V (11222H is OK)
Transponder on 12560H duplicate of 12545H
Transponder on 12607H duplicate of 12603H
Transponder on 12643H duplicate of 12633H
With linux 3.13.0 (+ my proposed patch):
Shows the channels from 11222H as found on 11224V
No channels found on 11224V
Transponder on 12524V duplicate of 12522V
Transponder on 12560H duplicate of 12545H
Transponder on 12607H duplicate of 12603H
Transponder on 12643H duplicate of 12633H
Unless some one can directly spot what is wrong in the ts2020.c code, I guess the next step will be to sprinkle printk statements in the tuning code and try to tune to the problematic channels. Then try to see if I can figure out how the code that programs the pll oscilliator functions and if I can come up with better dividers for it.
It would be very much appreciated if someone with a TeVii card using the ts2020 can confirm some of my findings, it would even be interesting to know if it's a problem common to many cards using the ts2020...
Finally I am quite sure that my tests above are ok, but I suppose it's possible I've made a mistake or two, since it's was a long, boring and manual process to match the transponders scanned to the web listings. I also suppose that there could be bugs in w_scan affecting the results, but guess further testing will rule this out. Also note that there might be more frequencies that are problematic, as I've only scanned 28E2 for the moment...
Signature · 1 line
Joakim
PATCH 1/1 ts2020.c : correct divider settings
Quoted 7 lines · Joakim Hernberg
Quoted 4 lines · On Wed, 22 Jan 2014 20:04:08 +0100 Joakim Hernberg <[email protected]> wrote:
I recently discovered a regression in the S471 driver. When trying to tune to 10818V on Astra 28E2, the system would tune to 11343V instead. After browsing the code it appears that a divider was changed when the tuning code was moved from
ds3000.ctots2020.c.
Use 10818V daily BBC News no problems. I also use 11353v
Quoted 25 lines
I decided to test this a bit more thoroughly. I scanned 28E2 with
w_scan, compared the listings for 28E2 on King Of Sat with the resulting channels.conf, and came up with the following anomalies. I've also verified the non/existence of the transponders with my VU+ STB.Some anomalies are common to all tests:
No channels found on 11307H (11307V is OK)
No channels found on 11344H (11344V is OK)
No channels found on 11390V (11389H is OK)
Finds 2 channels on 11097V that aren't in KOS nor found on the STB Transponder on 12000H duplicate of 11992HWith linux v3.8.1 (old tuning code in
ds3000.c):No channels found on 11224V (11222H is OK)
With linux v3.13.0 (new tuning code in
ts2020.c):Shows the channels from 11344V as found on 10818V
No channels found on 11224V (11222H is OK)
Quoted 8 lines
Transponder on 12560H duplicate of 12545H
Transponder on 12607H duplicate of 12603H
Transponder on 12643H duplicate of 12633HWith linux 3.13.0 (+ my proposed patch):
Shows the channels from 11222H as found on 11224V
No channels found on 11224V
Yes I can tune this channel using current ts2020 kernel code.
Quoted 6 lines
Transponder on 12524V duplicate of 12522V
Transponder on 12560H duplicate of 12545H
Transponder on 12607H duplicate of 12603H
Transponder on 12643H duplicate of 12633H
Problems here could be the carrier offset or error occurred during tuning.
The carrier offset can be as much as +/- 30 MHz and accidentally slip onto the next channel carrier.
The ds3000 does not return carrier offset adjusted frequency.
Quoted 6 lines
Unless some one can directly spot what is wrong in the
ts2020.ccode, I guess the next step will be to sprinkle printk statements in the tuning code and try to tune to the problematic channels. Then try to see if I can figure out how the code that programs the pll oscilliator functions and if I can come up with better dividers for it.
I am using the ts2020 with the m88r2000. It think the problem is in ds3000.
Here is alternative ndiv code, it is based on vendors code.
It uses the ndiv value not frequency to change the divider.
--- drivers/media/dvb-frontends/ts2020.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/media/dvb-frontends/ts2020.c +14 -10
@@ -186,22 +186,27 @@ static int ts2020_set_params(struct dvb_frontend *fe)struct ts2020_priv *priv = fe->tuner_priv;int ret;u32 frequency = c->frequency; -s32 offset_khz; +u32 offset_khz, ndiv_mul;u32 symbol_rate = (c->symbol_rate /1000 );u32 f3db, gdiv28;u16 value, ndiv, lpf_coeff;u8 lpf_mxdiv, mlpf_max, mlpf_min, nlpf;u8 lo =0x01 , div4 =0x0 ; + ndiv = (u16)((frequency *14 *2 +TS2020_XTAL_FREQ /2 ) + /TS2020_XTAL_FREQ ); +/* Calculate frequency divider */ -if (frequency < priv->frequency_div) { +if (ndiv <1100 ) { lo |=0x10 ; div4 =0x1 ; - ndiv = (frequency *14 *4 ) /TS2020_XTAL_FREQ ; - }else - ndiv = (frequency *14 *2 ) /TS2020_XTAL_FREQ ; - ndiv = ndiv + ndiv %2 ; - ndiv = ndiv -1024 ; + ndiv = (u16)((frequency *14 *4 +TS2020_XTAL_FREQ /2 ) + /TS2020_XTAL_FREQ ) -1024 ; + ndiv_mul = ndiv +1024 ; + }else { + ndiv -=1024 ; + ndiv_mul = ndiv - ndiv %2 +1024 ; + } ret =ts2020_writereg (fe,0x10 ,0x80 | lo);
@@ -272,9 +277,8 @@ static int ts2020_set_params(struct dvb_frontend *fe) ret |=ts2020_tuner_gate_ctrl (fe,0x01 );msleep (80 ); -/* calculate offset assuming 96000kHz*/ - offset_khz = (ndiv - ndiv %2 +1024 ) *TS2020_XTAL_FREQ - / (6 +8 ) / (div4 +1 ) /2 ; + + offset_khz = ndiv_mul *TS2020_XTAL_FREQ /14 / (div4 +1 ) /2 ; priv->frequency = offset_khz;
Signature · 1 line
1.8.5.3
Re: [PATCH TEST] ts2020.c : correct divider settings
Quoted 11 lines · On Fri, 24 Jan 2014 20:54:13 +0000 Malcolm Priestley <[email protected]> wrote:
Here is alternative ndiv code, it is based on vendors code.
It uses the ndiv value not frequency to change the divider.
Signed-off-by Malcolm Priestley <[email protected]>--- drivers/media/dvb-frontends/ts2020.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/drivers/media/dvb-frontends/ts2020.cindex 9aba044..9e051efb 100644
The problem was fixed by the other patch (and I suspect that it's specific to the TeVii hardware affected), but if I find some time I'll certainly have a play around with this patch too.
Thanks,
Signature · 1 line
Joakim