From patchwork Sun Jun 25 10:02:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9808037 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 F154C6038C for ; Sun, 25 Jun 2017 10:03:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEB2C27F90 for ; Sun, 25 Jun 2017 10:02:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C10C227F95; Sun, 25 Jun 2017 10:02:28 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 DC4A327F90 for ; Sun, 25 Jun 2017 10:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbdFYKC0 (ORCPT ); Sun, 25 Jun 2017 06:02:26 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36768 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdFYKCZ (ORCPT ); Sun, 25 Jun 2017 06:02:25 -0400 Received: by mail-wr0-f194.google.com with SMTP id 77so23584334wrb.3 for ; Sun, 25 Jun 2017 03:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qbYCVPL1676kFP7EKrjNjpHv9CxtDdbC9i32Rfjlb6g=; b=oEo3WjSz6feMzo9XBD10uGhMs+GRVw4L+h3uGVSiIxHz722k/aOtFLrCxnojOEvGie i4NlDvi3wK3w56L8ZLbDmszcFxiXRhg4TqO9uOgKaNx0v/WlACxnTd6MpYdj+5uGV4x7 AG4Wz5HXSvVwaMnsOBMz1R/Hn4L4humM92H+ozXdE8HKiWHHsLe0kLetdWuAPNUqFz4J NjlbfOwqf6gMNR+xpaqtSdrrLgrtSI145kJJ7JAVfFZjtz9kcMEFv3+DM9bQiuD4fJgt EdbLL5Mt0zJob34HbecBZcZ33YzfBVAUhyP5Cn9Sva5LzrQBgsleYXo89aAFS8VXfqMZ N/zQ== 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; bh=qbYCVPL1676kFP7EKrjNjpHv9CxtDdbC9i32Rfjlb6g=; b=hnrlUDHJRWh3Rn+OgA0W8vE7Hx+FBaMToTS3cP7ENL0jlyv7TkCVbsz6SDAob7BIyD Csq+QI4+YOfUusPWK1qwEO/GG7IjT18u74lkBZZLQ/WFE/OH//50A8id8ksgg42fJKoM CquWZkDLANQWroX8w4NSn4Fd4abWBqnVjvEBKkI7vW+/FtQ9r/rm3AjUoUx9IWZCiR6i LgEbd3br6iqsVYPhfop5MR4EYnotCAzrzfqJNIYYyueqGkPxhK69XsB2WVAuzWgK1dMI BdkdVt3mI7QXPwe+IPe2PzlI3HANVdRDFqtGOxEFgv0p/B0E6knBZfivmgFVxajwvzw8 GUXA== X-Gm-Message-State: AKS2vOxtPVeoZreRwi4lyXeX/2P0Blp+54zTlgwDAS+tOI08aC3cnIs+ +qD7yrZzyjlZPcHi X-Received: by 10.223.170.219 with SMTP id i27mr11135803wrc.49.1498384944194; Sun, 25 Jun 2017 03:02:24 -0700 (PDT) Received: from dvbdev.wuest.de (ip-37-24-178-151.hsi14.unitymediagroup.de. [37.24.178.151]) by smtp.gmail.com with ESMTPSA id x94sm8180873wrb.47.2017.06.25.03.02.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Jun 2017 03:02:23 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, aospan@netup.ru, serjk@netup.ru Cc: mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH] [media] dvb-frontends/cxd2841er: require STATE_ACTIVE_* for agc readout Date: Sun, 25 Jun 2017 12:02:22 +0200 Message-Id: <20170625100222.3222-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 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 From: Daniel Scheller When the demod driver puts the demod into sleep or shutdown state and it's status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed to the kernel log. If the last delsys was DVB-T/T2: cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1 cxd2841er: i2c rd failed=-5 addr=6c reg=26 and if it was DVB-C: cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1 cxd2841er: i2c rd failed=-5 addr=6c reg=49 This happens when read_status unconditionally calls into the read_signal_strength() function which triggers the read_agc_gain_*() functions, where these registered are polled. This isn't a critical thing since when the demod is active again, no more such errors are logged, however this might make users suspecting defects. Fix this by requiring STATE_ACTIVE_* in priv->state. If it isn't in any active state, additionally set the strength scale to NOT_AVAILABLE. Signed-off-by: Daniel Scheller Acked-by: Abylay Ospan --- V2/follow-up to https://patchwork.linuxtv.org/patch/42061/, changed as requested. Tested, working fine (ie. no "false" i2c failures). drivers/media/dvb-frontends/cxd2841er.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 08f67d60a7d9..12bff778c97f 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3279,7 +3279,10 @@ static int cxd2841er_get_frontend(struct dvb_frontend *fe, else if (priv->state == STATE_ACTIVE_TC) cxd2841er_read_status_tc(fe, &status); - cxd2841er_read_signal_strength(fe); + if (priv->state == STATE_ACTIVE_TC || priv->state == STATE_ACTIVE_S) + cxd2841er_read_signal_strength(fe); + else + p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; if (status & FE_HAS_LOCK) { cxd2841er_read_snr(fe);