From patchwork Sun Jul 10 22:37:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 962732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6AMbOXf029024 for ; Sun, 10 Jul 2011 22:37:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756755Ab1GJWhW (ORCPT ); Sun, 10 Jul 2011 18:37:22 -0400 Received: from mail-ww0-f42.google.com ([74.125.82.42]:41782 "EHLO mail-ww0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753791Ab1GJWhW (ORCPT ); Sun, 10 Jul 2011 18:37:22 -0400 Received: by wwg11 with SMTP id 11so1779057wwg.1 for ; Sun, 10 Jul 2011 15:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=v6xFo6gGvWT/Z92FqeqWPMuYpAqrqcHjl+iEB132jwE=; b=P1TnBPMnQRS8Yuo9+3JLL8A8QFMFIwdEbBCg00mjpa/SLa8oJOEcjt6tQuliJDb1aI nbEGXeE8zlM6RE97e7dMNtrpd+H2euPSQgyLx/4rfwLyy6NYszCVLH1uactswIcikyAi wVzuhAxh+C6fMLOH0eG28lFDC58n0N50waDGE= Received: by 10.216.81.5 with SMTP id l5mr2657290wee.102.1310337441233; Sun, 10 Jul 2011 15:37:21 -0700 (PDT) Received: from [94.197.182.238] (94.197.182.238.threembb.co.uk [94.197.182.238]) by mx.google.com with ESMTPS id u64sm6628787weq.4.2011.07.10.15.37.19 (version=SSLv3 cipher=OTHER); Sun, 10 Jul 2011 15:37:20 -0700 (PDT) Subject: [PATCH] STV0288 frontend provide wider carrier search and DVB-S2 drop out. resend From: Malcolm Priestley To: "'Linux Media Mailing List'" Date: Sun, 10 Jul 2011 23:37:13 +0100 Message-ID: <1310337433.2472.9.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sun, 10 Jul 2011 22:37:25 +0000 (UTC) The following patch provides wider carrier search. As with existing code search starts at MSB aligned. The boundary is widened to start at -9. In order to save time, if no carrier is detected at the start it advances to the next alignment until carrier is found. The stv0288 will detect a DVB-S2 carrier on all steps , a time out of 11 steps is introduced to drop out of the loop. In stv0288_set_symbol carrier and timing loops are restored to default values (inittab) before setting the symbol rate on each tune. A slight drift was noticed with full scan in the higher IF frequencies of each band. Signed-off-by: Malcolm Priestley --- drivers/media/dvb/frontends/stv0288.c | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb/frontends/stv0288.c b/drivers/media/dvb/frontends/stv0288.c index 8e0cfad..0aa3962 100644 --- a/drivers/media/dvb/frontends/stv0288.c +++ b/drivers/media/dvb/frontends/stv0288.c @@ -127,6 +127,11 @@ static int stv0288_set_symbolrate(struct dvb_frontend *fe, u32 srate) if ((srate < 1000000) || (srate > 45000000)) return -EINVAL; + stv0288_writeregI(state, 0x22, 0); + stv0288_writeregI(state, 0x23, 0); + stv0288_writeregI(state, 0x2b, 0xff); + stv0288_writeregI(state, 0x2c, 0xf7); + temp = (unsigned int)srate / 1000; temp = temp * 32768; @@ -461,6 +466,7 @@ static int stv0288_set_frontend(struct dvb_frontend *fe, char tm; unsigned char tda[3]; + u8 reg, time_out = 0; dprintk("%s : FE_SET_FRONTEND\n", __func__); @@ -488,22 +494,29 @@ static int stv0288_set_frontend(struct dvb_frontend *fe, /* Carrier lock control register */ stv0288_writeregI(state, 0x15, 0xc5); - tda[0] = 0x2b; /* CFRM */ tda[2] = 0x0; /* CFRL */ - for (tm = -6; tm < 7;) { + for (tm = -9; tm < 7;) { /* Viterbi status */ - if (stv0288_readreg(state, 0x24) & 0x8) - break; - - tda[2] += 40; - if (tda[2] < 40) + reg = stv0288_readreg(state, 0x24); + if (reg & 0x8) + break; + if (reg & 0x80) { + time_out++; + if (time_out > 10) + break; + tda[2] += 40; + if (tda[2] < 40) + tm++; + } else { tm++; + tda[2] = 0; + time_out = 0; + } tda[1] = (unsigned char)tm; stv0288_writeregI(state, 0x2b, tda[1]); stv0288_writeregI(state, 0x2c, tda[2]); udelay(30); } - state->tuner_frequency = c->frequency; state->fec_inner = FEC_AUTO; state->symbol_rate = c->symbol_rate;