summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
2025-02-08iio: dac: ad3552r-hs: fix message on wrong chip idAngelo Dureghello
Set a better info message on wrong chip id, fixing the expected value as read from the info struct. Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250114-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v4-5-979402e33545@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-08iio: dac: adi-axi-dac: add bus mode setupAngelo Dureghello
The ad354xr requires DSPI mode (2 data lanes) to work in buffering mode, so, depending on the DAC type, target TRANSFER_REGISTER "MULTI_IO_MODE" bitfield can be set between: SPI (configuration, entire ad35xxr family), DSPI (ad354xr), QSPI (ad355xr). Also bus IO_MODE must be set accordingly. About removal of AXI_DAC_CUSTOM_CTRL_SYNCED_TRANSFER, according to the HDL history the flag has never been used. So looks like the driver was including it by mistake or in anticipation for something that was never implemented on HDL side. Current HDL updated documentation confirm it is actually not in use anymore and replaced by the IO_MODE bits. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250114-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v4-4-979402e33545@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-08iio: filter: admv8818: Force initialization of SDOSam Winchenbach
When a weak pull-up is present on the SDO line, regmap_update_bits fails to write both the SOFTRESET and SDOACTIVE bits because it incorrectly reads them as already set. Since the soft reset disables the SDO line, performing a read-modify-write operation on ADI_SPI_CONFIG_A to enable the SDO line doesn't make sense. This change directly writes to the register instead of using regmap_update_bits. Fixes: f34fe888ad05 ("iio:filter:admv8818: add support for ADMV8818") Signed-off-by: Sam Winchenbach <swinchenbach@arka.org> Link: https://patch.msgid.link/SA1P110MB106904C961B0F3FAFFED74C0BCF5A@SA1P110MB1069.NAMP110.PROD.OUTLOOK.COM Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7606: fix wrong scale availableAngelo Dureghello
Fix wrong scale available list since only one value is returned: ... iio:device1: ad7606b (buffer capable) 8 channels found: voltage0: (input, index: 0, format: le:S16/16>>0) 2 channel-specific attributes found: attr 0: scale value: 0.305176 attr 1: scale_available value: 0.076293 Fix as: voltage0: (input, index: 0, format: le:S16/16>>0) 2 channel-specific attributes found: attr 0: scale value: 0.305176 attr 1: scale_available value: 0.076293 0.152588 0.305176 Fixes: 97c6d857041d ("iio: adc: ad7606: rework scale-available to be static") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250129-wip-bl-ad7606_add_backend_sw_mode-v3-3-c3aec77c0ab7@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: dac: ad3552r: clear reset status flagAngelo Dureghello
Clear reset status flag, to keep error status register clean after reset (ad3552r manual, rev B table 38). Reset error flag was left to 1, so debugging registers, the "Error Status Register" was dirty (0x01). It is important to clear this bit, so if there is any reset event over normal working mode, it is possible to detect it. Fixes: 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250125-wip-bl-ad3552r-clear-reset-v2-1-aa3a27f3ff8c@baylibre.com Cc: <Stable@vger..kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7192: fix channel selectMarkus Burri
Channel configuration doesn't work as expected. For FIELD_PREP the bit mask is needed and not the bit number. Fixes: 874bbd1219c7 ("iio: adc: ad7192: Use bitfield access macros") Signed-off-by: Markus Burri <markus.burri@mt.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250124150703.97848-1-markus.burri@mt.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: hid-sensor-prox: Split difference from multiple channelsRicardo Ribalda
When the driver was originally created, it was decided that sampling_frequency and hysteresis would be shared_per_type instead of shared_by_all (even though it is internally shared by all). Eg: in_proximity_raw in_proximity_sampling_frequency When we introduced support for more channels, we continued with shared_by_type which. Eg: in_proximity0_raw in_proximity1_raw in_proximity_sampling_frequency in_attention_raw in_attention_sampling_frequency Ideally we should change to shared_by_all, but it is not an option, because the current naming has been a stablished ABI by now. Luckily we can use separate instead. That will be more consistent: in_proximity0_raw in_proximity0_sampling_frequency in_proximity1_raw in_proximity1_sampling_frequency in_attention_raw in_attention_sampling_frequency Fixes: 596ef5cf654b ("iio: hid-sensor-prox: Add support for more channels") Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Link: https://patch.msgid.link/20241216-fix-hid-sensor-v2-1-ff8c1959ec4a@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: proximity: Fix use-after-free in hx9023s_send_cfg()Dheeraj Reddy Jonnalagadda
Reorder the assignment of fw_size to happen before release_firmware() to avoid accessing the firmware structure after it's been freed. Fixes: e9ed97be4fcc ("iio: proximity: hx9023s: Added firmware file parsing functionality") Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602791 Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250107123510.44978-1-dheeraj.linuxdev@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: at91-sama5d2_adc: fix sama7g5 realbits valueNayab Sayed
The number of valid bits in SAMA7G5 ADC channel data register are 16. Hence changing the realbits value to 16 Fixes: 840bf6cb983f ("iio: adc: at91-sama5d2_adc: add support for sama7g5 device") Signed-off-by: Nayab Sayed <nayabbasha.sayed@microchip.com> Link: https://patch.msgid.link/20250115-fix-sama7g5-adc-realbits-v2-1-58a6e4087584@microchip.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: pac1921: Move ACPI_FREE() to cover all branchesVictor Duicu
This patch moves ACPI_FREE() in pac1921_match_acpi_device() in order to cover all branches. Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com> Fixes: 9fdf1d033316 ("iio: adc: pac1921: Add ACPI support to Microchip pac1921") Acked-by: Matteo Martelli <matteomartelli3@gmail.com> Signed-off-by: Victor Duicu <victor.duicu@microchip.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20250117065314.4431-1-victor.duicu@microchip.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: light: apds9306: fix max_scale_nano valuesJavier Carrasco
The two provided max_scale_nano values must be multiplied by 100 and 10 respectively to achieve nano units. According to the comments: Max scale for apds0306 is 16.326432 → the fractional part is 0.326432, which is 326432000 in NANO. The current value is 3264320. Max scale for apds0306-065 is 14.09721 → the fractional part is 0.09712, which is 97120000 in NANO. The current value is 9712000. Update max_scale_nano initialization to use the right NANO fractional parts. Cc: stable@vger.kernel.org Fixes: 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Tested-by: subhajit.ghosh@tweaklogic.com Link: https://patch.msgid.link/20250112-apds9306_nano_vals-v1-1-82fb145d0b16@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: dac: adi-axi-dac: modify stream enableAngelo Dureghello
Change suggested from the AXI HDL team, modify the function axi_dac_data_stream_enable() to check for interface busy, to avoid possible issues when starting the stream. Fixes: e61d7178429a ("iio: dac: adi-axi-dac: extend features") Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250114-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v4-3-979402e33545@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: gts: Simplify available scale table buildMatti Vaittinen
Make available scale building more clear. This hurts the performance quite a bit by looping throgh the scales many times instead of doing everything in one loop. It however simplifies logic by: - decoupling the gain and scale allocations & computations - keeping the temporary 'per_time_gains' table inside the per_time_scales computation function. - separating building the 'all scales' table in own function and doing it based on the already computed per-time scales. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Tested-by: subhajit.ghosh@tweaklogic.com Link: https://patch.msgid.link/Z1_rRXqdhxhL6wBw@mva-rohm Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ti-ads124s08: Switch to fsleep()Fabio Estevam
According to Documentation/timers/delay_sleep_functions.rst, fsleep() is the preferred delay function to be used in non-atomic context, so switch to it accordingly. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Fabio Estevam <festevam@denx.de> Link: https://patch.msgid.link/20241209181624.1260868-1-festevam@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad4695: add custom regmap bus callbacksTrevor Gamblin
Add a custom implementation of regmap read/write callbacks using the SPI bus. This allows them to be performed at a lower SCLK rate than data reads. Previously, all SPI transfers were being performed at a lower speed, but with this change sample data is read at the max bus speed while the register reads/writes remain at the lower rate. Also remove .can_multi_write from the AD4695 driver's regmap_configs, as this isn't implemented or needed. For some background context, see: https://lore.kernel.org/linux-iio/20241028163907.00007e12@Huawei.com/ Suggested-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Tested-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241113-tgamblin-ad4695_improvements-v2-3-b6bb7c758fc4@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad4695: make ad4695_exit_conversion_mode() more robustTrevor Gamblin
Ensure that conversion mode is successfully exited when the command is issued by adding an extra transfer beforehand, matching the minimum CNV high and low times from the AD4695 datasheet. The AD4695 has a quirk where the exit command only works during a conversion, so guarantee this happens by triggering a conversion in ad4695_exit_conversion_mode(). Then make this even more robust by ensuring that the exit command is run at AD4695_REG_ACCESS_SCLK_HZ rather than the bus maximum. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Tested-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241113-tgamblin-ad4695_improvements-v2-2-b6bb7c758fc4@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: imu: bmi270: add temperature channelGustavo Silva
The BMI270 IMU includes a temperature sensor. Add a channel for reading the temperature. Signed-off-by: Gustavo Silva <gustavograzs@gmail.com> Link: https://patch.msgid.link/20250118-bmi270-temp-v2-1-50bc85f36ab2@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: accel: mc3230: add mc3510c supportVasiliy Doylov
This change integrates mc3510c support into the mc3230 driver. MC3510C uses the same registers as MC3230, but a different value scale. Tested on Huawei MediaPad T3 10 (huawei-agassi) Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com> Link: https://patch.msgid.link/20250116-mainlining-mc3510c-v4-5-a41308b85ec2@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: accel: mc3230: add multiple devices supportVasiliy Doylov
Refactor code to support multiple generations of MCUBE devices by defining name, chip id and product code in mc3230_chip_info struct. Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com> Link: https://patch.msgid.link/20250116-mainlining-mc3510c-v4-4-a41308b85ec2@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: accel: mc3230: add OF match tableVasiliy Doylov
This will make the driver auto loaded via device-tree. Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com> Link: https://patch.msgid.link/20250116-mainlining-mc3510c-v4-3-a41308b85ec2@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: accel: mc3230: add mount matrix supportVasiliy Doylov
This patch allows to read a mount-matrix device tree property and report to user-space or in-kernel iio clients. Signed-off-by: Vasiliy Doylov <nekodevelopper@gmail.com> Link: https://patch.msgid.link/20250116-mainlining-mc3510c-v4-2-a41308b85ec2@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: Use str_enable_disable-like helpersKrzysztof Kozlowski
Replace ternary (condition ? "enable" : "disable") syntax with helpers from string_choices.h because: 1. Simple function call with one argument is easier to read. Ternary operator has three arguments and with wrapping might lead to quite long code. 2. Is slightly shorter thus also easier to read. 3. It brings uniformity in the text - same string. 4. Allows deduping by the linker, which results in a smaller binary file. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250114192716.912476-1-krzysztof.kozlowski@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7625: drop BSD license tagTrevor Gamblin
The ad7625 driver was submitted under a dual BSD/GPL license, but this isn't a requirement for the code, and adds extra complexity. To make it consistent with similar drivers, drop the BSD tag and leave it as GPL-2.0-only. Suggested-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Link: https://patch.msgid.link/20250114-ad7625_license-v1-1-6555b7be05ab@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7173: don't make copy of ad_sigma_delta_info structDavid Lechner
Use two separate static const struct ad_sigma_delta_info instances instead of making a copy for each driver instance. Typically in the IIO subsystem, we use multiple static const instances of the same struct when there are different variants of the same family of devices as opposed to making a copy for each driver instance and modifying it. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250113-iio-adc-ad7313-fix-non-const-info-struct-v4-2-b63be3ecac4a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7173: move fwnode_irq_get_byname() call siteDavid Lechner
Move the call to fwnode_irq_get_byname() from the driver-specific ad7173_fw_parse_device_config() to the shared ad_sd_init() function. The main reason for this is that we want struct ad_sigma_delta_info to be static const data that describes the actual ADC chip, not the application-specific configuration or any runtime state. Previously, this struct was being used to pass the IRQ number to the shared ad_sd_init() function. Now, this is replaced by a boolean flag that is set at compile time and the ad_sd_init() function handles looking up the IRQ number instead. This also has the added benefit that if any other drivers need to make use of this in the future, they just have to set the flag and the shared code will take care of the rest rather than duplicating the code in each driver. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250113-iio-adc-ad7313-fix-non-const-info-struct-v4-1-b63be3ecac4a@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: stm32: Drop unnecessary DT property presence checkRob Herring (Arm)
There's no reason to check for regulator supply property presence before calling devm_regulator_get_optional() as that will return -ENODEV if the supply is not present. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Acked-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Tested-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Link: https://patch.msgid.link/20250109182325.3973684-2-robh@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7380: add alert supportJulien Stephan
The alert functionality is an out of range indicator and can be used as an early indicator of an out of bounds conversion result. ALERT_LOW_THRESHOLD and ALERT_HIGH_THRESHOLD registers are common to all channels. When using 1 SDO line (only mode supported by the driver right now), i.e data outputs only on SDOA, SDOB (or SDOD for 4 channels variants) is used as an alert pin. The alert pin is updated at the end of the conversion (set to low if an alert occurs) and is cleared on a falling edge of CS. The ALERT register contains information about the exact alert status: channel and direction. ALERT register can be accessed using debugfs if enabled. User can set high/low thresholds and enable alert detection using the regular iio events attributes: events/in_thresh_falling_value events/in_thresh_rising_value events/thresh_either_en In most use cases, user will hardwire the alert pin to trigger a shutdown. In theory, we could generate userspace IIO events for alerts, but this is not implemented yet for several reasons [1]. This can be implemented later if a real use case actually requires it. Signed-off-by: Julien Stephan <jstephan@baylibre.com> [1] https://lore.kernel.org/all/4be16272-5197-4fa1-918c-c4cdfcaee02e@baylibre.com/ Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250108-ad7380-add-alert-support-v4-4-1751802471ba@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7380: do not store osr in private data structureJulien Stephan
Since regmap cache is now enabled, we don't need to store the oversampling ratio in the private data structure. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20250108-ad7380-add-alert-support-v4-3-1751802471ba@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7380: enable regmap cacheJulien Stephan
Enable regmap cache, to avoid useless access on spi bus. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20250108-ad7380-add-alert-support-v4-2-1751802471ba@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-02-03iio: adc: ad7380: do not use iio_device_claim_direct_scoped anymoreJulien Stephan
Conditionnal scoped handlers are turning out to be a real pain: readability issues, compiler and linker handling issues among others so rollback and remove the scoped version of iio_dvice_claim_direct_mode. To impove code readability factorize code to set oversampling ratio. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20250108-ad7380-add-alert-support-v4-1-1751802471ba@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-16Merge tag 'iio-fixes-for-6.13b' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Merge from Jonathan: IIO: 2nd set of fixes for the 6.13 cycle. Given timing so late in cycle and that they are all confined to specific drivers, it is fine for these to go upstream early in the 6.14 cycle. hid-sensors - Handle processed attention channel rather than just returning an error. adi,ad3552r - Fix output ranges for ad3541r and ad3542r. - Clear the reset status flag so that we can pick up any resets during operation. adi,ad5791 - Fix a misleading dt binding example where the sense of the interrupt was reversed. adi,ad7606 - Fix some hard coded offsets that should be taking the number of channels on a particular part into account. These were missed due to some racing changes. ams,as73211 - Fix an off by one in optimized path for just reading the colour channels. bosch,bme680 - Fix type of variable passed as pointer, ensuring it works on big endian systems and doesn't expose uninitialized data. * tag 'iio-fixes-for-6.13b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: dac: ad3552r-hs: clear reset status flag iio: dac: ad3552r-common: fix ad3541/2r ranges iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw() iio: light: as73211: fix channel handling in only-color triggered buffer dt-bindings: iio: dac: ad5791: ldac gpio is active low iio: hid-sensor-prox: Fix invalid read_raw for attention iio: adc: ad7606: Fix hardcoded offset in the ADC channels
2025-01-13Merge 6.13-rc4 into char-misc-nextGreg Kroah-Hartman
We need the IIO fixes in here as well, and it resolves a merge conflict in: drivers/iio/adc/ti-ads1119.c Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-12iio: dac: ad3552r-hs: clear reset status flagAngelo Dureghello
Clear reset status flag, to keep error status register clean after reset (ad3552r manual, rev B table 38). Reset error flag was left to 1, so debugging registers, the "Error Status Register" was dirty (0x01). It is important to clear this bit, so if there is any reset event over normal working mode, it is possible to detect it. Fixes: 0b4d9fe58be8 ("iio: dac: ad3552r: add high-speed platform driver") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-2-2dac02f04638@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-12iio: dac: ad3552r-common: fix ad3541/2r rangesAngelo Dureghello
Fix ad3541/2r voltage ranges to be as per ad3542r datasheet, rev. C, table 38 (page 57). The wrong ad354xr ranges was generating erroneous Vpp output. In more details: - fix wrong number of ranges, they are 5 ranges, not 6, - remove non-existent 0-3V range, - adjust order, since ad3552r_find_range() get a wrong index, producing a wrong Vpp as output. Retested all the ranges on real hardware, EVALAD3542RFMCZ: adi,output-range-microvolt (fdt): <(000000) (2500000)>; ok (Rfbx1, switch 10) <(000000) (5000000)>; ok (Rfbx1, switch 10) <(000000) (10000000)>; ok (Rfbx1, switch 10) <(-5000000) (5000000)>; ok (Rfbx2, switch +/- 5) <(-2500000) (7500000)>; ok (Rfbx2, switch -2.5/7.5) Fixes: 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support") Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-1-2dac02f04638@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-12iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw()Dan Carpenter
The bme680_read_temp() function takes a pointer to s16 but we're passing an int pointer to it. This will not work on big endian systems and it also means that the other 16 bits are uninitialized. Pass an s16 type variable. Fixes: f51171ce2236 ("iio: chemical: bme680: Add SCALE and RAW channels") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Vasileios Amoiridis <vassilisamir@gmail.com> Link: https://patch.msgid.link/4addb68c-853a-49fc-8d40-739e78db5fa1@stanley.mountain Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-12Merge tag 'iio-for-6.14a' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Pull IIO updaate from Jonathan: IIO: 1st set of new device support, features and cleanup for 6.14 Fairly quiet cycle. Usual mix of new drivers, device support in existing drivers, features and more general rework and cleanup. There are a few late breaking or long standing but complex fixes in here as well. There is one expected merge conflict due to an upstream fix touching neighboring code in ti-ads1119. The trivial resolution is the right one with the result ending up as: struct { s16 sample; aligned_s64 timestamp; } scan; New device support ================== adi,ad4000 - Add support for many Pulsar ADC devices: AD7685, AD7686, AD7687, AD7688, AD7690, AD7691, AD7693, AD7942, AD7946, AD7980, AD7982, AD7983, AD7984, AD7988-1 and AD7988-5 ADCs. Generally similar to the AD4000 series but with lower sampling rates and no configuration registers. Includes addition of timestamp channels. adi,adis16480 - Add support for ADIS16486, ADIS16487 and ADIS16489 IMUs. Required a few tweaks to existing driver and addition of tables. kionix,kx022a - Add support for KX134ACR-LBZ accelerometer that is similar to the KX132ACR-LBZ but with a wider (+-64G) sensor range. - Add support for KX134-1211 accelerometer that is similar to the KX132-1211 but with a wider (+-16G) sensor range. nxp,fxls8962af - Add support for fxls8974cf and fxls8967af accelerometers, Both are compatible with fxls8962af but with different device IDs which are used in presence checks. renesas,rzg2l - Add support for Renesas RZ/GS3 SoC ADCs (various driver refactors precede this to allow for chip differences). rohm,bd79704 - New driver for this 6 channel DAC. st,mpu6050 - Support he IAM20380 which is effectively a cut down IAM20608 IMU with only a gyroscope (no accelerometer). st,stm-timmer-trigger - Add support for ADC trigger use case for the STM32MP25 SOC. Do not support the counter functionality in this driver as that is handled by the counter subsystem. ti,opt4060 - New driver for this RGBW color sensor. Driver drop =========== rohm,bu20008 - Drop as decision was made to not mass produce this light sensor after Matti had done all the work to get a driver upstream. Features ======== adi,ad_sigma_delta library + ad7124 - Allow for GPIO to check interrupt status, enabling this device on more platforms that don't obey prior (non general) assumptions on how the interrupt chips work. - Allow variation in reset sequence length allowing chip specific optimizations rather than always using worst case. adi,ad7124 - Add temperature channel support. adi,ad7173 - Add support calibration modes for this family of ADCs. adi,adxl345 - Binding update to allow specification of which interrupt line is connected (or none). - Support interrupts and FIFO based data capture. bosch,bme680 - Add regulators support. Note this required a new binding doc rather than use of trivial-devices - Runtime PM support. microchip,pac1921 - Add ACPI support including _DSM for shunt value and label. renesas,rzg2l - Enable runtime autosuspend. - Add suspend and resume support. tyhx,hx9023s - Add loading of a firmware file used to set defaults for some configuration registers. vishay,veml6030 - Support triggered buffers allowing efficient data capture at higher speeds. - Add regmap cache to reduce access to device. Cleanup and minor fixes ======================= cross-tree - Another batch of conversions to devm_regulator_get_enable_read_voltage() helper and related conversions to full devm that this enables. - Various patches using guard() to allow early returns and simpler code flow. - Various conversions from s64 timestamp __aligned(8) to aligned_s64 type. Includes a few cleanups where this unsigned and it should have been signed. - Fix up some missing types for drive-open-drain in dt-binding docs. core - Add missing documentation for iio_dmaengine_buffer_setup_ext() - Add check that all buffers passed to iio_read_channel_ext_info() and iio_read_channel_label() are page sized and page aligned. Done this way because the callbacks are almost always only used to fill sysfs attributes. The check covers the tiny percentage of cases where use is made of this data in a consumer driver. - Mark scan_timestamp memory of struct iio_dev private ensuring no drivers change the value which belongs to the IIO core. documentation - Various missing ABI docs added. - ABI docs made to use Y consistently as the wildcard for channel number. - Combine duplicate in_currentY_raw entries in ABI docs. iio-mux - Fix alignment of buffers passed to iio_channel_read_ext_info(). adi,ad_sigma_delta library - Respect keep_cs_asserted flag in read path. - Close a race condition around irq enabling and disabling. - Use explicit unsigned int in place of unsigned. adi,ad6695 - Move dt-binding header under adc sub-directory and fix include path in dt example. adi,ad7124 - Check number of channels in DT doesn't exceed what the driver can handle. - Check input specified in DT are possible. - Improved error reporting during probe. adi,ad7173 - Drop unused structure element. adi,ad7293 - Ensure power is turned on before resetting. adi,adxl345 - Some documentation simplification and parameter renames. - Add a function than unifies handling of power up and power down. - Add defines to have a complete set of registers defined. - Add missing \n to end of error messages. amlogic,meson_saradc - Simplify handling of the REG11 register access. awinic,aw96104 - Constify iio_info structure. bosch,bmp085 - Add to dt-binding to indicate devices support SPI. bosch,bmp280 - Use sizeof() to replace a somewhat magic 2. - Rename sleep related variables so the unit is included and use fsleep() to replace usleep_range() calls. bosch,bno055 - Constify struct bin_attribute capella,cm3232 - Reset device before checking hardware ID inline with suggested flow from datasheet. diolan,dln2 - Simplify zeroing of structure used to gather up data by just clearing the whole thing before writing rather than trying to clear out he padding after write. freescale,vf610 - Use devm_ and dev_error_probe() to simplify code and allow dropping of explicit remove() callback. invensense,timestamp library - Use a cast to remove possibility of integer overflow. kionix,kx022a - Increase reset delay a little. maxim,max1363 - Use a buffer of sufficient size in iio_priv() rather than allocating variable sized buffer at use time. microchip,mcp4725 - Replace of_property_read_bool() with of_property_present() for detecting presence of regulator which is obviously not a bool. nxp,fxls8962af - Add wakeup-source property to the dt binding to allow these sensors to wake the system up from suspend. - Enable finer grained build when not all bus types need to be supported. renesas,rzg2l - Use dev_err_probe(), improving handling of probe errors and simplifying code. - Convert to devm_ based cleanup. - Remove unnecessary runtime PM complexity as clocks are managed through PM domains. - Switch pm_ptr() removing need for __maybe_unused markings. - use read_poll_timeout() to replace open coded equivalent. samsung, ssp_sensors - Simplify code by always providing timestamp whether or not it is enabled. st,lsm6dsx - Avoid need to include linux/i3c/master by using i3cdev_to_dev() to get to the contained struct device. st,stm32-timer-trigger - Check for clk_enable() fails. vishay,veml6030 - Use new gts-helper functions and fix the _scale attribute to take into account changes in gain and integration time. Various other typo fixes in variable names + documentation and help text. A few whitespace cleanup patches. * tag 'iio-for-6.14a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (142 commits) iio: iio-mux: kzalloc instead of devm_kzalloc to ensure page alignment iio: adc: ad7625: Add ending newlines to error messages iio: accel: adxl345: complete the list of defines iio: accel: adxl345: add FIFO with watermark events iio: accel: adxl345: initialize FIFO delay value for SPI iio: accel: adxl345: introduce interrupt handling iio: light: veml3235: fix scale to conform to ABI iio: gts-helper: add helpers to ease searches of gain_sel and new_gain iio: light: veml3235: extend regmap to add cache iio: light: veml3235: fix code style dt-bindings: iio: accel: adxl345: add interrupt-names dt-bindings: iio: accel: adxl345: make interrupts not a required property dt-bindings: iio: imu: bmi323: add boolean type for drive-open-drain dt-bindings: iio: imu: bmi270: add boolean type for drive-open-drain dt-bindings: iio: imu: bmi160: add boolean type for drive-open-drain iio: adc: meson: simplify MESON_SAR_ADC_REG11 register access iio: adc: meson: use tabs instead of spaces for some REG11 bit fields iio: adc: meson: fix voltage reference selection field name typo iio: adc: rockchip: correct alignment of timestamp iio: imu: inv_icm42600: switch timestamp type from int64_t __aligned(8) to aligned_s64 ...
2025-01-04iio: iio-mux: kzalloc instead of devm_kzalloc to ensure page alignmentMatteo Martelli
During channel configuration, the iio-mux driver allocates a page with devm_kzalloc(PAGE_SIZE) to read channel ext_info. However, the resulting buffer points to an offset of the page due to the devres header sitting at the beginning of the allocated area. This leads to failure in the provider driver when sysfs_emit* helpers are used to format the ext_info attributes. Switch to plain kzalloc version. The devres version is not strictly necessary as the buffer is only accessed during the channel configuration phase. Rely on __free cleanup to deallocate the buffer. Also, move the ext_info handling into a new function to have the page buffer definition and assignment in one statement as suggested by cleanup documentation. Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com> Fixes: 7ba9df54b091 ("iio: multiplexer: new iio category and iio-mux driver") Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241202-iio-kmalloc-align-v1-2-aa9568c03937@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: adc: ad7625: Add ending newlines to error messagesUwe Kleine-König
Error messages passed to dev_err_probe() are supposed to end in "\n". Fix accordingly. Fixes: b7ffd0fa65e9 ("iio: adc: ad7625: add driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Tested-by: Trevor Gamblin <tgamblin@baylibre.com> Link: https://patch.msgid.link/20241230151030.3207529-2-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: accel: adxl345: complete the list of definesLothar Rubusch
Having interrupts events and FIFO available allows to evaluate the sensor events. Cover the list of interrupt based sensor events. Keep them in the header file for readability. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20241228232949.72487-5-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: accel: adxl345: add FIFO with watermark eventsLothar Rubusch
Add a basic setup for FIFO with configurable watermark. Add a handler for watermark interrupt events and extend the channel for the scan_index needed for the iio channel. The sensor is configurable to use a FIFO_BYPASSED mode or a FIFO_STREAM mode. For the FIFO_STREAM mode now a watermark can be configured, or disabled by setting 0. Further features require a working FIFO setup. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20241228232949.72487-4-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: accel: adxl345: initialize FIFO delay value for SPILothar Rubusch
Add the possibility to delay FIFO access when SPI is used. According to the datasheet this is needed for the adxl345. When initialization happens over SPI the need for delay is to be signalized, and the delay will be used. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20241228232949.72487-3-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: accel: adxl345: introduce interrupt handlingLothar Rubusch
Add the possibility to claim an interrupt. Init the state structure with an interrupt line obtained from the DT. The adxl345 can use two different interrupt lines for event handling. Only one is used. Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com> Link: https://patch.msgid.link/20241228232949.72487-2-l.rubusch@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: light: veml3235: fix scale to conform to ABIJavier Carrasco
The current scale is not ABI-compliant as it is just the sensor gain instead of the value that acts as a multiplier to be applied to the raw value (there is no offset). Use the iio-gts helpers to obtain the proper scale values according to the gain and integration time to match the resolution tables from the datasheet. When at it, use 'scale' instead of 'gain' consistently for the get/set functions to avoid misunderstandings. Fixes: c5a23f80c164 ("iio: light: add support for veml3235") Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241230-veml3235_scale-v3-2-48a5795e2f64@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-01-04iio: gts-helper: add helpers to ease searches of gain_sel and new_gainJavier Carrasco
This helper functions reduce the burden in the drivers that want to fetch a gain and time selector for a given scale or a new optimal gain. The former is currently achieved by calling iio_gts_find_gain_sel_for_scale_using_time() for the current time selector, and then iterating over the rest of time selectors if the gain selector was not found. The latter requires a combination of multiple iio-gts helpers to find the new gain, look for an optimal gain if there was no exact match, and set a minimum gain if the optimal gain is not in the range of available gains. Provide simpler workflows by means of functions that address common patterns in the users of the iio-gts helpers. Acked-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241230-veml3235_scale-v3-1-48a5795e2f64@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: light: veml3235: extend regmap to add cacheJavier Carrasco
The configuration and ID registers are not volatile and are not affected by read operations (i.e. not precious), making them suitable to be cached in order to reduce the number of accesses to the device. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241224-veml3235_scale-v2-3-2e1286846c77@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: light: veml3235: fix code styleJavier Carrasco
Trivial fixes to drop double spacings. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241224-veml3235_scale-v2-2-2e1286846c77@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: adc: meson: simplify MESON_SAR_ADC_REG11 register accessMartin Blumenstingl
Simply check the max_register value to decide whether MESON_SAR_ADC_REG11 is present on the current IP revision. This allows dropping two additional bool fields from struct meson_sar_adc_param which previously had to be manually kept in sync. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20241224142941.97759-4-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: adc: meson: use tabs instead of spaces for some REG11 bit fieldsMartin Blumenstingl
This makes them consistent with the rest of the driver. No functional changes. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20241224142941.97759-3-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: adc: meson: fix voltage reference selection field name typoMartin Blumenstingl
The field should be called "vref_voltage", without a typo in the word voltage. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20241224142941.97759-2-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-28iio: adc: rockchip: correct alignment of timestampJonathan Cameron
I assume this device is only used on architectures where a 8 byte integer type is always 8 byte aligned. However, I would prefer IIO drivers to never make that assumption as the code gets copied into new drivers which are not so tightly couple to one driver and those can run on architectures that align these types to only 4 bytes in which case this structure may be 4 byte to small leading to a buffer overrun. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20241215182912.481706-21-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>