lib/math: Move dvb_math.c into lib/math/int_log.c
Some existing and new users may benefit from the intlog2() and intlog10() APIs, make them wide available. Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> Link: https://lore.kernel.org/r/20230619172019.21457-2-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20230703135211.87416-2-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3d74f42c56
commit
f97fa3dcb2
32 changed files with 42 additions and 48 deletions
|
@ -162,8 +162,11 @@ Base 2 log and power Functions
|
||||||
.. kernel-doc:: include/linux/log2.h
|
.. kernel-doc:: include/linux/log2.h
|
||||||
:internal:
|
:internal:
|
||||||
|
|
||||||
Integer power Functions
|
Integer log and power Functions
|
||||||
-----------------------
|
-------------------------------
|
||||||
|
|
||||||
|
.. kernel-doc:: include/linux/int_log.h
|
||||||
|
:export:
|
||||||
|
|
||||||
.. kernel-doc:: lib/math/int_pow.c
|
.. kernel-doc:: lib/math/int_pow.c
|
||||||
:export:
|
:export:
|
||||||
|
|
|
@ -3,15 +3,6 @@
|
||||||
Digital TV Common functions
|
Digital TV Common functions
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
DVB devices
|
DVB devices
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,6 @@ dvb-vb2-$(CONFIG_DVB_MMAP) := dvb_vb2.o
|
||||||
|
|
||||||
dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o \
|
dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o \
|
||||||
dvb_ca_en50221.o dvb_frontend.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
|
obj-$(CONFIG_DVB_CORE) += dvb-core.o
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#define AF9013_PRIV_H
|
#define AF9013_PRIV_H
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "af9013.h"
|
#include "af9013.h"
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/i2c-mux.h>
|
#include <linux/i2c-mux.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
struct reg_val {
|
struct reg_val {
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include <linux/dvb/version.h>
|
#include <linux/dvb/version.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "cxd2820r.h"
|
#include "cxd2820r.h"
|
||||||
#include <linux/gpio/driver.h> /* For gpio_chip */
|
#include <linux/gpio/driver.h> /* For gpio_chip */
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <linux/dynamic_debug.h>
|
#include <linux/dynamic_debug.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include "cxd2841er.h"
|
#include "cxd2841er.h"
|
||||||
#include "cxd2841er_priv.h"
|
#include "cxd2841er_priv.h"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "cxd2880_tnrdmd_dvbt2.h"
|
#include "cxd2880_tnrdmd_dvbt2.h"
|
||||||
#include "cxd2880_tnrdmd_dvbt2_mon.h"
|
#include "cxd2880_tnrdmd_dvbt2_mon.h"
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
static const int ref_dbm_1000[4][8] = {
|
static const int ref_dbm_1000[4][8] = {
|
||||||
{-96000, -95000, -94000, -93000, -92000, -92000, -98000, -97000},
|
{-96000, -95000, -94000, -93000, -92000, -92000, -98000, -97000},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "cxd2880_tnrdmd_dvbt.h"
|
#include "cxd2880_tnrdmd_dvbt.h"
|
||||||
#include "cxd2880_tnrdmd_dvbt_mon.h"
|
#include "cxd2880_tnrdmd_dvbt_mon.h"
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
static const int ref_dbm_1000[3][5] = {
|
static const int ref_dbm_1000[3][5] = {
|
||||||
{-93000, -91000, -90000, -89000, -88000},
|
{-93000, -91000, -90000, -89000, -88000},
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
#include "cxd2880.h"
|
#include "cxd2880.h"
|
||||||
#include "cxd2880_tnrdmd_mon.h"
|
#include "cxd2880_tnrdmd_mon.h"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
|
|
||||||
#include "dib7000p.h"
|
#include "dib7000p.h"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
|
|
||||||
#include "dib9000.h"
|
#include "dib9000.h"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include "drxk.h"
|
#include "drxk.h"
|
||||||
#include "drxk_hard.h"
|
#include "drxk_hard.h"
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
static int power_down_dvbt(struct drxk_state *state, bool set_power_mode);
|
static int power_down_dvbt(struct drxk_state *state, bool set_power_mode);
|
||||||
static int power_down_qam(struct drxk_state *state);
|
static int power_down_qam(struct drxk_state *state);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "lgdt3305.h"
|
#include "lgdt3305.h"
|
||||||
|
|
||||||
static int debug;
|
static int debug;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "lgdt3306a.h"
|
#include "lgdt3306a.h"
|
||||||
#include <linux/i2c-mux.h>
|
#include <linux/i2c-mux.h>
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "lgdt330x_priv.h"
|
#include "lgdt330x_priv.h"
|
||||||
#include "lgdt330x.h"
|
#include "lgdt330x.h"
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include "m88ds3103.h"
|
#include "m88ds3103.h"
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/i2c-mux.h>
|
#include <linux/i2c-mux.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
#include "mn88443x.h"
|
#include "mn88443x.h"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define MN88472_PRIV_H
|
#define MN88472_PRIV_H
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "mn88472.h"
|
#include "mn88472.h"
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define MN88473_PRIV_H
|
#define MN88473_PRIV_H
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "mn88473.h"
|
#include "mn88473.h"
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include "or51132.h"
|
#include "or51132.h"
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include "or51211.h"
|
#include "or51211.h"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define RTL2830_PRIV_H
|
#define RTL2830_PRIV_H
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "rtl2830.h"
|
#include "rtl2830.h"
|
||||||
#include <linux/i2c-mux.h>
|
#include <linux/i2c-mux.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "rtl2832.h"
|
#include "rtl2832.h"
|
||||||
|
|
||||||
struct rtl2832_dev {
|
struct rtl2832_dev {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "si2165_priv.h"
|
#include "si2165_priv.h"
|
||||||
#include "si2165.h"
|
#include "si2165.h"
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
|
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
|
|
||||||
#include "stv0367.h"
|
#include "stv0367.h"
|
||||||
#include "stv0367_defs.h"
|
#include "stv0367_defs.h"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/dvb/frontend.h>
|
#include <linux/dvb/frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "tc90522.h"
|
#include "tc90522.h"
|
||||||
|
|
||||||
#define TC90522_I2C_THRU_REG 0xfe
|
#define TC90522_I2C_THRU_REG 0xfe
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
#include <media/dvb_frontend.h>
|
#include <media/dvb_frontend.h>
|
||||||
#include <media/dvb_math.h>
|
#include <linux/int_log.h>
|
||||||
#include "tda10048.h"
|
#include "tda10048.h"
|
||||||
|
|
||||||
#define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw"
|
#define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* dvb-math provides some complex fixed-point math
|
* Provides fixed-point logarithm operations.
|
||||||
* operations shared between the dvb related stuff
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
|
* Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
|
||||||
*
|
*
|
||||||
|
@ -15,8 +14,8 @@
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DVB_MATH_H
|
#ifndef __LINUX_INT_LOG_H
|
||||||
#define __DVB_MATH_H
|
#define __LINUX_INT_LOG_H
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# 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_CORDIC) += cordic.o
|
||||||
obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
|
obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* dvb-math provides some complex fixed-point math
|
* Provides fixed-point logarithm operations.
|
||||||
* operations shared between the dvb related stuff
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
|
* Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
|
||||||
*
|
*
|
||||||
|
@ -16,10 +15,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/export.h>
|
||||||
|
#include <linux/int_log.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
#include <asm/bug.h>
|
#include <asm/bug.h>
|
||||||
#include <media/dvb_math.h>
|
|
||||||
|
|
||||||
static const unsigned short logtable[256] = {
|
static const unsigned short logtable[256] = {
|
||||||
0x0000, 0x0171, 0x02e0, 0x044e, 0x05ba, 0x0725, 0x088e, 0x09f7,
|
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,
|
0xe82a, 0xe8ef, 0xe9b3, 0xea77, 0xeb3b, 0xebfe, 0xecc1, 0xed83,
|
||||||
0xee45, 0xef06, 0xefc8, 0xf088, 0xf149, 0xf209, 0xf2c8, 0xf387,
|
0xee45, 0xef06, 0xefc8, 0xf088, 0xf149, 0xf209, 0xf2c8, 0xf387,
|
||||||
0xf446, 0xf505, 0xf5c3, 0xf680, 0xf73e, 0xf7fb, 0xf8b7, 0xf973,
|
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)
|
unsigned int intlog2(u32 value)
|
Loading…
Add table
Reference in a new issue