From patchwork Tue Jun 20 17:45:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9800033 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 5C88F60329 for ; Tue, 20 Jun 2017 17:45:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FAC71FFD6 for ; Tue, 20 Jun 2017 17:45:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4482F2223E; Tue, 20 Jun 2017 17:45:19 +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 F405E1FFD6 for ; Tue, 20 Jun 2017 17:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbdFTRpR (ORCPT ); Tue, 20 Jun 2017 13:45:17 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36596 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbdFTRpQ (ORCPT ); Tue, 20 Jun 2017 13:45:16 -0400 Received: by mail-wr0-f196.google.com with SMTP id 77so19156124wrb.3 for ; Tue, 20 Jun 2017 10:45:15 -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:in-reply-to:references; bh=nySV51eDYHyoakl0gGkJu8Het0eZzjTgHcgz3bCsaA8=; b=mq59NCYlQRb/1ERionmjdyMnC02IZKexVOFQ8dp6bTx6U7zTvKFF3QibCHBqRxKXTg PqI6uuos0ojVxDgAzAmH6VyhCXOwTENc+vQyWMln44PA1xRAlRAfKG5YkHfTEa8QyOO1 ZOF/jjh5kJO0TpnwQa3up0g5xJCimz9FmPpI1W1hk3B2IJpKsS8TwkjldcmabBQh3oQq laH5fqX/OKDwkYX8eP1cv4n4bX9ygEg8J3xnqqdUYavGTXL0R8c2PKyZ63ylhoGgPYKu a0Fj9b7SzZZgrXRgIBCovuUSaMwnxnf0YjPJOMGD7FBSH0EiQ7OSuFKhYNzLJ/dmnUXB xbqQ== 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=nySV51eDYHyoakl0gGkJu8Het0eZzjTgHcgz3bCsaA8=; b=S36aOurneg/qLORlLdOsPO0NEzg2hB23ipFKiN+UbVIyj5kbxjpx5Sfb9WzFMIAaLE s+a+BI4g6IDzHyqEwAOA23t04hHPRxbc7aBT8/howXMOA/rIys4DXk+JhZwKSquBVu2Z Zn6yfYVXAk0Y50O1ve6Q7JCocVr2ggkR9QCQAXtaxHUxB0oCFbm/qei2OqWfj/zrrGaX SolwqVo+0USJhi4qKVSmwli/APh560g8VXf6EC3hnUVsohRX2pXhxptr/JRCF0dAf3lX bw/QufP0G26jf5jd/hTHRUtvVNJO5NZn79RTSxFqRgcYgMvuGZeLNzULCtfDKtKSPqSp 105A== X-Gm-Message-State: AKS2vOzxrbjPmRPTXP4xUi9wWUbxqwt0X3Yp0nSgRRvbjtOiWTIFqh4N z+d1PzRDBCAKaYbU X-Received: by 10.28.62.199 with SMTP id l190mr3933541wma.13.1497980714751; Tue, 20 Jun 2017 10:45:14 -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 e130sm18622962wmf.10.2017.06.20.10.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 10:45:14 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: liplianin@netup.ru, rjkm@metzlerbros.de Subject: [PATCH 4/4] [media] dvb-frontends/stv0367: DVB-C signal strength statistics Date: Tue, 20 Jun 2017 19:45:06 +0200 Message-Id: <20170620174506.7593-5-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170620174506.7593-1-d.scheller.oss@gmail.com> References: <20170620174506.7593-1-d.scheller.oss@gmail.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 From: Daniel Scheller Provide QAM/DVB-C signal strength in decibel scale. Values returned from stv0367cab_get_rf_lvl() are good but need to be multiplied as they're in 1dBm precision. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0367.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 0b13a407df23..cf684ba70a3f 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -3018,6 +3018,25 @@ static int stv0367ddb_read_status(struct dvb_frontend *fe, return -EINVAL; } +static void stv0367ddb_read_signal_strength(struct dvb_frontend *fe) +{ + struct stv0367_state *state = fe->demodulator_priv; + struct dtv_frontend_properties *p = &fe->dtv_property_cache; + s32 signalstrength; + + switch (state->activedemod) { + case demod_cab: + signalstrength = stv0367cab_get_rf_lvl(state) * 1000; + break; + default: + p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return; + } + + p->strength.stat[0].scale = FE_SCALE_DECIBEL; + p->strength.stat[0].uvalue = signalstrength; +} + static void stv0367ddb_read_snr(struct dvb_frontend *fe) { struct stv0367_state *state = fe->demodulator_priv; @@ -3102,6 +3121,7 @@ static int stv0367ddb_get_frontend(struct dvb_frontend *fe, stv0367ddb_read_ucblocks(fe); stv0367ddb_read_snr(fe); + stv0367ddb_read_signal_strength(fe); return 0; }