From patchwork Sun Nov 5 14:25:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schwarzott X-Patchwork-Id: 10042233 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 C38C66032D for ; Sun, 5 Nov 2017 14:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B578F28AB8 for ; Sun, 5 Nov 2017 14:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA9162946F; Sun, 5 Nov 2017 14:25:34 +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 6CD2828AB8 for ; Sun, 5 Nov 2017 14:25:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbdKEOZc (ORCPT ); Sun, 5 Nov 2017 09:25:32 -0500 Received: from smtp.gentoo.org ([140.211.166.183]:44712 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbdKEOZb (ORCPT ); Sun, 5 Nov 2017 09:25:31 -0500 Received: from gauss.fritz.box (unknown [IPv6:2001:a62:2d3:2e01:553e:3623:3ead:cddd]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zzam) by smtp.gentoo.org (Postfix) with ESMTPSA id 0E46C33BF55; Sun, 5 Nov 2017 14:25:29 +0000 (UTC) From: Matthias Schwarzott To: mchehab@kernel.org, linux-media@vger.kernel.org Cc: Matthias Schwarzott Subject: [PATCH 13/15] si2165: add DVBv3 wrapper for C/N statistics Date: Sun, 5 Nov 2017 15:25:09 +0100 Message-Id: <20171105142511.16563-13-zzam@gentoo.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171105142511.16563-1-zzam@gentoo.org> References: <20171105142511.16563-1-zzam@gentoo.org> 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 Add read_snr function that reads from property cache to support DVBv3. Signed-off-by: Matthias Schwarzott --- drivers/media/dvb-frontends/si2165.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 1cd2120f5dc4..ceb5a2bb0dea 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -794,6 +794,17 @@ static int si2165_read_status(struct dvb_frontend *fe, enum fe_status *status) return 0; } +static int si2165_read_snr(struct dvb_frontend *fe, u16 *snr) +{ + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + + if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL) + *snr = div_s64(c->cnr.stat[0].svalue, 100); + else + *snr = 0; + return 0; +} + static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate) { u64 oversamp; @@ -1111,6 +1122,7 @@ static const struct dvb_frontend_ops si2165_ops = { .set_frontend = si2165_set_frontend, .read_status = si2165_read_status, + .read_snr = si2165_read_snr, }; static int si2165_probe(struct i2c_client *client,