Commit 1e1b4fbd authored by Herve Codina's avatar Herve Codina Committed by Mark Brown

iio: consumer.h: Fix raw values documentation notes

The raw values notes mention 'ADC counts' and are not fully accurate.

Reword the notes in order to remove the 'ADC counts' and describe the
conversion needed between a raw value and a value in the standard units.
Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20230623085830.749991-5-herve.codina@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f75c544d
...@@ -201,8 +201,9 @@ struct iio_dev ...@@ -201,8 +201,9 @@ struct iio_dev
* @chan: The channel being queried. * @chan: The channel being queried.
* @val: Value read back. * @val: Value read back.
* *
* Note raw reads from iio channels are in adc counts and hence * Note, if standard units are required, raw reads from iio channels
* scale will need to be applied if standard units required. * need the offset (default 0) and scale (default 1) to be applied
* as (raw + offset) * scale.
*/ */
int iio_read_channel_raw(struct iio_channel *chan, int iio_read_channel_raw(struct iio_channel *chan,
int *val); int *val);
...@@ -212,8 +213,9 @@ int iio_read_channel_raw(struct iio_channel *chan, ...@@ -212,8 +213,9 @@ int iio_read_channel_raw(struct iio_channel *chan,
* @chan: The channel being queried. * @chan: The channel being queried.
* @val: Value read back. * @val: Value read back.
* *
* Note raw reads from iio channels are in adc counts and hence * Note, if standard units are required, raw reads from iio channels
* scale will need to be applied if standard units required. * need the offset (default 0) and scale (default 1) to be applied
* as (raw + offset) * scale.
* *
* In opposit to the normal iio_read_channel_raw this function * In opposit to the normal iio_read_channel_raw this function
* returns the average of multiple reads. * returns the average of multiple reads.
...@@ -281,8 +283,9 @@ int iio_read_channel_attribute(struct iio_channel *chan, int *val, ...@@ -281,8 +283,9 @@ int iio_read_channel_attribute(struct iio_channel *chan, int *val,
* @chan: The channel being queried. * @chan: The channel being queried.
* @val: Value being written. * @val: Value being written.
* *
* Note raw writes to iio channels are in dac counts and hence * Note that for raw writes to iio channels, if the value provided is
* scale will need to be applied if standard units required. * in standard units, the affect of the scale and offset must be removed
* as (value / scale) - offset.
*/ */
int iio_write_channel_raw(struct iio_channel *chan, int val); int iio_write_channel_raw(struct iio_channel *chan, int val);
...@@ -292,8 +295,9 @@ int iio_write_channel_raw(struct iio_channel *chan, int val); ...@@ -292,8 +295,9 @@ int iio_write_channel_raw(struct iio_channel *chan, int val);
* @chan: The channel being queried. * @chan: The channel being queried.
* @val: Value read back. * @val: Value read back.
* *
* Note raw reads from iio channels are in adc counts and hence * Note, if standard units are required, raw reads from iio channels
* scale will need to be applied if standard units are required. * need the offset (default 0) and scale (default 1) to be applied
* as (raw + offset) * scale.
*/ */
int iio_read_max_channel_raw(struct iio_channel *chan, int *val); int iio_read_max_channel_raw(struct iio_channel *chan, int *val);
...@@ -308,8 +312,9 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val); ...@@ -308,8 +312,9 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val);
* For ranges, three vals are always returned; min, step and max. * For ranges, three vals are always returned; min, step and max.
* For lists, all the possible values are enumerated. * For lists, all the possible values are enumerated.
* *
* Note raw available values from iio channels are in adc counts and * Note, if standard units are required, raw available values from iio
* hence scale will need to be applied if standard units are required. * channels need the offset (default 0) and scale (default 1) to be applied
* as (raw + offset) * scale.
*/ */
int iio_read_avail_channel_raw(struct iio_channel *chan, int iio_read_avail_channel_raw(struct iio_channel *chan,
const int **vals, int *length); const int **vals, int *length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment