History log of /linux-master/include/linux/iio/consumer.h
Revision Date Author Comments
# 75604180 23-Jun-2023 Herve Codina <herve.codina@bootlin.com>

iio: inkern: Add a helper to query an available minimum raw value

A helper, iio_read_max_channel_raw() exists to read the available
maximum raw value of a channel but nothing similar exists to read the
available minimum raw value.

This new helper, iio_read_min_channel_raw(), fills the hole and can be
used for reading the available minimum raw value of a channel.
It is fully based on the existing iio_read_max_channel_raw().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20230623085830.749991-11-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1e1b4fbd 23-Jun-2023 Herve Codina <herve.codina@bootlin.com>

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: Herve Codina <herve.codina@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20230623085830.749991-5-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b22bc4d6 15-Jul-2022 Nuno Sá <nuno.sa@analog.com>

iio: inkern: remove OF dependencies

Since all users of the OF dependendent API are now converted to use the
firmware agnostic alternative, we can drop OF dependencies from the IIO
in kernel interface.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-15-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 1e64b9c5 15-Jul-2022 Nuno Sá <nuno.sa@analog.com>

iio: inkern: move to fwnode properties

This moves the IIO in kernel interface to use fwnode properties and thus
be firmware agnostic.

Note that the interface is still not firmware agnostic. At this point we
have both OF and fwnode interfaces so that we don't break any user. On
top of this we also want to have a per driver conversion and that is the
main reason we have both of_xlate() and fwnode_xlate() support.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-6-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 635ef601 08-Mar-2021 Linus Walleij <linus.walleij@linaro.org>

iio: Provide iio_read_channel_processed_scale() API

Since the old iio_read_channel_processed() would
lose precision if we fall back to reading raw and
scaling, we introduce a new API that will pass in
a scale factor when reading a processed channel:
iio_read_channel_processed_scale().

Refactor iio_read_channel_processed() as a special
case with scale factor 1.

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Link: https://lore.kernel.org/linux-iio/20201224011607.1059534-1-linus.walleij@linaro.org/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210308100219.2732156-1-linus.walleij@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 6e39b145 03-Dec-2020 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

iio: provide of_iio_channel_get_by_name() and devm_ version it

There might be cases when the IIO channel is attached to the device
subnode instead of being attached to the main device node. Allow drivers
to query IIO channels by using device tree nodes.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20201204025509.1075506-8-dmitry.baryshkov@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fc1f75a0 27-Feb-2020 Alexandru Ardelean <alexandru.ardelean@analog.com>

iio: inkern: drop devm_iio_channel_release{_all} API calls

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9f421096 23-Mar-2019 Artur Rojek <contact@artur-rojek.eu>

iio: inkern: API for reading available iio channel attribute values

Extend the inkern API with a function for reading available
attribute values of iio channels.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 16cbca06 10-Jan-2018 Arnaud Pouliquen <arnaud.pouliquen@st.com>

IIO: consumer: allow to set buffer sizes

Add iio consumer API to set buffer size and watermark according
to sysfs API.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 34739a21 10-Jan-2018 Arnaud Pouliquen <arnaud.pouliquen@st.com>

IIO: inkern: API for manipulating channel attributes

Extend the inkern API with functions for reading and writing
attribute of iio channels.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8a848e75 14-May-2017 Peter Rosin <peda@axentia.se>

iio: inkern: api for manipulating ext_info of iio channels

Extend the inkern api with functions for reading and writing ext_info
of iio channels.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 00c5f80c 07-Nov-2016 Peter Rosin <peda@axentia.se>

iio: inkern: add helpers to query available values from channels

Specifically a helper for reading the available maximum raw value of a
channel and a helper for forwarding read_avail requests for raw values
from one iio driver to an iio channel that is consumed.

These rather specific helpers are in turn built with generic helpers
making it easy to build more helpers for available values as needed.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 0023e67d 24-Sep-2016 Matt Ranostay <mranostay@gmail.com>

iio: inkern: add iio_read_channel_offset helper

Allow access to underlying channel IIO_CHAN_INFO_OFFSET from a consumer.

Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# adca058b 19-Aug-2016 Matt Ranostay <mranostay@gmail.com>

iio: buffer-callback: allow getting underlying iio_dev

Add iio_channel_cb_get_iio_dev function to allow getting the
underlying iio_dev. This is useful for setting the trigger of the
consumer ADC device.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# efc2c013 06-Apr-2016 Laxman Dewangan <ldewangan@nvidia.com>

iio: core: Add devm_ APIs for iio_channel_{get,release}_all

Some of kernel driver uses the IIO framework to get the sensor
value via ADC or IIO HW driver. The client driver get iio channel
by iio_channel_get_all() and release it by calling
iio_channel_release_all().

Add resource managed version (devm_*) of these APIs so that if client
calls the devm_iio_channel_get_all() then it need not to release it
explicitly, it can be done by managed device framework when driver
get un-binded.

This reduces the code in error path and also need of .remove callback in
some cases.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 8bf872d8 06-Apr-2016 Laxman Dewangan <ldewangan@nvidia.com>

iio: core: Add devm_ APIs for iio_channel_{get,release}

Some of kernel driver uses the IIO framework to get the sensor
value via ADC or IIO HW driver. The client driver get iio channel
by iio_channel_get() and release it by calling iio_channel_release().

Add resource managed version (devm_*) of these APIs so that if client
calls the devm_iio_channel_get() then it need not to release it explicitly,
it can be done by managed device framework when driver get un-binded.

This reduces the code in error path and also need of .remove callback in
some cases.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# e52e9519 24-Jul-2015 Cristina Opriceana <cristina.opriceana@gmail.com>

include: linux: iio: Fix function parameter name in kernel doc

Fix buffer name from kernel doc according to the function parameter.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 09546a30 23-Sep-2014 Ivan T. Ivanov <iivanov@mm-sol.com>

iio: consumer.h: Fix scale factor in function comment

1 milivolt is equal to 1000000 nanovolts.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# f9380e71 26-Nov-2014 Dmitry Baryshkov <dbaryshkov@gmail.com>

iio: inkern: add iio_write_channel_raw

Introduce API for easy in-kernel setting of DAC values.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 476d4af2 03-Oct-2014 Sebastian Reichel <sre@kernel.org>

iio: inkern: add iio_read_channel_average_raw

Add iio_read_channel_average_raw to support reading
averaged raw values in consumer drivers.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 5d65d920 15-Sep-2013 Lars-Peter Clausen <lars@metafoo.de>

iio: iio_push_to_buffers(): Change type of 'data' to const void *

Change the type of the 'data' parameter for iio_push_to_buffers() from 'u8 *' to
'const void *'. Drivers typically use the correct type (e.g. __be16 *) for their
data buffer. When passing the buffer to iio_push_to_buffers() it needs to be
cast to 'u8 *' for the compiler to not complain (and also having to add __force
if we want to keep sparse happy as well). Since the buffer implementation should
not care about the data layout (except the size of one sample) using a void
pointer is the correct thing to do. Also make it const as the buffer
implementations are not supposed to modify it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 5aa57f0a 04-Feb-2013 Guenter Roeck <linux@roeck-us.net>

iio: Update iio_channel_get API to use consumer device pointer as argument

For iio_channel_get to work with OF based configurations, it needs the
consumer device pointer instead of the consumer device name as argument.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Anton Vorontsov <anton@enomsg.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# ca7d98db 31-Jan-2013 Guenter Roeck <linux@roeck-us.net>

iio: Update iio_channel_get_all and iio_channel_get_all_cb API

Pass device pointer instead of device name as parameter to iio_channel_get_all
and iio_channel_get_all_cb. This will enable us to use OF information to
retrieve consumer channel information.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 9f488ba8 13-Nov-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

IIO: fix build error in lp8788-charger.c

Turns out that consumer.h needs to include types.h on some platforms to
build properly (like powerpc).

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 92d1079b 30-Jun-2012 Jonathan Cameron <jic23@kernel.org>

staging:iio: add a callback buffer for in kernel push interface

This callback buffer is meant to be opaque to users, but basically
adds a very simple pass through buffer to which data may be
pushed when it is inserted into the buffer list.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 0464415d 30-Jun-2012 Jonathan Cameron <jic23@kernel.org>

staging:iio:in kernel users: Add a data field for channel specific info.

Used to allow information about a given channel mapping to be passed
through from board files to the consumer drivers.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 48e44ce0 17-Sep-2012 Lars-Peter Clausen <lars@metafoo.de>

iio:inkern: Add function to read the processed value

Add a function to read a processed value from a channel. The function will first
attempt to read the IIO_CHAN_INFO_PROCESSED attribute. If that fails it will
read the IIO_CHAN_INFO_RAW attribute and convert the result from a raw value to
a processed value.

The patch also introduces a function to convert raw value to a processed value
and exports it, in case a user needs or wants to do the conversion by itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 45f010ba 17-Sep-2012 Lars-Peter Clausen <lars@metafoo.de>

iio: consumer.h: Fix kernel doc incosistency

For the iio_read_channel_raw and iio_read_channel_scale the kerneldoc comment
refers to an argument called "channel", while the argument is called "chan" in
the function signature. This leads to the following warnings from kerneldoc:

Warning(include/linux/iio/consumer.h:71): No description found for parameter 'chan'
Warning(include/linux/iio/consumer.h:71): Excess function parameter 'channel' description in 'iio_read_channel_raw'
Warning(include/linux/iio/consumer.h:109): No description found for parameter 'chan'
Warning(include/linux/iio/consumer.h:109): Excess function parameter 'channel' description in 'iio_read_channel_scale'

This patch fixes the warnings by naming them consistently.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 88238fef 17-Aug-2012 Lars-Peter Clausen <lars@metafoo.de>

iio:consumer.h: Fix include guard

The symbol name for the #ifndef and the #define of the include guard do not
match and thus it becomes quite ineffective. Add the missing '_' to fix this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 314be14b 01-May-2012 Jonathan Cameron <jic23@kernel.org>

iio: Rename _st_ functions to loose the bit that meant the staging version.

These were originally introduced when the plan was to have parallel
IIO cores in and out of staging with a slow move between them.
Now we have reached the point where the whole core has moved,
they need clearing up!

Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 06458e27 25-Apr-2012 Jonathan Cameron <jic23@kernel.org>

IIO: Move core headers to include/linux/iio

Step 1 in moving the IIO core out of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>