From patchwork Wed Jun 21 19:45:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9802813 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 890CA6038C for ; Wed, 21 Jun 2017 19:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 784A028522 for ; Wed, 21 Jun 2017 19:45:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CD9D2856F; Wed, 21 Jun 2017 19:45:54 +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 1F69528522 for ; Wed, 21 Jun 2017 19:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbdFUTpx (ORCPT ); Wed, 21 Jun 2017 15:45:53 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33640 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbdFUTpv (ORCPT ); Wed, 21 Jun 2017 15:45:51 -0400 Received: by mail-wr0-f195.google.com with SMTP id x23so29319972wrb.0 for ; Wed, 21 Jun 2017 12:45:50 -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=pFE2gOeLJK0pT3pA9Sbj7q1iuWQK1SYF2lm6EMJVivM=; b=uOh8gU5doNj2w6E9yz7Ae/OiZMWp7e0TETMwjsvxJFo/Q9XLmzc4DePHvPd6mbqWwZ w1duk4VZ5z5ke75TE97dFpMVQYD+dOGkcpPK86QOvM8JspNuqm+Cb2mL/AVkvIMD5l+g di+GXV1Gh9avxj7Umva1H+dcVm/5F4e6TTSXAkmAIEDTP3V12eQneJRws4XBIFR+kSDZ UyEjhv9VobC/woD1a4LwCYnKwe71UsH5yCgYthPmoXE9sdusCpMPbO8Wn8H0NGVmFBjR mHj/sVoaB3SL+IxRCVC3bqPxlTYznwOeWDMvXnIjxEDu/i/mrZ7v50/4aGlLW++RU06Q qnXg== 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=pFE2gOeLJK0pT3pA9Sbj7q1iuWQK1SYF2lm6EMJVivM=; b=duRuVesn8OrJ5wCzE+VOcDAZKKH/70dTaeJ1bPhZE269rBF50WjcgGNa4M38IR16iO Pqm1flWlNUtSMSNlDTW0TOMgD+lWn0n/pGPUdbvCd2+T3pkN1zmY+461jZ/JnATxX2nz YK3ZuRd1bUdFFEOJRsAAHciulZTH2IiQ8JQtQUq6exA0sPhpfWs+EJBzNpK2ppqr8cDc 4eGcWhdrg3x3+0FA7Wq0nksLawe66pFufYZrQzCUMQfrPEdj5O57Uj1ma52foX1jXdaU qRdK/EAIMj3D+5KjwwUEjQYzh8PK96Lp4rryORwcRUpyjvslnaRsKyNJahfj3fqmq6MK d1eA== X-Gm-Message-State: AKS2vOwaLoui93JUntPLPkkx8w9lk7sFk9h4inYriSf7BbS24XxW+CuQ nnHc/ro/4sg+6BNN X-Received: by 10.223.163.15 with SMTP id c15mr20166614wrb.71.1498074349718; Wed, 21 Jun 2017 12:45:49 -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 29sm27314193wrv.23.2017.06.21.12.45.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 12:45:49 -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 v2 4/4] [media] dvb-frontends/stv0367: DVB-C signal strength statistics Date: Wed, 21 Jun 2017 21:45:44 +0200 Message-Id: <20170621194544.16949-5-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170621194544.16949-1-d.scheller.oss@gmail.com> References: <20170621194544.16949-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 d3be25bc1002..bac6707957a3 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -2998,6 +2998,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; @@ -3075,12 +3094,14 @@ static int stv0367ddb_read_status(struct dvb_frontend *fe, /* stop if demod isn't locked */ if (!(*status & FE_HAS_LOCK)) { + p->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; return ret; } stv0367ddb_read_snr(fe); + stv0367ddb_read_signal_strength(fe); stv0367ddb_read_ucblocks(fe); return 0;