From patchwork Thu Jun 22 20:03:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9805265 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 6F98E600C5 for ; Thu, 22 Jun 2017 20:03:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568F228338 for ; Thu, 22 Jun 2017 20:03:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B05828534; Thu, 22 Jun 2017 20:03:35 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 377E128338 for ; Thu, 22 Jun 2017 20:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752145AbdFVUDd (ORCPT ); Thu, 22 Jun 2017 16:03:33 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33530 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbdFVUDc (ORCPT ); Thu, 22 Jun 2017 16:03:32 -0400 Received: by mail-wr0-f196.google.com with SMTP id x23so7254860wrb.0 for ; Thu, 22 Jun 2017 13:03:31 -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=SPNVprNeqZwoDYgYFt4fK0bcmBBGaB9V8pZ+GFnfHPU=; b=LyX0PUVX+P+F7pSLYC/vQrI2u2iK1kHI3at64o5uq6v7sTvkfDgwJW407ADMePnqBR h4n908bteaMOBfApwgzbuhp4S1mihUByws0oQFLFW2MWpRAXWTkpHHFMrJL2f0ieYClI 3edjnnE21r+M2K2PmJWmi48nw1RTB1uyDsvJlBltS0nSAMZkDl+uO2/I4z3Dtwf6vOLS +EcLtQO/TgfnJLyeD3oPPDFODUZeMjsOvIKn0pMf/DwSQkYihrK0uSkzbGhQHay8q0oY zjegRXlsBMHmDZdAAWSyVCC6dedKhcbwj6YGia+BO+ACUoENaa4QqyFQQOiCSCRx7N0w 5mxg== 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=SPNVprNeqZwoDYgYFt4fK0bcmBBGaB9V8pZ+GFnfHPU=; b=E/WI8Bb3SkT6uNr0C5de/IWd40So09LiJkcGtm+ydTrpyyrmssRE+O9XEMGWDOxXaP LsPh6LZpz63hwbX77xZel/JIsiNvIZy74RctmqB0FYA4pw2wySvTtbjdi9YXqYiK/RYv 4j5D6ldI7e+p1GdxfD2G3bNbxysgiK2immIzjq5frz6krKpKpPh19grke6ExMVHUio/Q 8TRqXx8CeJhQJ1HJoQZPpV4fBlycfmXdCUFzXEqLrm3dPy+79vNAOLyxmJ31XLV7h6Z8 yhJyFhgL99TmjkGswUxthIOzqmJ9pI+1RPPA4QQD8/dk/OOR7qcG+64OKzWAOvDgWHaM hgwA== X-Gm-Message-State: AKS2vOzlOPUHNUQzckH3nHxDl7hsSbnryWtY9xBzuZIw59j51rvZnTfD EPfdR5WoddDYXNqo X-Received: by 10.223.135.112 with SMTP id 45mr3069236wrz.133.1498161810722; Thu, 22 Jun 2017 13:03:30 -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 c27sm2747187wrb.44.2017.06.22.13.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jun 2017 13:03:30 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, aospan@netup.ru, serjk@netup.ru Cc: mchehab@kernel.org Subject: [PATCH] [media] dvb-frontends/cxd2841er: require FE_HAS_SYNC for agc readout Date: Thu, 22 Jun 2017 22:03:28 +0200 Message-Id: <20170622200328.5387-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 fe_status FE_HAS_SYNC to be sure the demod is not put asleep or shut down. If FE_HAS_SYNC isn't set, additionally set the strength scale to NOT_AVAILABLE. Signed-off-by: Daniel Scheller --- 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..9fff031436f1 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 (status & FE_HAS_SYNC) + cxd2841er_read_signal_strength(fe); + else + p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; if (status & FE_HAS_LOCK) { cxd2841er_read_snr(fe);