summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-10-06iio: light: veml6030: add set up delay after any power on sequenceJavier Carrasco
The veml6030 requires a delay of 4 ms after activating the sensor. That is done correctly during the hw initialization, but it's missing after resuming. Move the delay to the power on function to make sure that it is always observerd. When at it, use fsleep() instead of usleep_range() as such a narrow range is not required. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241001-veml6035-v3-1-d789f6ff147c@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06iio: pressure: bmp280: Use char instead of s32 for data bufferVasileios Amoiridis
As it was reported and discussed here [1], storing the sensor data in an endian aware s32 buffer is not optimal. Advertising the timestamp as an addition of 2 s32 variables which is also implied is again not the best practice. For that reason, change the s32 sensor_data buffer to a u8 buffer and align it properly. [1]: https://lore.kernel.org/linux-iio/73d13cc0-afb9-4306-b498-5d821728c3ba@stanley.mountain/ Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com> Link: https://patch.msgid.link/20240930202353.38203-3-vassilisamir@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06iio: pressure: bmp280: Use unsigned type for raw valuesVasileios Amoiridis
The adc values coming directly from the sensor in the BM{E,P}{2,3}xx sensors are unsigned values so treat them as such. Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com> Link: https://patch.msgid.link/20240930202353.38203-2-vassilisamir@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06dt-bindings: iio: dac: ad3552r: fix maximum spi speedAngelo Dureghello
Fix maximum SPI clock speed, as per datasheet (Rev. B, page 6). Fixes: b0a96c5f599e ("dt-bindings: iio: dac: Add adi,ad3552r.yaml") Cc: stable@vger.kernel.org Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20241003-wip-bl-ad3552r-axi-v0-iio-testing-v4-4-ceb157487329@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06MAINTAINERS: iio: imu: add entry for InvenSense MPU-6050 driverJean-Baptiste Maneyrol
Add entry for inv_mpu6050 iio driver supporting InvenSense MPU-6xxx and ICM-206xxx devices. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-3-ca5a4928eb22@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06dt-bindings: iio: imu: migrate InvenSense email to TDK group domainJean-Baptiste Maneyrol
Migrate maintainer email to TDK domain. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-2-ca5a4928eb22@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06MAINTAINERS: iio: migrate invensense email address to tdk domainJean-Baptiste Maneyrol
InvenSense is part of TDK group. Update email address to use the TDK domain. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-1-ca5a4928eb22@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06MAINTAINERS: add the GE HealthCare PMC ADC driver entryHerve Codina
After contributing the driver, add myself as the maintainer for the GE HealthCare PCM ADC IIO driver. Signed-off-by: Herve Codina <herve.codina@bootlin.com> Tested-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/20241003114641.672086-5-herve.codina@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06iio: adc: Add support for the GE HealthCare PMC ADCHerve Codina
The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel (voltage and current), 16-Bit ADC with an I2C Interface. Signed-off-by: Herve Codina <herve.codina@bootlin.com> Tested-by: Ian Ray <ian.ray@gehealthcare.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241003114641.672086-4-herve.codina@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06dt-bindings: iio: adc: Add the GE HealthCare PMC ADCHerve Codina
The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel (voltage and current), 16-Bit ADC with an I2C Interface. Signed-off-by: Herve Codina <herve.codina@bootlin.com> Tested-by: Ian Ray <ian.ray@gehealthcare.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://patch.msgid.link/20241003114641.672086-3-herve.codina@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06dt-bindings: vendor-prefixes: Add an entry for GE HealthCareHerve Codina
Add the "gehc" entry for GE HealthCare. https://www.gehealthcare.com Signed-off-by: Herve Codina <herve.codina@bootlin.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Tested-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/20241003114641.672086-2-herve.codina@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-06docs: iio: fix grammatical errorIvin Joel Abraham
Clarify the instruction for disabling autocalibration by adding the word "by" Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com> Link: https://patch.msgid.link/20241002100341.110435-1-ivinjabraham@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: ad7606: Sort includes in alphabetical orderGuillaume Stols
Some of the includes were not in alphabetical order, this commit fixes it. Signed-off-by: Guillaume Stols <gstols@baylibre.com> Link: https://patch.msgid.link/20241004-ad7606_add_iio_backend_support-v3-5-38757012ce82@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: ad7606: Fix typo in the driver nameGuillaume Stols
The parallel driver's name is ad7606_par and not ad7606_parallel. Fixes: 0046a46a8f93 ("staging/ad7606: Actually build the interface modules") Signed-off-by: Guillaume Stols <gstols@baylibre.com> Link: https://patch.msgid.link/20241004-ad7606_add_iio_backend_support-v3-1-38757012ce82@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: qcom-spmi-adc5: Tidy up adc5_get_fw_data() error messagesBjorn Andersson
In the event that no channels (child nodes) are defined, the adc5 driver will provide a generic error message indicating that adc5_get_fw_data() returned -EINVAL. In all other error cases we get two error messages, one helpful and the generic one. Add a specific error message for the no channels case, and drop the generic one, in order to improve the generates log prints in both cases. Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> Link: https://patch.msgid.link/20241004-spmi-adc5-no-channel-error-v1-1-1a43d13ae967@oss.qualcomm.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: pac1921: remove unnecessary explicit castsMatteo Martelli
Many explicit casts were introduced to address Wconversion and Wsign-compare warnings. Remove them to improve readability. Link: https://lore.kernel.org/linux-iio/1fa4ab12-0939-477d-bc92-306fd32e4fd9@stanley.mountain/ Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com> Link: https://patch.msgid.link/20240930-iio-pac1921-nocast-v2-1-cc349e137f75@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: use dev_err_probe in probe functionJavier Carrasco
Drop the common 'dev_err() + return' combination in the probe function and use 'return dev_err_probe()' instead. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-7-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: add devicetree supportJavier Carrasco
Register the compatible from the dt-bindings. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-6-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05dt-bindings: iio: light: vishay,veml6075: add vishay,veml6070Javier Carrasco
This UVA device with I2C has the same properties as the veml6075, and the same dt-bindings can cover it too. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-5-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: add support for a regulatorJavier Carrasco
Add support for a device-managed regulator with the reference name provided in the datasheet (vdd). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-4-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: use device managed iio_device_registerJavier Carrasco
Simplify the code by using devm_iio_device_register(), which removes the need for a 'remove' function, as there are no more actions to take. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-3-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: use guard to handle mutexJavier Carrasco
Simplify the mutext handling by using a guard to automate the mutex unlocking. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-2-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: veml6070: add action for i2c_unregister_deviceJavier Carrasco
Simplify the code by adding an action to call i2c_unregister_device(), which removes the need for a 'fail' label, gotos to it, and an explicit call in veml6070_remove(). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-1-a9350341a646@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: dac: ad5770r: Convert to get_unaligned_le16Abhash Jha
Convert the manual shifting to use `get_unaligned_le16` api. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240928161805.165543-1-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: mt6360-adc: Converted to use get_unaligned_be16()Abhash Jha
Changed the manual shifting and adding of bytes to use get_unaligned_be16() api instead. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240928161108.163647-1-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: Fix typos in comments across various filesYu Jiaoliang
This commit fixes several typographical errors in comments within the drivers/iio/adc directory. No functional changes are made. Detected using codespell. Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com> Link: https://patch.msgid.link/20240926034411.3482986-1-yujiaoliang@vivo.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltrf216a: Document device name for compatibleShreeya Patel
Compatible 'ltr,ltrf216a' is used by Valve's Steamdeck device via the ACPI + PRP0001 mechanism. Document this info alongside the compatible. Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com> Link: https://patch.msgid.link/20240923131527.1408691-1-shreeya.patel@collabora.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: imu: inv_mpu6050: add support for IAM-20680HT/HPJean-Baptiste Maneyrol
IAM-20680HT & HP are 2 variants of IAM-20680 with better specs, wider temperature range, and a bigger FIFO (4k). Fully compatible with IAM-20680, FIFO is 512 bytes by default and with correct register setting we expand it to full 4k. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://patch.msgid.link/20240923-inv-mpu6050-add-iam20680-ht-hp-v2-2-48290e0b9931@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05dt-bindings: iio: imu: mpu6050: Add iam20680ht/hp bindings to mpu6050Jean-Baptiste Maneyrol
IAM-20680HT & HP are 2 variants of IAM-20680 that are backwards compatible. They just have better specs, temperature range and a bigger FIFO. Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20240923-inv-mpu6050-add-iam20680-ht-hp-v2-1-48290e0b9931@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: ad5755: use scoped device_for_each_child_node()Javier Carrasco
Switch to device_for_each_child_node_scoped() to simplify the code by removing the need for calls to fwnode_handle_put() in the error path, in this particular case dropping the jump to error_out as well. This prevents possible memory leaks if new error paths are added without the required call to fwnode_handle_put(). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-4-64ca8a424578@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: sun20i-gpadc: use scoped device_for_each_child_node()Javier Carrasco
Switch to device_for_each_child_node_scoped() to simplify the code by removing the need for calls to fwnode_handle_put() in the error path. This prevents possible memory leaks if new error paths are added without the required call to fwnode_handle_put(). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Chen-Yu Tsai <wens@csie.org> Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-3-64ca8a424578@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: qcom-spmi-vadc: use scoped device_for_each_child_node()Javier Carrasco
Switch to device_for_each_child_node_scoped() to simplify the code by removing the need for calls to fwnode_handle_put() in the error path. This prevents possible memory leaks if new error paths are added without the required call to fwnode_handle_put(). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-2-64ca8a424578@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node()Javier Carrasco
Switch to device_for_each_child_node_scoped() to simplify the code by removing the need for calls to fwnode_handle_put() in the error path. This prevents possible memory leaks if new error paths are added without the required call to fwnode_handle_put(). Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-1-64ca8a424578@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: ti-ads1119: Drop explicit initialization of struct ↵Uwe Kleine-König
i2c_device_id::driver_data to 0 These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Reviewed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> Link: https://patch.msgid.link/20240920153430.503212-11-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltr390: Replaced mask values with GENMASK()Abhash Jha
Changed the hardcoded mask values for GAIN_MASK and INT_TIME_MASK to use GENMASK() instead. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240914182239.507953-1-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltr390: Add interrupt persistance supportAbhash Jha
Added support to configure the threshold interrupt persistance value by providing IIO_EV_INFO_PERIOD attribute. The value written to the attribute should be in miliseconds and should be greater than the sampling rate of the sensor. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240914181246.504450-5-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltr390: Interrupts and threshold event supportAbhash Jha
Added support for threshold events for both the ALS and UVI channels. The events are reported when the threshold interrupt is triggered. Both rising and falling threshold types are supported. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240914181246.504450-4-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltr390: Suspend and Resume supportAbhash Jha
Added support for suspend and resume PM ops. We suspend the sensor by clearing the ALS_UVS_EN bit in the MAIN CONTROL register. And we resume it by setting that bit. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240914181246.504450-3-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: light: ltr390: Added configurable sampling frequency supportAbhash Jha
Provided configurable sampling frequency(Measurement rate) support. Also exposed the available sampling frequency values using read_avail callback. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240914181246.504450-2-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: max1363: Convert to get_unaligned_be16Abhash Jha
Converted manual shifting and or to use `get_unaligned_be16` api instead. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240920181437.20194-1-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05staging: iio: Fix alignment warningHridesh MG
Reported by checkpatch: CHECK: Alignment should match open parenthesis Signed-off-by: Hridesh MG <hridesh699@gmail.com> Acked-by: Steven Davis <goldside000@outlook.com> Link: https://patch.msgid.link/20240918174320.614642-1-hridesh699@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-10-05iio: adc: ad7606: add support for AD7606C-{16,18} partsAlexandru Ardelean
The AD7606C-16 and AD7606C-18 are pretty similar with the AD7606B. The main difference between AD7606C-16 & AD7606C-18 is the precision in bits (16 vs 18). Because of that, some scales need to be defined for the 18-bit variants, as they need to be computed against 2**18 (vs 2**16 for the 16 bit-variants). Because the AD7606C-16,18 also supports bipolar & differential channels, for SW-mode, the default range of 10 V or ±10V should be set at probe. On reset, the default range (in the registers) is set to value 0x3 which corresponds to '±10 V single-ended range', regardless of bipolar or differential configuration. Aside from the scale/ranges, the AD7606C-16 is similar to the AD7606B. The AD7606C-18 variant offers 18-bit precision. Because of this, the requirement to use this chip is that the SPI controller supports padding of 18-bit sequences to 32-bit arrays. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7606c-16.pdf Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7606c-18.pdf Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-9-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30dt-bindings: iio: adc: add docs for AD7606C-{16,18} partsAlexandru Ardelean
The driver will support the AD7606C-16 and AD7606C-18. This change adds the compatible strings for these devices. The AD7606C-16,18 channels also support these (individually configurable) types of channels: - bipolar single-ended - unipolar single-ended - bipolar differential Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-8-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30dt-bindings: iio: adc: document diff-channels corner case for some ADCsAlexandru Ardelean
Some ADCs have channels with negative and positive inputs, which can be used to measure differential voltage levels. These inputs/pins are dedicated (to the given channel) and cannot be muxed as with other ADCs. For those types of setups, the 'diff-channels' property can be specified to be used with the channel number (or reg property) for both negative and positive inputs/pins. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-7-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30iio: adc: ad7606: rework available attributes for SW channelsAlexandru Ardelean
For SW mode, the oversampling and scales attributes are always present. So, they can be implemented via a 'read_avail' hook in iio_info. For HW mode, it's a bit tricky, as these attributes get assigned based on GPIO definitions. So, for SW mode, we define a separate AD7606_SW_CHANNEL() macro, and use that for the SW channels. And 'ad7606_info_os_range_and_debug' can be renamed to 'ad7606_info_sw_mode' as it is only used for SW mode. For the 'read_avail' hook, we'll need to allocate the SW scales, so that they are just returned userspace without any extra processing. The allocation will happen when then ad7606_state struct is allocated. The oversampling available parameters don't need any extra processing; they can just be passed back to userspace (as they are). Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-6-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30iio: adc: ad7606: wrap channel ranges & scales into structAlexandru Ardelean
With the addition of AD7606C-16,18 which have differential & bipolar channels (and ranges), which can vary from channel to channel, we'll need to keep more information about each channel range. To do that, we'll add a 'struct ad7606_chan_scale' type to hold just configuration for each channel. This includes the scales per channel (which can be different with AD7606C-16,18), as well as the range for each channel. This driver was already keeping the range value for each channel before, and since this is couple with the scales, it also makes sense to put them in the same struct. Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-5-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30iio: adc: ad7606: move scale_setup as function pointer on chip-infoAlexandru Ardelean
Up until now, all ADCs were 16-bit precision. With the addition of the AD7606C some things will change. For one thing, we'll need to setup available-scales for each channel. Also for the 18-bit precision variants, the scales will be different. This change adds a function-pointer to the chip-info struct to be able to set this up (differently) for the new parts. For the current parts, the scales are the same (for all parts) between HW and SW modes. Also creating a 'ad7606_sw_mode_setup()' function that must be called before the scale_setup callback. This is needed in case SW mode is enabled for some ADCs. Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-4-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30iio: adc: ad7606: move 'val' pointer to ad7606_scan_direct()Alexandru Ardelean
The ad7606_scan_direct() function returns 'int', which is fine for 16-bit samples. But when going to 18-bit samples, these need to be implemented as 32-bit (or int) type. In that case when getting samples (which can be negative), we'd get random error codes. So, the easiest thing is to just move the 'val' pointer to 'ad7606_scan_direct()'. This doesn't qualify as a fix, it's just a preparation for 18-bit ADCs (of the AD7606 family). Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-3-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30iio: adc: ad7606: add 'bits' parameter to channels macrosAlexandru Ardelean
There are some newer additions to the AD7606 family, which support 18 bit precision. Up until now, all chips were 16 bit. This change adds a 'bits' parameter to the AD760X_CHANNEL macro and renames 'ad7606_channels' -> 'ad7606_channels_16bit' for the current devices. The AD7606_SW_CHANNEL() macro is also introduced, as a short-hand for IIO channels in SW mode. Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240919130444.2100447-2-aardelean@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-30dt-bindings: iio: adc: amlogic,meson-saradc: also allow meson8-saradc to ↵Neil Armstrong
have amlogic,hhi-sysctrl property The SARADC on the Amlogic Meson8 SoC also requires the amlogic,hhi-sysctrl, property, document it by adding the amlogic,meson8-saradc compatible in the adequate allOf:if:compatible:contains:enums along meson8b and meson8m2. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Rob Herring (Arm) <robh@kernel.org> Link: https://patch.msgid.link/20240911-topic-amlogic-arm32-upstream-bindings-fixes-amlogic-hhi-sysctrl-v1-1-b8c3180b2fba@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>