From patchwork Thu Mar 15 17:33:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gianluca Gennari X-Patchwork-Id: 10366 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1S8EZR-0006vk-80 for patchwork@linuxtv.org; Thu, 15 Mar 2012 18:34:37 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp for id 1S8EZQ-00024q-Bz; Thu, 15 Mar 2012 18:34:37 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758432Ab2COReU (ORCPT ); Thu, 15 Mar 2012 13:34:20 -0400 Received: from mail-ee0-f46.google.com ([74.125.83.46]:43646 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030449Ab2COReK (ORCPT ); Thu, 15 Mar 2012 13:34:10 -0400 Received: by eekc41 with SMTP id c41so1790074eek.19 for ; Thu, 15 Mar 2012 10:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=QD53kZu6R3GukfzN4QJ5fd8qBw/qB3tMwqcx+Vkk6RY=; b=s04JTOh773ngHp7rtlMdMI14exbsPup3ww5gv7lmN0039yQUHX/hegOvjyIy3aPVLp BIx9iem9qpKzNvbTWB0TVCxSJuTYMWNyM/U2iL5Ih4sjAlk7qNe7abJQ8scK2d5kd/Eq l1yGcJfmVxykIEVEN4JDPOtnt1j9VfjG/0wc1RAzXqcz3lUg5++Bpv/2Y3Wcet9R8MKa lQwsQeiEZNe5lLEmMiaxOMvbCCr7+aEJxZGyJSUqzc58qdnfKPzuwCR/oGetvuW7Oj5A qWvQFzFPtbbLsAWoIFWCefaGJq7i4xM27acpWT/yThlFh3GMkHpsac/h8jd20sdYOyiF yfhg== Received: by 10.213.16.78 with SMTP id n14mr84759eba.139.1331832849676; Thu, 15 Mar 2012 10:34:09 -0700 (PDT) Received: from localhost.localdomain (93-50-34-119.ip150.fastwebnet.it. [93.50.34.119]) by mx.google.com with ESMTPS id r44sm9250156eef.2.2012.03.15.10.34.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Mar 2012 10:34:09 -0700 (PDT) From: Gianluca Gennari To: linux-media@vger.kernel.org, mchehab@redhat.com Cc: crope@iki.fi, Gianluca Gennari Subject: [PATCH 1/3] cxd2820r: tweak search algorithm behavior Date: Thu, 15 Mar 2012 18:33:47 +0100 Message-Id: <1331832829-4580-2-git-send-email-gennarone@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1331832829-4580-1-git-send-email-gennarone@gmail.com> References: <1331832829-4580-1-git-send-email-gennarone@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.3.15.172123 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1800_1899 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' MPIS based STBs running 3.x kernels and the Enigma2 OS are not able to tune DVB-T channels with the PCTV 290e using the current cxd2820r driver. DVB-T2 channels instead work properly. This patch fixes the problem by changing the condition to break out from the wait lock loop in the "search" function of the cxd2820r demodulator from FE_HAS_SIGNAL to FE_HAS_LOCK. As a consequence, the "search" function of the demodulator driver now returns DVBFE_ALGO_SEARCH_SUCCESS only if the frequency lock is successfully acquired. This behavior seems consistent with other demodulator drivers (e.g. stv090x, hd29l2, stv0900, stb0899, mb86a16). This patch has been successfully tested with DVB-T and DVB-T2 signals, on both PC and the mipsel STB running Enigma2. No apparent side effect has been observed on PC applications like Kaffeine. DVB-C is not available in my country so it's not tested. Signed-off-by: Gianluca Gennari Acked-by: Antti Palosaari --- drivers/media/dvb/frontends/cxd2820r_core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/frontends/cxd2820r_core.c b/drivers/media/dvb/frontends/cxd2820r_core.c index 5c7c2aa..3bba37d 100644 --- a/drivers/media/dvb/frontends/cxd2820r_core.c +++ b/drivers/media/dvb/frontends/cxd2820r_core.c @@ -526,12 +526,12 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe) if (ret) goto error; - if (status & FE_HAS_SIGNAL) + if (status & FE_HAS_LOCK) break; } /* check if we have a valid signal */ - if (status) { + if (status & FE_HAS_LOCK) { priv->last_tune_failed = 0; return DVBFE_ALGO_SEARCH_SUCCESS; } else {