From patchwork Wed Jun 29 22:43:24 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: 9206305 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 9A29560B17 for ; Wed, 29 Jun 2016 22:43:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD68284A9 for ; Wed, 29 Jun 2016 22:43:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80802285F9; Wed, 29 Jun 2016 22:43:49 +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 0D2CC284A9 for ; Wed, 29 Jun 2016 22:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751960AbcF2Wnh (ORCPT ); Wed, 29 Jun 2016 18:43:37 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:43486 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751911AbcF2Wng (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-0003tY-Dl; 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-0008KE-6u; Wed, 29 Jun 2016 19:43:29 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , Jonathan Corbet , Michael Ira Krufky Subject: [PATCH 08/10] dvb_frontend: create a new ops to help returning signals in dB Date: Wed, 29 Jun 2016 19:43:24 -0300 Message-Id: <790b5e1664c84e806a13143eff1c79b95fb4bf63.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 add a new ops that will allow tuners to better report the dB level of its AGC logic to the demod drivers. As the maximum gain may vary from tuner to tuner, we'll be reversing the logic here: instead of reporting the gain, let's report the attenuation. This way, converting from it to the legacy DVBv3 way is trivial. It is also easy to adjust the level of the received signal to dBm, as it is just a matter of adding an offset at the demod and/or at the bridge driver. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_frontend.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index 9592573a0b41..e8a4d341f420 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -227,8 +227,17 @@ enum dvbfe_search { * should return 0. * @get_status: returns the frontend lock status * @get_rf_strength: returns the RF signal strengh. Used mostly to support - * analog TV and radio. Digital TV should report, instead, - * via DVBv5 API (@dvb_frontend.dtv_property_cache;). + * analog TV and radio. This is deprecated, in favor of + * @get_rf_attenuation. + * @get_rf_attenuation: returns the RF signal attenuation, relative to the + * maximum supported gain, in 1/1000 dB steps. Please + * notice that 0 means that the tuner is using its maximum + * gain. So, a value of 10000, for example, means a 10dB + * attenuation. This is ops is meant to be used by + * demodulator drivers to estimate the maximum signal + * strength. For that, it will add an offset, in order to + * expose the signal strength to userspace via dvbv5 + * stats, in dBm. * @get_afc: Used only by analog TV core. Reports the frequency * drift due to AFC. * @calc_regs: callback function used to pass register data settings @@ -264,6 +273,7 @@ struct dvb_tuner_ops { #define TUNER_STATUS_STEREO 2 int (*get_status)(struct dvb_frontend *fe, u32 *status); int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength); + s32 (*get_rf_attenuation)(struct dvb_frontend *fe); int (*get_afc)(struct dvb_frontend *fe, s32 *afc); /*