aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-07-29iio: buffer-dmaengine: fix releasing dma channel on errorDavid Lechner1-1/+3
If dma_get_slave_caps() fails, we need to release the dma channel before returning an error to avoid leaking the channel. Fixes: 2d6ca60f3284 ("iio: Add a DMAengine framework based buffer") Signed-off-by: David Lechner <[email protected]> Link: https://patch.msgid.link/20240723-iio-fix-dmaengine-free-on-error-v1-1-2c7cbc9b92ff@baylibre.com Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7606: remove frstdata check for serial modeGuillaume Stols3-29/+49
The current implementation attempts to recover from an eventual glitch in the clock by checking frstdata state after reading the first channel's sample: If frstdata is low, it will reset the chip and return -EIO. This will only work in parallel mode, where frstdata pin is set low after the 2nd sample read starts. For the serial mode, according to the datasheet, "The FRSTDATA output returns to a logic low following the 16th SCLK falling edge.", thus after the Xth pulse, X being the number of bits in a sample, the check will always be true, and the driver will not work at all in serial mode if frstdata(optional) is defined in the devicetree as it will reset the chip, and return -EIO every time read_sample is called. Hence, this check must be removed for serial mode. Fixes: b9618c0cacd7 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4") Signed-off-by: Guillaume Stols <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29staging: iio: frequency: ad9834: Validate frequency parameter valueAleksandr Mishin1-1/+1
In ad9834_write_frequency() clk_get_rate() can return 0. In such case ad9834_calc_freqreg() call will lead to division by zero. Checking 'if (fout > (clk_freq / 2))' doesn't protect in case of 'fout' is 0. ad9834_write_frequency() is called from ad9834_write(), where fout is taken from text buffer, which can contain any value. Modify parameters checking. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 12b9d5bf76bf ("Staging: IIO: DDS: AD9833 / AD9834 driver") Suggested-by: Dan Carpenter <[email protected]> Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Dan Carpenter <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity ↵Yasin Lee3-0/+1158
sensor A SAR sensor from NanjingTianyihexin Electronics Ltd. The device has the following entry points: Usual frequency: - sampling_frequency Instant reading of current values for different sensors: - in_proximity0_raw - in_proximity1_raw - in_proximity2_raw - in_proximity3_raw - in_proximity4_raw and associated events in events/ Signed-off-by: Yasin Lee <[email protected]> Link: https://patch.msgid.link/20240702-add-tyhx-hx9023s-sensor-driver-v9-3-c030f1801d9b@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: proximity: Add TYHX HX9023SYasin Lee1-0/+93
A capacitive proximity sensor Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Yasin Lee <[email protected]> Link: https://patch.msgid.link/20240702-add-tyhx-hx9023s-sensor-driver-v9-2-c030f1801d9b@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: vendor-prefixes: add tyhxYasin Lee1-0/+2
Add vendor prefix for NanjingTianyihexin Electronics Ltd. http://www.tianyihexin.com Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Yasin Lee <[email protected]> Link: https://patch.msgid.link/20240702-add-tyhx-hx9023s-sensor-driver-v9-1-c030f1801d9b@gmail.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: dac: ti-dac7311: Add check for spi_setupChen Ni1-1/+3
Add check for the return value of spi_setup() and return the error if it fails in order to catch the error. Signed-off-by: Chen Ni <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7606: switch mutexes to guardGuillaume Stols1-24/+15
Switching to guard simplifies the code and avoids to take care to unlock the mutex in case of premature return. Signed-off-by: Guillaume Stols <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7606: fix standby gpio state to match the documentationGuillaume Stols1-2/+2
The binding's documentation specifies that "As the line is active low, it should be marked GPIO_ACTIVE_LOW". However, in the driver, it was handled the opposite way. This commit sets the driver's behaviour in sync with the documentation Fixes: 722407a4e8c0 ("staging:iio:ad7606: Use GPIO descriptor API") Signed-off-by: Guillaume Stols <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7606: fix oversampling gpio arrayGuillaume Stols2-4/+5
gpiod_set_array_value was misused here: the implementation relied on the assumption that an unsigned long was required for each gpio, while the function expects a bit array stored in "as much unsigned long as needed for storing one bit per GPIO", i.e it is using a bit field. This leaded to incorrect parameter passed to gpiod_set_array_value, that would set 1 value instead of 3. It also prevents to select the software mode correctly for the AD7606B. Fixes: d2a415c86c6b ("iio: adc: ad7606: Add support for AD7606B ADC") Fixes: 41f71e5e7daf ("staging: iio: adc: ad7606: Use find_closest() macro") Signed-off-by: Guillaume Stols <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: adc: adi,ad7606: add conditionsGuillaume Stols1-6/+54
Since the driver supports several parts that present differences in their layout and behaviour, it is necessary to describe the differences from one chip to another. Reviewed-by: Conor Dooley <[email protected]> Signed-off-by: Guillaume Stols <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: adc: adi,ad7606: fix exampleGuillaume Stols1-1/+0
Example uses adi,ad7606-8 as compatible, but adi,sw-mode is not available for it. So remove this property from example. Acked-by: Conor Dooley <[email protected]> Signed-off-by: Guillaume Stols <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: adc: adi,ad7606: add supply propertiesGuillaume Stols1-0/+11
Add voltage supplies Acked-by: Conor Dooley <[email protected]> Signed-off-by: Guillaume Stols <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: adc: adi,ad7606: improve descriptionsGuillaume Stols1-13/+20
Reword a few descriptions, and normalize the text width to 80 characters. Reviewed-by: Rob Herring (Arm) <[email protected]> Signed-off-by: Guillaume Stols <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: iio: adc: adi,ad7606: normalize textwidthGuillaume Stols1-26/+24
Normalize textwidth to 80 columns on the descriptions. Acked-by: Rob Herring (Arm) <[email protected]> Signed-off-by: Guillaume Stols <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad9467: support new partsNuno Sa1-0/+101
Add support for new devices: * Analog Devices AD9652 16-bit 310 MSPS ADC; * Analog Devices AD9643 14-Bit, 170/210/250 MSPS ADC; * Analog Devices AD9649 14-bit 20/40/65/80 MSPS ADC. Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29dt-bindings: adc: ad9467: support new partsNuno Sa1-0/+3
Add support for new devices: * Analog Devices AD9652 16-bit 310 MSPS ADC; * Analog Devices AD9643 14-Bit, 170/210/250 MSPS ADC; * Analog Devices AD9649 14-bit 20/40/65/80 MSPS ADC. Note all these parts have subtle differences in their programming model (different scales, number of channels, etc..) so fallbacks are not possible. Signed-off-by: Nuno Sa <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad9467: don't allow reading vref if not availableNuno Sa1-6/+16
If there's only one possible scale, there's no way to change the Vref select in the device so avoid reading the register in ad9467_get_scale(). In this case, it makes no sense to provide the .read_available() callback nor allowing for writing the scale attribute. Note this is in preparation for supporting a new device that only has one possible scale. Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad9467: add new chip_info variablesNuno Sa1-9/+29
Add new variables to the per chip info structure: * test_points: Number of valid test points for calibration; * has_dco_invert: Supports inverting DCO (Data clock output) polarity; * dco_en: Specicic mask to enable DCO delays. This is in preparation for supporting new parts with subtle differences in how to configure the hardware. Note that with the new test_points variable, we also add a new calib_map_size to 'struct ad9467_state' so we know our map size depending on how many test points we have and if we can run the calibration in the inverted state or not. Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad9467: support multiple channels calibrationNuno Sa1-40/+75
The calibration process mixes the support for calibrating multiple channels with only having one channel. Some paths do have 'num_channels' into account while others don't. As of now, the driver only supports devices with one channel so the above is not really a problem. That said, we'll add support for devices with more than one channel, hence let's properly make the calibration process to work with it. Signed-off-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ti-tsc2046: simplify with cleanup.hKrzysztof Kozlowski1-17/+12
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: max1363: simplify with cleanup.hKrzysztof Kozlowski1-21/+13
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: at91: simplify with cleanup.hKrzysztof Kozlowski1-8/+5
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7280a: simplify with cleanup.hKrzysztof Kozlowski1-6/+4
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: bma400: simplify with cleanup.hKrzysztof Kozlowski1-6/+5
Allocate the memory with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: pressure: bmp280: Constify struct regmap_busJavier Carrasco1-3/+3
`bmp280_regmap_bus` and `bmp380_regmap_bus` are conditionally assigned to `bmp_regmap_bus`, which is only used to pass the struct as a read-only member. Add the const modifier to the structs and the pointer to move the data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Tested-By: Vasileios Amoiridis <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: light: gp2ap002: Constify struct regmap_busJavier Carrasco1-1/+1
`gp2ap002_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: imu: bno055: Constify struct regmap_busJavier Carrasco1-1/+1
`bno055_ser_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: imu: bmi323: Constify struct regmap_busJavier Carrasco2-2/+2
`bmi323_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: dac: ltc2688: Constify struct regmap_busJavier Carrasco1-1/+1
`ltc2688_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: chemical: bme680: Constify struct regmap_busJavier Carrasco1-1/+1
`bme680_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Tested-By: Vasileios Amoiridis <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7091r8: Constify struct regmap_busJavier Carrasco1-1/+1
`ad7091r8_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Marcelo Schmitt <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: bmi088: Constify struct regmap_busJavier Carrasco1-1/+1
`bmi088_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: bma400: Constify struct regmap_busJavier Carrasco1-1/+1
`bma400_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: adxl367: Constify struct regmap_busJavier Carrasco1-1/+1
`adxl367_spi_regmap_bus` is not modified and can be declared as const to move its data to a read-only section. Signed-off-by: Javier Carrasco <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: imu: adis16480: make use of iio_for_each_active_channel()Nuno Sa1-1/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-20-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: imu: adis16475: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-19-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: at91_adc: make use of iio_for_each_active_channel()Nuno Sa1-3/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-18-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad_sigma_delta: use new '.masklength' accessorsNuno Sa1-3/+3
Make use of iio_get_masklength) and iio_for_each_active_channel() to access '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-17-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad799x: make use of iio_get_masklength()Nuno Sa1-1/+2
Use iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-16-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7298: make use of iio_get_masklength()Nuno Sa1-1/+2
Use iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-15-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: adc: ad7266: make use of iio_get_masklength()Nuno Sa1-1/+2
Use iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-14-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: stk8ba50: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-13-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: stk8312: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-12-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: sca3300: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-11-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: msa311: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/20240702-dev-iio-masklength-private-v1-10-98193bf536a6@analog.com Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: fxls8962af-core: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: cros_ec_accel_legacy: make use of iio_get_masklength()Nuno Sa1-1/+1
Ue iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: bmc150-accel-core: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2024-07-29iio: accel: bma180: make use of iio_for_each_active_channel()Nuno Sa1-2/+1
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it. Signed-off-by: Nuno Sa <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>