summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)AuthorFilesLines
2021-10-18Merge tag 'staging-5.15-rc6' of ↵Linus Torvalds14-16/+50
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging and IIO driver fixes from Greg KH: "Here are a number of small IIO and staging driver fixes for 5.15-rc6. They include: - vc04_services bugfix for reported problem - r8188eu array underflow fix - iio driver fixes for a lot of tiny reported issues. All of these have been in linux-next for a while with no reported issues" * tag 'staging-5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask() staging: vc04_services: shut up out-of-range warning iio: light: opt3001: Fixed timeout error when 0 lux iio: adis16480: fix devices that do not support sleep mode iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED iio: adis16475: fix deadlock on frequency set iio: ssp_sensors: add more range checking in ssp_parse_dataframe() iio: ssp_sensors: fix error code in ssp_print_mcu_debug() iio: adc: ad7793: Fix IRQ flag iio: adc: ad7780: Fix IRQ flag iio: adc: ad7192: Add IRQ flag iio: adc: aspeed: set driver data when adc probe. iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume() iio: adc: max1027: Fix the number of max1X31 channels iio: adc: max1027: Fix wrong shift with 12-bit devices iio: adc128s052: Fix the error handling path of 'adc128_probe()' iio: adc: rzg2l_adc: Fix -EBUSY timeout error return iio: accel: fxls8962af: return IRQ_HANDLED when fifo is flushed iio: dac: ti-dac5571: fix an error code in probe()
2021-10-07iio/test-format: build kunit tests without structleak pluginBrendan Higgins1-0/+1
The structleak plugin causes the stack frame size to grow immensely when used with KUnit: ../drivers/iio/test/iio-test-format.c: In function ‘iio_test_iio_format_value_fixedpoint’: ../drivers/iio/test/iio-test-format.c:98:1: warning: the frame size of 2336 bytes is larger than 2048 bytes [-Wframe-larger-than=] Turn it off in this file. Signed-off-by: Brendan Higgins <brendanhiggins@google.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2021-10-03iio: light: opt3001: Fixed timeout error when 0 luxJiri Valek - 2N1-3/+3
Reading from sensor returned timeout error under zero light conditions. Signed-off-by: Jiri Valek - 2N <valek@2n.cz> Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ") Link: https://lore.kernel.org/r/20210920125351.6569-1-valek@2n.cz Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-26iio: adis16480: fix devices that do not support sleep modeNuno Sá1-3/+11
Not all devices supported by this driver support being put to sleep mode. For those devices, when calling 'adis16480_stop_device()' on the unbind path, we where actually writing in the SYNC_SCALE register. Fixes: 80cbc848c4fa0 ("iio: imu: adis16480: Add support for ADIS16490") Fixes: 82e7a1b250170 ("iio: imu: adis16480: Add support for ADIS1649x family of devices") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210903141423.517028-6-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-26iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSEDHui Liu1-0/+8
The previous driver does't apply the necessary scaling to take the voltage range into account. We change readback value from raw data to input voltage to fix case IIO_CHAN_INFO_PROCESSED. Fixes: ace4cdfe67be ("iio: adc: mt2701: Add Mediatek auxadc driver for mt2701.") Signed-off-by: Hui Liu <hui.liu@mediatek.com> Link: https://lore.kernel.org/r/20210926073028.11045-2-hui.liu@mediatek.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-25iio: adis16475: fix deadlock on frequency setNuno Sá1-1/+2
With commit 39c024b51b560 ("iio: adis16475: improve sync scale mode handling"), two deadlocks were introduced: 1) The call to 'adis_write_reg_16()' was not changed to it's unlocked version. 2) The lock was not being released on the success path of the function. This change fixes both these issues. Fixes: 39c024b51b560 ("iio: adis16475: improve sync scale mode handling") Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210920090047.74903-1-nuno.sa@analog.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-18iio: ssp_sensors: add more range checking in ssp_parse_dataframe()Dan Carpenter1-1/+8
The "idx" is validated at the start of the loop but it gets incremented during the iteration so it needs to be checked again. Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210909091336.GA26312@kili Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-18iio: ssp_sensors: fix error code in ssp_print_mcu_debug()Dan Carpenter1-1/+1
The ssp_print_mcu_debug() function should return negative error codes on error. Returning "length" is meaningless. This change does not affect runtime because the callers only care about zero/non-zero. Reported-by: Jonathan Cameron <jic23@kernel.org> Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210914105333.GA11657@kili Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: ad7793: Fix IRQ flagAlexandru Tachici1-1/+1
In Sigma-Delta devices the SDO line is also used as an interrupt. Leaving IRQ on level instead of falling might trigger a sample read when the IRQ is enabled, as the SDO line is already low. Not sure if SDO line will always immediately go high in ad_sd_buffer_postenable before the IRQ is enabled. Also the datasheet seem to explicitly say the falling edge of the SDO should be used as an interrupt: >From the AD7793 datasheet: " The DOUT/RDY falling edge can be used as an interrupt to a processor" Fixes: da4d3d6bb9f6 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags") Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210906065630.16325-4-alexandru.tachici@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: ad7780: Fix IRQ flagAlexandru Tachici1-1/+1
Correct IRQ flag here is falling. In Sigma-Delta devices the SDO line is also used as an interrupt. Leaving IRQ on level instead of falling might trigger a sample read when the IRQ is enabled, as the SDO line is already low. Not sure if SDO line will always immediately go high in ad_sd_buffer_postenable before the IRQ is enabled. Also the datasheet seem to explicitly say the falling edge of the SDO should be used as an interrupt: >From the AD7780 datasheet: " The DOUT/Figure 22 RDY falling edge can be used as an interrupt to a processor" Fixes: da4d3d6bb9f6 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags") Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210906065630.16325-3-alexandru.tachici@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: ad7192: Add IRQ flagAlexandru Tachici1-0/+1
IRQ type in ad_sigma_delta_info struct was missing. In Sigma-Delta devices the SDO line is also used as an interrupt. Leaving IRQ on level instead of falling might trigger a sample read when the IRQ is enabled, as the SDO line is already low. Not sure if SDO line will always immediately go high in ad_sd_buffer_postenable before the IRQ is enabled. Also the datasheet seem to explicitly say the falling edge of the SDO should be used as an interrupt: >From the AD7192 datasheet: "The DOUT/RDY falling edge can be used as an interrupt to a processor," Fixes: da4d3d6bb9f6 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags") Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210906065630.16325-2-alexandru.tachici@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: aspeed: set driver data when adc probe.Billy Tsai1-0/+1
Fix the issue when adc remove will get the null driver data. Fixed: commit 573803234e72 ("iio: Aspeed ADC") Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com> Link: https://lore.kernel.org/r/20210831071458.2334-2-billy_tsai@aspeedtech.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in ↵Yang Yingliang1-1/+3
rzg2l_adc_pm_runtime_resume() Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume(). Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20210819132416.175644-1-yangyingliang@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: max1027: Fix the number of max1X31 channelsMiquel Raynal1-1/+0
The macro MAX1X29_CHANNELS() already calls MAX1X27_CHANNELS(). Calling MAX1X27_CHANNELS() before MAX1X29_CHANNELS() in the definition of MAX1X31_CHANNELS() declares the first 8 channels twice. So drop this extra call from the MAX1X31 channels list definition. Fixes: 7af5257d8427 ("iio: adc: max1027: Prepare the introduction of different resolutions") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210818111139.330636-3-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: max1027: Fix wrong shift with 12-bit devicesMiquel Raynal1-1/+1
10-bit devices must shift the value twice. This is not needed anymore on 12-bit devices. Fixes: ae47d009b508 ("iio: adc: max1027: Introduce 12-bit devices support") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20210818111139.330636-2-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc128s052: Fix the error handling path of 'adc128_probe()'Christophe JAILLET1-0/+6
A successful 'regulator_enable()' call should be balanced by a corresponding 'regulator_disable()' call in the error handling path of the probe, as already done in the remove function. Update the error handling path accordingly. Fixes: 913b86468674 ("iio: adc: Add TI ADC128S052") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/85189f1cfcf6f5f7b42d8730966f2a074b07b5f5.1629542160.git.christophe.jaillet@wanadoo.fr Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: adc: rzg2l_adc: Fix -EBUSY timeout error returnColin Ian King1-1/+1
Currently when a timeout occurs in rzg2l_adc_hw_init the error -EBUSY is assigned to ret but the error code is used as the function is hard-coded to return 0. The variable ret is 0 before entering the while-loop hence the fix is just to return ret at the end of the function to return the success 0 or -EBUSY return code. Addresses-Coverity: ("Unused value") Fixes: d484c21bacfa ("iio: adc: Add driver for Renesas RZ/G2L A/D converter") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://lore.kernel.org/r/20210817172111.495897-1-colin.king@canonical.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: accel: fxls8962af: return IRQ_HANDLED when fifo is flushedSean Nyekjaer1-1/+1
fxls8962af_fifo_flush() will return the samples flushed. So return IRQ_NONE only if an error is returned. Fixes: 79e3a5bdd9ef ("iio: accel: fxls8962af: add hw buffered sampling") Signed-off-by: Sean Nyekjaer <sean@geanix.com> Link: https://lore.kernel.org/r/20210817124336.1672169-1-sean@geanix.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14iio: dac: ti-dac5571: fix an error code in probe()Dan Carpenter1-0/+1
If we have an unexpected number of channels then return -EINVAL instead of returning success. Fixes: df38a4a72a3b ("iio: dac: add TI DAC5571 family support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20210816183954.GB2068@kili Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-08Merge branch 'akpm' (patches from Andrew)Linus Torvalds2-4/+2
Merge more updates from Andrew Morton: "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f. Subsystems affected by this patch series: mm (memory-hotplug, rmap, ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan), alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib, checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig, selftests, ipc, and scripts" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (94 commits) scripts: check_extable: fix typo in user error message mm/workingset: correct kernel-doc notations ipc: replace costly bailout check in sysvipc_find_ipc() selftests/memfd: remove unused variable Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH configs: remove the obsolete CONFIG_INPUT_POLLDEV prctl: allow to setup brk for et_dyn executables pid: cleanup the stale comment mentioning pidmap_init(). kernel/fork.c: unexport get_{mm,task}_exe_file coredump: fix memleak in dump_vma_snapshot() fs/coredump.c: log if a core dump is aborted due to changed file permissions nilfs2: use refcount_dec_and_lock() to fix potential UAF nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group nilfs2: fix NULL pointer in nilfs_##name##_attr_release nilfs2: fix memory leak in nilfs_sysfs_create_device_group trap: cleanup trap_init() init: move usermodehelper_enable() to populate_rootfs() ...
2021-09-08iio/drivers/hid-sensor: use HZ macrosDaniel Lezcano1-2/+1
HZ unit conversion macros are available in units.h, use them and remove the duplicate definition. Link: https://lkml.kernel.org/r/20210816114732.1834145-8-daniel.lezcano@linaro.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Chanwoo Choi <cw00.choi@samsung.com> Cc: Christian Eggers <ceggers@arri.de> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Lukasz Luba <lukasz.luba@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-08iio/drivers/as73211: use HZ macrosDaniel Lezcano1-2/+1
HZ unit conversion macros are available in units.h, use them and remove the duplicate definition. Link: https://lkml.kernel.org/r/20210816114732.1834145-6-daniel.lezcano@linaro.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Christian Eggers <ceggers@arri.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Chanwoo Choi <cw00.choi@samsung.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Lukasz Luba <lukasz.luba@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-01Merge tag 'staging-5.15-rc1' of ↵Linus Torvalds80-687/+2386
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull IIO and staging driver updates from Greg KH: "Here is the big set of staging and IIO driver updates for 5.15-rc1. Also included in here are the counter driver subsystem updates as the IIO drivers needed them. Lots of churn in some staging drivers, we dropped the "old" rtl8188eu driver and replaced it with a newer version of the driver that had been maintained out-of-tree by Larry with the end goal of actually being able to get this driver out of staging eventually. Despite that driver being "newer" the line count of this pull request is going up. Some drivers moved out of staging as well, which is always nice to see, that is why there are additions to the mfc and misc driver subsystems. All of these were acked by the various subsystem maintainers involved. But by far, as normal, it's coding style cleanups all over the drivers/staging/ tree in here. Full details of these changes are in the shortlog. All of these have been in linux-next for a while with no reported problems" [ Note: the r8188eu merge clashed with commit 89939e890605 ("staging: rtlwifi: use siocdevprivate") from the networking tree. When resolving the issue, I noted that the whole r8188eu rtw_android code is dead since commit ae7471cae00a ("staging: r8188eu: remove rtw_ioctl function"). End result: the merge resolution was to throw all of that away, rather than do the mindless fixup to code that isn't actually reachable - Linus ] * tag 'staging-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (551 commits) staging: vt6655: Remove filenames in files staging: r8188eu: add extra TODO entries staging: vt6656: Remove filenames in files staging: wlan-ng: fix invalid assignment warning staging: r8188eu: rename fields of struct rtl_ps staging: r8188eu: remove ODM_DynamicPrimaryCCA_DupRTS() staging: r8188eu: rename fields of struct dyn_primary_cca staging: r8188eu: rename struct field Wifi_Error_Status staging: r8188eu: Provide a TODO file for this driver staging: r8188eu: remove unneeded variable staging: r8188eu: remove unneeded conversions to bool staging: r8188eu: remove {read,write}_macreg staging: r8188eu: core: remove condition with no effect staging: r8188eu: remove ethernet.h header file staging: r8188eu: remove ip.h header file staging: r8188eu: remove if_ether.h header file staging: r8188eu: make rtw_deinit_intf_priv return void staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c ...
2021-08-30Merge tag 'for-v5.15' of ↵Linus Torvalds1-0/+23
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "Battery/charger related: - cros-peripheral-charger: new driver - mt6360-charger: new driver - simple-battery: support reading chemistry info - max17042-battery: add max77849 support - sbs-battery: add time_to_empty_now support - smb347-charger: prepare USB OTG support - rn5t618: add voltage_now support - axp288: cleanup & optimizations - max17042_battery: cleanups - ab8500: cleanups - misc minor cleanups and DT binding fixes reset related: - tps65086-restart: new driver - linkstation-poweroff: support NETGEAR ReadyNAS Duo v2" * tag 'for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (51 commits) power: supply: core: Fix parsing of battery chemistry/technology power: supply: max17042_battery: log SOC threshold using debug log level power: supply: max17042_battery: more robust chip type checks power: supply: max17042_battery: fix typo in MAx17042_TOFF power: supply: max17042_battery: clean up MAX17055_V_empty power: supply: smb347-charger: Implement USB VBUS regulator power: supply: smb347-charger: Add missing pin control activation power: supply: smb347-charger: Utilize generic regmap caching power: supply: smb347-charger: Make smb347_set_writable() IRQ-safe dt-bindings: power: supply: smb347-charger: Document USB VBUS regulator power: reset: Add TPS65086 restart driver dt-bindings: power: supply: max17042: describe interrupt power: supply: max17042: remove duplicated STATUS bit defines power: supply: max17042: handle fails of reading status register power: supply: core: Parse battery chemistry/technology dt-bindings: power: Extend battery bindings with chemistry power: reset: linkstation-poweroff: add new device power: reset: linkstation-poweroff: prepare for new devices power: supply: bq24735: reorganize ChargeOption command macros power: supply: rn5t618: Add voltage_now property ...
2021-08-17Merge tag 'iio-for-5.15b' of ↵Greg Kroah-Hartman9-52/+1027
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 2nd set of new IIO device support and cleanups for the 5.15 cycle. A small pull request to pick up a few new drivers and some cleanup and fix patches. New device support * ad5110 non-volatile digital potentiometer - New driver * renesas rzl/gl2 12-bit / 8 channel ADC block - New driver and bindings Minor or late breaking fixes and cleanups * ltc2983 - Fix a false assumption of initial interrupt during probe(). * hp03 - Use devm_* to simplify probe and allow the remove function to be dropped. * rockchip_saradc - Use a regulator notifier to reduce overheads of querying the scale. * tag 'iio-for-5.15b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: adc: Add driver for Renesas RZ/G2L A/D converter dt-bindings: iio: adc: Add binding documentation for Renesas RZ/G2L A/D converter iio: pressure: hp03: update device probe to register with devm functions iio: adc: rockchip_saradc: add voltage notifier so get referenced voltage once at probe iio: ltc2983: fix device probe iio: potentiometer: Add driver support for AD5110 dt-bindings: iio: potentiometer: Add AD5110 in trivial-devices
2021-08-16Merge 5.14-rc6 into staging-nextGreg Kroah-Hartman6-8/+10
We need the IIO fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-15iio: adc: Add driver for Renesas RZ/G2L A/D converterLad Prabhakar3-0/+611
Add ADC driver support for Renesas RZ/G2L A/D converter in SW trigger mode. A/D Converter block is a successive approximation analog-to-digital converter with a 12-bit accuracy and supports a maximum of 8 input channels. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20210804202118.25745-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15iio: pressure: hp03: update device probe to register with devm functionsThéo Borém Fabris1-29/+7
Update device probe to register resources with device-managed functions. Further, get rid of device-specific remove callback which is no longer needed. Signed-off-by: Théo Borém Fabris <theobf@usp.br> Link: https://lore.kernel.org/r/20210809203014.10955-1-theobf@usp.br Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15iio: adc: rockchip_saradc: add voltage notifier so get referenced voltage ↵David Wu1-7/+40
once at probe Add voltage notifier, no need to query regulator voltage for every saradc read, just get regulator voltage once at probe. Signed-off-by: David Wu <david.wu@rock-chips.com> Signed-off-by: Simon Xue <xxm@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://lore.kernel.org/r/20210810011007.54066-1-xxm@rock-chips.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15iio: ltc2983: fix device probeNuno Sá1-16/+14
There is no reason to assume that the IRQ rising edge (indicating that the device start up phase is done) will happen after we request the IRQ. If the device is already up by the time we request it, the call to 'wait_for_completion_timeout()' will timeout and we will fail the device probe even though there's nothing wrong. Fix it by just polling the status register until we get the indication that the device is up and running. As a side effect of this fix, requesting the IRQ is also moved to after the setup function. Fixes: f110f3188e563 ("iio: temperature: Add support for LTC2983") Reported-and-tested-by: Drew Fustini <drew@pdp7.com> Reviewed-by: Drew Fustini <drew@pdp7.com> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210811133220.190264-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15iio: potentiometer: Add driver support for AD5110Mugilraj Dhavachelvan3-0/+355
The AD5110/AD5112/AD5114 provide a nonvolatile solution for 128-/64-/32-position adjustment applications, offering guaranteed low resistor tolerance errors of ±8% and up to ±6 mA current density. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5110_5112_5114.pdf Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210814175607.48399-3-dmugil2000@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-13iio: adc: rn5t618: Add iio mapAndreas Kemnade1-0/+23
Add iio map to allow power driver to read out values as a consumer. This approach does not block later addition of devicetree support which would be helpful if there is an in-kernel consumer for AIN0/1. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-08-09iio: hid-sensor-press: Add timestamp channelYe Xiang1-16/+24
Each sample has a timestamp field with this change. This timestamp may be from the sensor hub when present or local kernel timestamp. The unit of timestamp is nanosecond. Signed-off-by: Ye Xiang <xiang.ye@intel.com> Link: https://lore.kernel.org/r/20210731032556.26813-1-xiang.ye@intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: accel: bmc150: Add support for BMC156Stephan Gerhold5-9/+45
BMC156 is another accelerometer that works just fine with the bmc150-accel driver. It's very similar to BMC150 (also a accelerometer + magnetometer combo) but with only one accelerometer interrupt pin. It would make sense if only INT1 was exposed but someone at Bosch decided to only have an INT2 pin. Try to deal with this by making use of the INT2 support introduced in the previous commit and force using INT2 for BMC156. To detect that we need to bring up a simplified version of the previous type IDs. Note that unlike the type IDs removed in commit c06a6aba6835 ("iio: accel: bmc150: Drop misleading/duplicate chip identifiers") here I only add one for the special case of BMC156. Everything else still happens by reading the CHIP_ID register since the chip type information often is not accurate in ACPI tables. Tested-by: Nikita Travkin <nikita@trvn.ru> # BMC156 Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20210802155657.102766-5-stephan@gerhold.net Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: accel: bmc150: Make it possible to configure INT2 instead of INT1Stephan Gerhold1-12/+59
Some Bosch accelerometers have two interrupt pins (INT1 and INT2). At the moment, the driver uses only the first one, which is fine for most situations. However, some boards might only have INT2 connected for some reason. Add the necessary bits and configuration to set up INT2. Then try to detect this situation at least for device tree setups by checking if the first interrupt (the one picked by the I2C/SPI core) is actually named "INT2" using the interrupt-names property. of_irq_get_byname() returns either 0 or some error code in case the driver probed without device tree, so in all other cases we fall back to configuring INT1 as before. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210802155657.102766-4-stephan@gerhold.net Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: light: cm3323: Add of_device_id tableSiddharth Manthan1-0/+7
Add an of_device_id table to explicitly support the Capella cm3323 Ambient Light Sensor rather than relying on matching against the i2c_device_id table. Signed-off-by: Siddharth Manthan <siddharth.manthan@gmail.com> Link: https://lore.kernel.org/r/20210728110048.14593-2-siddharth.manthan@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: chemical: Add driver support for sgp40Andreas Klinger3-0/+390
sgp40 is a gas sensor used for measuring the air quality. This driver is reading the raw resistance value which can be passed to an userspace algorithm for further calculation. The raw value is also used to calculate an estimated absolute voc index in the range from 0 to 500. For this purpose the raw_mean value of the resistance for which the index value is 250 might be set up as a calibration step. This can be done with in_resistance_calibbias. Compensation of relative humidity and temperature is supported and can be used by writing to output values of out_humidityrelative_raw and out_temp_raw. There is a predecesor sensor type (sgp30) already existing. This driver module was not extended because the new sensor is quite different in its i2c telegrams. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20210804154641.GA3237@arbad Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: ep93xx: Prepare clock before using itAlexander Sverdlin1-3/+3
Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch to Common Clock Framework, otherwise the following is visible: WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:1011 clk_core_enable+0x9c/0xbc Enabling unprepared ep93xx-adc CPU: 0 PID: 1 Comm: swapper Not tainted 5.13.0-rc5-... #1 Hardware name: Cirrus Logic EDB9302 Evaluation Board [<c000d5b0>] (unwind_backtrace) from [<c000c590>] (show_stack+0x10/0x18) [<c000c590>] (show_stack) from [<c03a5f38>] (dump_stack+0x20/0x2c) [<c03a5f38>] (dump_stack) from [<c03a2098>] (__warn+0x98/0xc0) [<c03a2098>] (__warn) from [<c03a2150>] (warn_slowpath_fmt+0x90/0xc0) [<c03a2150>] (warn_slowpath_fmt) from [<c01d8358>] (clk_core_enable+0x9c/0xbc) [<c01d8358>] (clk_core_enable) from [<c01d8698>] (clk_core_enable_lock+0x18/0x30) [<c01d8698>] (clk_core_enable_lock) from [<c0266560>] (ep93xx_adc_probe+0xe4/0x1a0) [<c0266560>] (ep93xx_adc_probe) from [<c02126e0>] (platform_probe+0x34/0x80) [<c02126e0>] (platform_probe) from [<c0210bf8>] (really_probe+0xe8/0x394) [<c0210bf8>] (really_probe) from [<c0211464>] (device_driver_attach+0x5c/0x64) [<c0211464>] (device_driver_attach) from [<c02114e8>] (__driver_attach+0x7c/0xec) [<c02114e8>] (__driver_attach) from [<c020f1b4>] (bus_for_each_dev+0x78/0xc4) [<c020f1b4>] (bus_for_each_dev) from [<c0211570>] (driver_attach+0x18/0x24) [<c0211570>] (driver_attach) from [<c020fab4>] (bus_add_driver+0x140/0x1cc) [<c020fab4>] (bus_add_driver) from [<c0211c44>] (driver_register+0x74/0x114) [<c0211c44>] (driver_register) from [<c02134f8>] (__platform_driver_register+0x18/0x24) [<c02134f8>] (__platform_driver_register) from [<c0470148>] (ep93xx_adc_driver_init+0x10/0x1c) [<c0470148>] (ep93xx_adc_driver_init) from [<c045ce88>] (do_one_initcall+0x7c/0x1a4) [<c045ce88>] (do_one_initcall) from [<c045d184>] (kernel_init_freeable+0x17c/0x1fc) [<c045d184>] (kernel_init_freeable) from [<c03a64d0>] (kernel_init+0x8/0xf8) [<c03a64d0>] (kernel_init) from [<c00082d8>] (ret_from_fork+0x14/0x3c) ... ep93xx-adc ep93xx-adc: Cannot enable clock ep93xx-adc: probe of ep93xx-adc failed with error -108 Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Link: https://lore.kernel.org/r/20210613233041.128961-2-alexander.sverdlin@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: adc: fsl-imx25-gcq: adjust irq check to match docs and simplify codeTang Bin1-6/+3
For the function of platform_get_irq(), the example in platform.c is * int irq = platform_get_irq(pdev, 0); * if (irq < 0) * return irq; the return value of zero is unnecessary to check, so make the right check and simplify code. Note that platform_get_irq() is documented as never returning 0 so this is a minor optmization rather than a fix. Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20210802120929.33760-1-tangbin@cmss.chinamobile.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio: dac: max5821: convert device register to device managed functionThéo Borém Fabris1-24/+17
Add a device managed hook, via devm_add_action_or_reset() and max5821_regulator_disable(), to disable voltage regulator on device detach. Replace iio_device_register() by devm_iio_device_register() and remove the max5821_remove() function used to unregister the device and disable the voltage regulator. Remove i2c_set_clientdata() from the probe function, since i2c_get_clientdata() is not used anymore. Remove regulator_disable() calls from the probe function. Signed-off-by: Théo Borém Fabris <theobf@usp.br> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210724220159.11998-1-theobf@usp.br Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio/adc: ingenic: add JZ4760B support to the sadc driverChristophe Branchereau1-0/+10
The JZ4760B variant differs slightly from the JZ4760: it has a bit called VBAT_SEL in the CFG register. In order to correctly sample the battery voltage on existing handhelds using this SOC, the bit must be cleared. We leave the possibility to set the bit, by using the "ingenic,use-internal-divider" in the devicetree. Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com> Link: https://lore.kernel.org/r/20210726082033.351533-5-cbranchereau@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio/adc: ingenic: add JZ4760 support to the sadc driverChristophe Branchereau1-4/+78
The jz4760 sadc is very similar to the jz4770 one, but has a VREF of 2.5V and 3 aux channels. modify ingenic_adc_read_chan_info_raw() needs a change to account for it. Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20210726082033.351533-4-cbranchereau@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio/adc: ingenic: rename has_aux2 to has_aux_mdChristophe Branchereau1-5/+5
The jz4760(b) socs have 3 aux channels. The purpose of has_aux2 is to set the MD bits used to select the AUX channel to be sampled, not to describe the hardware. Rename it to a more appropriate name. Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20210726082033.351533-2-cbranchereau@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio: sx9310: Support ACPI propertyGwendal Grignou1-32/+16
Use device_property_read_... to support both device tree and ACPI bindings. Simplify the logic for reading "combined-sensors" array, as we assume it has been vetted at firmware build time. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20210728181757.187627-1-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31iio: adc: Fix incorrect exit of for-loopColin Ian King1-2/+2
Currently the for-loop that scans for the optimial adc_period iterates through all the possible adc_period levels because the exit logic in the loop is inverted. I believe the comparison should be swapped and the continue replaced with a break to exit the loop at the correct point. Addresses-Coverity: ("Continue has no effect") Fixes: e08e19c331fb ("iio:adc: add iio driver for Palmas (twl6035/7) gpadc") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210730071651.17394-1-colin.king@canonical.com Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25iio: adc: meson-saradc: Fix indentation of arguments after a line-breakMartin Blumenstingl1-4/+4
Align the function arguments after a line-break with the opening parenthesis on the previous line. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20210717233718.332267-4-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25iio: adc: meson-saradc: Add missing space between if and parenthesisMartin Blumenstingl1-1/+1
Add a missing space between if and the opening parenthesis to make the coding style consistent across the whole driver. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20210717233718.332267-3-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25iio: adc: meson-saradc: Disable BL30 integration on G12A and newer SoCsMartin Blumenstingl1-1/+9
G12A and newer don't use the SAR ADC to read the SoC temperature from within the firmware. Instead there's now a dedicated thermal sensor. Disable the BL30 integration for G12A and newer SoCs to save a few CPU cycles when reading samples. Adding a separate struct meson_sar_adc_data is a good idea anyways because starting with G12A there's some extra registers to read the samples in a simplified way. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20210717233718.332267-2-martin.blumenstingl@googlemail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-24iio: humidity: hdc100x: Add margin to the conversion timeChris Lesiak1-2/+4
The datasheets have the following note for the conversion time specification: "This parameter is specified by design and/or characterization and it is not tested in production." Parts have been seen that require more time to do 14-bit conversions for the relative humidity channel. The result is ENXIO due to the address phase of a transfer not getting an ACK. Delay an additional 1 ms per conversion to allow for additional margin. Fixes: 4839367d99e3 ("iio: humidity: add HDC100x support") Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20210614141820.2034827-1-chris.lesiak@licor.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-24iio: gyro: st_gyro: use devm_iio_triggered_buffer_setup() for bufferAlexandru Ardelean3-16/+3
The st_gyro_allocate_ring() function calls iio_triggered_buffer_setup() to allocate a triggered buffer. But the same can be done with devm_iio_triggered_buffer_setup() and then the st_gyro_common_remove() no longer needs to manually deallocate it. We know that the parent of the IIO device is used to manage other instances of the devm unwind, so it can be used in the st_gyro_allocate_ring() as well. Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210720074642.223293-4-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>