From patchwork Mon Jun 19 17:20:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13284869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB94CEB64D9 for ; Mon, 19 Jun 2023 17:24:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 852CD839; Mon, 19 Jun 2023 19:23:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 852CD839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687195460; bh=c//YFBvWQtr50bcVlP9oa8SHFjYDAQjCasTe2gb/7Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=vjBCMmdWDcbwwmLuczwMDdBGRcfJlKOjvR7/i219+GNz27iFHOjSjyg0HIqfSMo/F lAVAIqI0PWSvxKyY5h0ZL7wQWrfoga4TlpCrPBU5LhyqsloZsF9MtABtYu2ZH0LekX 0Kk4XaWNjzijah5MqJfr89s0LGF6nGcyXo6wltiY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6787AF80549; Mon, 19 Jun 2023 19:22:42 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C92AAF80553; Mon, 19 Jun 2023 19:22:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4F3FFF80217; Mon, 19 Jun 2023 19:22:36 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E17ADF80130 for ; Mon, 19 Jun 2023 19:20:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E17ADF80130 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=W4fGVvM/ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687195225; x=1718731225; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c//YFBvWQtr50bcVlP9oa8SHFjYDAQjCasTe2gb/7Lc=; b=W4fGVvM/njIsBfWHu8QutWhI5DEURZ4JN2QmZx5/luYc03XSBA3XvXoZ ymQwJ6VE48TTGvadhjUIre6NvGWLvzlX6HnwCGfxg1Vdmq0DMFsUd18tR EizkgMmH/Hglo+YOqr01vvfGN6zq4Ggs5EiDdM/xAFW4hEKNyWcMTVeLg VTKFvRqexkGSikWobeyhcvDETS0MAz+xw7wwcBqA+iz2LE25yMIjXE1ix admfUpvyW7vZLM0mHsgcHNXrWpOB9gHVbkZfqe3GDfSa44mmG4qXd6fbb GXhsa78r9dYdo7xhSngTs1vD+tmdAZhlpmMTUBvZQkMYalXKwbMZckbyz A==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="423342542" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="423342542" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 10:20:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="691150803" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="691150803" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2023 10:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9BB2A23A; Mon, 19 Jun 2023 20:20:23 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mauro Carvalho Chehab , Hans Verkuil , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Mark Brown , David Lin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: Antti Palosaari , Sergey Kozlov , Abylay Ospan , Yasunari Takiguchi , Michael Krufky , Matthias Schwarzott , Akihiro Tsukada , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v1 1/4] lib/math: Move dvb_math.c into lib/math/int_log.c Date: Mon, 19 Jun 2023 20:20:16 +0300 Message-Id: <20230619172019.21457-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> References: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: S6XTUB2BQMNJUBSUIXXM45QSUNLTOUL5 X-Message-ID-Hash: S6XTUB2BQMNJUBSUIXXM45QSUNLTOUL5 X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Some existing and new users may benefit from the intlog2() and intlog10() APIs, make them wide available. Signed-off-by: Andy Shevchenko Reviewed-by: Mauro Carvalho Chehab --- Documentation/driver-api/media/dtv-common.rst | 2 +- drivers/media/dvb-core/Makefile | 2 +- drivers/media/dvb-frontends/af9013_priv.h | 2 +- drivers/media/dvb-frontends/af9033_priv.h | 2 +- drivers/media/dvb-frontends/cxd2820r_priv.h | 2 +- drivers/media/dvb-frontends/cxd2841er.c | 2 +- .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c | 2 +- .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c | 2 +- drivers/media/dvb-frontends/cxd2880/cxd2880_top.c | 2 +- drivers/media/dvb-frontends/dib7000p.c | 2 +- drivers/media/dvb-frontends/dib8000.c | 2 +- drivers/media/dvb-frontends/dib9000.c | 2 +- drivers/media/dvb-frontends/drxk_hard.c | 2 +- drivers/media/dvb-frontends/lgdt3305.c | 2 +- drivers/media/dvb-frontends/lgdt3306a.c | 2 +- drivers/media/dvb-frontends/lgdt330x.c | 2 +- drivers/media/dvb-frontends/m88ds3103_priv.h | 2 +- drivers/media/dvb-frontends/mn88443x.c | 2 +- drivers/media/dvb-frontends/mn88472_priv.h | 2 +- drivers/media/dvb-frontends/mn88473_priv.h | 2 +- drivers/media/dvb-frontends/or51132.c | 2 +- drivers/media/dvb-frontends/or51211.c | 2 +- drivers/media/dvb-frontends/rtl2830_priv.h | 2 +- drivers/media/dvb-frontends/rtl2832_priv.h | 2 +- drivers/media/dvb-frontends/si2165.c | 2 +- drivers/media/dvb-frontends/stv0367.c | 2 +- drivers/media/dvb-frontends/tc90522.c | 2 +- drivers/media/dvb-frontends/tda10048.c | 2 +- include/{media/dvb_math.h => linux/int_log.h} | 7 +++---- lib/math/Makefile | 2 +- .../media/dvb-core/dvb_math.c => lib/math/int_log.c | 11 ++++++----- 31 files changed, 38 insertions(+), 38 deletions(-) rename include/{media/dvb_math.h => linux/int_log.h} (92%) rename drivers/media/dvb-core/dvb_math.c => lib/math/int_log.c (95%) diff --git a/Documentation/driver-api/media/dtv-common.rst b/Documentation/driver-api/media/dtv-common.rst index f8b2c4dc8170..cf234e0e101a 100644 --- a/Documentation/driver-api/media/dtv-common.rst +++ b/Documentation/driver-api/media/dtv-common.rst @@ -9,7 +9,7 @@ Math functions Provide some commonly-used math functions, usually required in order to estimate signal strength and signal to noise measurements in dB. -.. kernel-doc:: include/media/dvb_math.h +.. kernel-doc:: include/linux/int_log.h DVB devices diff --git a/drivers/media/dvb-core/Makefile b/drivers/media/dvb-core/Makefile index 62b028ded9f7..1cb3ca67bed9 100644 --- a/drivers/media/dvb-core/Makefile +++ b/drivers/media/dvb-core/Makefile @@ -8,6 +8,6 @@ dvb-vb2-$(CONFIG_DVB_MMAP) := dvb_vb2.o dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o \ dvb_ca_en50221.o dvb_frontend.o \ - $(dvb-net-y) dvb_ringbuffer.o $(dvb-vb2-y) dvb_math.o + $(dvb-net-y) dvb_ringbuffer.o $(dvb-vb2-y) obj-$(CONFIG_DVB_CORE) += dvb-core.o diff --git a/drivers/media/dvb-frontends/af9013_priv.h b/drivers/media/dvb-frontends/af9013_priv.h index 3b9b9424fe1a..bba7a9693a23 100644 --- a/drivers/media/dvb-frontends/af9013_priv.h +++ b/drivers/media/dvb-frontends/af9013_priv.h @@ -12,7 +12,7 @@ #define AF9013_PRIV_H #include -#include +#include #include "af9013.h" #include #include diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index 0e64da0cdeab..7560da75ef00 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include struct reg_val { u32 reg; diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h index 9b4d9cf8563d..605320bbc12b 100644 --- a/drivers/media/dvb-frontends/cxd2820r_priv.h +++ b/drivers/media/dvb-frontends/cxd2820r_priv.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include "cxd2820r.h" #include /* For gpio_chip */ #include diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 5431f922f55e..ef403a9fb753 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include "cxd2841er.h" #include "cxd2841er_priv.h" diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c index 604580bf7cf7..4e173dd87ecf 100644 --- a/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c @@ -11,7 +11,7 @@ #include "cxd2880_tnrdmd_dvbt2.h" #include "cxd2880_tnrdmd_dvbt2_mon.h" -#include +#include static const int ref_dbm_1000[4][8] = { {-96000, -95000, -94000, -93000, -92000, -92000, -98000, -97000}, diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c index fedc3b4a2fa0..86d5a1e4022a 100644 --- a/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c @@ -11,7 +11,7 @@ #include "cxd2880_tnrdmd_dvbt.h" #include "cxd2880_tnrdmd_dvbt_mon.h" -#include +#include static const int ref_dbm_1000[3][5] = { {-93000, -91000, -90000, -89000, -88000}, diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c index d5b1b3788e39..f67b6d24b8d4 100644 --- a/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include "cxd2880.h" #include "cxd2880_tnrdmd_mon.h" diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index a90d2f51868f..b791e687d2e2 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include "dib7000p.h" diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index fe19d127abb3..2abda7d1cb6e 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c index 914ca820c174..1c57587a917a 100644 --- a/drivers/media/dvb-frontends/dib9000.c +++ b/drivers/media/dvb-frontends/dib9000.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include "dib9000.h" diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index 3301ef75d441..6ad4f202f1bf 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c @@ -20,7 +20,7 @@ #include #include "drxk.h" #include "drxk_hard.h" -#include +#include static int power_down_dvbt(struct drxk_state *state, bool set_power_mode); static int power_down_qam(struct drxk_state *state); diff --git a/drivers/media/dvb-frontends/lgdt3305.c b/drivers/media/dvb-frontends/lgdt3305.c index 62d743988919..c15d3735d34c 100644 --- a/drivers/media/dvb-frontends/lgdt3305.c +++ b/drivers/media/dvb-frontends/lgdt3305.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "lgdt3305.h" static int debug; diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index 70258884126b..3c6650f6e9a3 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "lgdt3306a.h" #include diff --git a/drivers/media/dvb-frontends/lgdt330x.c b/drivers/media/dvb-frontends/lgdt330x.c index 83565209c3b1..97a10996c7fa 100644 --- a/drivers/media/dvb-frontends/lgdt330x.c +++ b/drivers/media/dvb-frontends/lgdt330x.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include "lgdt330x_priv.h" #include "lgdt330x.h" diff --git a/drivers/media/dvb-frontends/m88ds3103_priv.h b/drivers/media/dvb-frontends/m88ds3103_priv.h index aa5306f40201..594ad9cbc2cc 100644 --- a/drivers/media/dvb-frontends/m88ds3103_priv.h +++ b/drivers/media/dvb-frontends/m88ds3103_priv.h @@ -10,7 +10,7 @@ #include #include "m88ds3103.h" -#include +#include #include #include #include diff --git a/drivers/media/dvb-frontends/mn88443x.c b/drivers/media/dvb-frontends/mn88443x.c index 2ce5692bc22c..db2921c736af 100644 --- a/drivers/media/dvb-frontends/mn88443x.c +++ b/drivers/media/dvb-frontends/mn88443x.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "mn88443x.h" diff --git a/drivers/media/dvb-frontends/mn88472_priv.h b/drivers/media/dvb-frontends/mn88472_priv.h index 337562723f88..41f14bd67bfd 100644 --- a/drivers/media/dvb-frontends/mn88472_priv.h +++ b/drivers/media/dvb-frontends/mn88472_priv.h @@ -9,7 +9,7 @@ #define MN88472_PRIV_H #include -#include +#include #include "mn88472.h" #include #include diff --git a/drivers/media/dvb-frontends/mn88473_priv.h b/drivers/media/dvb-frontends/mn88473_priv.h index eca7f4e2b769..e9daaacfa22f 100644 --- a/drivers/media/dvb-frontends/mn88473_priv.h +++ b/drivers/media/dvb-frontends/mn88473_priv.h @@ -9,7 +9,7 @@ #define MN88473_PRIV_H #include -#include +#include #include "mn88473.h" #include #include diff --git a/drivers/media/dvb-frontends/or51132.c b/drivers/media/dvb-frontends/or51132.c index 24de1b115158..355f3598627b 100644 --- a/drivers/media/dvb-frontends/or51132.c +++ b/drivers/media/dvb-frontends/or51132.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include "or51132.h" diff --git a/drivers/media/dvb-frontends/or51211.c b/drivers/media/dvb-frontends/or51211.c index ddcaea5c9941..ae732dc5116e 100644 --- a/drivers/media/dvb-frontends/or51211.c +++ b/drivers/media/dvb-frontends/or51211.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include "or51211.h" diff --git a/drivers/media/dvb-frontends/rtl2830_priv.h b/drivers/media/dvb-frontends/rtl2830_priv.h index fae78ed78522..ae1fc24a4d84 100644 --- a/drivers/media/dvb-frontends/rtl2830_priv.h +++ b/drivers/media/dvb-frontends/rtl2830_priv.h @@ -9,7 +9,7 @@ #define RTL2830_PRIV_H #include -#include +#include #include "rtl2830.h" #include #include diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h index 5f79f95b9475..f11ba038d5f0 100644 --- a/drivers/media/dvb-frontends/rtl2832_priv.h +++ b/drivers/media/dvb-frontends/rtl2832_priv.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include "rtl2832.h" struct rtl2832_dev { diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 72810efd1a96..434d003bf397 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include "si2165_priv.h" #include "si2165.h" diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 95e376f23506..a93f40617469 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include "stv0367.h" #include "stv0367_defs.h" diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index 879f028f9682..1f8cbf45554a 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include "tc90522.h" #define TC90522_I2C_THRU_REG 0xfe diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index 0b3f6999515e..3cb4e5270e4f 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "tda10048.h" #define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw" diff --git a/include/media/dvb_math.h b/include/linux/int_log.h similarity index 92% rename from include/media/dvb_math.h rename to include/linux/int_log.h index 8690ec42954d..332306202464 100644 --- a/include/media/dvb_math.h +++ b/include/linux/int_log.h @@ -1,6 +1,5 @@ /* - * dvb-math provides some complex fixed-point math - * operations shared between the dvb related stuff + * Provides fixed-point logarithm operations. * * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com) * @@ -15,8 +14,8 @@ * GNU Lesser General Public License for more details. */ -#ifndef __DVB_MATH_H -#define __DVB_MATH_H +#ifndef __LINUX_INT_LOG_H +#define __LINUX_INT_LOG_H #include diff --git a/lib/math/Makefile b/lib/math/Makefile index bfac26ddfc22..91fcdb0c9efe 100644 --- a/lib/math/Makefile +++ b/lib/math/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-y += div64.o gcd.o lcm.o int_pow.o int_sqrt.o reciprocal_div.o +obj-y += div64.o gcd.o lcm.o int_log.o int_pow.o int_sqrt.o reciprocal_div.o obj-$(CONFIG_CORDIC) += cordic.o obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o diff --git a/drivers/media/dvb-core/dvb_math.c b/lib/math/int_log.c similarity index 95% rename from drivers/media/dvb-core/dvb_math.c rename to lib/math/int_log.c index dc90564d7f34..322df25a22d6 100644 --- a/drivers/media/dvb-core/dvb_math.c +++ b/lib/math/int_log.c @@ -1,6 +1,5 @@ /* - * dvb-math provides some complex fixed-point math - * operations shared between the dvb related stuff + * Provides fixed-point logarithm operations. * * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com) * @@ -16,10 +15,12 @@ */ #include +#include +#include #include -#include +#include + #include -#include static const unsigned short logtable[256] = { 0x0000, 0x0171, 0x02e0, 0x044e, 0x05ba, 0x0725, 0x088e, 0x09f7, @@ -53,7 +54,7 @@ static const unsigned short logtable[256] = { 0xe82a, 0xe8ef, 0xe9b3, 0xea77, 0xeb3b, 0xebfe, 0xecc1, 0xed83, 0xee45, 0xef06, 0xefc8, 0xf088, 0xf149, 0xf209, 0xf2c8, 0xf387, 0xf446, 0xf505, 0xf5c3, 0xf680, 0xf73e, 0xf7fb, 0xf8b7, 0xf973, - 0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47 + 0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47, }; unsigned int intlog2(u32 value) From patchwork Mon Jun 19 17:20:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13284867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D51FEB64D9 for ; Mon, 19 Jun 2023 17:22:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DE032844; Mon, 19 Jun 2023 19:21:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DE032844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687195342; bh=bEqeDD3qlJ8khKucahwjiIUNYJkrQelnvBDmHsOyzeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XWCrHqmpehz/eaiF+se3jL8mmra3VU9MYc0zRgNEyaHVfF/XhewkE3y4256YY76J7 IF2JCRkrosPgvdom7eOS2twHAe8ol1LrmisJaimw3pWYCifpl9IQaWGpIGAAvEdVGs iJKj3yTEsY+ljjySHQh4KPlq0nP3rf9aFsK6DTj4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7CB98F8052E; Mon, 19 Jun 2023 19:20:41 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3653CF80558; Mon, 19 Jun 2023 19:20:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 57461F80529; Mon, 19 Jun 2023 19:20:35 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1A921F80301 for ; Mon, 19 Jun 2023 19:20:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1A921F80301 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Zs8HS7Ey DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687195227; x=1718731227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bEqeDD3qlJ8khKucahwjiIUNYJkrQelnvBDmHsOyzeg=; b=Zs8HS7Ey2T9l7FhzEdcju0u+QeNHT4FR0qXzFfy36n+kDBVmiDigRX62 dOVjkOo5GoSwFRYqBwJ9JZEHA2A/u2q0unDrOYYJwh6FLD4Kl0a11QJN5 W+6+usptL1CPIwgAuhyrl/hqIQ67L8Gz4oyLpabbG6uOUW1LHnfCvKtZI EKNtmXWtUBGufGhXPAh7xbPJqTEO2joSgtFqQ5Qjn3ODR3ESgrRw1DXd2 Plyd1Wm/f/nXDhRdgF5CYJIiyL3Jay+CwUUrkeH6wmYiDpRDbE7nmOKwv OYx5hYz9Tjo5n5JA/f4qunBiy7NfJqfjOhgiiA4jhAROWF+4iypAcNbzU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="363105854" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="363105854" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 10:20:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="960482501" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="960482501" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2023 10:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A68BE40F; Mon, 19 Jun 2023 20:20:23 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mauro Carvalho Chehab , Hans Verkuil , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Mark Brown , David Lin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: Antti Palosaari , Sergey Kozlov , Abylay Ospan , Yasunari Takiguchi , Michael Krufky , Matthias Schwarzott , Akihiro Tsukada , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v1 2/4] lib/math/int_log: Use ARRAY_SIZE(logtable) where makes sense Date: Mon, 19 Jun 2023 20:20:17 +0300 Message-Id: <20230619172019.21457-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> References: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: BFAHBEKK55HW7YXEUOMGZ7H766BOSWCT X-Message-ID-Hash: BFAHBEKK55HW7YXEUOMGZ7H766BOSWCT X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use ARRAY_SIZE(logtable) where makes sense. Signed-off-by: Andy Shevchenko Reviewed-by: Mauro Carvalho Chehab --- lib/math/int_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/math/int_log.c b/lib/math/int_log.c index 322df25a22d6..ea98fc0b3fe2 100644 --- a/lib/math/int_log.c +++ b/lib/math/int_log.c @@ -91,7 +91,7 @@ unsigned int intlog2(u32 value) * so we would use the entry 0x18 */ significand = value << (31 - msb); - logentry = (significand >> 23) & 0xff; + logentry = (significand >> 23) % ARRAY_SIZE(logtable); /** * last step we do is interpolation because of the @@ -109,7 +109,7 @@ unsigned int intlog2(u32 value) * logtable_next is 256 */ interpolation = ((significand & 0x7fffff) * - ((logtable[(logentry + 1) & 0xff] - + ((logtable[(logentry + 1) % ARRAY_SIZE(logtable)] - logtable[logentry]) & 0xffff)) >> 15; /* now we return the result */ From patchwork Mon Jun 19 17:20:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13284868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE9CCEB64D9 for ; Mon, 19 Jun 2023 17:23:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 756D2843; Mon, 19 Jun 2023 19:23:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 756D2843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687195433; bh=pnBvaAXYA1YK+iYr+QnoTRToNMTLkN2QhhkWEfWRPa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fikiSQxBdWOAWS7IMs5OVwXPiMpKTKIBrVDK99oEjOj9Cc/wIWeIB6S9IdadTYcab FoH4M78MaCGZoGAHjTUXhV06pPP9wxvmA8a1xoMywXBvAzIEDkekzGRqLBO7YXuDnO 2zd/HzBsWIruYb63MDFNpYXNtpmyOes937NBcj54= Received: by alsa1.perex.cz (Postfix, from userid 50401) id AA013F8052E; Mon, 19 Jun 2023 19:22:40 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id EA838F80130; Mon, 19 Jun 2023 19:22:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3525CF8052D; Mon, 19 Jun 2023 19:22:36 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 12480F80217 for ; Mon, 19 Jun 2023 19:20:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 12480F80217 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=atAXcDQU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687195227; x=1718731227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pnBvaAXYA1YK+iYr+QnoTRToNMTLkN2QhhkWEfWRPa0=; b=atAXcDQU065G8eBf2+AB2yLqbhHzPrHbiD8O6phPoJOSb2u10nITlGfN xSk+cMsHSWHiOD+kExgLW/2REY8WZWPWM7HCzTkWgjiDTqdDXBjolmgcQ SLUpHlj05MKj9q45uMoiL3Altn8gRW8++/MMPAespm0bKuCqYO/CNZjBS G6lf8VUyaoDZnIHG2pFY/PpQuOntSFqFRakti8iAgy7FsaajDCRijzJ29 e14kM0IX2vgxSjSZghh3BtH3wFS+fToddurw7+kvEN5NNiibK75BY3vMi g2DDkSw/a0LwOiNmDdEmErBdtEoLztrfakaAPUtTRMygiGi+0mmYVM+yi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="423342556" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="423342556" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 10:20:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="691150804" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="691150804" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 19 Jun 2023 10:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B84D4690; Mon, 19 Jun 2023 20:20:23 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mauro Carvalho Chehab , Hans Verkuil , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Mark Brown , David Lin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: Antti Palosaari , Sergey Kozlov , Abylay Ospan , Yasunari Takiguchi , Michael Krufky , Matthias Schwarzott , Akihiro Tsukada , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v1 3/4] lib/math/int_log: Replace LGPL-2.1-or-later boilerplate with SPDX identifier Date: Mon, 19 Jun 2023 20:20:18 +0300 Message-Id: <20230619172019.21457-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> References: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: R6UJOYSHCIT6MFFOKKS477NHS36XYKQ7 X-Message-ID-Hash: R6UJOYSHCIT6MFFOKKS477NHS36XYKQ7 X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Replace license boilerplate in udftime.c with SPDX identifier for LGPL-2.1-or-later. Signed-off-by: Andy Shevchenko Acked-by: Mauro Carvalho Chehab --- include/linux/int_log.h | 11 +---------- lib/math/int_log.c | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/linux/int_log.h b/include/linux/int_log.h index 332306202464..0a6f58c38b61 100644 --- a/include/linux/int_log.h +++ b/include/linux/int_log.h @@ -1,17 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * Provides fixed-point logarithm operations. * * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com) - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. */ #ifndef __LINUX_INT_LOG_H diff --git a/lib/math/int_log.c b/lib/math/int_log.c index ea98fc0b3fe2..8f9da3a2ad39 100644 --- a/lib/math/int_log.c +++ b/lib/math/int_log.c @@ -1,17 +1,8 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later /* * Provides fixed-point logarithm operations. * * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com) - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. */ #include From patchwork Mon Jun 19 17:20:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13284870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 216B6EB64DA for ; Mon, 19 Jun 2023 17:24:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E917A86E; Mon, 19 Jun 2023 19:23:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E917A86E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687195466; bh=LdlF3E4uPxnpIZZzXZm8S0r/ubLZondXarGx45cBWxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UHGubB67Bxthq8tszT7HNoWHsJaE9Bqjtra0l24VslH+IHZm+qdP1dk2TCGra7CLp tmKCbqLmGSiiFZ5gI+0bxmIxRfZo79vzPU+aYudQqycwyiVGi5id+aRF7I/ooG3N90 3KSan9ZnzBKw0FlJ2Lh1NquxK8YxUUaoho23YTX4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 690C7F80578; Mon, 19 Jun 2023 19:22:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 311AFF80578; Mon, 19 Jun 2023 19:22:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65762F80132; Mon, 19 Jun 2023 19:22:36 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 88CD3F800BA for ; Mon, 19 Jun 2023 19:20:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 88CD3F800BA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YBTf66QV DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687195229; x=1718731229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LdlF3E4uPxnpIZZzXZm8S0r/ubLZondXarGx45cBWxI=; b=YBTf66QVpqwzy7LeBl1yQBabQh4QUeX2dYlO09FyFqC/sm83PtoXN09R Q+SXw+N8a9oWSlc8AVM1VEd9suQnc5CCgbaNwot2J0bFwEvA5PL4WimFA KuY6dDbdfN7zlTUCrpf7yoPkU9GG+yaGYINbjs9Ux29YSb18eVRZiCbRk oyScc+egDJhDMfK9suNov25jgCj3pZF2EGgYiB+R2w14VfOpSLmFRlFw/ plShJPLaA8P1lGI9NjtzV/mA5kJY/UFKKk72hotlWEnfons39SVTQsU4Q HfXZzsWIWwGckfSg+Clr3/r9NKBymv7xlVoXVuglR9e8diIe8egHv5bFv w==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="363105869" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="363105869" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 10:20:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="960482502" X-IronPort-AV: E=Sophos;i="6.00,255,1681196400"; d="scan'208";a="960482502" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2023 10:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BE40A413; Mon, 19 Jun 2023 20:20:23 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mauro Carvalho Chehab , Hans Verkuil , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Mark Brown , David Lin , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Cc: Antti Palosaari , Sergey Kozlov , Abylay Ospan , Yasunari Takiguchi , Michael Krufky , Matthias Schwarzott , Akihiro Tsukada , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Subject: [PATCH v1 4/4] ASoC: nau8825: Replace copied'n'pasted intlog10() Date: Mon, 19 Jun 2023 20:20:19 +0300 Message-Id: <20230619172019.21457-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> References: <20230619172019.21457-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: ZKHQOHF32LFM3S4UXH2R2ZSLZVES3UUX X-Message-ID-Hash: ZKHQOHF32LFM3S4UXH2R2ZSLZVES3UUX X-MailFrom: andriy.shevchenko@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: As the code even references to dvb_math.c, which is now available as int_log.c, replace its content by the calling respective API. Signed-off-by: Andy Shevchenko Acked-by: Mark Brown --- sound/soc/codecs/nau8825.c | 93 ++------------------------------------ 1 file changed, 3 insertions(+), 90 deletions(-) diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 9e0e4ddf128e..5cb0de648bd3 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,6 @@ #define NAU_FVCO_MIN 90000000 /* cross talk suppression detection */ -#define LOG10_MAGIC 646456993 #define GAIN_AUGMENT 22500 #define SIDETONE_BASE 207000 @@ -219,42 +219,6 @@ static const struct reg_sequence nau8825_regmap_patch[] = { { NAU8825_REG_MIC_BIAS, 0x0046 }, }; - -static const unsigned short logtable[256] = { - 0x0000, 0x0171, 0x02e0, 0x044e, 0x05ba, 0x0725, 0x088e, 0x09f7, - 0x0b5d, 0x0cc3, 0x0e27, 0x0f8a, 0x10eb, 0x124b, 0x13aa, 0x1508, - 0x1664, 0x17bf, 0x1919, 0x1a71, 0x1bc8, 0x1d1e, 0x1e73, 0x1fc6, - 0x2119, 0x226a, 0x23ba, 0x2508, 0x2656, 0x27a2, 0x28ed, 0x2a37, - 0x2b80, 0x2cc8, 0x2e0f, 0x2f54, 0x3098, 0x31dc, 0x331e, 0x345f, - 0x359f, 0x36de, 0x381b, 0x3958, 0x3a94, 0x3bce, 0x3d08, 0x3e41, - 0x3f78, 0x40af, 0x41e4, 0x4319, 0x444c, 0x457f, 0x46b0, 0x47e1, - 0x4910, 0x4a3f, 0x4b6c, 0x4c99, 0x4dc5, 0x4eef, 0x5019, 0x5142, - 0x526a, 0x5391, 0x54b7, 0x55dc, 0x5700, 0x5824, 0x5946, 0x5a68, - 0x5b89, 0x5ca8, 0x5dc7, 0x5ee5, 0x6003, 0x611f, 0x623a, 0x6355, - 0x646f, 0x6588, 0x66a0, 0x67b7, 0x68ce, 0x69e4, 0x6af8, 0x6c0c, - 0x6d20, 0x6e32, 0x6f44, 0x7055, 0x7165, 0x7274, 0x7383, 0x7490, - 0x759d, 0x76aa, 0x77b5, 0x78c0, 0x79ca, 0x7ad3, 0x7bdb, 0x7ce3, - 0x7dea, 0x7ef0, 0x7ff6, 0x80fb, 0x81ff, 0x8302, 0x8405, 0x8507, - 0x8608, 0x8709, 0x8809, 0x8908, 0x8a06, 0x8b04, 0x8c01, 0x8cfe, - 0x8dfa, 0x8ef5, 0x8fef, 0x90e9, 0x91e2, 0x92db, 0x93d2, 0x94ca, - 0x95c0, 0x96b6, 0x97ab, 0x98a0, 0x9994, 0x9a87, 0x9b7a, 0x9c6c, - 0x9d5e, 0x9e4f, 0x9f3f, 0xa02e, 0xa11e, 0xa20c, 0xa2fa, 0xa3e7, - 0xa4d4, 0xa5c0, 0xa6ab, 0xa796, 0xa881, 0xa96a, 0xaa53, 0xab3c, - 0xac24, 0xad0c, 0xadf2, 0xaed9, 0xafbe, 0xb0a4, 0xb188, 0xb26c, - 0xb350, 0xb433, 0xb515, 0xb5f7, 0xb6d9, 0xb7ba, 0xb89a, 0xb97a, - 0xba59, 0xbb38, 0xbc16, 0xbcf4, 0xbdd1, 0xbead, 0xbf8a, 0xc065, - 0xc140, 0xc21b, 0xc2f5, 0xc3cf, 0xc4a8, 0xc580, 0xc658, 0xc730, - 0xc807, 0xc8de, 0xc9b4, 0xca8a, 0xcb5f, 0xcc34, 0xcd08, 0xcddc, - 0xceaf, 0xcf82, 0xd054, 0xd126, 0xd1f7, 0xd2c8, 0xd399, 0xd469, - 0xd538, 0xd607, 0xd6d6, 0xd7a4, 0xd872, 0xd93f, 0xda0c, 0xdad9, - 0xdba5, 0xdc70, 0xdd3b, 0xde06, 0xded0, 0xdf9a, 0xe063, 0xe12c, - 0xe1f5, 0xe2bd, 0xe385, 0xe44c, 0xe513, 0xe5d9, 0xe69f, 0xe765, - 0xe82a, 0xe8ef, 0xe9b3, 0xea77, 0xeb3b, 0xebfe, 0xecc1, 0xed83, - 0xee45, 0xef06, 0xefc8, 0xf088, 0xf149, 0xf209, 0xf2c8, 0xf387, - 0xf446, 0xf505, 0xf5c3, 0xf680, 0xf73e, 0xf7fb, 0xf8b7, 0xf973, - 0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47 -}; - /** * nau8825_sema_acquire - acquire the semaphore of nau88l25 * @nau8825: component to register the codec private data with @@ -368,65 +332,14 @@ static void nau8825_hpvol_ramp(struct nau8825 *nau8825, } /** - * nau8825_intlog10_dec3 - Computes log10 of a value - * the result is round off to 3 decimal. This function takes reference to - * dvb-math. The source code locates as the following. - * Linux/drivers/media/dvb-core/dvb_math.c + * nau8825_intlog10_dec3 - Computes log10 of a value, rounding the result to 3 decimal places. * @value: input for log10 * * return log10(value) * 1000 */ static u32 nau8825_intlog10_dec3(u32 value) { - u32 msb, logentry, significand, interpolation, log10val; - u64 log2val; - - /* first detect the msb (count begins at 0) */ - msb = fls(value) - 1; - /** - * now we use a logtable after the following method: - * - * log2(2^x * y) * 2^24 = x * 2^24 + log2(y) * 2^24 - * where x = msb and therefore 1 <= y < 2 - * first y is determined by shifting the value left - * so that msb is bit 31 - * 0x00231f56 -> 0x8C7D5800 - * the result is y * 2^31 -> "significand" - * then the highest 9 bits are used for a table lookup - * the highest bit is discarded because it's always set - * the highest nine bits in our example are 100011000 - * so we would use the entry 0x18 - */ - significand = value << (31 - msb); - logentry = (significand >> 23) & 0xff; - /** - * last step we do is interpolation because of the - * limitations of the log table the error is that part of - * the significand which isn't used for lookup then we - * compute the ratio between the error and the next table entry - * and interpolate it between the log table entry used and the - * next one the biggest error possible is 0x7fffff - * (in our example it's 0x7D5800) - * needed value for next table entry is 0x800000 - * so the interpolation is - * (error / 0x800000) * (logtable_next - logtable_current) - * in the implementation the division is moved to the end for - * better accuracy there is also an overflow correction if - * logtable_next is 256 - */ - interpolation = ((significand & 0x7fffff) * - ((logtable[(logentry + 1) & 0xff] - - logtable[logentry]) & 0xffff)) >> 15; - - log2val = ((msb << 24) + (logtable[logentry] << 8) + interpolation); - /** - * log10(x) = log2(x) * log10(2) - */ - log10val = (log2val * LOG10_MAGIC) >> 31; - /** - * the result is round off to 3 decimal - */ - return log10val / ((1 << 24) / 1000); + return intlog10(value) / ((1 << 24) / 1000); } /**