From patchwork Sun Jun 25 11:26:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9808113 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 9448E6089D for ; Sun, 25 Jun 2017 11:26:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85A4926E97 for ; Sun, 25 Jun 2017 11:26:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A619285DC; Sun, 25 Jun 2017 11:26:59 +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 11D6126E97 for ; Sun, 25 Jun 2017 11:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751066AbdFYL04 (ORCPT ); Sun, 25 Jun 2017 07:26:56 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34498 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbdFYL0w (ORCPT ); Sun, 25 Jun 2017 07:26:52 -0400 Received: by mail-wr0-f194.google.com with SMTP id k67so23865372wrc.1 for ; Sun, 25 Jun 2017 04:26:52 -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=PlT4vHzwJ40aIFWa8zSH+yJVJT3s0zxqeMf5HXzeq4o=; b=EoKeW/WAv9fmKeXpMBV64TG2Q5CD4KlBp7SgvYk4sfzWyR4h5rEICTTP+MQs6VxziW lS43p6iIe39krLglFoTzltBeh94dsV/9m02X+IRDQKPD4U2UPlgEo9IE7WEtxhJ6Gdzm ZkhiLooscZlCeGFgi49N6Uzk891L2N7oymQCz/prQYmFHDIY1r3hoPXwymQwhBEBWXiA Jb14NamYNbI+JUo1tPBaZ2f/yywgXSid5YGdatLDfJAorj3aqHxsjHHJW7r8xa9HMpZK NdsXlPlLSLvhCTYagz6fTOIJ9caPy7Hs+xyPu8+L9MXyLAaVr8po2lkdKS9nNfotEq6R 0odA== 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=PlT4vHzwJ40aIFWa8zSH+yJVJT3s0zxqeMf5HXzeq4o=; b=qpL4iqdPM1wUrllvZDYpPAp2CmoD1KXdwJn22fmA3p3iK+fnIGwcpXw2/0aLuWfxQR P68I6DwfEsCkyqFOkP0FQK/EnCdyygll0MFShklGANx+cAwcba4Er3kAVtm7pF0t/sjM liIdHGkWc0DQlTJfBlClruXzvYVdx0H85XGI8bNQ5PWJ71MROcPZvB/nHVfXoGsmp5tD oCXcHt9Ri8YoDjHIk0QuuZYc/xaXUy5blO5vky1XAl+00Lk5Lo064xRj4P7XrbkAAr9/ MxwKIeCeLSFZXnvop8Psyw/xj1s6VltVrBk2OdryoiHkOjMvBU0VNLd54tT2t7P2Eh+t 5Mhw== X-Gm-Message-State: AKS2vOymCjkEVcvcFa1Cw2ui5zywkjfjJjMUUHdLhLa9LP0afthtUMMV Vt952MPvGCDDs8LD X-Received: by 10.223.149.99 with SMTP id 90mr11906484wrs.46.1498390011248; Sun, 25 Jun 2017 04:26:51 -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 b131sm9896099wma.11.2017.06.25.04.26.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Jun 2017 04:26:50 -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, crope@iki.fi Subject: [PATCH v3 3/4] [media] dvb-frontends/stv0367: DVB-C signal strength statistics Date: Sun, 25 Jun 2017 13:26:45 +0200 Message-Id: <20170625112646.7973-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170625112646.7973-1-d.scheller.oss@gmail.com> References: <20170625112646.7973-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 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 138f859d0f25..6097752a93bc 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -3011,6 +3011,25 @@ static int stv0367ddb_set_frontend(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; @@ -3086,6 +3105,8 @@ static int stv0367ddb_read_status(struct dvb_frontend *fe, if (ret) return ret; + stv0367ddb_read_signal_strength(fe); + /* read carrier/noise when a carrier is detected */ if (*status & FE_HAS_CARRIER) stv0367ddb_read_snr(fe);