summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
* iio: light: tsl2772: fix reading proximity-diodes from device treeBrian Masney2023-04-081-0/+1
| | | | | | | | | | | | | | | tsl2772_read_prox_diodes() will correctly parse the properties from device tree to determine which proximity diode(s) to read from, however it didn't actually set this value on the struct tsl2772_settings. Let's go ahead and fix that. Reported-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/lkml/20230327120823.1369700-1-trix@redhat.com/ Fixes: 94cd1113aaa0 ("iio: tsl2772: add support for reading proximity led settings from device tree") Signed-off-by: Brian Masney <bmasney@redhat.com> Link: https://lore.kernel.org/r/20230404011455.339454-1-bmasney@redhat.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: dac: ad5755: Add missing fwnode_handle_put()Liang He2023-04-011-0/+1
| | | | | | | | | | | | In ad5755_parse_fw(), we should add fwnode_handle_put() when break out of the iteration device_for_each_child_node() as it will automatically increase and decrease the refcounter. Fixes: 3ac27afefd5d ("iio:dac:ad5755: Switch to generic firmware properties and drop pdata") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20230322035627.1856421-1-windhl@126.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger()Dan Carpenter2023-04-011-1/+1
| | | | | | | | | | The at91_adc_allocate_trigger() function is supposed to return error pointers. Returning a NULL will cause an Oops. Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/5d728f9d-31d1-410d-a0b3-df6a63a2c8ba@kili.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Merge tag 'iio-fixes-for-6.3a' of ↵Greg Kroah-Hartman2023-03-2812-27/+59
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus Jonathan writes: 1st set of IIO fixes for 6.3 Usual mixed bag: - core - output buffers Fix return of bytes written when only some succeed. Fix O_NONBLOCK handling to not block. - adi,ad7791 Fix IRQ type. Not confirmed to have any impact but good to correct it anyway - adi,adis16400 Missing CONFIG_CRC32 - capella,cm32181 Unregister 2nd I2C client if one is used. - cio-dac Fix bitdepth for range check on write. - linear,ltc2497 Fix a wrong shift of the LSB introduced when switching to be24 handling. - maxim,max11410 Fix handling of return code in read_poll_timeout() - qcom,spmi-adc Fix an accidental change of channel name to include the reg value from OF. - ti,palmas Fix a null dereference on remove due to wrong function used to get the drvdata. - ti,ads7950 Mark GPIO as can sleep. * tag 'iio-fixes-for-6.3a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip iio: adc: palmas_gpadc: fix NULL dereference on rmmod iio: adc: max11410: fix read_poll_timeout() usage iio: dac: cio-dac: Fix max DAC write value check for 12-bit iio: light: cm32181: Unregister second I2C client if present iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler iio: adc: ad7791: fix IRQ flags iio: buffer: make sure O_NONBLOCK is respected iio: buffer: correctly return bytes written in output buffers iio: light: vcnl4000: Fix WARN_ON on uninitialized lock iio: adis16480: select CONFIG_CRC32 drivers: iio: adc: ltc2497: fix LSB shift iio: adc: qcom-spmi-adc5: Fix the channel name
| * iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chipLars-Peter Clausen2023-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ads7950 uses a mutex as well as SPI transfers in its GPIO callbacks. This means these callbacks can sleep and the `can_sleep` flag should be set. Having the flag set will make sure that warnings are generated when calling any of the callbacks from a potentially non-sleeping context. Fixes: c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: David Lechner <david@lechnology.com> Link: https://lore.kernel.org/r/20230312210933.2275376-1-lars@metafoo.de Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: palmas_gpadc: fix NULL dereference on rmmodPatrik Dahlström2023-03-181-1/+1
| | | | | | | | | | | | | | | | | | Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL. Signed-off-by: Patrik Dahlström <risca@dalakolonin.se> Link: https://lore.kernel.org/r/20230313205029.1881745-1-risca@dalakolonin.se Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: max11410: fix read_poll_timeout() usageNuno Sá2023-03-121-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though we are passing 'ret' as stop condition for read_poll_timeout(), that return code is still being ignored. The reason is that the poll will stop if the passed condition is true which will happen if the passed op() returns error. However, read_poll_timeout() returns 0 if the *complete* condition evaluates to true. Therefore, the error code returned by op() will be ignored. To fix this we need to check for both error codes: * The one returned by read_poll_timeout() which is either 0 or ETIMEDOUT. * The one returned by the passed op(). Fixes: a44ef7c46097 ("iio: adc: add max11410 adc driver") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Acked-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com> Link: https://lore.kernel.org/r/20230307095303.713251-1-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: dac: cio-dac: Fix max DAC write value check for 12-bitWilliam Breathitt Gray2023-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The CIO-DAC series of devices only supports DAC values up to 12-bit rather than 16-bit. Trying to write a 16-bit value results in only the lower 12 bits affecting the DAC output which is not what the user expects. Instead, adjust the DAC write value check to reject values larger than 12-bit so that they fail explicitly as invalid for the user. Fixes: 3b8df5fd526e ("iio: Add IIO support for the Measurement Computing CIO-DAC family") Cc: stable@vger.kernel.org Signed-off-by: William Breathitt Gray <william.gray@linaro.org> Link: https://lore.kernel.org/r/20230311002248.8548-1-william.gray@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: light: cm32181: Unregister second I2C client if presentKai-Heng Feng2023-02-261-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a second dummy client that talks to the actual I2C address was created in probe(), there should be a proper cleanup on driver and device removal to avoid leakage. So unregister the dummy client via another callback. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Suggested-by: Hans de Goede <hdegoede@redhat.com> Fixes: c1e62062ff54 ("iio: light: cm32181: Handle CM3218 ACPI devices with 2 I2C resources") Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2152281 Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Link: https://lore.kernel.org/r/20230223020059.2013993-1-kai.heng.feng@canonical.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: accel: kionix-kx022a: Get the timestamp from the driver's private data ↵Mehdi Djait2023-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the trigger_handler The trigger_handler gets called from the IRQ thread handler using iio_trigger_poll_chained() which will only call the bottom half of the pollfunc and therefore pf->timestamp will not get set. Use instead the timestamp from the driver's private data which is always set in the IRQ handler. Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer") Link: https://lore.kernel.org/linux-iio/Y+6QoBLh1k82cJVN@carbian/ Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com> Link: https://lore.kernel.org/r/20230218135111.90061-1-mehdi.djait.k@gmail.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: ad7791: fix IRQ flagsNuno Sá2023-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | The interrupt is triggered on the falling edge rather than being a level low interrupt. Fixes: da4d3d6bb9f6 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230120124645.819910-1-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: buffer: make sure O_NONBLOCK is respectedNuno Sá2023-02-181-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For output buffers, there's no guarantee that the buffer won't be full in the first iteration of the loop in which case we would block independently of userspace passing O_NONBLOCK or not. Fix it by always checking the flag before going to sleep. While at it (and as it's a bit related), refactored the loop so that the stop condition is 'written != n', i.e, run the loop until all data has been copied into the IIO buffers. This makes the code a bit simpler. Fixes: 9eeee3b0bf190 ("iio: Add output buffer support") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230216101452.591805-3-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: buffer: correctly return bytes written in output buffersNuno Sá2023-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If for some reason 'rb->access->write()' does not write the full requested data and the O_NONBLOCK is set, we would return 'n' to userspace which is not really truth. Hence, let's return the number of bytes we effectively wrote. Fixes: 9eeee3b0bf190 ("iio: Add output buffer support") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230216101452.591805-2-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: light: vcnl4000: Fix WARN_ON on uninitialized lockMårten Lindahl2023-02-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are different init functions for the sensors in this driver in which only one initializes the generic vcnl4000_lock. With commit e21b5b1f2669 ("iio: light: vcnl4000: Preserve conf bits when toggle power") the vcnl4040 sensor started to depend on the lock, but it was missed to initialize it in vcnl4040's init function. This has not been visible until we run lockdep on it: DEBUG_LOCKS_WARN_ON(lock->magic != lock) at kernel/locking/mutex.c:575 __mutex_lock+0x4f8/0x890 Call trace: __mutex_lock mutex_lock_nested vcnl4200_set_power_state vcnl4200_init vcnl4000_probe Fix this by initializing the lock in the probe function instead of doing it in the chip specific init functions. Fixes: e21b5b1f2669 ("iio: light: vcnl4000: Preserve conf bits when toggle power") Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230131140109.2067577-1-marten.lindahl@axis.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adis16480: select CONFIG_CRC32Arnd Bergmann2023-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In rare randconfig builds, the missing CRC32 helper causes a link error: ld.lld: error: undefined symbol: crc32_le >>> referenced by usercopy_64.c >>> vmlinux.o:(adis16480_trigger_handler) Fixes: 941f130881fa ("iio: adis16480: support burst read function") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230131094616.130238-1-arnd@kernel.org Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * drivers: iio: adc: ltc2497: fix LSB shiftIan Ray2023-01-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct the "sub_lsb" shift for the ltc2497 and drop the sub_lsb element which is now constant. An earlier version of the code shifted by 14 but this was a consequence of reading three bytes into a __be32 buffer and using be32_to_cpu(), so eight extra bits needed to be skipped. Now we use get_unaligned_be24() and thus the additional skip is wrong. Fixes: 2187cfeb3626 ("drivers: iio: adc: ltc2497: LTC2499 support") Signed-off-by: Ian Ray <ian.ray@ge.com> Link: https://lore.kernel.org/r/20230127125714.44608-1-ian.ray@ge.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * iio: adc: qcom-spmi-adc5: Fix the channel nameAndy Shevchenko2023-01-281-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The node name can contain an address part which is unused by the driver. Moreover, this string is propagated into the userspace label, sysfs filenames *and breaking ABI*. Cut the address part out before assigning the channel name. Fixes: 4f47a236a23d ("iio: adc: qcom-spmi-adc5: convert to device properties") Reported-by: Marijn Suijten <marijn.suijten@somainline.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> Link: https://lore.kernel.org/r/20230118100623.42255-1-andriy.shevchenko@linux.intel.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | Merge tag 'char-misc-6.3-rc1' of ↵Linus Torvalds2023-02-2451-508/+2981
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc and other driver subsystem updates from Greg KH: "Here is the large set of driver changes for char/misc drivers and other smaller driver subsystems that flow through this git tree. Included in here are: - New IIO drivers and features and improvments in that subsystem - New hwtracing drivers and additions to that subsystem - lots of interconnect changes and new drivers as that subsystem seems under very active development recently. This required also merging in the icc subsystem changes through this tree. - FPGA driver updates - counter subsystem and driver updates - MHI driver updates - nvmem driver updates - documentation updates - Other smaller driver updates and fixes, full details in the shortlog All of these have been in linux-next for a while with no reported problems" * tag 'char-misc-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (223 commits) scripts/tags.sh: fix incompatibility with PCRE2 firmware: coreboot: Remove GOOGLE_COREBOOT_TABLE_ACPI/OF Kconfig entries mei: lower the log level for non-fatal failed messages mei: bus: disallow driver match while dismantling device misc: vmw_balloon: fix memory leak with using debugfs_lookup() nvmem: stm32: fix OPTEE dependency dt-bindings: nvmem: qfprom: add IPQ8074 compatible nvmem: qcom-spmi-sdam: register at device init time nvmem: rave-sp-eeprm: fix kernel-doc bad line warning nvmem: stm32: detect bsec pta presence for STM32MP15x nvmem: stm32: add OP-TEE support for STM32MP13x nvmem: core: use nvmem_add_one_cell() in nvmem_add_cells_from_of() nvmem: core: add nvmem_add_one_cell() nvmem: core: drop the removal of the cells in nvmem_add_cells() nvmem: core: move struct nvmem_cell_info to nvmem-provider.h nvmem: core: add an index parameter to the cell of: property: add #nvmem-cell-cells property of: property: make #.*-cells optional for simple props of: base: add of_parse_phandle_with_optional_args() net: add helper eth_addr_add() ...
| * | Merge 6.2-rc7 into char-misc-nextGreg Kroah-Hartman2023-02-0610-30/+143
| |\| | | | | | | | | | | | | | | | | | | We need the char-misc driver fixes in here as other patches depend on them. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | iio: adc: ad7291: Fix indentation error by adding extra spacesAnup Sharma2023-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added extra spaces before statements to fix following indentation warnings reported by checkpatch.pl. WARNING: Statements should start on a tabstop + return 0; Signed-off-by: Anup Sharma <anupnewsmail@gmail.com> Link: https://lore.kernel.org/r/Y9Vf4Tp8JKvy+y0u@yoga Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: accel: mma9551_core: Prevent uninitialized variable in ↵Harshit Mogalapalli2023-01-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mma9551_read_config_word() Smatch Warns: drivers/iio/accel/mma9551_core.c:299 mma9551_read_config_word() error: uninitialized symbol 'v'. When (offset >= 1 << 12) is true mma9551_transfer() will return -EINVAL without 'v' being initialized, so check for the error and return. Note: No actual bug as caller checks the return value and does not use the parameter in the problem case. Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230126153610.3586243-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: accel: mma9551_core: Prevent uninitialized variable in ↵Harshit Mogalapalli2023-01-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mma9551_read_status_word() Smatch Warns: drivers/iio/accel/mma9551_core.c:357 mma9551_read_status_word() error: uninitialized symbol 'v'. When (offset >= 1 << 12) is true mma9551_transfer() will return -EINVAL without 'v' being initialized, so check for the error and return. Note: Not a bug as such because the caller checks return value and doesn't not use this parameter in the problem case. Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230126152147.3585874-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: imu: fix spdx formatTom Rix2023-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | checkpatch reports WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 FILE: drivers/iio/imu/bno055/bno055_ser_trace.c:1: +//SPDX-License-Identifier: GPL-2.0 Add a space Fixes: 2eef5a9cc643 ("iio: imu: add BNO055 serdev driver") Signed-off-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20230124194301.656518-1-trix@redhat.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: imx93: Fix spelling mistake "geting" -> "getting"Colin Ian King2023-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Thrre is a spelling mistake in a dev_err_probe message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20230124100413.684416-1-colin.i.king@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: add imx93 adc supportHaibo Chen2023-01-223-0/+495
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ADC in i.mx93 is a total new ADC IP, add a driver to support this ADC. Currently, only support one shot normal conversion triggered by software. For other mode, will add in future. Signed-off-by: Haibo Chen <haibo.chen@nxp.com> Link: https://lore.kernel.org/r/20230117135137.1735536-2-haibo.chen@nxp.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: ti-ads7924: add Texas Instruments ADS7924 driverHugo Villeneuve2023-01-213-0/+486
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Texas Instruments ADS7924 is a 4 channels, 12-bit analog to digital converter (ADC) with an I2C interface. Datasheet: https://www.ti.com/lit/gpn/ads7924 Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Link: https://lore.kernel.org/r/20230115170623.3680647-2-hugo@hugovil.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: imu: st_lsm6dsx: add 'mount_matrix' sysfs entry to gyro channel.Philippe De Muyter2023-01-211-2/+3
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Philippe De Muyter <phdm@macqel.be> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://lore.kernel.org/r/1673874434-30750-3-git-send-email-Philippe.DeMuyter@macq.eu Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: imu: st_lsm6dsx: fix naming of 'struct iio_info' in st_lsm6dsx_shub.c.Philippe De Muyter2023-01-211-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need the name 'st_lsm6dsx_ext_info' for the actual 'iio_chan_spec_ext_info'. Rename the 'st_lsm6dsx_ext_info' in st_lsm6dsx_shub.c to 'st_lsm6dsx_shub_info'. For consistency, replace also 'ext' by 'shub' in 'st_lsm6dsx_ext_attributes' and 'st_lsm6dsx_ext_attribute_group'. Signed-off-by: Philippe De Muyter <phdm@macqel.be> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://lore.kernel.org/r/1673874434-30750-2-git-send-email-Philippe.DeMuyter@macq.eu Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: light: vcnl4000: Add interrupt support for vcnl4040Mårten Lindahl2023-01-211-0/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support to configure proximity sensor interrupts and threshold limits for vcnl4040. If an interrupt is detected an event will be pushed to the event interface. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230117190017.3789181-4-marten.lindahl@axis.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: light: vcnl4000: Make irq handling more genericMårten Lindahl2023-01-211-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver supports 4 chips, by which only one (vcnl4010) handles interrupts and has support for triggered buffer. The setup of these functions is hardcoded for vcnl4010 inside the generic vcnl4000_probe, and thus ignores the chip specific configuration structure where all other chip specific functions are specified. This complicates adding interrupt handler and triggered buffer support to chips which may have support for it. Add members for irq threads and iio_buffer_setup_ops to the generic vcnl4000_chip_spec struct, so that instead of checking a chip specific boolean irq support, we check for a chip specific triggered buffer handler, and/or a chip specific irq thread handler. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230117190017.3789181-3-marten.lindahl@axis.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: light: vcnl4000: Prepare for more generic setupMårten Lindahl2023-01-211-128/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to allow the chip_spec array reference the function pointers for interrupts, the code for these functions need to be moved above the chip_spec array. This is a prestep to support a more generic setup of interrupts. Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230117190017.3789181-2-marten.lindahl@axis.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: dac: add support for max5522Angelo Dureghello2023-01-213-0/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add initial support for DAC max5522. Tested writing DAC A and B with some values, from 0 to 1023, measured output voltages, driver works properly. Additions for max5523/24/25 will follow. Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com> Link: https://lore.kernel.org/r/20221106165928.223318-1-angelo.dureghello@timesys.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: core: Sort headersAndy Shevchenko2023-01-211-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sort the headers in alphabetic order in order to ease the maintenance for this part. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230118074828.66155-2-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: core: Replace iio_sysfs_match_string_with_gaps() by __sysfs_match_string()Andy Shevchenko2023-01-211-31/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | None of the current users is using gaps in the list of the items. No need to have a specific function for that, just replace it by library available __sysfs_match_string(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230118074828.66155-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: xilinx-ams: Convert to use fwnode_device_is_compatible()Andy Shevchenko2023-01-211-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace open coded fwnode_device_is_compatible() in the driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20230119174749.76769-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: chemical: scd30_core: Switch to use dev_err_probe()Andy Shevchenko2023-01-141-26/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to use dev_err_probe() to simplify the error paths and unify message template. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230113141917.23725-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: chemical: scd30_core: use sysfs_emit() to instead of scnprintf()Andy Shevchenko2023-01-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230113141117.23353-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: stm32-dfsdm: add id registers supportOlivier Moysan2023-01-082-35/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support of identification registers to STM32 DFSDM to allow hardware capabilities discovery and configuration check. The number of filters and channels, are read from registers, when they are available. Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20230105125331.328275-1-olivier.moysan@foss.st.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: qcom-spmi-adc5: define ADC5_BAT_ID_100K_PU channelLuca Weiss2023-01-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Define the ADC channel used for battery identification purposes so it can be used in drivers. Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> Link: https://lore.kernel.org/r/20230106-pm7250b-bat_id-v1-1-82ca8f2db741@fairphone.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: magnetometer: st_magn: Add LSM303CStephan Gerhold2023-01-085-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The magnetometer part of ST LSM303C is similar (perhaps even identical) to the already supported standalone LIS3MDL magnetometer, so just add the new st,lsm303c-magn compatible for the existing definitions. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230106102239.9647-4-stephan@gerhold.net Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: accel: st_accel: Add LSM303CStephan Gerhold2023-01-085-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The accelerometer part of ST LSM303C is similar (perhaps even identical) to the already supported standalone LIS2HH12 accelerometer, so just add the new st,lsm303c-accel compatible for the existing definitions. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230106102239.9647-3-stephan@gerhold.net Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | drivers: iio: cdc: Drop redundant if checkAlexander Vorwerk2023-01-081-2/+1
| | | | | | | | | | | | | | | | | | | | | Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Alexander Vorwerk <zabe@avorwerk.net> Link: https://lore.kernel.org/r/20230105025351.12099-1-zabe@avorwerk.net Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: max11410: Use asm intead of asm-genericAndy Shevchenko2023-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no point to specify asm-generic for the unaligned.h. Drop the 'generic' suffix and move the inclusion to be after the non-IIO linux/* ones. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230103144903.39905-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: ti-adc128s052: Sort headersAndy Shevchenko2023-01-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sort the headers in alphabetic order in order to ease the maintenance for this part. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230102173450.29882-4-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: ti-adc128s052: Drop anti-pattern of ACPI_PTR() useAndy Shevchenko2023-01-081-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ACPI_PTR() is more harmful than helpful. For example, in this case if CONFIG_ACPI=n, the ID table left unused and code is obfuscated by ifdeffery. Drop anti-pattern of ACPI_PTR() use. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230102173450.29882-3-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: ti-adc128s052: Switch to use spi_get_device_match_data()Andy Shevchenko2023-01-081-23/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spi_get_device_match_data() helps to get driver data from the firmware node or SPI ID table. Use it instead of open coding. While at it, switch ID tables to provide an acrual pointers to the configuration data. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230102173450.29882-2-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: ep93xx: Enable wider build testing with COMPILE_TESTJonathan Cameron2023-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is useful to be able to build this driver without needing to build support for ARCH_EP93XX. Also add an explicit dependency on HAS_IOMEM so we have devm_platform_ioremap_resource() etc available. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com> Cc: Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Link: https://lore.kernel.org/r/20221231144128.489810-1-jic23@kernel.org
| * | iio: adc: ep93xx: Add OF supportAlexander Sverdlin2022-12-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Prepare for EP93xx conversion to DT. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Link: https://lore.kernel.org/r/20221223162636.6488-2-alexander.sverdlin@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: adc: qcom-spmi-adc5: Suppress probe-deferral error messageMarijn Suijten2022-12-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Much like 807efb7102e8 ("thermal: qcom-spmi-adc-tm5: suppress probe-deferral error message") the ADC5 driver also spams a similar probe-deferral error on startup when a channel is not yet available: [ 0.343136] qcom-spmi-adc-tm5 1c40000.spmi:pmic@0:adc-tm@3500: get dt data failed: -517 Suppress it by using dev_err_probe instead, which also takes care of storing the message as reason for deferring. Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: Martin Botka <martin.botka@somainline.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Link: https://lore.kernel.org/r/20221216190945.902754-1-marijn.suijten@somainline.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: imu: kmx61: Fix spelling mistake "Errow" -> "Error"Colin Ian King2022-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20221209233202.222083-1-colin.i.king@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>