From patchwork Wed Jun 29 22:43:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 9206311 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 CBC626089F for ; Wed, 29 Jun 2016 22:43:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE98F284A9 for ; Wed, 29 Jun 2016 22:43:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2E6328655; Wed, 29 Jun 2016 22:43: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=-6.9 required=2.0 tests=BAYES_00,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 6091C285E7 for ; Wed, 29 Jun 2016 22:43:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752005AbcF2Wns (ORCPT ); Wed, 29 Jun 2016 18:43:48 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:43489 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbcF2Wng (ORCPT ); Wed, 29 Jun 2016 18:43:36 -0400 Received: from 177.17.252.210.dynamic.adsl.gvt.net.br ([177.17.252.210] helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIOCk-0003tT-Dh; Wed, 29 Jun 2016 22:43:34 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.87) (envelope-from ) id 1bIOCf-0008K6-4o; Wed, 29 Jun 2016 19:43:29 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Michael Ira Krufky , "David S. Miller" , Daniel Vetter , Jiri Kosina , Laurent Pinchart Subject: [PATCH 06/10] au8522: show signal strength in dBm, for devices with xc5000 Date: Wed, 29 Jun 2016 19:43:22 -0300 Message-Id: <6ec9fface21b8b5ddab4bce9ef237b69a84316e2.1467240152.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <0003e025f7664aae1500f084bbd6f7aa5d92d47f.1467240152.git.mchehab@s-opensource.com> References: <0003e025f7664aae1500f084bbd6f7aa5d92d47f.1467240152.git.mchehab@s-opensource.com> In-Reply-To: <0003e025f7664aae1500f084bbd6f7aa5d92d47f.1467240152.git.mchehab@s-opensource.com> References: <0003e025f7664aae1500f084bbd6f7aa5d92d47f.1467240152.git.mchehab@s-opensource.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 Devices with xc5000 provide the signal strength value in dBm. So, provide it with the proper scale to userspace. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/au8522_dig.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/au8522_dig.c b/drivers/media/dvb-frontends/au8522_dig.c index 22d837494cc7..518040228064 100644 --- a/drivers/media/dvb-frontends/au8522_dig.c +++ b/drivers/media/dvb-frontends/au8522_dig.c @@ -744,6 +744,15 @@ static void au8522_get_stats(struct dvb_frontend *fe, enum fe_status status) fe->ops.i2c_gate_ctrl(fe, 0); if (ret < 0) state->strength = 0; + + /* + * FIXME: As this frontend is used only with au0828, and, + * currently, the tuner is eiter xc5000 or tda18271, and + * only the first implements get_rf_strength(), we'll assume + * that the strength will be returned in dB. + */ + c->strength.stat[0].svalue = 35000 - 1000 * (65535 - state->strength) / 256; + c->strength.stat[0].scale = FE_SCALE_DECIBEL; } else { u32 tmp; /* @@ -769,9 +778,9 @@ static void au8522_get_stats(struct dvb_frontend *fe, enum fe_status status) state->strength = 0xffff; else state->strength = tmp / 8960; + c->strength.stat[0].uvalue = state->strength; + c->strength.stat[0].scale = FE_SCALE_RELATIVE; } - c->strength.stat[0].scale = FE_SCALE_RELATIVE; - c->strength.stat[0].uvalue = state->strength; /* Read UCB blocks */ if (!(status & FE_HAS_LOCK)) {