aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/adc
AgeCommit message (Collapse)AuthorFilesLines
2024-04-20iio: buffer-dma: add iio_dmaengine_buffer_setup()Nuno Sa1-15/+1
This brings the DMA buffer API more in line with what we have in the triggered buffer. There's no need of having both devm_iio_dmaengine_buffer_setup() and devm_iio_dmaengine_buffer_alloc(). Hence we introduce the new iio_dmaengine_buffer_setup() that together with devm_iio_dmaengine_buffer_setup() should be all we need. Note that as part of this change iio_dmaengine_buffer_alloc() is again static and the axi-adc was updated accordingly. Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-13iio: adc: ad7944: Consolidate spi_sync() wrapperDavid Lechner1-54/+13
Since commit 6020ca4de8e5 ("iio: adc: ad7944: use spi_optimize_message()"), The helper functions wrapping spi_sync() for 3-wire and 4-wire modes are virtually identical. Since gpiod_set_value_cansleep() does a NULL check internally, we can consolidate the two functions into one and avoid switch statements at the call sites. The default cases of the removed switch statement were just to make the compiler happy and are not reachable since the mode is validated in the probe function. So removing those should be safe. Signed-off-by: David Lechner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-13iio: adc: qcom-spmi-adc5: Use device_for_each_child_node_scoped()Jonathan Cameron1-5/+2
Switching to the _scoped() version removes the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case that's all in error paths. A slightly less convincing usecase than many as all the failure paths are wrapped up in a call to a per fwnode_handle utility function. The complexity in that function is sufficient that it makes sense to factor it out even if it this new auto cleanup would enable simpler returns if the code was inline at the call site. Hence I've left it alone. Cc: Marijn Suijten <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-13iio: adc: stm32: Use device_for_each_child_node_scoped()Jonathan Cameron1-38/+24
Switching to the _scoped() version removes the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case that's all in error paths. Note this would have made the bug fixed in the previous path much less likely as it allows for direct returns. Took advantage of dev_err_probe() to futher simplify things given no longer a need for the goto err. Cc: Olivier Moysan <[email protected]> Tested-by: Fabrice Gasnier <[email protected]> Acked-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-13iio: adc: stm32: Fixing err code to not indicate successJonathan Cameron1-0/+1
This path would result in returning 0 / success on an error path. Cc: Olivier Moysan <[email protected]> Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding") Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: ad7173: Fix ! vs ~ typo in ad7173_sel_clk()Dan Carpenter1-1/+1
This was obviously supposed to be a bitwise negate instead of logical. Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: pac1934: Use device_for_each_available_child_node_scoped() to ↵Jonathan Cameron1-46/+31
simplify error handling. Also change both firmware parsing functions to return meaningful errors. Whilst for the ACPI case this isn't that useful, for the generic fwnode case we can return the errors coming from the property parsing instead of just whether we succeeded or not. Cc: Marius Cristea <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: ad7173: Use device_for_each_child_node_scoped() to simplify error ↵Jonathan Cameron1-17/+7
paths. This loop definition automatically releases the fwnode_handle on early exit such as the error cases seen here. This reducing boilerplate and the chance of a resource leak being introduced in future. Cc: Dumitru Ceclan <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: ad4130: Use device_for_each_child_node_scoped() to simplify error ↵Jonathan Cameron1-5/+2
paths. This loop definition removes the need for manual releasing of the fwnode_handle in early exit paths (here an error path) allow simplfication of the code and reducing the chance of future modificiations not releasing fwnode_handle correctly. Cc: Cosmin Tanislav <[email protected]> Cc: Nuno Sa <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: ab8500-gpadc: Use device_for_each_child_node_scoped() to simplify ↵Jonathan Cameron1-3/+1
erorr paths. This new loop definition automatically releases the handle on early exit reducing the chance of bugs that cause resource leaks. Cc: Linus Walleij <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-04-06iio: adc: ab8500-gpadc: Fix kernel-doc parameter names.Jonathan Cameron1-2/+2
Seems these got renamed at somepoint but the documentation wasn't updated to match. Cc: Linus Walleij <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-30iio: adc: ad7944: use spi_optimize_message()David Lechner1-74/+103
This modifies the ad7944 driver to use spi_optimize_message() to reduce CPU usage and increase the max sample rate by avoiding repeating validation of the spi message on each transfer. Signed-off-by: David Lechner <[email protected]> Link: https://lore.kernel.org/r/20240328-ad7944-spi-optimize-message-v2-1-a142b2576379@baylibre.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-28iio: adc: ad7944: simplify adi,spi-mode property parsingDavid Lechner1-11/+10
This simplifies the adi,spi-mode property parsing by using device_property_match_property_string() instead of two separate functions. Also, the error return value is now more informative in cases where there was a problem parsing the property. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: David Lechner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7944: Add support for "3-wire mode"David Lechner1-18/+139
This adds support for AD7944 ADCs wired in "3-wire mode". (NOTE: 3-wire is the datasheet name for this wiring configuration and has nothing to do with SPI_3WIRE.) In the 3-wire mode, the SPI controller CS line can be wired to the CNV line on the ADC and used to trigger conversions rather that using a separate GPIO line. The turbo/chain mode compatibility check at the end of the probe function is technically can't be triggered right now but adding it now anyway so that we don't forget to add it later when support for daisy-chaining is added. Reviewed-by: Nuno Sa <[email protected]> Signed-off-by: David Lechner <[email protected]> Link: https://lore.kernel.org/r/20240314-mainline-ad7944-3-wire-mode-v2-1-d469da0705d2@baylibre.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7944: add driver for AD7944/AD7985/AD7986David Lechner3-0/+427
This adds a driver for the Analog Devices Inc. AD7944, AD7985, and AD7986 ADCs. These are a family of pin-compatible ADCs that can sample at rates up to 2.5 MSPS. The initial driver adds support for sampling at lower rates using the usual IIO triggered buffer and can handle all 3 possible reference voltage configurations. Signed-off-by: David Lechner <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: twl4030-madc: Make use of device propertiesAndy Shevchenko1-10/+9
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7173: add support for additional modelsDumitru Ceclan1-6/+80
Add support for Analog Devices AD7172-2, AD7175-8, AD7177-2. Signed-off-by: Dumitru Ceclan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7173: improve chip id's definesDumitru Ceclan1-3/+3
Rename to AD7172_2_ID to avoid confusion with _4 model. Reorder id's by reg value. Signed-off-by: Dumitru Ceclan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7173: add AD7173 driverDumitru Ceclan3-0/+1134
The AD7173 family offer a complete integrated Sigma-Delta ADC solution which can be used in high precision, low noise single channel applications or higher speed multiplexed applications. The Sigma-Delta ADC is intended primarily for measurement of signals close to DC but also delivers outstanding performance with input bandwidths out to ~10kHz. Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Michael Walle <[email protected]> # for gpio-regmap Signed-off-by: Dumitru Ceclan <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad_sigma_delta: Add optional irq selectionDumitru Ceclan1-9/+14
Add optional irq_num attribute to ad_sigma_delta_info structure for selecting the used interrupt line for ADC's conversion completion. Signed-off-by: Dumitru Ceclan <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: spear_adc: Make use of device propertiesAndy Shevchenko1-15/+10
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: rcar-gyroadc: use for_each_available_child_node_scoped()Jonathan Cameron1-15/+6
Using automated cleanup to replace of_node_put() handling allows for a simplfied flow by enabling direct returns on errors. Non available child nodes should never have been considered; that is ones where status != okay and was defined. Reviewed-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: rzg2l_adc: Use device_for_each_child_node_scoped()Jonathan Cameron1-8/+3
Switching to the _scoped() version removes the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case that's all in error paths. Cc: Lad Prabhakar <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: hx711: Switch from of specific to fwnode property handling.Jonathan Cameron1-3/+2
Allows driver to be used with other firmware types and removes an example that might be copied into new IIO drivers. Cc: Andreas Klinger <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7192: Convert from of specific to fwnode property handlingJonathan Cameron1-19/+19
Enables use of with other firmwware types. Removes a case of device tree specific handlers that might get copied into new drivers. Cc: Alisa-Dariana Roman <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7292: Switch from of specific to fwnode property handlingJonathan Cameron1-7/+6
This reduces the wrong of device tree only IIO drivers that might be copied by converting over this simple case. Makes use of the new _scoped() handling to automatically release the fwnode_handle on early exit from the loop. Cc: Nuno Sá <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: ad7124: Switch from of specific to fwnode based property handlingJonathan Cameron1-32/+23
Using the generic firmware data access functions from property.h provides a number of advantages: 1) Works with different firmware types. 2) Doesn't provide a 'bad' example for new IIO drivers. 3) Lets us use the new _scoped() loops with automatic reference count cleanup for fwnode_handle Cc: Lars-Peter Clausen <[email protected]> Cc: Michael Hennerich <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: fsl-imx25-gcq: Use devm_* and dev_err_probe() to simplify probeJonathan Cameron1-51/+35
Custom callbacks are need for regulators (so there is a handle to read the voltage from) and the clk because it is retrieved from the parent rather than directly from firmware description. Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: fsl-imx25-gcq: Switch from of specific handing to fwnode based.Jonathan Cameron1-33/+21
Using the generic firmware data access functions from property.h provides a number of advantages: 1) Works with different firmware types. 2) Doesn't provide a 'bad' example for new IIO drivers. 3) Lets us use the new _scoped() loops with automatic reference count cleanup for fwnode_handle Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-25iio: adc: max11410: Use device_for_each_child_node_scoped()Jonathan Cameron1-20/+7
Switching to the _scoped() version removes the need for manual calling of fwnode_handle_put() in the paths where the code exits the loop early. In this case that's all in error paths. Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-03-21Merge tag 'char-misc-6.9-rc1' of ↵Linus Torvalds17-627/+3124
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc and other driver subsystem updates from Greg KH: "Here is the big set of char/misc and a number of other driver subsystem updates for 6.9-rc1. Included in here are: - IIO driver updates, loads of new ones and evolution of existing ones - coresight driver updates - const cleanups for many driver subsystems - speakup driver additions - platform remove callback void cleanups - mei driver updates - mhi driver updates - cdx driver updates for MSI interrupt handling - nvmem driver updates - other smaller driver updates and cleanups, full details in the shortlog All of these have been in linux-next for a long time with no reported issue, other than a build warning for the speakup driver" The build warning hits clang and is a gcc (and C23) extension, and is fixed up in the merge. Link: https://lore.kernel.org/all/[email protected]/ * tag 'char-misc-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (279 commits) binder: remove redundant variable page_addr uio_dmem_genirq: UIO_MEM_DMA_COHERENT conversion uio_pruss: UIO_MEM_DMA_COHERENT conversion cnic,bnx2,bnx2x: use UIO_MEM_DMA_COHERENT uio: introduce UIO_MEM_DMA_COHERENT type cdx: add MSI support for CDX bus pps: use cflags-y instead of EXTRA_CFLAGS speakup: Add /dev/synthu device speakup: Fix 8bit characters from direct synth parport: sunbpp: Convert to platform remove callback returning void parport: amiga: Convert to platform remove callback returning void char: xillybus: Convert to platform remove callback returning void vmw_balloon: change maintainership MAINTAINERS: change the maintainer for hpilo driver char: xilinx_hwicap: Fix NULL vs IS_ERR() bug hpet: remove hpets::hp_clocksource platform: goldfish: move the separate 'default' propery for CONFIG_GOLDFISH char: xilinx_hwicap: drop casting to void in dev_set_drvdata greybus: move is_gb_* functions out of greybus.h greybus: Remove usage of the deprecated ida_simple_xx() API ...
2024-03-13Merge tag 'spi-v6.9' of ↵Linus Torvalds1-7/+7
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "This release sees some exciting changes from David Lechner which implements some optimisations that have been talked about for a long time which allows client drivers to pre-prepare SPI messages for repeated or low latency use. This lets us move work out of latency sensitive paths and avoid repeating work for frequently performed operations. As well as being useful in itself this will also be used in future to allow controllers to directly trigger SPI operations (eg, from interrupts). Otherwise this release has mostly been focused on cleanups, plus a couple of new devices: - Support for pre-optimising messages - A big set of updates from Uwe Kleine-König moving drivers to use APIs with more modern terminology for controllers - Major overhaul of the s3c64xx driver - Support for Google GS101 and Samsung Exynos850" * tag 'spi-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (122 commits) spi: Introduce SPI_INVALID_CS and is_valid_cs() spi: Fix types of the last chip select storage variables spi: Consistently use BIT for cs_index_mask spi: Exctract spi_dev_check_cs() helper spi: Exctract spi_set_all_cs_unused() helper spi: s3c64xx: switch exynos850 to new port config data spi: s3c64xx: switch gs101 to new port config data spi: s3c64xx: deprecate fifo_lvl_mask, rx_lvl_offset and port_id spi: s3c64xx: get rid of the OF alias ID dependency spi: s3c64xx: introduce s3c64xx_spi_set_port_id() spi: s3c64xx: let the SPI core determine the bus number spi: s3c64xx: allow FIFO depth to be determined from the compatible spi: s3c64xx: retrieve the FIFO depth from the device tree spi: s3c64xx: determine the fifo depth only once spi: s3c64xx: allow full FIFO masks spi: s3c64xx: define a magic value spi: dt-bindings: introduce FIFO depth properties spi: axi-spi-engine: use struct_size() macro spi: axi-spi-engine: use __counted_by() attribute spi: axi-spi-engine: remove p from struct spi_engine_message_state ...
2024-02-28iio: adc: qcom-pm8xxx-xoadc: drop unused kerneldoc struct pm8xxx_chan_info ↵Krzysztof Kozlowski1-1/+0
member Drop description of non-existing 'struct pm8xxx_chan_info' member: qcom-pm8xxx-xoadc.c:386: warning: Excess struct member 'scale_fn_type' description in 'pm8xxx_chan_info' Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: rockchip_saradc: replace custom logic with ↵Quentin Schulz1-8/+3
devm_reset_control_get_optional_exclusive devm_reset_control_get_optional_exclusive does what this driver is trying to do in its probe function, therefore let's switch over to that subsystem function. Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-3-84b06a0f623a@theobroma-systems.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: rockchip_saradc: use mask for write_enable bitfieldQuentin Schulz1-2/+2
Some of the registers on the SARADCv2 have bits write protected except if another bit is set. This is usually done by having the lowest 16 bits store the data to write and the highest 16 bits specify which of the 16 lowest bits should have their value written to the hardware block. The write_enable mask for the channel selection was incorrect because it was just the value shifted by 16 bits, which means it would only ever write bits and never clear them. So e.g. if someone starts a conversion on channel 5, the lowest 4 bits would be 0x5, then starts a conversion on channel 0, it would still be 5. Instead of shifting the value by 16 as the mask, let's use the OR'ing of the appropriate masks shifted by 16. Note that this is not an issue currently because the only SARADCv2 currently supported has a reset defined in its Device Tree, that reset resets the SARADC controller before starting a conversion on a channel. However, this reset is handled as optional by the probe function and thus proper masking should be used in the event an SARADCv2 without a reset ever makes it upstream. Fixes: 757953f8ec69 ("iio: adc: rockchip_saradc: Add support for RK3588") Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-2-84b06a0f623a@theobroma-systems.com Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: rockchip_saradc: fix bitmask for channels on SARADCv2Quentin Schulz1-1/+1
The SARADCv2 on RK3588 (the only SoC currently supported that has an SARADCv2) selects the channel through the channel_sel bitfield which is the 4 lowest bits, therefore the mask should be GENMASK(3, 0) and not GENMASK(15, 0). Fixes: 757953f8ec69 ("iio: adc: rockchip_saradc: Add support for RK3588") Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-1-84b06a0f623a@theobroma-systems.com Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: adding support for PAC193xMarius Cristea3-0/+1648
This is the iio driver for Microchip PAC193X series of Power Monitor with Accumulator chip family. Signed-off-by: Marius Cristea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: ti-ads1298: prevent divide by zero in ads1298_set_samp_freq()Dan Carpenter1-0/+2
The "val" variable comes from the user so we need to ensure that it's not zero. In fact, all negative values are invalid as well. Add a check for that. Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver") Acked-by: Mike Looijmans <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: ti-ads1298: Fix error code in probe()Dan Carpenter1-1/+1
There is a copy and paste bug here, it should be "reg_vref" instead of "reg_avdd". The "priv->reg_avdd" variable is zero so it ends up returning success. Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Mike Looijmans <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: mcp320x: Simplify device removal logicArturas Moskvinas1-20/+9
Use devm_* APIs to enable/disable regulator and to register in IIO infrastructure. Signed-off-by: Arturas Moskvinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-28iio: adc: ads8688: Switch to mod_devicetable.h for struct of_device_id ↵Jonathan Cameron1-1/+1
definition of.h was only included to get access to this structure, so include the correct header directly instead. Reviewed-by: Nuno Sa <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-25Merge tag 'iio-for-6.9a' of ↵Greg Kroah-Hartman12-594/+1458
http://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: IIO: 1st set of new device support, features and cleanup for 6.9 IIO Backend support =================== New approach from Nuno Sa to the problem of reuse of drivers with IIO devices that are actually the combination of a highspeed chip and an FPGA core handling the data capture and flows. It will hopefully also apply to some other split designs. The ad9467 and axi-adi drivers are converted over to this framework. New device support ================== adi,admfm2000 - New driver for this dual microwave down converter. ams,as73211 - Add support for as7331 UV sensor. richtek,rtq6056 - Add support for related parts RTQ6053 and RTQ6059 st,lsm6dsx - Add ASM330LHHXG1 accelerometer and gyro support (mainly IDs) ti,ads1298 - New driver for this medical ADC. Features ======== tests - Unit tests for the gain-time-scale helper library. bosch,bmi088 - I2C support. bosh,bmi160 - Add 10EC5280 ACPI ID. Used in a number of devices that won't get fixed. The ID is actually a PCI ID belonging to realtech. No response was received to earlier attempts to notify them of this. The manufacturers of some devices have replied to say they will not fix this incorrect ID. Add the ID and hope it isn't a problem. bosch,bmi323 - Add BOSC0200 ACPI ID. Note this is a duplicate of one in the bmc150 driver (it appears these parts share a windows driver). Both drivers perform an ID check that is safe on the other part before successfully probing. hid-sensors-als - Add color temperature and chromaticity support. Note this is a replacement for the series reverted in 6.8 that correctly handles all the potential channel combinations. honeywell,hsc030pa - Triggered buffer support (after driver cleanup). honeywell,mprls00025pa - Improved error handling. - New DT binding to allow use of part number triplet as provided in data sheet to specify equivalent of most of the binding more efficiently. - SPI support. memsic,mxc4005 - ACPI ID MDA6655 as seen in the Chuwi Minibook X 2023 ti,hdc3020 - Add threshold event support (after some driver cleanup) veml,vcnl4000 - Switch to high resolution proximity measurement. Cleanup ======= Various minor typo fixes and better use of defines etc. Treewide - Stop using ACPI_PTR(). The savings in space are small and not worth the complexity of __maybe_unused of ifdef guards. To avoid use in new IIO drivers based on copy and paste, clean it out. - cleanup.h based handling of iio_device_claim_direct_mode()/ iio_device_release_direct_mode() using scope_cond_guard(). In many drivers this is combined with other automated cleanup to give maximum simplifications. An initial set of drivers are converted over to this infrastructure. Tools - Use rewinddir() instead of seekdir() to return to start of file. core - Make iio_bus_type constant. adi,ad16475 - Use irq_get_trigger_type() instead of opencoding. adi,ad16480 - Use irq_get_trigger_type() instead of opencoding. adi,ad-sigma-delta - Avoid overwriting IRQ flags if provided by firmware. ams,as73211 - Use IIO_VAL_FRACTIONAL for scales to simplify the code and potentially improve accuracy. gts-library - Use a div64_u64() instead of a loop to do a division. honeywell,mprls00025pa - Clean up dt-binding doc. - Drop defaults when DT binding not providing values. Very unlikely these were useful given they were wrong for vast majority of supported devices. - Whitespace cleanup miramems,da280 - Use i2c_get_match_data() to replace hand rolled ACPI matching code. semtech,sx9324 - Avoid unnecessary copying of property strings. st,lsm6dsx - Improve docs, particularly wrt to making addition of new device support less noisy. st,lsm9ds0 - Use dev_err_probe() in all probe() error handling. - Improved header includes. - Tidy up termination of ID tables. ti,ads1014 - Correct upper bound on PGA (wrong value had no actual impact) ti,afe4403/4404 - devm_ useage to simplify error handling in probe() and allow() remove to be dropped. voltage-divider - Add dt-binding for io-channel-cells to allow such a device to be both an IIO consumer and IIO producer at the same time. * tag 'iio-for-6.9a' of http://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (106 commits) iio: imu: bmi323: Add ACPI Match Table iio: accel: bmc150: Document duplicate ACPI entries with bmi323 driver iio: adc: ti-ads1298: Add driver dt-bindings: iio: adc: ti-ads1298: Add bindings iio: pressure: hsc030pa add triggered buffer iio: pressure: hsc030pa add mandatory delay iio: pressure: hsc030pa: update datasheet URLs iio: pressure: hsc030pa: include cleanup iio: pressure: hsc030pa: use signed type to hold div_64() result dt-bindings: iio: pressure: honeywell,hsc030pa.yaml add spi props iio: st_sensors: lsm9ds0: Use common style for terminator in ID tables iio: st_sensors: lsm9ds0: Don't use "proxy" headers iio: st_sensors: lsm9ds0: Use dev_err_probe() everywhere iio: adc: adi-axi-adc: move to backend framework iio: adc: ad9467: convert to backend framework iio: add the IIO backend framework iio: buffer-dmaengine: export buffer alloc and free functions of: property: add device link support for io-backends dt-bindings: adc: axi-adc: update bindings for backend framework dt-bindings: adc: ad9467: add new io-backend property ...
2024-02-19iio: adc: ti-ads1298: Add driverMike Looijmans3-0/+781
Skeleton driver for the TI ADS1298 medical ADC. This device is typically used for ECG and similar measurements. Supports data acquisition at configurable scale and sampling frequency. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Mike Looijmans <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-19iio: adc: adi-axi-adc: move to backend frameworkNuno Sa2-290/+96
Move to the IIO backend framework. Devices supported by adi-axi-adc now register themselves as backend devices. Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-19iio: adc: ad9467: convert to backend frameworkNuno Sa2-91/+178
Convert the driver to use the new IIO backend framework. The device functionality is expected to be the same (meaning no added or removed features). Also note this patch effectively breaks ABI and that's needed so we can properly support this device and add needed features making use of the new IIO framework. Given the lack of features (and devices supported) in the ad9467 driver compared with the ADI out of tree version, we don't expect any user of the upstream driver so no one should notice the ABI breakage. However, if someone is affected by this, ADI will happily support transitioning to the backend framework. Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-19iio: buffer-dmaengine: export buffer alloc and free functionsNuno Sa1-0/+1
Export iio_dmaengine_buffer_free() and iio_dmaengine_buffer_alloc(). This is in preparation of introducing IIO backends support. This will allow us to allocate a buffer and control it's lifetime from a device different from the one holding the DMA firmware properties. Effectively, in this case the struct device holding the firmware information about the DMA channels is not the same as iio_dev->dev.parent (typical case). While at it, namespace the buffer-dmaengine exports and update the current user of these buffers. Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-17iio: adc: ad7091r-base: Use auto cleanup of locks.Jonathan Cameron1-17/+8
Done to reduce boilerplate and simplify code flow by allowing early returns with the lock automatically released. Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-17iio: adc: ad4130: Use automatic cleanup of locks and direct mode.Jonathan Cameron1-79/+52
Reduces boilerplate and allows for simpler to follow direct returns. Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-17iio: adc: max1363: Use automatic cleanup for locks and iio mode claiming.Jonathan Cameron1-92/+79
This simplifies error return paths. Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-02-17iio: adc: ad_sigma_delta: allow overwriting the IRQ flagsNuno Sa1-1/+6
Make sure we can specify the IRQ trigger type from firmware and drivers won't ignore it. In fact, this how it should be done but since someone might be already depending on the driver to hardcode the trigger type (and not specifying it in firmware), let's do it like this so there's no possible breakage. Signed-off-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/20240117-dev_sigma_delta_no_irq_flags-v1-2-db39261592cf@analog.com Signed-off-by: Jonathan Cameron <[email protected]>