summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
* iio: proximity: stk3310: Export near level property for proximity sensorArnaud Ferraris2022-04-281-0/+25
| | | | | | | | | | This makes the value from which an object should be considered "near" available to userspace. This hardware-dependent value should be set in the device-tree. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com> Link: https://lore.kernel.org/r/20220420112540.91907-3-arnaud.ferraris@collabora.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: proximity: vl53l0x: Fix return value check of wait_for_completion_timeoutMiaoqian Lin2022-04-281-4/+3
| | | | | | | | | | | | wait_for_completion_timeout() returns unsigned long not int. It returns 0 if timed out, and positive if completed. The check for <= 0 is ambiguous and should be == 0 here indicating timeout which is the only error case. Fixes: 3cef2e31b54b ("iio: proximity: vl53l0x: Add IRQ support") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Link: https://lore.kernel.org/r/20220412064210.10734-1-linmq006@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: stmpe-adc: Fix wait_for_completion_timeout return value checkMiaoqian Lin2022-04-281-4/+4
| | | | | | | | | | | | | wait_for_completion_timeout() returns unsigned long not long. it returns 0 if timed out, and positive if completed. The check for <= 0 is ambiguous and should be == 0 here indicating timeout which is the only error case Fixes: e813dde6f833 ("iio: stmpe-adc: Use wait_for_completion_timeout") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com> Link: https://lore.kernel.org/r/20220412065150.14486-1-linmq006@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: mma8452: Add missing documentation for name element of chip_infoJonathan Cameron2022-04-281-0/+1
| | | | | | | | | | | | Documentation needed to avoid build warning with W=1 builds. It doesn't really add any non obvious information but good to have it anyway. No fixes tag as not worth backporting onto the fix that added the name element to the structure. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220410153317.290896-1-jic23@kernel.org
* iio: adc: Kconfig: Make RZG2L_ADC depend on ARCH_RZG2LLad Prabhakar2022-04-281-1/+1
| | | | | | | | | | | | ADC block is common on Renesas RZ/G2L and RZ/V2L SoC's, so instead of adding dependency for each SoC's add dependency on ARCH_RZG2L. The ARCH_RZG2L config option is already selected by ARCH_R9A07G044 and ARCH_R9A07G054. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20220406070315.13862-1-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: gyro: fxas21002c: Make use of device propertiesAndy Shevchenko2022-04-281-5/+3
| | | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Link: https://lore.kernel.org/r/20220413131513.59258-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: gyro: mpu3050: Make use of device propertiesAndy Shevchenko2022-04-281-5/+5
| | | | | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. While at it, reuse temporary device pointer in the same function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220413163004.84789-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Convert to use firmware node handle instead of OF nodeAndy Shevchenko2022-04-281-7/+9
| | | | | | | | | | | Switch the IIO core to use firmware node handle instead of OF node. This will allow to get label from firmware on non-OF systems. Note, this doesn't change of_iio_*() APIs for now. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413180202.19220-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: light: tsl2772: Make use of device propertiesAndy Shevchenko2022-04-281-15/+10
| | | | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. While at it, reuse temporary device pointer in the same function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413181402.19582-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: proximity: ping: Replace OF specific code by device_get_match_data()Andy Shevchenko2022-04-281-3/+2
| | | | | | | | Instead of calling the OF specific API, use device_get_match_data(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413183421.20427-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: magnetometer: ak8974: Drop dependency on OFAndy Shevchenko2022-04-281-1/+0
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413184502.20998-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: light: cm3605: Drop dependency on OFAndy Shevchenko2022-04-281-1/+0
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413184627.21125-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: temperature: max31856: Make use of device propertiesAndy Shevchenko2022-04-281-3/+3
| | | | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Add missing mod_devicetable.h include. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413185044.21588-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: dmard06: Drop dependency on OFAndy Shevchenko2022-04-281-1/+0
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413190327.30054-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: afe: rescale: Make use of device propertiesAndy Shevchenko2022-04-282-4/+2
| | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413190117.29814-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: dac: dpot: Drop dependency on OFAndy Shevchenko2022-04-281-1/+0
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413190632.30365-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: dac: lpc18xx: Drop dependency on OFAndy Shevchenko2022-04-281-1/+1
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413190819.38206-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: dac: vf610: Drop dependency on OFAndy Shevchenko2022-04-281-1/+0
| | | | | | | | | Nothing in this driver depends on OF firmware so drop the dependency to remove the false impression such a dependency exists. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220413191611.46204-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: imu: bmi160: Make use of device propertiesAndy Shevchenko2022-04-283-35/+23
| | | | | | | | | | | Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. While at it, reuse temporary device pointer in the same function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220414131804.25227-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: adxl355: use fwnode_irq_get_byname()Puranjay Mohan2022-04-281-5/+2
| | | | | | | | | Use the generic fwnode_irq_get_byname() in place of of_irq_get_byname() to get the IRQ number from the interrupt pin. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Link: https://lore.kernel.org/r/20211109200840.135019-3-puranjay12@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: imu: st_lsm6dsx: add support to ASM330LHHXLorenzo Bianconi2022-04-286-5/+22
| | | | | | | | | | | | Add support to STM ASM330LHHX (acc + gyro) automotive Mems sensor. The ASM330LHHX sensor can use LSM6DSR as fallback device since it implements all the ASM330LHHX features currently implemented in st_lsm6dsx. Datasheet: https://www.st.com/resource/en/datasheet/asm330lhhx.pdf Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://lore.kernel.org/r/04e2644772a6761a25c36bb9679979567fdebda3.1649100168.git.lorenzo@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ad7266: convert probe to full device-managedMaíra Canal2022-04-281-30/+14
| | | | | | | | | | | | Convert probe functions to device-managed variants, with exception of the regulator, which required a devm_add_action_or_reset() hook registration. Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Maíra Canal <maira.canal@usp.br> Link: https://lore.kernel.org/r/20220407115621.10781-1-maira.canal@usp.br Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: Replace strtobool() with kstrtobool()Lars-Peter Clausen2022-04-2824-28/+28
| | | | | | | | | | | strtobool() is deprecated and just a wrapper around kstrtobool().Replace it with kstrtobool() so the deprecated function can be removed eventually. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220409105812.2113895-1-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Simplify the registration of kfifo buffersMiquel Raynal2022-04-1016-27/+3
| | | | | | | | | | | | | | | | | | | | Among all the users of the kfifo buffers, no one uses the INDIO_BUFFER_HARDWARE mode. So let's take this as a general rule and simplify a little bit the internals - overall the documentation - by eliminating unused specific cases. Use the INDIO_BUFFER_SOFTWARE mode by default with kfifo buffers, which will basically mimic what all the "non direct" modes do. Cc: Benson Leung <bleung@chromium.org> Cc: Guenter Roeck <groeck@chromium.org> Cc: Jyoti Bhayana <jbhayana@google.com> Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-13-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Move the currentmode entry to the opaque structureMiquel Raynal2022-04-103-10/+14
| | | | | | | | | | | | | | This entry should, under no situation, be modified by device drivers. Now that we have limited its read access to device drivers really needing it and did so through a dedicated helper, we can easily move this variable to the opaque structure in order to prevent any further modification from non-authorized code (out of the core, basically). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20220207143840.707510-12-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Hide read accesses to iio_dev->currentmodeMiquel Raynal2022-04-103-4/+15
| | | | | | | | | | | | | | | | | In order to later move this variable within the opaque structure, let's create a helper for accessing it in read-only mode. This helper will be exposed to device drivers and kept accessible for the few that could need it. The write access to this variable however should be fully reserved to the core so in a second step we will hide this variable into the opaque structure. Cc: Eugen Hristev <eugen.hristev@microchip.com> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-11-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: Un-inline iio_buffer_enabled()Miquel Raynal2022-04-101-0/+12
| | | | | | | | | | | | | | | | | | As we are going to hide the currentmode inside the opaque structure, this helper would soon need to call a non-inline function which would simply drop the benefit of having the helper defined inline in a header. One alternative is to move this helper in the core as there is no more interest in defining it inline in a header. We will pay the minor cost either way. Let's do like the iio_device_id() helper which also refers to the opaque structure and gets defined in the core. Suggested-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-10-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: st_sensors: Use iio_device_claim/release_direct_mode() when relevantMiquel Raynal2022-04-101-21/+17
| | | | | | | | | | | | | | The st_sensors_core driver hardcodes the content of the iio_device_claim_direct_mode() and iio_device_release_direct_mode() helpers. Let's get rid of this handcrafted implementation and use the proper core helpers instead. Additionally, this lowers the tab level (which is always good) and prevents the use of the ->currentmode variable which is not supposed to be used like this anyway. Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-9-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: st_sensors: Stop abusing mlock to ensure internal coherencyMiquel Raynal2022-04-104-24/+8
| | | | | | | | | | | | | An odr_lock has been introduced to protect local accesses to the odr internal cache and ensure the cached value always reflected the actual value. Using the mlock() for this purpose is no longer needed, so let's drop these extra mutex_lock/unlock() calls. Suggested-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-8-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: st_sensors: Add a local lock for protecting odrMiquel Raynal2022-04-101-6/+18
| | | | | | | | | | | | | | Right now the (framework) mlock lock is (ab)used for multiple purposes: 1- protecting concurrent accesses over the odr local cache 2- avoid changing samplig frequency whilst buffer is running Let's start by handling situation #1 with a local lock. Suggested-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-7-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: st_sensors: Drop the protection on _avail functionsMiquel Raynal2022-04-101-4/+0
| | | | | | | | | | | | | | | The use of a lock there seems pointless. Besides preventing to read these information from userspace while buffers are enabled (which is not supposed to happen), it only protect read accesses over static const values, which are never supposed to be written anyway. Drop these lock calls. Suggested-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-6-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: st_sensors: Return as early as possible from the _write_raw() callbacksMiquel Raynal2022-04-103-14/+5
| | | | | | | | | | | | | As there is no cleanup to do, let's return as early as possible in the various ST sensor drivers _write_raw() callback functions. There is no functional change. Suggested-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-5-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: stm32-dfsdm: Avoid dereferencing ->currentmodeMiquel Raynal2022-04-101-3/+2
| | | | | | | | | | | | | | This is an internal variable of the core, let's use the iio_buffer_enabled() helper which is exported for the following purpose: telling if the current mode is a buffered mode, which is precisely what this driver looks for. Cc: Olivier Moysan <olivier.moysan@foss.st.com> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Link: https://lore.kernel.org/r/20220207143840.707510-4-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: magnetometer: rm3100: Stop abusing the ->currentmodeMiquel Raynal2022-04-101-12/+3
| | | | | | | | | | | | | | This is an internal variable for the core, here it is set to a "default" value by the driver in order to later be able to perform checks against it. None of this is needed because this check actually cares about the buffers being enabled or not. So it is an unproper side-channel access to the information "are the buffers enabled?", returned officially by the iio_buffer_enabled() helper. Use this helper instead. Cc: Song Qiang <songqiang1304521@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-3-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Switch to read_availMarek Vasut2022-04-041-45/+67
| | | | | | | | | | | | Replace sysfs attributes with read_avail() callback. This also permits removal of ads1115_info, since the scale attribute tables are now part of chip data. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20220328194725.149150-10-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Replace data_rate with chip data struct ads1015_dataMarek Vasut2022-04-041-8/+10
| | | | | | | | | | | | | Instead of storing only data_rate in private data, store pointer to the whole chip data and use the data_rate from chip data throughout the driver. No functional change. This is done in preparation for switching to read_avail(). Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-9-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Convert to OF match dataMarek Vasut2022-04-041-55/+55
| | | | | | | | | | | | | | | Replace chip type enumeration in match data with pointer to static constant structure which contains all the different chip properties in one place, and then replace handling of chip type in probe() with simple copy of fields in the new match data structure into struct iio_dev. This reduces code and increases static data. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-8-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Add static assert to test if shifted realbits fit into ↵Marek Vasut2022-04-041-2/+24
| | | | | | | | | | | | | | storagebits Add compile-time static_assert wrapper to verify that shifted realbits fit into storagebits. The macro is implemented in a more generic way so it can be used to verify other values if required. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-7-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Add TLA2024 supportMarek Vasut2022-04-041-2/+51
| | | | | | | | | | | | | Add support for TI TLA2024 ADC. This chip is compatible with ADS1015 except it has no comparator in it, hence the comparator configuration bits are missing in Configuration Register and the Hi_Thresh/Lo_Thresh registers are missing as well and so is event support. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-6-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Make channel event_spec optionalMarek Vasut2022-04-041-22/+38
| | | | | | | | | | | | Pass event_spec and num_event_specs to ADS1015_V_CHAN and ADS1015_V_DIFF_CHAN macros, to make it possible to pass no event_spec at all for chips which have no comparator and thus no events. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-5-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Deduplicate channel macrosMarek Vasut2022-04-041-64/+22
| | | | | | | | | | | | These macros differ only in the number of valid bits of each ADC sample and the shift of those bits, i.e. ADS1015 is 12bit ADC shifted by 4 left, ADS1115 is 16bit ADC shifted by 0. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-4-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ti-ads1015: Switch to static const writeable ranges tableMarek Vasut2022-04-041-12/+9
| | | | | | | | | | | | Switch the driver from code implementing test whether a regmap register is writeable to static const tables describing the test. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Andy Shevchenko <andy@kernel.org> Cc: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220328194725.149150-3-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Print error and fail iio_device_register() in case sample bits do ↵Marek Vasut2022-04-041-0/+13
| | | | | | | | | | | | | | | not fit storage bits Add runtime check to verify whether storagebits are at least as big as shifted realbits. This should help spot broken drivers which may set realbits + shift above storagebits. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20220328195307.154422-1-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: kxsd9-spi: changed leading spaces to tabsPaul Lemmermann2022-04-041-2/+2
| | | | | | | | | | Changed the leading spaces to tabs, in accordance with kernel coding conventions, and removed trailing comma. Found with checkpatch. Signed-off-by: Paul Lemmermann <thepaulodoom@thepaulodoom.com> Link: https://lore.kernel.org/r/YkInN6SL7pP2f5Sf@hp-amd-paul Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: dmard09: fixed code styling issuesPaul Lemmermann2022-04-041-1/+1
| | | | | | | | Cleaning up code. Found with checkpatch. Signed-off-by: Paul Lemmermann <thepaulodoom@thepaulodoom.com> Link: https://lore.kernel.org/r/YkItIE5sp3P4sZdY@hp-amd-paul Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: sysfs-trigger: replace usage of found with dedicated list iterator variableJakob Koschel2022-04-041-6/+5
| | | | | | | | | | | | | | | | | | | To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220331230632.957634-3-jakobkoschel@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: ssp_sensors: replace usage of found with dedicated list iterator variableJakob Koschel2022-04-041-7/+6
| | | | | | | | | | | | | | | | | | | To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220331230632.957634-2-jakobkoschel@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: buffer: remove usage of list iterator variable for ↵Jakob Koschel2022-04-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | list_for_each_entry_continue_reverse() In preparation to limit the scope of the list iterator variable to the list traversal loop, use a dedicated pointer to iterate through the list [1]. Since that variable should not be used past the loop iteration, a separate variable is used to 'remember the current location within the loop'. To either continue iterating from that position or start a new iteration (if the previous iteration was complete) list_prepare_entry() is used. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20220331230632.957634-1-jakobkoschel@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: palmas: shut up warning about calibration mismatch (due to noise)H. Nikolaus Schaller2022-04-041-1/+2
| | | | | | | | | | | | | Although technically checking for ADC values below 0 is correct, because they are outside of the calibration values, there is usually noise which spuriously fills the console log with error messages if calculated input voltage gets close to 0V. Ignore small negative calculated values, but clamp them to 0. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Link: https://lore.kernel.org/r/1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ad7192: add sequencer supportAlexandru Tachici2022-04-041-1/+41
| | | | | | | | Add sequencer support for AD7192. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Link: https://lore.kernel.org/r/20220322105029.86389-7-alexandru.tachici@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>