From patchwork Wed Apr 19 23:13:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 9689189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E0A5602DC for ; Wed, 19 Apr 2017 23:14:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 609F92582C for ; Wed, 19 Apr 2017 23:14:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 557BB28437; Wed, 19 Apr 2017 23:14:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF0FD2582C for ; Wed, 19 Apr 2017 23:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940337AbdDSXOh (ORCPT ); Wed, 19 Apr 2017 19:14:37 -0400 Received: from mail-qk0-f174.google.com ([209.85.220.174]:34773 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940333AbdDSXOd (ORCPT ); Wed, 19 Apr 2017 19:14:33 -0400 Received: by mail-qk0-f174.google.com with SMTP id y63so2964384qkd.1 for ; Wed, 19 Apr 2017 16:14:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernellabs-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MB7Cgx2ZveItnP75DiqK+P/Fr3+JbunUc5dYh3HLjf0=; b=yR1X37vqQ8t9L/pk+1tZ76n4KoBtlx4DVV7m2V15Y5gKtUle1rffhrbu1Yh6DjwFXV 1TBwM/XkQINx/JCMeflc/BqQLylggGjGI/m6su8EUl7mRMWYj6kgWDlKv+1d/2SFQg9f rZtS8pCO9ZZZrbFrMp8nD72/AdPMfdTq4+A9gxDMTETTQWMcK/ZHp5I7lUWDBTjA185i Uw6xDh/hoVYD8Oix6IBm5BCtsbH9T8q4LCIZfwXuSz3J+TH+Jme+R8v6Q6hqnMOcejAY jrrWEDH5aarkLz/oQ5zxiV/v+iXFJVo8yt63Og8nb7Y8BLs9M670hfRCKdMWKYoifJZf eqEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MB7Cgx2ZveItnP75DiqK+P/Fr3+JbunUc5dYh3HLjf0=; b=D1opAXt3ZEAd1/29maU8DhvHjzVLaGviJ2Ar7P7OFaG0rcwnneTneTHAysaFn9tTRJ jbnYCs/D6cld22rLNltCxcQez5JbB+HVZttNRpakBbdBH5WBvM4W6o8k6Xd8sMMecTmB UX5UZd/cyfM8Wuh9Eo2PcPaBbqv7dW1oyTNjFFy4a7scnnd6MrFuuq9L6TENCld8zhHu Gn9yV+Jog96jYyPnGkzZ+toAQWg3u85i1/Z0K6BKA+yU30zy3Locdfk0bWbUm+hNdUHQ vo1+YYTUTT74C7pqMiFcIlXzT0OL7UIQMij3ElguR4uiF3/PiAKEWAK1dbsvcJ+MxGbs +5hQ== X-Gm-Message-State: AN3rC/46mdSbpU3la6QJuktpkopGunUJTJDT+ykTJMD6e+E0C8XE1iKA sM8vyjXgKGk+Up4s X-Received: by 10.55.10.131 with SMTP id 125mr446238qkk.74.1492643672433; Wed, 19 Apr 2017 16:14:32 -0700 (PDT) Received: from localhost.localdomain (cpe-74-71-114-159.nyc.res.rr.com. [74.71.114.159]) by smtp.gmail.com with ESMTPSA id 123sm2951916qkm.22.2017.04.19.16.14.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 16:14:32 -0700 (PDT) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller Subject: [PATCH 07/12] au8522: fix lock detection to be more reliable. Date: Wed, 19 Apr 2017 19:13:50 -0400 Message-Id: <1492643635-30823-8-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> References: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only looking at the lock register causes the status to float between locked and not locked when there is no signal. So improve the logic to also examine the state of the FSC PLL, which results in the lock status being consistently reported. Signed-off-by: Devin Heitmueller --- drivers/media/dvb-frontends/au8522_decoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c index 5e21640..343dc92 100644 --- a/drivers/media/dvb-frontends/au8522_decoder.c +++ b/drivers/media/dvb-frontends/au8522_decoder.c @@ -623,10 +623,12 @@ static int au8522_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) int val = 0; struct au8522_state *state = to_state(sd); u8 lock_status; + u8 pll_status; /* Interrogate the decoder to see if we are getting a real signal */ lock_status = au8522_readreg(state, 0x00); - if (lock_status == 0xa2) + pll_status = au8522_readreg(state, 0x7e); + if ((lock_status == 0xa2) && (pll_status & 0x10)) vt->signal = 0xffff; else vt->signal = 0x00;