summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
2025-04-22iio: adc: ad4000: Add support for SPI offloadMarcelo Schmitt
FPGA HDL projects can include a PWM generator in addition to SPI-Engine. The PWM IP is used to trigger SPI-Engine offload modules that in turn set SPI-Engine to execute transfers to poll data from the ADC. That allows data to be read at the maximum sample rates. Also, it is possible to set a specific sample rate by setting the proper PWM duty cycle and related state parameters, thus allowing an adjustable ADC sample rate when a PWM (offload trigger) is used in combination with SPI-Engine. Add support for SPI offload. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://patch.msgid.link/386ce043a0e3fc9e8ff71f17aef8de128ce5869e.1743110188.git.marcelo.schmitt@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7944: drop bits_per_word hackDavid Lechner
Remove setting bits_per_word in SPI xfers without data. The shortcoming that this was working around was fixed in the SPI controller driver, so it is no longer necessary. And we don't need this to be cargo-culted to new drivers. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250331-iio-adc-ad7944-drop-bits_per_word-hack-v1-1-2b952e033340@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: dac: bd79703: Support ROHM BD79702Matti Vaittinen
The ROHM BD79702 is similar to the BD79703, except that it has only 4 channels whereas BD79703 has 6 channels. The channel 'addresses' of the first two channels (used to identify the channel when data is read over SPI) are same for both ICs. The next two channels of the BD79702 have same addresses as the last two channels of the BD79703. This means the BD79702 channel addresses do not follow the channel numbers with a constant offset. Thus, we need to specify the addresses separately, instead of directly deriving them from the channel number with a constant offset. It's worth noting that the data-sheet describes the BD79702 as a device having channels 1,2,5 and 6. The driver however represents channels 0,1,2,3 to the users - with no gaps in the numbering - which may be more familiar view for the application software. Support ROHM BD79702 DAC. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/0ba243a63115dd4af03ebf9656c65b8c259a3e34.1743576022.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: dac: bd79703: Support BD79700 and BD79701Matti Vaittinen
The BD79700 and BD79701 look like almost exact subsets of the BD79703. The BD79703 contains 6 channels (channels 0 to 5). The BD79700 provides only 2 channels, matching the BD79703 channels 0 and 1. The BD79701 provides 3 channels (matching BD79703 channels 0, 1, and 2). Furthermore, the BD79700 and BD79701 do not have separate VFS pin but use VCC for the full-scale voltage. Suopport these ICs using the BD79703 driver. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/845aa45974f6fb81c83046368a24a0674e9a8b0e.1743576022.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: dac: bd79703: Add chip dataMatti Vaittinen
Add a chip data structure which allows handling the different variants (ROHM BD79700, BD79701) with different number of channels. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/2cacb4bec5455fe1aa58a0b28d2d91b96a396d1a.1743576022.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: dac: bd79703 Store device address to 'address'Matti Vaittinen
The ROHM BD79703 needs to identify a channel which we are reading from in the SPI transfers. This can be seen as an address for the device. For the bd79703 the address is nicely aligned with the channel number, so the driver uses the channel ID for the SPI transfers. This, however, does not need to be the case. The iio_chan_spec has a separate 'address' field, which we can populate directly with this information. This helps adding new ICs like the ROHM BD79702 where the channel ID is different from this address to be handled by this driver, so we don't need to have separate, IC specific mapping for channel numbers <=> addresses. Make the 'address' field in the iio_chan_spec to contain the SPI protocol address for the channel, and use this value in the transfers. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/e53cb4120d16a3c678e1f391b600af630d6767ce.1743576022.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3320a: Implement regmap supportDavid Heidelberg
Modernize and clean up the driver using the regmap framework. With the regmap implementation, the compiler produces a significantly smaller module. Size before: 72 kB Size after: 58 kB Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-5-d189bea87261@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3010: Implement regmap supportDavid Heidelberg
Modernize and clean up the driver using the regmap framework. With the regmap implementation, the compiler produces a significantly smaller module. Size before: 72 kB Size after: 58 kB Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-4-d189bea87261@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3320a: Fix an error handling path in al3320a_probe()David Heidelberg
If regmap_write() fails in al3320a_init(), al3320a_set_pwr_off is not called. In order to avoid such a situation, move the devm_add_action_or_reset() which calls al3320a_set_pwr_off right after a successful al3320a_set_pwr_on. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-3-d189bea87261@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3000a: Fix an error handling path in al3000a_probe()David Heidelberg
If regmap_write() fails in al3000a_init(), al3000a_set_pwr_off is not called. In order to avoid such a situation, move the devm_add_action_or_reset() which calls al3000a_set_pwr_off right after a successful al3000a_set_pwr_on. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-2-d189bea87261@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3010: Improve al3010_init error handling with dev_err_probe()David Heidelberg
Minor code simplifications and improved error reporting. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-1-d189bea87261@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: vcnl4035: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. This case triggered a false positive from sparse, resolved by factoring out the code that includes the claim and release of direct mode. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-19-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: vcnl4000: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. To simplify the code whilst making the change (and avoid potential false positives from sparse), split the enabling and disabling of thresholds into separate functions. This could have been done in two steps by splitting the functions first, but would have meant rewriting the enable function twice. Cc: Astrid Rost <astrid.rost@axis.com> Tested-by: Per-Daniel Olsson <perdaniel.olsson@axis.com> Reviewed-by: Per-Daniel Olsson <perdaniel.olsson@axis.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-18-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: tcs3472: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-17-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: tcs3414: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-16-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: st_uvis25: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-15-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: si1145: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-14-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: rpr0521: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-13-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: rpr0521: Factor out handling of IIO_INFO_RAW and use guard()Jonathan Cameron
Factor out the code which is only called with the direct mode claimed. This and the use of guard(mutex) allows direct returns simplifying code flow. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-12-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: rohm-bu27034: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Acked-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-11-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: opt4060: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. This is a case where the code is pinning down the mode so also has a claim on buffered mode. A follow up set may move those calls over to a sparse friendly form as well. Tested-by: Per-Daniel Olsson <perdaniel.olsson@axis.com> Reviewed-by: Per-Daniel Olsson <perdaniel.olsson@axis.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-10-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: ltr501: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-9-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: ltr501: Factor out core of write_raw() where direct mode claim ↵Jonathan Cameron
is held. Factoring this code out allows for direct returns on error simplifying code flow. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-8-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: ltr501: Factor out IIO_INFO_RAW leg of read_raw() callback.Jonathan Cameron
Factoring this code out allows for direct returns, simplifying code flow. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-7-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: as73211: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: as73211: Use guard() and move mode switch into inner write_raw ↵Jonathan Cameron
fucntion By using guard(mutex) and moving code that switches the device to config mode into _as73211_write_raw() the error flow is simplified. Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-5-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: isl29125: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-4-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: gp2ap020a00f: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: apds9306: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Acked-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-2-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: rcar: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-9-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: mxs-lradc: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-8-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ti-ads1015: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Marek Vasut <marex@denx.de> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-7-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ti-ads1015: Use guard(mutex) and factor out code for INFO_RAWJonathan Cameron
By use of automatic lock release and introducing a new utility function to handle the core activity of reading the ADC channel, many more complex code flows can be replaced by direct returns. Cc: Marek Vasut <marex@denx.de> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ti-ads1100: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-5-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ti-ads1100: Use guard(mutex) to allow direct returnsJonathan Cameron
Use of automated lock release simplifies the code. Cc: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-4-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: vf610: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Frank Li <Frank.Li@nxp.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: vf610: Move claim of direct mode to caller of vf610_read_sample ↵Jonathan Cameron
and use guard(mutex) These two changes allow direct returns in all paths, improving code readablity. Cc: Frank Li <Frank.Li@nxp.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309165819.1346684-2-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: trigger: stm32-lptimer: add support for stm32mp25Olivier Moysan
Add support for STM32MP25 SoC. Use newly introduced compatible to handle this new HW variant. Add new trigger definitions that can be used by the stm32 analog-to-digital converter. Use compatible data to identify them. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Link: https://patch.msgid.link/20250314171451.3497789-4-fabrice.gasnier@foss.st.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: cros_ec: Avoid -Wflex-array-member-not-at-end warningGustavo A. R. Silva
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest of the code, accordingly. So, with these changes, fix the following warning: drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c:39:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/Z9lE6IVDeC5lnChN@kspp Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: proximity: cros_ec_mkbp_proximity: Avoid -Wflex-array-member-not-at-end ↵Gustavo A. R. Silva
warning -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest of the code, accordingly. So, with these changes, fix the following warning: drivers/iio/proximity/cros_ec_mkbp_proximity.c:63:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://patch.msgid.link/Z9lEYdPPIyiRGm36@kspp Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606_par: add ad7606c chipsDavid Lechner
Add lookup table entries for ad7606c-16 and ad7606c-18 chips. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-10-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: dynamically allocate channel infoDavid Lechner
Refactor the ad7606 drivers to dynamically allocate the channel info. The channel info was getting a bit unwieldy. In some cases, the indio_dev->channels field was getting assigned up to 3 different times, each in a different function, making it difficult to see where the info was coming from. This problem stems from the number of permutations of the channel array needed to support various modes of operation and data buses. We already have 4 per chip (hardware mode, software mode, AXI ADC backend and AXI ADC backend with software mode) and we intend to add two more per chip when adding SPI offload support. To make it easier to read and maintain, move all of the channel setup to a single function that dynamically allocates and fills in the channel info. Additionally, this lets us remove some hacks where we had to compute an offset due to the fact that sometimes there was a soft timestamp channel at the start of the array. Now the timestamp channel is always at the end of the array as is typical in other drivers. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-9-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: drop ch param from ad7606_scale_setup_cb_tDavid Lechner
Drop the ch parameter from the ad7606_scale_setup_cb_t functions. The same info is already available from the chan param via chan->scan_type and chan->channel, so the parameter is redundant. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-8-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: don't use address fieldDavid Lechner
Drop use of the address field in the ad7606 driver. This field was duplicating the same info that was already in the channel and scan_index fields. This is one less thing to have to hold in your mind when reading the code. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-7-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: use kernel identifier name styleDavid Lechner
Use lower_snake_case for the identifier names as that is the usual kernel code style. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-6-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: fix kernel-doc commentsDavid Lechner
Fix several issues with kernel-doc comments in ad7606.h: * Add missing ":" to @param names. * Fix order of @param names. * Add some missing parameters. * Remove some non-existent parameters. * Fix alignment and wrapping. * Fix some spelling. `./scripts/kernel-doc -v -none drivers/iio/adc/ad7606*` is happy now. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-5-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: use devm_mutex_init()David Lechner
Use devm_mutex_init() in ad7606_probe(). Mutexes should be cleaned up on driver removal. Also add missing include while we are touching this. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-4-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606: add missing max sample ratesDavid Lechner
Add max sample rates for all of the chips. Previously, only one chip had this field populated. The fallback value for the initial sampling frequency can be removed now that all chips have a max sample rate defined. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-3-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: adc: ad7606_spi: check error in ad7606B_sw_mode_config()David Lechner
Add missing error check in ad7606B_sw_mode_config(). Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-2-4b605427774c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-22iio: light: al3320a: Split set_pwr function into set_pwr_on and _offDavid Heidelberg
Simplifies later conversion to the regmap framework. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250319-al3010-iio-regmap-v2-8-1310729d0543@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>