Jonathan Cameron
74fc7aacda
iio: pressure: dlhl60d: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-25-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
e0a4d6a93e
iio: magnetometer: rm3100: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-24-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
587895606e
iio: magnetometer: mag3110: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-23-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
b5228482eb
iio: magnetometer: mag3110: Factor out core of read/write_raw() and use guard() to simplify code flow.
...
The combination of guard(mutex) and factoring out sections of code
that occur with the device held in direct mode simplifies code flow.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-22-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
0daeba3eda
iio: imu: st_lsm6dsx: Switch to sparse friendly 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: Lorenzo Bianconi <lorenzo@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-21-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
a332a90eac
iio: imu: st_lsm6dsx: Switch to sparse friendly claim/release_direct()
...
This driver caused a false positive with __cond_lock() style solution
but is fine with the simple boolean return approach now used.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-20-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:10:00 +01:00
Jonathan Cameron
ee56bbcaad
iio: imu: st_lsm6dsx: Factor out parts of st_lsm6dsx_shub_write_raw() to allow direct returns
...
By factoring out all the code that occurs with direct mode claimed
to a helper function, that helper function can directly return simplifying
code flow.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
59d3109aab
iio: imu: smi240: Switch to sparse friendly 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: Shen Jianping <Jianping.Shen@de.bosch.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-18-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
4455bc5c30
iio: imu: inv_mpu6050: Switch to sparse friendly 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: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
cbff19a382
iio: imu: inv_icm42600: Switch to sparse friendly 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: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
ca75b9fb28
iio: humidity: hts211: Switch to sparse friendly 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: Lorenzo Bianconi <lorenzo@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
db532a4114
iio: humidity: hts211: Factor out everything under direct mode claim into helper functions.
...
Pulling out the functionality of read_raw() and write_raw() callbacks
so that only the mode claim is done in the initial call allows for
direct returns and simpler error handling in the new __hts211_write_raw()
/ __hts211_read_raw() functions.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
35a34861ce
iio: humidity: hdc2010: Switch to sparse friendly 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: Eugene Zaikonnikov <ez@norphonic.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
0d51e888e0
iio: humidity: hdc100x: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-12-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
d9e6b59e5b
iio: humidity: hdc100x: Use guard(mutex) to simplify code flow
...
By using autoreleasing on the lock a number of paths can use
direct returns allow earlier exit from functions.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-11-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
6c9dc1e8f2
iio: health: max30102: Switch to sparse friendly 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 particular case is about ensuring
the mode does not change rather than ensuring we are in direct mode.
A follow up may cleanup the buffer mode claim.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
fcc065fdf5
iio: gyro: adxrs290: Switch to sparse friendly 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: Nishant Malpani <nish.malpani25@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
f664ab98b2
iio: common: st_sensors: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-8-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
0ceb75d0af
iio: common: scmi: Switch to sparse friendly 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: Jyoti Bhayana <jbhayana@google.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:59 +01:00
Jonathan Cameron
ba22e78635
iio: chemical: scd4x: Switch to sparse friendly 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: Roan van Dijk <roan@protonic.nl >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Jonathan Cameron
3976dc8323
iio: chemical: atlas-sensor: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Jonathan Cameron
e9786c5408
iio: chemical: ccs811: Switch to sparse friendly 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 >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Jonathan Cameron
fef6da136e
iio: chemical: ccs811: Factor out handling of read of IIO_INFO_RAW to simplify error paths.
...
Factor out the implementation of this part of read_raw() and use
guard() to allow direct returns, simplifying both error and non error
paths.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Jonathan Cameron
36ee4794dd
iio: addac: ad74115: Switch to sparse friendly 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: Cosmin Tanislav <demonsingur@gmail.com >
Reviewed-by: David Lechner <dlechner@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com >
Link: https://patch.msgid.link/20250331121317.1694135-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Uwe Kleine-König
7df3a6eb5c
iio: adc: ad7124: Make register naming consistent
...
Cleanup definition of register related constants:
- Use the register and field names exactly as documented in the data
sheet.
- Consistently use <regname>_<bitfield> to name a register's bitfield.
- Drop _MSK definitions and implicit FIELD_PREP calls.
- Consistent indentation.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com >
Link: https://patch.msgid.link/20250317115247.3735016-8-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Uwe Kleine-König
7dd17a4e98
iio: adc: ad7124: Remove ability to write filter_low_pass_3db_frequency
...
There are several issues with the function that implements writing to
the filter_low_pass_3db_frequency property:
- The sinc3 factor should be 0.272 not 0.262 (this is fixed for the
reading side in the previous patch).
- For freq > 1 the if condition is always true so the sinc4 filter is
hardly ever chosen.
- In the nearly always taken if branch the filter is set to sinc3, but
the frequency is set for sinc4. (And vice versa in the else branch.)
This is broken enough to justify the claim that there isn't any serious
user. Also it it counter-intuitive that setting the 3db frequency
modifies the sample frequency and the filter type.
So drop the ability to write that property.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Link: https://patch.msgid.link/20250317115247.3735016-7-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Uwe Kleine-König
8712e4986e
iio: adc: ad7124: Fix 3dB filter frequency reading
...
The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB}
and for sinc3 the factor is 0.272 according to the data sheets for
ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).
Fixes: cef2760954 ("iio: adc: ad7124: add 3db filter")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com >
Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Link: https://patch.msgid.link/20250317115247.3735016-6-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Marcelo Schmitt
8c411d4b96
Documentation: iio: ad4000: Describe offload support
...
When SPI offloading is supported, the IIO device provides different sysfs
interfaces to allow using the adjusting the sample rate. Document SPI
offload support for AD4000 and similar devices.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Link: https://patch.msgid.link/eb94013b1a4d66a8492cf094aef3e4410f81d22b.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Marcelo Schmitt
d66b2c84fb
Documentation: iio: ad4000: Add IIO Device characteristics section
...
Complement ad4000 IIO driver documentation with considerations about
``_scale_available`` attribute and table of typical channel attributes.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Link: https://patch.msgid.link/6c8fe68d7d413ffdd33b154ba45600c7ce7013da.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Marcelo Schmitt
66ac231508
Documentation: iio: ad4000: Add new supported parts
...
Commit <c3948d090080> ("iio: adc: ad4000: Add support for PulSAR devices"),
extended the ad4000 driver supports many single-channel PulSAR devices.
Update IIO ad4000 documentation with the extra list of supported devices.
Reviewed-by: David Lechner <dlechner@baylibre.com >
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com >
Link: https://patch.msgid.link/2b602abd0773af91e7ccd9dd7a2afe67f4792f95.1743110188.git.marcelo.schmitt@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:58 +01:00
Marcelo Schmitt
59b51edf71
iio: adc: ad4000: Add support for SPI offload
...
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-22 19:09:58 +01:00
David Lechner
ff2e2a5c52
iio: adc: ad7944: drop bits_per_word hack
...
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-22 19:09:57 +01:00
Matti Vaittinen
7a84e33afe
iio: dac: bd79703: Support ROHM BD79702
...
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-22 19:09:57 +01:00
Matti Vaittinen
25468dbb81
iio: dac: bd79703: Support BD79700 and BD79701
...
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-22 19:09:57 +01:00
Matti Vaittinen
67c318c46c
iio: dac: bd79703: Add chip data
...
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-22 19:09:57 +01:00
Matti Vaittinen
f026928c20
iio: dac: bd79703 Store device address to 'address'
...
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-22 19:09:57 +01:00
Matti Vaittinen
04f0bc81d6
dt-bindings: Add ROHM BD7970x variants
...
The ROHM BD79700, BD79701 and BD79702 are subsets of the BD79703 DAC.
The main difference is the number of the channels. BD79703 has 6
channels.
The BD79702 has 4, BD79701 3 and BD79700 2 channels. Additionally, the
BD79700 and BD79701 do not have separate Vfs pin but use the Vcc also
for the full-scale voltage.
Add properties for the BD79700, BD79701 and BD79702.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com >
Acked-by: Conor Dooley <conor.dooley@microchip.com >
Link: https://patch.msgid.link/0a114565e4de52bf8f98c4f9d17943e5148b0112.1743576022.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:57 +01:00
David Heidelberg
1850e6ae7f
iio: light: al3320a: Implement regmap support
...
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-22 19:09:57 +01:00
David Heidelberg
0e5e21e23d
iio: light: al3010: Implement regmap support
...
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-22 19:09:57 +01:00
David Heidelberg
b8154f3477
iio: light: al3320a: Fix an error handling path in al3320a_probe()
...
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-22 19:09:57 +01:00
David Heidelberg
c0461f8e84
iio: light: al3000a: Fix an error handling path in al3000a_probe()
...
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-22 19:09:57 +01:00
David Heidelberg
42b1a2663f
iio: light: al3010: Improve al3010_init error handling with dev_err_probe()
...
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-22 19:09:57 +01:00
Jonathan Cameron
cac2bc675b
iio: light: vcnl4035: Switch to sparse friendly 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-22 19:09:57 +01:00
Jonathan Cameron
8d7c205ff9
iio: light: vcnl4000: Switch to sparse friendly 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-22 19:09:56 +01:00
Jonathan Cameron
abce31c33d
iio: light: tcs3472: Switch to sparse friendly 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-17-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:56 +01:00
Jonathan Cameron
65a6ce5aeb
iio: light: tcs3414: Switch to sparse friendly 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-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:56 +01:00
Jonathan Cameron
565e9c17e4
iio: light: st_uvis25: Switch to sparse friendly 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-22 19:09:56 +01:00
Jonathan Cameron
43622f88b0
iio: light: si1145: Switch to sparse friendly 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-14-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:56 +01:00
Jonathan Cameron
e0dc0feb99
iio: light: rpr0521: Switch to sparse friendly 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-13-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
2025-04-22 19:09:56 +01:00
Jonathan Cameron
9c97c7d2a9
iio: light: rpr0521: Factor out handling of IIO_INFO_RAW and use guard()
...
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-22 19:09:56 +01:00