aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-10-25lkdtm/bugs: Check that a per-task stack canary existsKees Cook5-0/+81
Introduce REPORT_STACK_CANARY to check for differing stack canaries between two processes (i.e. that an architecture is correctly implementing per-task stack canaries), using the task_struct canary as the hint to locate in the stack. Requires that one of the processes being tested not be pid 1. Cc: Ard Biesheuvel <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-25selftests/lkdtm: Add way to repeat a testKees Cook1-1/+9
Some LKDTM tests need to be run more than once (usually to setup and then later trigger). Until now, the only case was the SOFT_LOCKUP test, which wasn't useful to run in the bulk selftests. The coming stack canary checking needs to run twice, so support this with a new test output prefix "repeat". Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-25Merge tag 'soundwire-5.16-rc1' of ↵Greg Kroah-Hartman5-43/+70
git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next Vinod writes: soundwire updates for 5.16-rc1 - Update on sysfs wildcard documentation - debugfs update for core and qcom driver - invalid slave pointer fix for bus * tag 'soundwire-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: soundwire: qcom: add debugfs entry for soundwire register dump soundwire: bus: stop dereferencing invalid slave pointer ABI: sysfs-bus-soundwire-slave: use wildcards on What definitions ABI: sysfs-bus-soundwire-master: use wildcards on What definitions soundwire: debugfs: use controller id and link_id for debugfs
2021-10-24iio: frequency: adrf6780: Fix adrf6780_spi_{read,write}()Nathan Chancellor1-2/+2
Clang warns: drivers/iio/frequency/adrf6780.c:117:1: error: all paths through this function will call itself [-Werror,-Winfinite-recursion] { ^ drivers/iio/frequency/adrf6780.c:138:1: error: all paths through this function will call itself [-Werror,-Winfinite-recursion] { ^ 2 errors generated. The underscore variants should be used here. Link: https://github.com/ClangBuiltLinux/linux/issues/1490 Fixes: 63aaf6d06d87 ("iio: frequency: adrf6780: add support for ADRF6780") Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-24Merge tag 'iio-for-5.16b' of ↵Greg Kroah-Hartman34-250/+1467
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: 2nd set of IIO new driver, cleanups and features for the 5.16 cycle New device support * adrf6780 microwave upconverter. - New driver for this interesting device including bindings. Features * lite-on ltr501 - Add dt-bindings including vendor ID and of_device_id table. - Add regulator support. * sensiron,scd4x - Add reporting of channel scale. Cleanups including fixes for things in this cycle * Tree wide: Another set of dev_err_probe() introductions to reduce noise in logs when deferred probing is needed and provide more debug info. Devices included this time: - amlogic,meson_saradc - capella,cm3605 - fsl,imx7d - maxim,max1118 - maxim,max1241 - nxp,lpc18xx - qcom,pm8xxxx-xoadc - rockchip,saradc - sharp,gp2ap002 - sterricson,ab8500 - ti,ads7950 * core - iio:buffer - Fix a path where a ret value is not intialized. * channel-mux - Add support to mux core subsystem for a settling delay and use it in the iio-channel-mux driver. - Fix a few dt binding warnings. * nxp,lpc18xx - Convert to devm_ functions for all of probe and drop remove() * st,lsm6dsx - Suppress a warning due to lack of handling of an enum *_MAX entry that is just there to get the size. * st,stm32-adc - Add generic channel binding, deprecating the old approach. - Add nvmem support to get calibration data for the vrefint channel and use it to perform such calibration. - Add a binding for sample-time to the generic channel description as it can be per channel. * ti,adc128s052 - Use devm_ managed functions and drop remove() * vti,sca3000 - Use sign_extend32() rather than opencoding. * xilinx,xadc - Drop irq field from state structure as now just used in probe. * tag 'iio-for-5.16b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (36 commits) dt-bindings: iio: frequency: add adrf6780 doc iio: frequency: adrf6780: add support for ADRF6780 iio: chemical: scd4x: Add a scale for the co2 concentration reading dt-bindings: iio: io-channel-mux: allow duplicate channel, labels dt-bindings: iio: io-channel-mux: add optional #io-channel-cells iio: adc: adc128s052: Simplify adc128_probe() iio: multiplexer: iio-mux: Support settle-time-us property dt-bindings: iio: io-channel-mux: Add property for settle time mux: add support for delay after muxing iio: adc: stm32-adc: use generic binding for sample-time iio: adc: stm32-adc: add vrefint calibration support iio: adc: stm32-adc: add support of internal channels iio: adc: stm32-adc: add support of generic channels binding iio: adc: stm32-adc: split channel init into several routines dt-bindings: iio: stm32-adc: add nvmem support for vrefint internal channel dt-bindings: iio: stm32-adc: add generic channel binding iio: accel: sca3000: Use sign_extend32() instead of opencoding sign extension. iio: xilinx-xadc: Remove `irq` field from state struct iio: imu: st_lsm6dsx: Avoid potential array overflow in st_lsm6dsx_set_odr() iio: light: gp2ap002: Make use of the helper function dev_err_probe() ...
2021-10-24Merge tag 'iio-fixes-for-5.16a' of ↵Greg Kroah-Hartman7-18/+42
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: First set of IIO fixes for the 5.16 cycle As these are very late in the 5.15 cycle and non are particularly urgent, they can wait for the merge window. Key element in this set is Yang Yingliang has identified a number of issues in error paths introduced recently when we added multiple buffer support. Other fixes: * adi,ad5662 - Fix handling of i2c_master_send() return value. * adi,ad5766 - Fix a wrong dt-property name that indicated wrong units and did not mach the bindings. - Associated 'fix' of the bindings example to have a possible scale. * st,pressure-spi - Add some missing entries to the spi_device_id table to ensure auto-loading works. * ti,tsc2046 - Fix a backwards comparison leading to a false dev_warn * tag 'iio-fixes-for-5.16a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: buffer: Fix memory leak in iio_buffers_alloc_sysfs_and_mask() iio: adc: tsc2046: fix scan interval warning iio: core: fix double free in iio_device_unregister_sysfs() iio: core: check return value when calling dev_set_name() iio: buffer: Fix memory leak in iio_buffer_register_legacy_sysfs_groups() iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask() iio: buffer: Fix memory leak in __iio_buffer_alloc_sysfs_and_mask() iio: buffer: check return value of kstrdup_const() iio: dac: ad5446: Fix ad5622_write() return value Documentation:devicetree:bindings:iio:dac: Fix val drivers: iio: dac: ad5766: Fix dt property name iio: st_pressure_spi: Add missing entries SPI to device ID table
2021-10-22misc: enclosure: replace snprintf in show functions with sysfs_emitYe Guojin1-8/+8
coccicheck complains about the use of snprintf() in sysfs show functions: WARNING use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Ye Guojin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-22Merge tag 'icc-5.16-rc1' of ↵Greg Kroah-Hartman7-910/+4819
git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc into char-misc-next Georgi writes: interconnect changes for 5.16 Here are the changes for the 5.16-rc1 merge window consisting of just driver updates. The highlight is the refactoring of some existing drivers into common code and expanding some macros that will make adding QoS support much easier. Driver changes: - icc-rpm: move bus clocks handling into qnoc_probe - sdm660: expand DEFINE_QNODE macros - sdm660: drop default/unused values - sdm660: merge common code into icc-rpm - icc-rpm: add support for QoS reg offset - msm8916: expand DEFINE_QNODE macros - msm8916: add support for AP-owned nodes - msm8939: expand DEFINE_QNODE macros - msm8939: add support for AP-owned nodes - qcs404: expand DEFINE_QNODE macros - qcom: drop DEFINE_QNODE macro - samsung: describe drivers in KConfig Signed-off-by: Georgi Djakov <[email protected]> * tag 'icc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc: interconnect: samsung: describe drivers in KConfig interconnect: qcom: drop DEFINE_QNODE macro interconnect: qcs404: expand DEFINE_QNODE macros interconnect: msm8939: add support for AP-owned nodes interconnect: msm8939: expand DEFINE_QNODE macros interconnect: msm8916: add support for AP-owned nodes interconnect: msm8916: expand DEFINE_QNODE macros interconnect: icc-rpm: add support for QoS reg offset interconnect: sdm660: merge common code into icc-rpm interconnect: sdm660: drop default/unused values interconnect: sdm660: expand DEFINE_QNODE macros interconnect: icc-rpm: move bus clocks handling into qnoc_probe
2021-10-22Merge tag 'fsi-for-v5.16' of ↵Greg Kroah-Hartman9-127/+282
git://git.kernel.org/pub/scm/linux/kernel/git/joel/fsi into char-misc-next Joel writes: FSI changes for v5.16 - SBEFIFO usersapce interfaces to perform FFDC (First Failure Data Capture) and detect timeouts - A fix to handle multiple messages in flight * tag 'fsi-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/fsi: fsi: sbefifo: Use interruptible mutex locking fsi: sbefifo: Add sysfs file indicating a timeout error docs: ABI: testing: Document the SBEFIFO timeout interface hwmon: (occ) Provide the SBEFIFO FFDC in binary sysfs docs: ABI: testing: Document the OCC hwmon FFDC binary interface fsi: occ: Store the SBEFIFO FFDC in the user response buffer fsi: occ: Use a large buffer for responses hwmon: (occ) Remove sequence numbering and checksum calculation fsi: occ: Force sequence numbering per OCC
2021-10-22fsi: sbefifo: Use interruptible mutex lockingEddie James1-3/+9
Some SBE operations have extremely large responses and can require several minutes to process the response. During this time, the device lock must be held. If another process attempts an operation, it will wait for the mutex for longer than the kernel hung task watchdog allows. Therefore, use the interruptible function to lock the mutex. Signed-off-by: Eddie James <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22fsi: sbefifo: Add sysfs file indicating a timeout errorEddie James1-0/+16
The SBEFIFO timeout error requires special handling in userspace to do recovery operations. Add a sysfs file to indicate a timeout error, and notify pollers when a timeout occurs. This will be used by the openpower-occ-control application. Signed-off-by: Eddie James <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22docs: ABI: testing: Document the SBEFIFO timeout interfaceEddie James1-0/+10
Add documentation for the new sysfs entry that indicates whether or not the SBE has timed out. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22hwmon: (occ) Provide the SBEFIFO FFDC in binary sysfsEddie James1-1/+85
Save any FFDC provided by the OCC driver, and provide it to userspace through a binary sysfs entry. Notify userspace pollers when there is an error too. Signed-off-by: Eddie James <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22docs: ABI: testing: Document the OCC hwmon FFDC binary interfaceEddie James1-0/+13
Add documentation for the new binary sysfs that will dump the SBEFIFO FFDC. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22fsi: occ: Store the SBEFIFO FFDC in the user response bufferEddie James1-18/+48
If the SBEFIFO response indicates an error, store the response in the user buffer and return an error. Previously, the user had no way of obtaining the SBEFIFO FFDC. The user's buffer now contains data in the event of a failure. No change in the event of a successful transfer. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-22fsi: occ: Use a large buffer for responsesEddie James2-66/+46
Allocate a large buffer for each OCC to handle response data. This removes memory allocation during an operation, and also allows for the maximum amount of SBE FFDC. Previously for the putsram and attn commands, only 32 words would have been available, and for getsram, only up to the size of the transfer. SBE FFDC might be up to 8Kb. The SBE interface expects data to be specified in units of words (4 bytes), defined as OCC_MAX_RESP_WORDS. This change allows the full FFDC capture to be implemented, where before it was not available. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-10-21dt-bindings: iio: frequency: add adrf6780 docAntoniu Miclaus1-0/+131
Add device tree bindings for the ADRF6780 Upconverter. Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21iio: frequency: adrf6780: add support for ADRF6780Antoniu Miclaus3-0/+540
The ADRF6780 is a silicon germanium (SiGe) design, wideband, microwave upconverter optimized for point to point microwave radio designs operating in the 5.9 GHz to 23.6 GHz frequency range. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADRF6780.pdf Signed-off-by: Antoniu Miclaus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21iio: chemical: scd4x: Add a scale for the co2 concentration readingRoan van Dijk1-2/+7
This patch adds a scale for the co2 concentration reading. The reading is expressed in percent after applying the scale to the raw value. Signed-off-by: Roan van Dijk <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21dt-bindings: iio: io-channel-mux: allow duplicate channel, labelsPeter Rosin1-2/+3
This is needed since an empty channel label is used to indicate an unused channel, and there can be more that one of those. Fixes the following problem reported by dtbs_check: envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements arch/arm/boot/dts/at91-tse850-3.dt.yaml Suggested-by: Rob Herring <[email protected]> Signed-off-by: Peter Rosin <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21dt-bindings: iio: io-channel-mux: add optional #io-channel-cellsPeter Rosin1-0/+3
Needed for in-kernel use of the child channels of the mux. Fixes problems like this, reported by dtbs_check: adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+' arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml Suggested-by: Vincent Whitchurch <[email protected]> Signed-off-by: Peter Rosin <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21iio: adc: adc128s052: Simplify adc128_probe()Christophe JAILLET1-23/+10
Turn 'adc128_probe()' into a full resource managed function to simplify the code. This way, the .remove function can be removed. Doing so, the only 'spi_get_drvdata()' call is removed and the corresponding 'spi_set_drvdata()' can be removed as well. Suggested-by: Alexandru Ardelean <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Link: https://lore.kernel.org/r/4fa7fcc59c40e27af0569138d656c698a53dbd44.1630002770.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21iio: multiplexer: iio-mux: Support settle-time-us propertyVincent Whitchurch1-1/+6
If the devicetree specifies that the hardware requires a settle time, pass this time on to the mux APIs. Signed-off-by: Vincent Whitchurch <[email protected]> Reviewed-by: Lars-Peter Clausen <[email protected]> Tested-by: Lars-Peter Clausen <[email protected]> Acked-by: Peter Rosin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21dt-bindings: iio: io-channel-mux: Add property for settle timeVincent Whitchurch1-0/+5
Hardware may require some time for the muxed analog signals to settle after the muxing is changed. Allow this time to be specified in the devicetree. Signed-off-by: Vincent Whitchurch <[email protected]> Reviewed-by: Rob Herring <[email protected]> Reviewed-by: Lars-Peter Clausen <[email protected]> Tested-by: Lars-Peter Clausen <[email protected]> Acked-by: Peter Rosin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21mux: add support for delay after muxingVincent Whitchurch3-10/+55
Hardware may require some time for the muxed analog signals to settle after the muxing is changed. Allow users of the mux subsystem to specify this delay with the new mux_control_select_delay() function (and the _try equivalent). Signed-off-by: Vincent Whitchurch <[email protected]> Reviewed-by: Lars-Peter Clausen <[email protected]> Tested-by: Lars-Peter Clausen <[email protected]> Acked-by: Peter Rosin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-21counter: Fix use-after-free race condition for events_queue_size writeWilliam Breathitt Gray3-6/+17
A race condition is possible when writing to events_queue_size where the events kfifo is freed during the execution of a kfifo_in(), resulting in a use-after-free. This patch prevents such a scenario by protecting the events queue in operation with a spinlock and locking before performing the events queue size adjustment. The existing events_lock mutex is renamed to events_out_lock to reflect that it only protects events queue out operations. Because the events queue in operations can occur in an interrupt context, a new events_in_lock spinlock is introduced and utilized. Fixes: feff17a550c7 ("counter: Implement events_queue_size sysfs attribute") Cc: David Lechner <[email protected]> Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-21counter: Cleanup lingering atomic.h includesWilliam Breathitt Gray2-2/+0
With the removal of the chrdev_lock atomic flag, the counter-sysfs.c and counter-chrdev.c no longer needs to include the atomic.h header file. Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-10-21iio: buffer: Fix memory leak in iio_buffers_alloc_sysfs_and_mask()Yang Yingliang1-5/+7
When 'iio_dev_opaque->buffer_ioctl_handler' alloc fails in iio_buffers_alloc_sysfs_and_mask(), the 'attrs' allocated in iio_buffer_register_legacy_sysfs_groups() will be leaked: unreferenced object 0xffff888108568d00 (size 128): comm "88", pid 2014, jiffies 4294963294 (age 26.920s) hex dump (first 32 bytes): 80 3e da 02 80 88 ff ff 00 3a da 02 80 88 ff ff .>.......:...... 00 35 da 02 80 88 ff ff 00 38 da 02 80 88 ff ff .5.......8...... backtrace: [<0000000095a9e51e>] __kmalloc+0x1a3/0x2f0 [<00000000faa3735e>] iio_buffers_alloc_sysfs_and_mask+0xfa3/0x1480 [industrialio] [<00000000a46384dc>] __iio_device_register+0x52e/0x1b40 [industrialio] [<00000000210af05e>] __devm_iio_device_register+0x22/0x80 [industrialio] [<00000000730d7b41>] adjd_s311_probe+0x195/0x200 [adjd_s311] [<00000000c0f70eb9>] i2c_device_probe+0xa07/0xbb0 The iio_buffer_register_legacy_sysfs_groups() is called in __iio_buffer_alloc_sysfs_and_mask(), so move the iio_buffer_unregister_legacy_sysfs_groups() into __iio_buffer_free_sysfs_and_mask(), then the memory will be freed. Reported-by: Hulk Robot <[email protected]> Fixes: d9a625744ed0 ("iio: core: merge buffer/ & scan_elements/ attributes") Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20soundwire: qcom: add debugfs entry for soundwire register dumpSrinivas Kandagatla1-0/+27
For debug purposes add an entry in debugfs to dump Qualcomm SoundWire Controller registers. Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
2021-10-20soundwire: bus: stop dereferencing invalid slave pointerSrinivas Kandagatla1-1/+1
Slave pointer is invalid after end of list iteration, using this would result in below Memory abort. Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004 ... Call trace: __dev_printk+0x34/0x7c _dev_warn+0x6c/0x90 sdw_bus_exit_clk_stop+0x194/0x1d0 swrm_runtime_resume+0x13c/0x238 pm_generic_runtime_resume+0x2c/0x48 __rpm_callback+0x44/0x150 rpm_callback+0x6c/0x78 rpm_resume+0x314/0x558 rpm_resume+0x378/0x558 rpm_resume+0x378/0x558 __pm_runtime_resume+0x3c/0x88 Use bus->dev instead to print this error message. Fixes: b50bb8ba369cd ("soundwire: bus: handle -ENODATA errors in clock stop/start sequences") Signed-off-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
2021-10-20iio: adc: stm32-adc: use generic binding for sample-timeOlivier Moysan1-29/+41
Add st,min-sample-time-nsecs to channel generic binding. Sample time can be defined par channel node. If a channel is configured as differential, the same sample time applies for both inputs. Keep support of legacy st,min-sample-time-nsecs property for backward compatibility. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: stm32-adc: add vrefint calibration supportOlivier Moysan1-6/+68
Add support of vrefint calibration. If a channel is labeled as vrefint, get vrefint calibration from non volatile memory for this channel. vrefint channel is exposed as a processed channel returning the actual value of vrefp: vrefp = 3.3 x vrefint_cal / vrefint_data A conversion on vrefint channel allows to update scale factor according to vrefint deviation, compared to vrefint calibration value. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: stm32-adc: add support of internal channelsOlivier Moysan3-3/+146
Add support of ADC2 internal channels VDDCORE, VREFINT and VBAT. The reserved label name "vddcore", "vrefint" and "vbat" must be used in Device Tree channel node, to enable the corresponding internal channel. Note: This patch does not provide support of internal channels for F4 and H7. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: stm32-adc: add support of generic channels bindingOlivier Moysan1-9/+86
Add support of generic IIO channel binding: ./devicetree/bindings/iio/adc/adc.yaml Keep support of st,adc-channels and st,adc-diff-channels for backward compatibility. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: stm32-adc: split channel init into several routinesOlivier Moysan1-44/+87
Split stm32_adc_chan_of_init channel initialization function into several routines to increase readability and prepare channel generic binding handling. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20dt-bindings: iio: stm32-adc: add nvmem support for vrefint internal channelOlivier Moysan1-0/+8
Add support of nvmem. This allows to retrieve calibration data from OTP for vrefint internal channel. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Acked-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20dt-bindings: iio: stm32-adc: add generic channel bindingOlivier Moysan1-7/+93
Add ADC generic channel binding. This binding should be used as an alternate to legacy channel properties whenever possible. ADC generic channel binding allows to identify supported internal channels through the following reserved label names: "vddcore", "vrefint" and "vbat". This binding also allows to set a different sampling time for each channel. Signed-off-by: Olivier Moysan <[email protected]> Reviewed-by: Fabrice Gasnier <[email protected]> Reviewed-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: accel: sca3000: Use sign_extend32() instead of opencoding sign extension.Jonathan Cameron1-2/+1
Whilst nice to get rid of this non obvious code, this also clears a static checker warning: drivers/iio/accel/sca3000.c:734 sca3000_read_raw() warn: no-op. '((*val) << 19) >> 19' Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Reviewed-by: Lars-Peter Clausen <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2021-10-20iio: xilinx-xadc: Remove `irq` field from state structLars-Peter Clausen2-4/+2
Since commit 2a9685d1a3b7 ("iio: adc: xilinx: use more devres helpers and remove remove()") the `irq` field from XADC driver state struct is only used in the `probe()` function. Use the local `irq` variable throughout the `probe()` function and remove the now unused field from the state struct. Signed-off-by: Lars-Peter Clausen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: imu: st_lsm6dsx: Avoid potential array overflow in st_lsm6dsx_set_odr()Teng Qi1-2/+4
The length of hw->settings->odr_table is 2 and ref_sensor->id is an enum variable whose value is between 0 and 5. However, the value ST_LSM6DSX_ID_MAX (i.e. 5) is not caught properly in switch (sensor->id) { If ref_sensor->id is ST_LSM6DSX_ID_MAX, an array overflow will ocurrs in function st_lsm6dsx_check_odr(): odr_table = &sensor->hw->settings->odr_table[sensor->id]; and in function st_lsm6dsx_set_odr(): reg = &hw->settings->odr_table[ref_sensor->id].reg; To avoid this array overflow, handle ST_LSM6DSX_ID_GYRO explicitly and return -EINVAL for the default case. The enum value ST_LSM6DSX_ID_MAX is only present as an easy way to check the limit and as such is never used, however this is not locally obvious. Reported-by: TOTE Robot <[email protected]> Signed-off-by: Teng Qi <[email protected]> Acked-by: Lorenzo Bianconi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: light: gp2ap002: Make use of the helper function dev_err_probe()Cai Huoqing1-14/+10
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: light: cm3605: Make use of the helper function dev_err_probe()Cai Huoqing1-14/+15
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()Cai Huoqing1-2/+2
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()Cai Huoqing1-15/+12
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()Cai Huoqing1-5/+4
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. BTW, change the return value from 'ENXIO' to 'ENODEV', perfer ENODEV which means no such device. Signed-off-by: Cai Huoqing <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: meson_saradc: Make use of the helper function dev_err_probe()Cai Huoqing1-22/+17
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Reviewed-by: Martin Blumenstingl <[email protected]> Tested-by: Martin Blumenstingl <[email protected]> #Meson8b Odroid-C1 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: max1241: Make use of the helper function dev_err_probe()Cai Huoqing1-9/+8
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: max1118: Make use of the helper function dev_err_probe()Cai Huoqing1-4/+3
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()Cai Huoqing1-8/+6
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-10-20iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()Cai Huoqing1-12/+6
When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>