summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
* Merge 6.11-rc7 into char-misc-nextGreg Kroah-Hartman2024-09-0910-59/+91
|\ | | | | | | | | | | We need the char-misc fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: imu: inv_mpu6050: fix interrupt status read for old buggy chipsJean-Baptiste Maneyrol2024-08-171-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interrupt status read seems to be broken on some old MPU-6050 like chips. Fix by reverting to previous driver behavior bypassing interrupt status read. This is working because these chips are not supporting WoM and data ready is the only interrupt source. Fixes: 5537f653d9be ("iio: imu: inv_mpu6050: add new interrupt handler for WoM events") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # LG P880 Link: https://patch.msgid.link/20240814143735.327302-1-inv.git-commit@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: fix GPIO device infoDumitru Ceclan2024-08-171-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Models AD4114/5/6 have .higher_gpio_bits = true. This is not correct as the only models that have the GPIO bits to a higher position are AD4111/2. Fix by removing the higher_gpio_bits = true from the AD4114/5/6 models. Fixes: 13d12e3ad12d ("iio: adc: ad7173: Add support for AD411x devices") Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Link: https://patch.msgid.link/20240809134909.26829-1-dumitru.ceclan@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7124: fix DT configuration parsingDumitru Ceclan2024-08-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cfg pointer is set before reading the channel number that the configuration should point to. This causes configurations to be shifted by one channel. For example setting bipolar to the first channel defined in the DT will cause bipolar mode to be active on the second defined channel. Fix by moving the cfg pointer setting after reading the channel number. Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels") Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240806085133.114547-1-dumitru.ceclan@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad_sigma_delta: fix irq_flags on irq requestNuno Sa2024-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With commit 7b0c9f8fa3d2 ("iio: adc: ad_sigma_delta: Add optional irq selection"), we can get the irq line from struct ad_sigma_delta_info instead of the spi device. However, in devm_ad_sd_probe_trigger(), when getting the irq_flags with irq_get_trigger_type() we are still using the spi device irq instead of the one used for devm_request_irq(). Fixes: 7b0c9f8fa3d2 ("iio: adc: ad_sigma_delta: Add optional irq selection") Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240806-dev-fix-ad-sigma-delta-v1-1-aa25b173c063@analog.com Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ads1119: Fix IRQ flagsFrancesco Dolcini2024-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove IRQF_TRIGGER_FALLING flag from irq request, this should come from the platform firmware and should not be hard-coded into the driver. Add IRQF_ONESHOT flag to the irq request, the interrupt should not be re-activated in interrupt context, it should be done only after the device irq handler run. Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver") Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Reviwed-by: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com> Link: https://patch.msgid.link/20240731140657.88265-1-francesco@dolcini.it Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: fix scale application in iio_convert_raw_to_processed_unlockedMatteo Martelli2024-08-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | When the scale_type is IIO_VAL_INT_PLUS_MICRO or IIO_VAL_INT_PLUS_NANO the scale passed as argument is only applied to the fractional part of the value. Fix it by also multiplying the integer part by the scale provided. Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value") Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com> Link: https://patch.msgid.link/20240730-iio-fix-scale-v1-1-6246638c8daa@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7124: fix config comparisonDumitru Ceclan2024-08-031-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ad7124_find_similar_live_cfg() computes the compare size by substracting the address of the cfg struct from the address of the live field. Because the live field is the first field in the struct, the result is 0. Also, the memcmp() call is made from the start of the cfg struct, which includes the live and cfg_slot fields, which are not relevant for the comparison. Fix by grouping the relevant fields with struct_group() and use the size of the group to compute the compare size; make the memcmp() call from the address of the group. Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels") Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240731-ad7124-fix-v1-2-46a76aa4b9be@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7124: fix chip ID mismatchDumitru Ceclan2024-08-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ad7124_soft_reset() function has the assumption that the chip will assert the "power-on reset" bit in the STATUS register after a software reset without any delay. The POR bit =0 is used to check if the chip initialization is done. A chip ID mismatch probe error appears intermittently when the probe continues too soon and the ID register does not contain the expected value. Fix by adding a 200us delay after the software reset command is issued. Fixes: b3af341bbd96 ("iio: adc: Add ad7124 support") Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240731-ad7124-fix-v1-1-46a76aa4b9be@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7173: Fix incorrect compatible stringDumitru Ceclan2024-07-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | Wrong compatible strings are used for AD411x devices. Fix by adding the missing "adi," prefix. Fixes: 13d12e3ad12d ("iio: adc: ad7173: Add support for AD411x devices") Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240723111322.324947-1-dumitru.ceclan@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: buffer-dmaengine: fix releasing dma channel on errorDavid Lechner2024-07-291-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 <dlechner@baylibre.com> Link: https://patch.msgid.link/20240723-iio-fix-dmaengine-free-on-error-v1-1-2c7cbc9b92ff@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7606: remove frstdata check for serial modeGuillaume Stols2024-07-293-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 <gstols@baylibre.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240702-cleanup-ad7606-v3-1-18d5ea18770e@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: axp20x_adc: add support for AXP717 ADCChris Morgan2024-09-071-0/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the AXP717 ADC. The AXP717 differs from other ADCs in this series by utilizing a 14 bit ADC for all channels (a full 16 bits with the first 2 digits reserved). It also differs by lacking a battery discharge current channel. Note that while the current charge channel itself is included in this driver for the AXP717 and listed in the datasheet, no scale or offset was given for this channel. For now no scale or offset is provided in this driver. Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://patch.msgid.link/20240821215456.962564-13-macroalpha82@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_dataChris Morgan2024-09-071-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | Add the register for adc_en1 and adc_en2 to the axp_data struct. This allows us to specify a different register to enable the adc channels for different devices such as the AXP717. Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20240821215456.962564-2-macroalpha82@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: standardize on formatting for id match tablesJonathan Cameron2024-09-0564-169/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a frequent minor comment in reviews, so start cleaning up existing drivers in the hope we get fewer cases of cut and paste. There are not kernel wide rules for these, but for IIO the style that I prefer (and hence most common) is: - Space after { and before } - No comma after terminator { } This may cause merge conflicts but they should be trivial to resolve hence I have not broken this into per driver patches. Link: https://patch.msgid.link/20240818180912.719399-1-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensorshuaijie wang2024-09-053-0/+858
| | | | | | | | | | | | | | | | | | | | | | | | | | AW96103 is a low power consumption capacitive touch and proximity controller. Each channel can be independently config as sensor input, shield output. Channel Information: aw96103: 3-channel aw96105: 5-channel Signed-off-by: shuaijie wang <wangshuaijie@awinic.com> Link: https://patch.msgid.link/20240827080229.1431784-3-wangshuaijie@awinic.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: sophgo-saradc: Add driver for Sophgo CV1800B SARADCThomas Bonnefille2024-09-033-0/+238
| | | | | | | | | | | | | | | | This adds a driver for the Sophgo CV1800B SARADC. Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com> Link: https://patch.msgid.link/20240829-sg2002-adc-v5-2-aacb381e869b@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: st_lsm6dsx: Remove useless dev_fwnode() callsAndy Shevchenko2024-09-031-17/+6
| | | | | | | | | | | | | | | | | | | | | | | | The device property APIs designed that way that they will return an error when there is no valid fwnode provided. Moreover, the check for NULL of dev_fwnode() is not fully correct as in some (currently rare) cases it may contain an error pointer. This is not a problem anyway (see keyword 'valid' above) that's why the code works properly even without this change. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240826212344.866928-3-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helperAndy Shevchenko2024-09-031-69/+1
| | | | | | | | | | | | | | | | | | Replace the duplicate ACPI "ROTM" data parsing code with the new shared iio_read_acpi_mount_matrix() helper. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240826212344.866928-2-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: mcp320x: Drop vendorless compatible stringsRob Herring (Arm)2024-09-031-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The vendorless compatible strings are deprecated and weren't retained when the binding was converted to schema. As a result, they are listed as undocumented when running "make dt_compatible_check". Rather than add them back to the schema, let's just drop them as they are unnecessary. Furthermore, they are unnecessary as the SPI matching will strip the vendor prefix on compatible string and match that against the spi_device_id table. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Link: https://patch.msgid.link/20240826191728.1415189-1-robh@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: dac: ad5449: drop support for platform dataBartosz Golaszewski2024-09-031-13/+2
| | | | | | | | | | | | | | | | | | There are no longer any users of the platform data struct. Remove support for it from the driver. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://patch.msgid.link/20240814092629.9862-1-brgl@bgdev.pl Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: xilinx-ams: use device_* to iterate over device child nodesJavier Carrasco2024-09-031-10/+5
| | | | | | | | | | | | | | | | | | | | | | Use `device_for_each_child_node_scoped()` in `ams_parse_firmware()` to explicitly state device child node access, and simplify the child node handling as it is not required outside the loop. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Mike Leach <mike.leach@linaro.org> Link: https://patch.msgid.link/20240820-device_child_node_access-v3-1-1ee09bdedb9e@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: ad4695: implement calibration supportDavid Lechner2024-09-031-2/+156
| | | | | | | | | | | | | | | | | | | | The AD4695 has a calibration feature that allows the user to compensate for variations in the analog front end. This implements this feature in the driver using the standard `calibgain` and `calibbias` attributes. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240820-ad4695-gain-offset-v1-2-c8f6e3b47551@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: ad4695: add 2nd regmap for 16-bit registersDavid Lechner2024-09-031-15/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AD4695 and similar chips have some multibyte registers that have to be read/written in a single operation. So we need to add a 2nd regmap for these registers. These registers are removed from the 8-bit regmap allowable ranges and AD4695_MAX_REG is dropped since it would be ambiguous now. debugfs register access is also updated to automatically use the correct regmap depending on the register address. Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240820-ad4695-gain-offset-v1-1-c8f6e3b47551@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: bmi323: peripheral in lowest power state on suspendDenis Benato2024-09-031-2/+159
| | | | | | | | | | | | | | | | | | | | | | The bmi323 is mounted on some devices that are powered by an internal battery: help in reducing system overall power drain while the system is in s2idle or the imu driver is not loaded by resetting it in its lowest power draining state. Signed-off-by: Denis Benato <benato.denis96@gmail.com> Link: https://patch.msgid.link/20240824141122.334620-2-benato.denis96@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: accel: bmc150: Improve bmc150_apply_bosc0200_acpi_orientation()Andy Shevchenko2024-09-031-3/+3
| | | | | | | | | | | | | | | | | | By using ACPI_HANDLE() the handler argument can be retrieved directly. Replace ACPI_COMPANION() + dereference with ACPI_HANDLE(). Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240823230107.745900-1-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: accel: bmc150: use fwnode_irq_get_byname()Andy Shevchenko2024-09-031-2/+2
| | | | | | | | | | | | | | | | | | Use the generic fwnode_irq_get_byname() in place of of_irq_get_byname() to get the IRQ number from the interrupt pin. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240823230056.745872-1-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: proximity: cros_ec_mkbp_proximity: Switch to including ↵Andy Shevchenko2024-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | mod_devicetable.h for struct of_device_id definition of.h was only included for this definition, so include the correct header instead. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240823220718.743596-1-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: magnetometer: ak8975: Add AK09118 supportDanila Tikhonov2024-09-032-1/+38
| | | | | | | | | | | | | | | | | | | | | | Add additional AK09118 to the magnetometer driver which has the same register mapping and scaling as the AK09112 device. Signed-off-by: Danila Tikhonov <danila@jiaxyga.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Link: https://patch.msgid.link/20240819-ak09918-v4-4-f0734d14cfb9@mainlining.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: magnetometer: ak8975: Fix reading for ak099xx sensorsBarnabás Czémán2024-09-031-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move ST2 reading with overflow handling after measurement data reading. ST2 register read have to be read after read measurment data, because it means end of the reading and realease the lock on the data. Remove ST2 read skip on interrupt based waiting because ST2 required to be read out at and of the axis read. Fixes: 57e73a423b1e ("iio: ak8975: add ak09911 and ak09912 support") Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Link: https://patch.msgid.link/20240819-ak09918-v4-2-f0734d14cfb9@mainlining.org Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: magnetometer: ak8975: Relax failure on unknown idBarnabás Czémán2024-09-031-3/+7
| | | | | | | | | | | | | | | | | | Relax failure when driver gets an unknown device id for allow probe for register compatible devices. Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Link: https://patch.msgid.link/20240819-ak09918-v4-1-f0734d14cfb9@mainlining.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()Yang Ruibin2024-08-211-1/+1
| | | | | | | | | | | | | | | | | | The debugfs_create_dir() function returns error pointers. It never returns NULL. So use IS_ERR() to check it. Signed-off-by: Yang Ruibin <11162571@vivo.com> Link: https://patch.msgid.link/20240821083911.3411-1-11162571@vivo.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: sgp40: retain documentation in driverAndreas Klinger2024-08-211-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | Retain documentation on how the voc index is actually calculated in driver code as it'll be removed in Documentation. This is a follow up on patch "[PATCH] iio: ABI: remove duplicate in_resistance_calibbias" from David. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Link: https://patch.msgid.link/ZsWdFOIkDtEB9WGO@mail.your-server.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: light: ltr390: Calculate 'counts_per_uvi' dynamicallyAbhash Jha2024-08-171-2/+12
| | | | | | | | | | | | | | | | | | | | | | counts_per_uvi depends on the current value of gain and resolution. Hence, we cannot use the hardcoded value 96. The `counts_per_uvi` function gives the count based on the current gain and resolution (integration time). Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240814113135.14575-3-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: light: ltr390: Add ALS channel and support for gain and resolutionAbhash Jha2024-08-171-15/+90
| | | | | | | | | | | | | | | | | | | | | | | | Add new ALS channel and allow reading lux and scale values. Also provide gain and resolution configuration for ALS channel. Add automatic mode switching between the UVS and ALS channel based on which channel is being accessed. The default mode in which the sensor start is ALS mode. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240814113135.14575-2-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: ad4695: implement triggered bufferDavid Lechner2024-08-171-3/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements buffered reads for the ad4695 driver using the typical triggered buffer implementation, including adding a soft timestamp channel. The chip has 4 different modes for doing conversions. The driver is using the advanced sequencer mode since that is the only mode that allows individual configuration of all aspects each channel (e.g. bipolar config currently and oversampling to be added in the future). Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20240813-iio-adc-ad4695-buffered-read-v2-1-9bb19fc1924b@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: proximity: hx9023s: Fix error code in hx9023s_property_get()Dan Carpenter2024-08-171-1/+2
| | | | | | | | | | | | | | | | | | | | If we're returning because "reg >= HX9023S_CH_NUM" then set the error code to -ENIVAL instead of success. Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/49b5a9bc-e5ca-43a7-a665-313eb06fbe27@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: light: noa1305: Fix up integration time look upMarek Vasut2024-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code is always iterating over two fields in the noa1305_int_time_available array. Fix iteration limit, which has to be halved to avoid out of bounds access in case the value that is being looked up is not in the array. Fixes: 025f23cfebad ("iio: light: noa1305: Make integration time configurable") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Marek Vasut <marex@denx.de> Link: https://patch.msgid.link/20240814191946.81386-1-marex@denx.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: humidity: Add support for ENS210Joshua Felmeden2024-08-173-0/+351
| | | | | | | | | | | | | | | | | | | | | | Add support for ENS210/ENS210A/ENS211/ENS212/ENS213A/ENS215. The ENS21x is a family of temperature and relative humidity sensors with accuracies tailored to the needs of specific applications. Signed-off-by: Joshua Felmeden <jfelmeden@thegoodpenguin.co.uk> Link: https://patch.msgid.link/20240805-ens21x-v6-2-5bb576ef26a6@thegoodpenguin.co.uk Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: adis16460: drop ifdef around CONFIG_DEBUG_FSNuno Sa2024-08-101-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16460_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-4-d3adb6996518@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: adis16400: drop ifdef around CONFIG_DEBUG_FSNuno Sa2024-08-101-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16400_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-3-d3adb6996518@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: adis16480: drop ifdef around CONFIG_DEBUG_FSNuno Sa2024-08-101-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16480_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-2-d3adb6996518@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: imu: adis16475: drop ifdef around CONFIG_DEBUG_FSNuno Sa2024-08-101-6/+3
| | | | | | | | | | | | | | | | | | | | Use IS_ENABLED(CONFIG_DEBUG_FS) to return early in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-1-d3adb6996518@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: pac1921: add missing error return in probe()Dan Carpenter2024-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | This error path was intended to return, and not just print an error. The current code will lead to an error pointer dereference. Fixes: 371f778b83cd ("iio: adc: add support for pac1921") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Matteo Martelli <matteomartelli3@gmail.com> Link: https://patch.msgid.link/1fa4ab12-0939-477d-bc92-306fd32e4fd9@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: Fix spelling mistake "avaialable" -> "available"Colin Ian King2024-08-101-1/+1
| | | | | | | | | | | | | | | | There is a spelling mistake in a dev_warn message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://patch.msgid.link/20240807094745.4174785-1-colin.i.king@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: dac: ltc2664: Fix off by one in ltc2664_channel_config()Dan Carpenter2024-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | This comparison should be >= ARRAY_SIZE() instead of >. The "mspan" variable is later used as an array index into ltc2664_mspan_lut[] so this is an off by one bug. Fixes: 4cc2fc445d2e ("iio: dac: ltc2664: Add driver for LTC2664 and LTC2672") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/5727ab54-6280-466e-b107-1b6006e5ab29@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: bmi323: suspend and resume triggering on relevant pm operationsDenis Benato2024-08-104-0/+26
| | | | | | | | | | | | | | | | | | Prevent triggers from stop working after the device has entered sleep: use iio_device_suspend_triggering and iio_device_resume_triggering helpers. Signed-off-by: Denis Benato <benato.denis96@gmail.com> Link: https://patch.msgid.link/20240807185619.7261-3-benato.denis96@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: trigger: allow devices to suspend/resume theirs associated triggerDenis Benato2024-08-101-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a machine enters a sleep state while a trigger is associated to an iio device that trigger is not resumed after exiting the sleep state: provide iio device drivers a way to suspend and resume the associated trigger to solve the aforementioned bug. Each iio driver supporting external triggers is expected to call iio_device_suspend_triggering before suspending, and iio_device_resume_triggering upon resuming. Signed-off-by: Denis Benato <benato.denis96@gmail.com> Link: https://patch.msgid.link/20240807185619.7261-2-benato.denis96@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: light: apds9960: Add proximity and gesture offset calibrationAbhash Jha2024-08-101-1/+54
| | | | | | | | | | | | | | | | | | | | | | Proximity and gesture offset registers perform offset correction to improve cross-talk performance. Added `calibbias` to the proximity and gesture channels. Provided facility to set calibbias based on the channel number. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240804134212.51682-2-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | iio: adc: stm32-dfsdm: add scaling support to dfsdmOlivier Moysan2024-08-102-1/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add scaling support to STM32 DFSDM. When used in an analog context, a DFSDM filter typically converts the data from a sigma delta modulator. The IIO device associated to the DFSDM filter provides these data as raw data. The IIO device can provide scaling information (voltage and offset) to allow conversion of raw data into physical values. With the new binding based on IIO backend framework, the sigma delta modulators are defined as backends providing scaling information. The scaling is not supported with legacy binding. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Acked-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240730084640.1307938-10-olivier.moysan@foss.st.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>