From patchwork Thu Apr 7 09:08:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rico Tzschichholz X-Patchwork-Id: 90167 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id DE8C6B6F44 for ; Thu, 7 Apr 2011 22:27:29 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q7oIw-0005qb-80; Thu, 07 Apr 2011 12:27:18 +0000 Received: from mailout11.t-online.de ([194.25.134.85]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q7lCX-0003w0-Sy for kernel-team@lists.ubuntu.com; Thu, 07 Apr 2011 09:08:30 +0000 Received: from fwd16.aul.t-online.de (fwd16.aul.t-online.de ) by mailout11.t-online.de with smtp id 1Q7lCW-0000ho-SX; Thu, 07 Apr 2011 11:08:28 +0200 Received: from [192.168.0.2] (VO7jq0ZlghXTE-QrlZiTCi9ajHdYdBTrZhLJGyBQX+0oFxQDfC5nVdphcSDu68kgRC@[91.42.177.158]) by fwd16.t-online.de with esmtp id 1Q7lCV-0QJTAO0; Thu, 7 Apr 2011 11:08:27 +0200 Message-ID: <4D9D7F09.8080509@t-online.de> Date: Thu, 07 Apr 2011 11:08:25 +0200 From: Rico Tzschichholz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.15) Gecko/20110307 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: kernel-team@lists.ubuntu.com Subject: UBUNTU: (pre-stable) Natty - dvb channel switching timeout fix X-Enigmail-Version: 1.1.2 X-ID: VO7jq0ZlghXTE-QrlZiTCi9ajHdYdBTrZhLJGyBQX+0oFxQDfC5nVdphcSDu68kgRC X-TOI-MSGID: fc094e91-4d08-4d57-bf29-1bfce4fa41e8 X-Mailman-Approved-At: Thu, 07 Apr 2011 12:27:16 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Hello, i'd like to request the inclusion of the attached patch which can be found here: https://patchwork.kernel.org/patch/244201/ Since upgrading to 2.6.38.x the usage of stb0899-based DVB cards like S2-3200 (TT3200) is quite broken. Trying to get a channel-lock results mostly in a timeout. This patch fixes the problem as proposed and make channel switching faster. Unfortunately it isn't included upstream yet. best regards, Rico Tzschichholz From patchwork Sun Oct 10 15:08:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [v2] V4L/DVB: faster DVB-S lock for mantis cards using stb0899 demod Date: Sun, 10 Oct 2010 15:08:27 -0000 From: Tuxoholic X-Patchwork-Id: 244201 Message-Id: To: linux-media@vger.kernel.org Cc: manu@linuxtv.org hi list This is a modified version of my previous patch [1] to improve the tuning algo of stb0899 cards using the mantis bridge. With the kind help of Bjørn Mork I was able to keep it minimally invasive with the same effect. Over the last month many testers in vdr-portal.de [2] reported positive results using the patch. This should run fine with all sort of cards using the stb0899 demodulator. [1] http://www.spinics.net/lists/linux-media/msg23181.html [2] http://www.vdr-portal.de/board/thread.php?threadid=99603 Signed-off-by: SE diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index 2da55ec..3efde1e 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -206,7 +206,6 @@ static enum stb0899_status stb0899_check_tmg(struct stb0899_state *state) static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - struct stb0899_params *params = &state->params; short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; int index = 0; @@ -216,10 +215,9 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) /* timing loop computation & symbol rate optimisation */ derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_step = (params->srate / 2L) / internal->mclk; + derot_step = internal->derot_step * 4; /* dertot_step = decreasing delta */ while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { - index++; derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ if (abs(derot_freq) > derot_limit) @@ -230,6 +228,7 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ } + index++; internal->direction = -internal->direction; /* Change zigzag direction */ } @@ -278,14 +277,18 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; + short int derot_freq = 0, last_derot_freq = 0, derot_limit, derot_step, next_loop = 3; int index = 0; + int base_freq; u8 cfr[2]; u8 reg; internal->status = NOCARRIER; derot_limit = (internal->sub_range / 2L) / internal->mclk; derot_freq = internal->derot_freq; + derot_step = internal->derot_step * 2; + last_derot_freq = internal->derot_freq; + base_freq = internal->derot_freq; reg = stb0899_read_reg(state, STB0899_CFD); STB0899_SETFIELD_VAL(CFD_ON, reg, 1); @@ -294,11 +297,10 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) do { dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); if (stb0899_check_carrier(state) == NOCARRIER) { - index++; last_derot_freq = derot_freq; - derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ + derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ - if(abs(derot_freq) > derot_limit) + if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) next_loop--; if (next_loop) { @@ -310,9 +312,10 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ } + index++; + internal->direction = -internal->direction; /* Change zigzag direction */ } - internal->direction = -internal->direction; /* Change zigzag direction */ } while ((internal->status != CARRIEROK) && next_loop); if (internal->status == CARRIEROK) { @@ -338,6 +341,7 @@ static enum stb0899_status stb0899_check_data(struct stb0899_state *state) int lock = 0, index = 0, dataTime = 500, loop; u8 reg; + msleep(1); internal->status = NODATA; /* RESET FEC */ @@ -348,6 +352,7 @@ static enum stb0899_status stb0899_check_data(struct stb0899_state *state) reg = stb0899_read_reg(state, STB0899_TSTRES); STB0899_SETFIELD_VAL(FRESACS, reg, 0); stb0899_write_reg(state, STB0899_TSTRES, reg); + msleep(1); if (params->srate <= 2000000) dataTime = 2000; @@ -360,6 +365,7 @@ static enum stb0899_status stb0899_check_data(struct stb0899_state *state) stb0899_write_reg(state, STB0899_DSTATUS2, 0x00); /* force search loop */ while (1) { + msleep(1); // Alex: added 1 mSec /* WARNING! VIT LOCKED has to be tested before VIT_END_LOOOP */ reg = stb0899_read_reg(state, STB0899_VSTATUS); lock = STB0899_GETFIELD(VSTATUS_LOCKEDVIT, reg); @@ -387,20 +393,21 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state) short int derot_freq, derot_step, derot_limit, next_loop = 3; u8 cfr[2]; u8 reg; - int index = 1; + int index = 0; + int base_freq; struct stb0899_internal *internal = &state->internal; - struct stb0899_params *params = &state->params; - derot_step = (params->srate / 4L) / internal->mclk; + derot_step = internal->derot_step; derot_limit = (internal->sub_range / 2L) / internal->mclk; derot_freq = internal->derot_freq; + base_freq = internal->derot_freq; do { if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ - if (abs(derot_freq) > derot_limit) + if (derot_freq > base_freq + derot_limit || derot_freq < base_freq - derot_limit) next_loop--; if (next_loop) { @@ -414,9 +421,9 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state) stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ stb0899_check_carrier(state); - index++; } } + index++; internal->direction = -internal->direction; /* change zig zag direction */ } while ((internal->status != DATAOK) && next_loop); -- 1.7.1