android_kernel_lge_bullhead/include/linux/iio
Lars-Peter Clausen c79f44d1c0 iio: Add inverse unit conversion macros
commit c689a923c867eac40ed3826c1d9328edea8b6bc7 upstream.

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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 10:00:07 -07:00
..
adc iio:adc:ad_sigma_delta move to info_mask_(shared_by_type/separate) 2013-03-17 19:49:24 +00:00
common First set of IIO new drivers and cleanup for the 3.10 cycle. 2013-03-25 10:50:03 -07:00
dac iio: add mcp4725 I2C DAC driver 2012-06-12 14:50:51 -07:00
frequency iio: frequency: ADF4350: Fix potential reference div factor overflow. 2012-08-16 20:24:33 +01:00
gyro itg3200: fix incorrect ifdef comment 2013-03-18 10:59:42 +01:00
imu staging:iio:accel:adis move to info_mask_(shared_by_type/separate) 2013-03-17 19:49:37 +00:00
buffer.h staging:iio: Remove noop call to __iio_update_buffer 2013-01-31 17:56:44 +00:00
consumer.h iio: Update iio_channel_get API to use consumer device pointer as argument 2013-02-06 19:23:52 +00:00
driver.h iio: Simplify iio_map_array_unregister API 2013-02-02 12:02:20 +00:00
events.h iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask 2014-12-06 15:05:47 -08:00
iio.h iio: Add inverse unit conversion macros 2015-09-21 10:00:07 -07:00
kfifo_buf.h iio: Add missing include guards to headers 2012-08-27 18:57:56 +01: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 iio: correct documentation for IIO_CONST_ATTR_SAMP_FREQ_AVAIL, match name of #define 2012-06-18 17:31:42 -07:00
trigger.h iio:trigger: modify return value for iio_trigger_get 2014-10-05 14:54:11 -07:00
trigger_consumer.h iio:trigger_consumer.h: Add missing includes and forward declarations 2012-08-27 18:57:59 +01:00
triggered_buffer.h iio: Add helper function for initializing triggered buffers 2012-06-18 17:26:09 -07:00
types.h iio: Add pressure channel type 2012-11-20 21:26:38 +00:00