summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'char-misc-6.9-rc1' of ↵Linus Torvalds2024-03-2117-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/20240321134831.GA2762840@dev-arch.thelio-3990X/ * 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 ...
| * iio: adc: qcom-pm8xxx-xoadc: drop unused kerneldoc struct pm8xxx_chan_info ↵Krzysztof Kozlowski2024-02-281-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 <krzysztof.kozlowski@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20240225202744.60500-1-krzysztof.kozlowski@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: rockchip_saradc: replace custom logic with ↵Quentin Schulz2024-02-281-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 <quentin.schulz@theobroma-systems.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-3-84b06a0f623a@theobroma-systems.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: rockchip_saradc: use mask for write_enable bitfieldQuentin Schulz2024-02-281-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 <quentin.schulz@theobroma-systems.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-2-84b06a0f623a@theobroma-systems.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: rockchip_saradc: fix bitmask for channels on SARADCv2Quentin Schulz2024-02-281-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 <quentin.schulz@theobroma-systems.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-1-84b06a0f623a@theobroma-systems.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: adding support for PAC193xMarius Cristea2024-02-283-0/+1648
| | | | | | | | | | | | | | | | | | This is the iio driver for Microchip PAC193X series of Power Monitor with Accumulator chip family. Signed-off-by: Marius Cristea <marius.cristea@microchip.com> Link: https://lore.kernel.org/r/20240222164206.65700-3-marius.cristea@microchip.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-ads1298: prevent divide by zero in ads1298_set_samp_freq()Dan Carpenter2024-02-281-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 <mike.looijmans@topic.nl> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/c32c9087-86de-423b-8101-67b4a7f9d728@moroto.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ti-ads1298: Fix error code in probe()Dan Carpenter2024-02-281-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 <dan.carpenter@linaro.org> Acked-by: Mike Looijmans <mike.looijmans@topic.nl> Link: https://lore.kernel.org/r/5f393a87-ca8b-4e68-a6f4-a79f75a91ccb@moroto.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: mcp320x: Simplify device removal logicArturas Moskvinas2024-02-281-20/+9
| | | | | | | | | | | | | | | | Use devm_* APIs to enable/disable regulator and to register in IIO infrastructure. Signed-off-by: Arturas Moskvinas <arturas.moskvinas@gmail.com> Link: https://lore.kernel.org/r/20240219074139.193464-2-arturas.moskvinas@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ads8688: Switch to mod_devicetable.h for struct of_device_id ↵Jonathan Cameron2024-02-281-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 <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240218173323.1023703-5-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * Merge tag 'iio-for-6.9a' of ↵Greg Kroah-Hartman2024-02-2512-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 ...
| | * iio: adc: ti-ads1298: Add driverMike Looijmans2024-02-193-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 <andriy.shevchenko@linux.intel.com> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Link: https://lore.kernel.org/r/20240216153020.485201-2-mike.looijmans@topic.nl Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: adi-axi-adc: move to backend frameworkNuno Sa2024-02-192-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 <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240210-iio-backend-v11-7-f5242a5fb42a@analog.com Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ad9467: convert to backend frameworkNuno Sa2024-02-192-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 <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240210-iio-backend-v11-6-f5242a5fb42a@analog.com Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: buffer-dmaengine: export buffer alloc and free functionsNuno Sa2024-02-191-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 <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240210-iio-backend-v11-4-f5242a5fb42a@analog.com Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ad7091r-base: Use auto cleanup of locks.Jonathan Cameron2024-02-171-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Done to reduce boilerplate and simplify code flow by allowing early returns with the lock automatically released. Reviewed-by: Nuno Sa <nuno.a@analog.com> Link: https://lore.kernel.org/r/20240128150537.44592-11-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ad4130: Use automatic cleanup of locks and direct mode.Jonathan Cameron2024-02-171-79/+52
| | | | | | | | | | | | | | | | | | | | | | | | Reduces boilerplate and allows for simpler to follow direct returns. Reviewed-by: Nuno Sa <nuno.a@analog.com> Link: https://lore.kernel.org/r/20240128150537.44592-10-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: max1363: Use automatic cleanup for locks and iio mode claiming.Jonathan Cameron2024-02-171-92/+79
| | | | | | | | | | | | | | | | | | | | | | | | This simplifies error return paths. Reviewed-by: Nuno Sa <nuno.a@analog.com> Link: https://lore.kernel.org/r/20240128150537.44592-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ad_sigma_delta: allow overwriting the IRQ flagsNuno Sa2024-02-171-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 <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240117-dev_sigma_delta_no_irq_flags-v1-2-db39261592cf@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: rtq6056: Add support for the whole RTQ6056 familyChiYuan Huang2024-01-231-20/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RTQ6053 and RTQ6059 are the same series of RTQ6056. The respective differences with RTQ6056 are listed below RTQ6053 - chip package type RTQ6059 - Reduce the pinout for vbus sensing pin - Some internal ADC scaling change Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://lore.kernel.org/r/3541207c4727e3a76b9a3caf88ef812a4d47b764.1704676198.git.cy_huang@richtek.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guardsJonathan Cameron2024-01-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20231231183514.566609-25-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| | * iio: adc: ti-ads1015: Use correct pga upper boundMohammed Billoo2024-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devicetree binding and datasheets (for both the ADS1015 and ADS1115) show that the PGA index should have a maximum value of 5, and not 6. Signed-off-by: Mohammed Billoo <mab.kernel@gmail.com> Link: https://lore.kernel.org/r/20240106174836.1086714-1-mab.kernel@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | Merge tag 'spi-v6.9' of ↵Linus Torvalds2024-03-131-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 ...
| * | iio: adc: ad_sigma_delta: Follow renaming of SPI "master" to "controller"Uwe Kleine-König2024-02-081-7/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"") some functions and struct members were renamed. To not break all drivers compatibility macros were provided. To be able to remove these compatibility macros push the renaming into this driver. Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/de866d09c80c89816df62602ba4ba8ba30e9971f.1707324794.git.u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
* | iio: adc: ad4130: only set GPIO_CTRL if pin is unusedCosmin Tanislav2024-02-101-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, GPIO_CTRL bits are set even if the pins are used for measurements. GPIO_CTRL bits should only be set if the pin is not used for other functionality. Fix this by only setting the GPIO_CTRL bits if the pin has no other function. Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver") Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240207132007.253768-2-demonsingur@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: ad4130: zero-initialize clock init dataCosmin Tanislav2024-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The clk_init_data struct does not have all its members initialized, causing issues when trying to expose the internal clock on the CLK pin. Fix this by zero-initializing the clk_init_data struct. Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver") Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240207132007.253768-1-demonsingur@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: ad7091r8: Fix error code in ad7091r8_gpio_setup()Dan Carpenter2024-01-221-1/+1
|/ | | | | | | | | | | There is a copy and paste error so it accidentally returns ->convst_gpio instead of ->reset_gpio. Fix it. Fixes: 0b76ff46c463 ("iio: adc: Add support for AD7091R-8") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://lore.kernel.org/r/fd905ad0-6413-489c-9a3b-90c0cdb35ec9@moroto.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Merge tag 'char-misc-6.8-rc1' of ↵Linus Torvalds2024-01-1710-346/+1149
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc and other driver updates from Greg KH: "Here is the big set of char/misc and other driver subsystem changes for 6.8-rc1. Other than lots of binder driver changes (as you can see by the merge conflicts) included in here are: - lots of iio driver updates and additions - spmi driver updates - eeprom driver updates - firmware driver updates - ocxl driver updates - mhi driver updates - w1 driver updates - nvmem driver updates - coresight driver updates - platform driver remove callback api changes - tags.sh script updates - bus_type constant marking cleanups - lots of other small driver updates All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (341 commits) android: removed duplicate linux/errno uio: Fix use-after-free in uio_open drivers: soc: xilinx: add check for platform firmware: xilinx: Export function to use in other module scripts/tags.sh: remove find_sources scripts/tags.sh: use -n to test archinclude scripts/tags.sh: add local annotation scripts/tags.sh: use more portable -path instead of -wholename scripts/tags.sh: Update comment (addition of gtags) firmware: zynqmp: Convert to platform remove callback returning void firmware: turris-mox-rwtm: Convert to platform remove callback returning void firmware: stratix10-svc: Convert to platform remove callback returning void firmware: stratix10-rsu: Convert to platform remove callback returning void firmware: raspberrypi: Convert to platform remove callback returning void firmware: qemu_fw_cfg: Convert to platform remove callback returning void firmware: mtk-adsp-ipc: Convert to platform remove callback returning void firmware: imx-dsp: Convert to platform remove callback returning void firmware: coreboot_table: Convert to platform remove callback returning void firmware: arm_scpi: Convert to platform remove callback returning void firmware: arm_scmi: Convert to platform remove callback returning void ...
| * iio: adc: Add support for AD7091R-8Marcelo Schmitt2023-12-265-0/+297
| | | | | | | | | | | | | | | | | | | | Add support for Analog Devices AD7091R-2, AD7091R-4, and AD7091R-8 low power 12-Bit SAR ADCs with SPI interface. Extend ad7091r-base driver so it can be used by the AD7091R-8 driver. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/09d1d1c4b39cecc528488efac6094233715f5659.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: Split AD7091R-5 config symbolMarcelo Schmitt2023-12-262-1/+6
| | | | | | | | | | | | | | | | | | Split AD7091R-5 kconfig symbol into one symbol for the base AD7091R driver and another one for the I2C interface AD7091R-5 driver. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/8cae37c611c1b0fe3faef7a4b8c4cc915eaeddc7.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Add chip_info callback to get conversion result channelMarcelo Schmitt2023-12-263-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | AD7091R-5 and AD7091R-2/-4/-8 have slightly different register field layout and due to that require different masks for getting the index of the channel associated with each read. Add a callback function so the base driver can get correct channel ID for each chip variant. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/1f7a40b4839b3a1c3f1a0654a1b329bea870feb6.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Set device mode through chip_info callbackMarcelo Schmitt2023-12-263-37/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | AD7091R-5 devices have a few modes of operation (sample, command, autocycle) which are set by writing to configuration register fields. Follow up patches will add support for AD7091R-2/-4/-8 which don't have those operation modes nor the register fields for setting them. Make ad7091r_set_mode() a callback function of AD7091R chip_info struct so the base driver can appropriately handle each design without having to check which actual chip is connected. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/5140336980f66c2c45f05895c3b68e2f65fba1c2.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Remove unneeded probe parametersMarcelo Schmitt2023-12-263-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | With the grouping of ad7091r initialization data and callbacks into the init_info struct, there is no more need to pass the device name and register map through probe function parameters as those will be available in the init_info object. Remove probe parameters that are not needed anymore. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/090a6b461410a374511a8c73659de28b2665f96b.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Move chip init data to container structMarcelo Schmitt2023-12-263-30/+55
| | | | | | | | | | | | | | | | | | | | | | | | AD7091R designs may differ on their communication protocol and resources required for proper setup. Extract what is design specific into a init_info struct so the base driver can use data and callback functions from that struct rather than checking which specific chip is connected during device initialization. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/1aca2261e227474dc58ce26442845947bcde9b14.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Move generic AD7091R code to base driver and header fileMarcelo Schmitt2023-12-263-37/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some code generic to AD7091R devices such as channel definitions were in the AD7091R-5 driver. There was also some generic register definitions declared in the base driver which would make more sense to be in the header file. The device state struct will be needed for the ad7091r8 driver in a follow up patch so that ought to be moved to the header file as well. Lastly, a couple of regmap callback functions are also capable of abstracting characteristics of different AD7091R devices and those are now being exported to IIO_AD7091R name space. Move AD7091R generic code either to the base driver or to the header file so both the ad7091r5 and the ad7091r8 driver can use those declaration in follow up patches. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/6376fc523ee503d47ec499e2cd2ef13bfb5fd8ba.1703013352.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Enable internal vref if external vref is not suppliedMarcelo Schmitt2023-12-262-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ADC needs a voltage reference to work correctly. Users can provide an external voltage reference or use the chip internal reference to operate the ADC. The availability of an in chip reference for the ADC saves the user from having to supply an external voltage reference, which makes the external reference an optional property as described in the device tree documentation. Though, to use the internal reference, it must be enabled by writing to the configuration register. Enable AD7091R internal voltage reference if no external vref is supplied. Fixes: 260442cc5be4 ("iio: adc: ad7091r5: Add scale and external VREF support") Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/b865033fa6a4fc4bf2b4a98ec51a6144e0f64f77.1703013352.git.marcelo.schmitt1@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Allow users to configure device eventsMarcelo Schmitt2023-12-263-24/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AD7091R-5 devices are supported by the ad7091r-5 driver together with the ad7091r-base driver. Those drivers declared iio events for notifying user space when ADC readings fall bellow the thresholds of low limit registers or above the values set in high limit registers. However, to configure iio events and their thresholds, a set of callback functions must be implemented and those were not present until now. The consequence of trying to configure ad7091r-5 events without the proper callback functions was a null pointer dereference in the kernel because the pointers to the callback functions were not set. Implement event configuration callbacks allowing users to read/write event thresholds and enable/disable event generation. Since the event spec structs are generic to AD7091R devices, also move those from the ad7091r-5 driver the base driver so they can be reused when support for ad7091r-2/-4/-8 be added. Fixes: ca69300173b6 ("iio: adc: Add support for AD7091R5 ADC") Suggested-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/59552d3548dabd56adc3107b7b4869afee2b0c3c.1703013352.git.marcelo.schmitt1@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Align arguments to function call parenthesisMarcelo Schmitt2023-12-171-2/+3
| | | | | | | | | | | | | | | | | | Align arguments to function call open parenthesis to comply with the Linux kernel coding style. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/fc71a82d3b4a6bc6f511f27451dbd7a3280a8c95.1702746240.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Set alert bit in config registerMarcelo Schmitt2023-12-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ad7091r-base driver sets up an interrupt handler for firing events when inputs are either above or below a certain threshold. However, for the interrupt signal to come from the device it must be configured to enable the ALERT/BUSY/GPO pin to be used as ALERT, which was not being done until now. Enable interrupt signals on the ALERT/BUSY/GPO pin by setting the proper bit in the configuration register. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/e8da2ee98d6df88318b14baf3dc9630e20218418.1702746240.git.marcelo.schmitt1@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7091r: Pass iio_dev to event handlerMarcelo Schmitt2023-12-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous version of ad7091r event handler received the ADC state pointer and retrieved the iio device from driver data field with dev_get_drvdata(). However, no driver data have ever been set, which led to null pointer dereference when running the event handler. Pass the iio device to the event handler and retrieve the ADC state struct from it so we avoid the null pointer dereference and save the driver from filling the driver data field. Fixes: ca69300173b6 ("iio: adc: Add support for AD7091R5 ADC") Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://lore.kernel.org/r/5024b764107463de9578d5b3b0a3d5678e307b1a.1702746240.git.marcelo.schmitt1@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: adi-axi-adc: convert to regmapNuno Sa2023-12-112-34/+53
| | | | | | | | | | | | | | | | | | Use MMIO regmap interface. It makes things easier for manipulating bits. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-8-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: use the more common !val NULL checkNuno Sa2023-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | Check !val instead of directing checking for NULL (val == NULL). No functional changes intended. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-7-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: use chip_info variables instead of arrayNuno Sa2023-12-101-46/+43
| | | | | | | | | | | | | | | | | | | | Instead of having an array and keeping IDs for each entry of the array, just have a chip_info struct per device. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-6-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: use spi_get_device_match_data()Nuno Sa2023-12-101-3/+1
| | | | | | | | | | | | | | | | | | Make use of spi_get_device_match_data() to simplify things. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-5-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: fix scale settingNuno Sa2023-12-102-59/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading in_voltage_scale we can get something like: root@analog:/sys/bus/iio/devices/iio:device2# cat in_voltage_scale 0.038146 However, when reading the available options: root@analog:/sys/bus/iio/devices/iio:device2# cat in_voltage_scale_available 2000.000000 2100.000006 2200.000007 2300.000008 2400.000009 2500.000010 which does not make sense. Moreover, when trying to set a new scale we get an error because there's no call to __ad9467_get_scale() to give us values as given when reading in_voltage_scale. Fix it by computing the available scales during probe and properly pass the list when .read_available() is called. While at it, change to use .read_available() from iio_info. Also note that to properly fix this, adi-axi-adc.c has to be changed accordingly. Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") Signed-off-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-4-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: add mutex to struct ad9467_stateNuno Sa2023-12-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | When calling ad9467_set_scale(), multiple calls to ad9467_spi_write() are done which means we need to properly protect the whole operation so we are sure we will be in a sane state if two concurrent calls occur. Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") Signed-off-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-3-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: don't ignore error codesNuno Sa2023-12-101-10/+17
| | | | | | | | | | | | | | | | | | | | Make sure functions that return errors are not ignored. Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-2-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad9467: fix reset gpio handlingNuno Sa2023-12-101-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reset gpio was being handled with inverted polarity. This means that as far as gpiolib is concerned we were actually leaving the pin asserted (in theory, this would mean reset). However, inverting the polarity in devicetree made things work. Fix it by doing it the proper way and how gpiolib expects it to be done. While at it, moved the handling to it's own function and dropped 'reset_gpio' from the 'struct ad9467_state' as we only need it during probe. On top of that, refactored things so that we now request the gpio asserted (i.e in reset) and then de-assert it. Also note that we now use gpiod_set_value_cansleep() instead of gpiod_direction_output() as we already request the pin as output. Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC") Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231207-iio-backend-prep-v2-1-a4a33bc4d70e@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: mcp3911: simplify code with guard macroMarcus Folkesson2023-12-101-41/+23
| | | | | | | | | | | | | | | | Use the guard(mutex) macro for handle mutex lock/unlocks. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Link: https://lore.kernel.org/r/20231206-mcp3911-guard-v4-1-30c3c5d4340f@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: Add driver support for MAX34408/9Ivan Mikhaylov2023-11-163-0/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MAX34408/MAX34409 are two- and four-channel current monitors that are configured and monitored with a standard I2C/SMBus serial interface. Each unidirectional current sensor offers precision high-side operation with a low full-scale sense voltage. The devices automatically sequence through two or four channels and collect the current-sense samples and average them to reduce the effect of impulse noise. The raw ADC samples are compared to user-programmable digital thresholds to indicate overcurrent conditions. Overcurrent conditions trigger a hardware output to provide an immediate indication to shut down any necessary external circuitry. Add as ADC driver which only supports current monitoring for now. Link: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX34408-MAX34409.pdf Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com> Link: https://lore.kernel.org/r/20231014211254.16719-3-fr0st61te@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>