summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
Commit message (Collapse)AuthorAgeFilesLines
* of: remove internal arguments from of_property_for_each_u32()Luca Ceresoli2024-07-251-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The of_property_for_each_u32() macro needs five parameters, two of which are primarily meant as internal variables for the macro itself (in the for() clause). Yet these two parameters are used by a few drivers, and this can be considered misuse or at least bad practice. Now that the kernel uses C11 to build, these two parameters can be avoided by declaring them internally, thus changing this pattern: struct property *prop; const __be32 *p; u32 val; of_property_for_each_u32(np, "xyz", prop, p, val) { ... } to this: u32 val; of_property_for_each_u32(np, "xyz", val) { ... } However two variables cannot be declared in the for clause even with C11, so declare one struct that contain the two variables we actually need. As the variables inside this struct are not meant to be used by users of this macro, give the struct instance the noticeable name "_it" so it is visible during code reviews, helping to avoid new code to use it directly. Most usages are trivially converted as they do not use those two parameters, as expected. The non-trivial cases are: - drivers/clk/clk.c, of_clk_get_parent_name(): easily doable anyway - drivers/clk/clk-si5351.c, si5351_dt_parse(): this is more complex as the checks had to be replicated in a different way, making code more verbose and somewhat uglier, but I refrained from a full rework to keep as much of the original code untouched having no hardware to test my changes All the changes have been build tested. The few for which I have the hardware have been runtime-tested too. Reviewed-by: Andre Przywara <andre.przywara@arm.com> # drivers/clk/sunxi/clk-simple-gates.c, drivers/clk/sunxi/clk-sun8i-bus-gates.c Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # drivers/gpio/gpio-brcmstb.c Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> # drivers/irqchip/irq-atmel-aic-common.c Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # drivers/iio/adc/ti_am335x_adc.c Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> # drivers/pwm/pwm-samsung.c Acked-by: Richard Leitner <richard.leitner@linux.dev> # drivers/usb/misc/usb251xb.c Acked-by: Mark Brown <broonie@kernel.org> # sound/soc/codecs/arizona.c Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> # sound/soc/codecs/arizona.c Acked-by: Michael Ellerman <mpe@ellerman.id.au> # arch/powerpc/sysdev/xive/spapr.c Acked-by: Stephen Boyd <sboyd@kernel.org> # clk Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Acked-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20240724-of_property_for_each_u32-v3-1-bea82ce429e2@bootlin.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
* Merge tag 'iio-for-6.11b' of ↵Greg Kroah-Hartman2024-07-0435-888/+2310
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: IIO: 2nd set of new device support, features and cleanup for 6.11 The big one here is we finally have Paul Cercueil's (and others) DMA buffer support for IIO devices enabling high speed zero copy transfer of data to and from sensors supported by IIO (and for example USB). This should aid with upstream support of a range of higher performance ADCs and DACs. Two merges from other trees - spi/spi_devm_optimize used for simplification in ad7944. - dmaengine/topic_dma_vec to enable the DMABUF series. One feature with impact outside IIO. - Richer set of dev_err_probe() like helpers to cover ERR_PTR() cases. New device support ================== adi,ad7173 - Add support for AD4111, AD4112, AD4114, AD4115 and ADC4116 pseudo differential ADCs. Major driver rework was needed to enabled these. adi,ad7944 - Use devm_spi_optimize_message() to avoid a local devm cleanup callback. This is the example case from the patch set, others will follow. mediatek,mt6359-auxadc - New driver for this ADC IP found in MT6357, MT6358 and MT6359 PMICs. st,accel - Add support for the LIS2DS12 accelerometer ti,ads1119 - New driver for this 16 bit 2-differential or 4-single ended channel ADC. Features ======== dt-bindings - Introduce new common-mode-channel property to help handle pseudo differential ADCs where we have something that looks like one side of differential input, but which is only suited for use with a slow moving reference. adi,adf4350 - Support use as a clock provider. iio-hmwon - Support reading of labels from IIO devices by their consumers and use this in the hwmon bridge. Cleanup and minor fixes ======================= Treewide - Use regmap_clear_bits() / regmap_set_bits() to simplify open coded equivalents. - Use devm_regulator_get_enable_read_voltage() to replace equivalent opencoded boilerplate. In some cases enabled complete conversion to devm handling and removal of explicit remove() callbacks. - Introduce dev_err_ptr_probe() and other variants and make use of of them in a couple of examples driver cleanups. Will find use in many more drivers soon. adi,ad7192 - Introduce local struct device *dev and use dev_err_probe() to give more readable code. adi,adi-axi-adc/dac - Improved consistency of messages using dev_err_probe() adi,adis - Split the trigger handling into cases that needed paging and those that don't resulting in more readable code. - Use cleanup.h to simplify error paths via scoped cleanup. - Add adis specific lock helpers and make use of them in a number of drivers. adi,ad7192 - Update maintainer (Alisa-Dariana Roman) adi,ad7606 - dt-binding cleanup. avago,apds9306 - Add a maintainer entry (Subhajit Ghosh) linear,ltc2309 - Fix a wrong endian type. st,stm32-dfsdm - Fix a missing port property in the dt-binding. st,sensors - Relax whoami match failure to a warning print rather than probe failure. This enables fallback compatibles to existing parts from those that don't necessarily even exit yet. * tag 'iio-for-6.11b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (112 commits) iio: adc: ad7173: Fix uninitialized symbol is_current_chan iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADC math.h: Add unsigned 8 bits fractional numbers type dt-bindings: iio: adc: Add MediaTek MT6359 PMIC AUXADC iio: common: scmi_iio: convert to dev_err_probe() iio: backend: make use of dev_err_cast_probe() iio: temperature: ltc2983: convert to dev_err_probe() dev_printk: add new dev_err_probe() helpers iio: xilinx-ams: Add labels iio: adc: ad7944: use devm_spi_optimize_message() Documentation: iio: Document high-speed DMABUF based API iio: buffer-dmaengine: Support new DMABUF based userspace API iio: buffer-dma: Enable support for DMABUFs iio: core: Add new DMABUF interface infrastructure MAINTAINERS: Update AD7192 driver maintainer iio: adc: ad7192: use devm_regulator_get_enable_read_voltage iio: st_sensors: relax WhoAmI check in st_sensors_verify_id() MAINTAINERS: Add AVAGO APDS9306 dt-bindings: iio: adc: adi,ad7606: comment and sort the compatible names dt-bindings: iio: adc: adi,ad7606: add missing datasheet link ...
| * iio: adc: ad7173: Fix uninitialized symbol is_current_chanJonathan Cameron2024-07-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | Move the definition down and make it a boolean that is initialized to false. Fixes: 13d12e3ad12d ("iio: adc: ad7173: Add support for AD411x devices") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202406232046.DKfBJq6o-lkp@intel.com/ Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: Add support for MediaTek MT6357/8/9 Auxiliary ADCAngeloGioacchino Del Regno2024-07-013-0/+619
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a driver to support reading the Auxiliary ADC IP found in the MediaTek MT6357, MT6358 and MT6359 Power Management ICs, featuring a different register layout, configuration reset and ADC reading sequence from the other already supported MediaTek SoC or PMIC (aux)ADC HW. This driver provides multiple ADC channels for system monitoring, such as battery voltage, PMIC temperature, PMIC-internal voltage regulators temperature, and others. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://patch.msgid.link/20240604123008.327424-5-angelogioacchino.delregno@collabora.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: xilinx-ams: Add labelsSean Anderson2024-06-301-48/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Label all the channels using names from the reference manual. Some of the "control" channels are duplicates of other channels. The reference manual describes it like: > The AMS register set includes several measurement registers that are > written to by the PS SYSMON unit using the single-channel mode > (sequencer off). These voltage measurements are performed using the > unipolar sampling circuit with a 0 to 3V range and do not have alarms > or minimum/maximum registers. So I think these really are measuring the same voltages but in a different location. In which case, sharing labels makes sense to me. Signed-off-by: Sean Anderson <sean.anderson@linux.dev> Link: https://patch.msgid.link/20240620204842.817237-1-sean.anderson@linux.dev Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7944: use devm_spi_optimize_message()David Lechner2024-06-301-23/+3
| | | | | | | | | | | | | | | | | | Use new devm_spi_optimize_message() helper to simplify repeated code in the ad7944 driver. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240624-devm_spi_optimize_message-v3-2-912138c27b66@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7192: use devm_regulator_get_enable_read_voltageDavid Lechner2024-06-301-67/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes use of the new devm_regulator_get_enable_read_voltage() function to reduce boilerplate code. Error messages have changed slightly since there are now fewer places where we print an error. The rest of the logic of selecting which supply to use as the reference voltage remains the same. Also 1000 is replaced by MILLI in a few places for consistency. Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://patch.msgid.link/20240624124941.113010-2-alisa.roman@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ltc2309: Fix endian type passed to be16_to_cpu()Jonathan Cameron2024-06-281-1/+1
| | | | | | | | | | | | | | | | | | Picked up by sparse. Cc: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Liam Beguin <liambeguin@gmail.com> Link: https://patch.msgid.link/20240624193210.347434-1-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-ads8688: drop ads8688_remove()David Lechner2024-06-251-26/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | By using a few devm_ functions, we can simplify the driver and remove the ads8688_remove() function. spi_set_drvdata() is removed since there are no more callers of spi_get_drvdata(). Also use dev_err_probe() to simplify error return. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-9-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-ads8688: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-24/+5
| | | | | | | | | | | | | | | | Use devm_regulator_get_enable_read_voltage() to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-8-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-adc108s102: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-25/+3
| | | | | | | | | | | | | | | | Use devm_regulator_get_enable_read_voltage() to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-7-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: max1363: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-24/+4
| | | | | | | | | | | | | | | | | | Use devm_regulator_get_enable_read_voltage() to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-6-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ltc2309: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-37/+6
| | | | | | | | | | | | | | | | | | | | | | | | Use devm_regulator_get_enable_read_voltage() to simplify the code. Error message is changed since there is only one error return now. LTC2309_INTERNAL_REF_MV macro is added to make the internal reference voltage value self-documenting. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-5-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: hx711: use dev_err_probe()David Lechner2024-06-251-22/+13
| | | | | | | | | | | | | | | | | | Use dev_err_probe() to simplify error returns in the probe function. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andreas Klinger <ak@it-klinger.de> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-4-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: hx711: remove hx711_remove()David Lechner2024-06-251-22/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | By using a few more devm_ functions, we can remove the hx711_remove() function in the hx711 driver. platform_set_drvdata() is also removed since there are no more callers of platform_get_drvdata(). Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andreas Klinger <ak@it-klinger.de> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-3-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: hx711: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-18/+2
| | | | | | | | | | | | | | | | | | | | Use the devm_regulator_get_enable_read_voltage() helper to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andreas Klinger <ak@it-klinger.de> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-2-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: aspeed_adc: use devm_regulator_get_enable_read_voltage()David Lechner2024-06-251-22/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This makes use of the devm_regulator_get_enable_read_voltage() helper function to simplify the code. The error return is moved closer to the function call to make it easier to follow the logic. And a few blank lines are added for readability. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> Link: https://patch.msgid.link/20240621-iio-regulator-refactor-round-2-v1-1-49e50cd0b99a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-ads1119: Add driverJoão Paulo Gonçalves2024-06-253-0/+838
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ADS1119 is a precision, 16-bit, analog-to-digital converter (ADC) that features two differential or four single-ended inputs through a flexible input multiplexer (MUX), rail-to-rail input buffers, a programmable gain stage, a voltage reference, and an oscillator. Apart from normal single conversion, the driver also supports continuous conversion mode using a triggered buffer. However, in this mode only one channel can be scanned at a time. Datasheet: https://www.ti.com/lit/gpn/ads1119 Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Link: https://patch.msgid.link/20240617183905.4685-1-francesco@dolcini.it Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: stm32-dfsdm-adc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-17/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-18-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: sc27xx_adc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-17-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: rn5t618-adc: make use of regmap_set_bits()Trevor Gamblin2024-06-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-16-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: qcom-spmi-rradc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-15-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: berlin2-adc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20240617-review-v3-8-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: mp2629_adc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-14-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: meson_saradc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-57/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: George Stark <gnstark@salutedevices.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-13-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: intel_mrfld_adc: make use of regmap_clear_bits()Trevor Gamblin2024-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-12-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ina2xx-adc: make use of regmap_clear_bits()Trevor Gamblin2024-06-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-11-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: fsl-imx25-gcq: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-10-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: cpcap-adc: make use of regmap_clear_bits(), regmap_set_bits()Trevor Gamblin2024-06-251-27/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-9-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: bcm_iproc_adc: make use of regmap_clear_bits()Trevor Gamblin2024-06-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-7-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: axp288_adc: make use of regmap_set_bits()Trevor Gamblin2024-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-6-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: axp20x_adc: make use of regmap_set_bits()Trevor Gamblin2024-06-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-5-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad4130: make use of regmap_clear_bits()Trevor Gamblin2024-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-4-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: Add support for AD411x devicesDumitru Ceclan2024-06-251-32/+282
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for AD4111/AD4112/AD4114/AD4115/AD4116. The AD411X family encompasses a series of low power, low noise, 24-bit, sigma-delta analog-to-digital converters that offer a versatile range of specifications. This family of ADCs integrates an analog front end suitable for processing both fully differential and single-ended, bipolar voltage inputs addressing a wide array of industrial and instrumentation requirements. - All ADCs have inputs with a precision voltage divider with a division ratio of 10. - AD4116 has 5 low level inputs without a voltage divider. - AD4111 and AD4112 support current inputs (0 mA to 20 mA) using a 50ohm shunt resistor. Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-9-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: document sampling frequency behaviourDumitru Ceclan2024-06-251-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ADCs supported by this driver feature a sequencer that read in a loop all the enabled chanels. When setting the individual sampling frequency for each channel and enabling multiple channels, the effective of each channel will be lower than the actual set value. Document this behaviour in a comment. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-8-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: refactor device info structsDumitru Ceclan2024-06-251-138/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | Drop setting .has_temp and .has_input_buf to false in device info struct. Drop array of device info structs and use individual structs for all; drop models enum as no longer needed. This improves readability as the structs are pointed directly. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-7-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: add support for special inputsDumitru Ceclan2024-06-251-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | Add support for selecting REF+ and REF- inputs on all models. Add support for selecting ((AVDD1 − AVSS)/5) inputs on supported models. Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-6-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: refactor ain and vref selectionDumitru Ceclan2024-06-251-19/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Move validation of analog inputs and reference voltage selection to separate functions to reduce the size of the channel config parsing function and improve readability. Add defines for the number of analog inputs in a channel. Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-5-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: refactor channel configuration parsingDumitru Ceclan2024-06-251-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Move configurations regarding number of channels from *_fw_parse_device_config to *_fw_parse_channel_config. Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/all/20240303162148.3ad91aa2@jic23-huawei/ Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Link: https://patch.msgid.link/20240607-ad4111-v7-4-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad_sigma_delta: add disable_one callbackDumitru Ceclan2024-06-253-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sigma delta ADCs with a sequencer need to disable the previously enabled channel when reading using ad_sigma_delta_single_conversion(). This was done manually in drivers for devices with sequencers. This patch implements handling of single channel disabling after a single conversion. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240607-ad4111-v7-3-97e3855900a0@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7944: use devm_regulator_get_enable_read_voltageDavid Lechner2024-06-221-42/+12
| | | | | | | | | | | | | | | | | | | | This makes use of the new devm_regulator_get_enable_read_voltage() function to reduce boilerplate code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240612-iio-adc-ref-supply-refactor-v2-5-fa622e7354e9@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7793: use devm_regulator_get_enable_read_voltageDavid Lechner2024-06-221-21/+3
| | | | | | | | | | | | | | | | | | | | This makes use of the new devm_regulator_get_enable_read_voltage() function to reduce boilerplate code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240612-iio-adc-ref-supply-refactor-v2-4-fa622e7354e9@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7292: use devm_regulator_get_enable_read_voltageDavid Lechner2024-06-221-30/+6
| | | | | | | | | | | | | | | | | | | | This makes use of the new devm_regulator_get_enable_read_voltage() function to reduce boilerplate code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240612-iio-adc-ref-supply-refactor-v2-3-fa622e7354e9@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7266: use devm_regulator_get_enable_read_voltageDavid Lechner2024-06-221-27/+6
| | | | | | | | | | | | | | | | | | | | This makes use of the new devm_regulator_get_enable_read_voltage() function to reduce boilerplate code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240612-iio-adc-ref-supply-refactor-v2-2-fa622e7354e9@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7192: Clean up devAlisa-Dariana Roman2024-06-221-35/+30
| | | | | | | | | | | | | | | | | | Clean up by using a local variable struct device *dev. Also use dev_err_probe where possible. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com> Link: https://patch.msgid.link/20240613114001.270233-2-alisa.roman@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: adi-axi-adc: improve probe() error messagingTrevor Gamblin2024-06-221-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current error handling for calls such as devm_clk_get_enabled() in the adi-axi-adc probe() function means that, if a property such as 'clocks' (for example) is not present in the devicetree when booting a kernel with the driver enabled, the resulting error message will be vague, e.g.: |adi_axi_adc 44a00000.backend: probe with driver adi_axi_adc failed with error -2 Change the devm_clk_get_enabled(), devm_regmap_init_mmio(), and devm_iio_backend_register() checks to use dev_err_probe() with some context for easier debugging. After the change: |adi_axi_adc 44a00000.backend: error -ENOENT: failed to get clock |adi_axi_adc 44a00000.backend: probe with driver adi_axi_adc failed with error -2 Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240613163407.2147884-1-tgamblin@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | Merge 6.10-rc6 into char-misc-nextGreg Kroah-Hartman2024-07-012-2/+8
|\ \ | |/ |/| | | | | | | We need the char/misc/iio fixes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: adc: ad7266: Fix variable checking bugFernando Yang2024-06-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | The ret variable was not checked after iio_device_release_direct_mode(), which could possibly cause errors Fixes: c70df20e3159 ("iio: adc: ad7266: claim direct mode during sensor read") Signed-off-by: Fernando Yang <hagisf@usp.br> Link: https://lore.kernel.org/r/20240603180757.8560-1-hagisf@usp.br Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: xilinx-ams: Don't include ams_ctrl_channels in scan_maskSean Anderson2024-06-081-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | ams_enable_channel_sequence constructs a "scan_mask" for all the PS and PL channels. This works out fine, since scan_index for these channels is less than 64. However, it also includes the ams_ctrl_channels, where scan_index is greater than 64, triggering undefined behavior. Since we don't need these channels anyway, just exclude them. Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver") Signed-off-by: Sean Anderson <sean.anderson@linux.dev> Link: https://lore.kernel.org/r/20240311162800.11074-1-sean.anderson@linux.dev Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | Merge tag 'v6.10-rc4' into char-misc-nextGreg Kroah-Hartman2024-06-172-20/+21
|\| | | | | | | | | | | We need the char-misc and iio fixes in here as well to build on top of. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>