linux_dsm_epyc7002/include/linux/iio
Lars-Peter Clausen c689a923c8 iio: Add inverse unit conversion macros
Add inverse unit conversion macro to convert from standard IIO units to
units that might be used by some devices.

Those are useful in combination with scale factors that are specified as
IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will
contain the maximum raw value the sensor will generate and the numerator
the value it maps to in a specific unit. Sometimes datasheets specify those
in different units than the standard IIO units (e.g. degree/s instead of
rad/s) and so we need to do a unit conversion.

From a mathematical point of view it does not make a difference whether we
apply the unit conversion to the numerator or the inverse unit conversion
to the denominator since (x / y) / z = x / (y * z). But as the denominator
is typically a larger value and we are rounding both the numerator and
denominator to integer values using the later method gives us a better
precision (E.g. the relative error is smaller if we round 8000.3 to 8000
rather than rounding 8.3 to 8).

This is where in inverse unit conversion macros will be used.

Marked for stable as used by some upcoming fixes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08 12:50:40 +01:00
..
accel iio: accel: kxcjk1013 3-axis accelerometer driver 2014-06-14 17:10:21 +01:00
adc iio:adc:ad_sigma_delta move to info_mask_(shared_by_type/separate) 2013-03-17 19:49:24 +00:00
common iio: st-sensors: add configuration for WhoAmI address 2015-07-23 20:43:04 +01:00
dac iio: max517: Add support for MAX520 and MAX521 chips. 2015-03-28 10:57:34 +00:00
frequency iio: frequency: adf4350: cast value to unsigned to make code checkers happy 2013-06-04 18:36:52 +01:00
gyro itg3200: fix incorrect ifdef comment 2013-03-18 10:59:42 +01:00
imu iio: adis: Switch sampling frequency attr to core support. 2014-07-07 09:44:17 +01:00
buffer.h iio: Specify supported modes for buffers 2015-06-01 11:31:12 +01:00
consumer.h include: linux: iio: Fix function parameter name in kernel doc 2015-08-02 18:34:18 +01:00
driver.h iio: Simplify iio_map_array_unregister API 2013-02-02 12:02:20 +00:00
events.h iio: Export userspace IIO headers 2015-02-14 17:05:03 +00:00
iio.h iio: Add inverse unit conversion macros 2015-08-08 12:50:40 +01:00
kfifo_buf.h iio: kfifo: Add resource management devm_iio_kfifo_allocate/free 2014-12-26 11:39:57 +00:00
machine.h staging:iio:in kernel users: Add a data field for channel specific info. 2012-11-10 10:17:27 +00:00
sysfs.h include: linux: iio: Add missing kernel doc field 2015-08-02 18:36:05 +01:00
trigger_consumer.h iio:trigger_consumer.h: Add missing includes and forward declarations 2012-08-27 18:57:59 +01:00
trigger.h iio: declare struct to fix warning 2015-08-08 12:28:46 +01:00
triggered_buffer.h iio: Fix parameters in iio_triggered_buffer_setup 2015-07-05 15:19:50 +01:00
types.h iio: core: add high pass filter attributes 2015-05-17 10:32:35 +01:00