summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'spi-v5.13' of ↵Linus Torvalds2021-04-261-2/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "The only core work for SPI this time around is the completion of the conversion to the new style method for specifying transfer delays, meaning we can cope with what most controllers support more directly using conversions in the core rather than open coding in drivers. Otherwise it's a good stack of cleanups and fixes plus a few new drivers. Summary: - Completion of the conversion to new style transfer delay configuration - Introduction and use of module_parport_driver() helper, merged here as there's no parport tree - Support for Altera SoCs on DFL buses, NXP i.MX8DL, HiSilicon Kunpeng, MediaTek MT8195" * tag 'spi-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (113 commits) spi: Rename enable1 to activate in spi_set_cs() spi: Convert Freescale QSPI binding to json schema spi: stm32-qspi: fix debug format string spi: tools: make a symbolic link to the header file spi.h spi: fsi: add a missing of_node_put spi: Make error handling of gpiod_count() call cleaner spidev: Add Micron SPI NOR Authenta device compatible spi: brcm,spi-bcm-qspi: convert to the json-schema spi: altera: Add DFL bus driver for Altera API Controller spi: altera: separate core code from platform code spi: stm32-qspi: Fix compilation warning in ARM64 spi: Handle SPI device setup callback failure. spi: sync up initial chipselect state spi: stm32-qspi: Add dirmap support spi: stm32-qspi: Trigger DMA only if more than 4 bytes to transfer spi: stm32-qspi: fix pm_runtime usage_count counter spi: spi-zynqmp-gqspi: return -ENOMEM if dma_map_single fails spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op spi: spi-zynqmp-gqspi: Resolved slab-out-of-bounds bug spi: spi-zynqmp-gqspi: fix hang issue when suspend/resume ...
* \ Merge tag 'acpi-5.13-rc1' of ↵Linus Torvalds2021-04-261-3/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI updates from Rafael Wysocki: "These update the ACPICA code in the kernel to the most recent upstream revision including (but not limited to) new material introduced in the 6.4 version of the spec, update message printing in the ACPI-related code, address a few issues and clean up code in a number of places. Specifics: - Update ACPICA code in the kernel to upstream revision 20210331 including the following changes: * Add parsing for IVRS IVHD 40h and device entry F0h (Alexander Monakov). * Add new CEDT table for CXL 2.0 and iASL support for it (Ben Widawsky, Bob Moore). * NFIT: add Location Cookie field (Bob Moore). * HMAT: add new fields/flags (Bob Moore). * Add new flags in SRAT (Bob Moore). * PMTT: add new fields/structures (Bob Moore). * Add CSI2Bus resource template (Bob Moore). * iASL: Decode subtable type field for VIOT (Bob Moore). * Fix various typos and spelling mistakes (Colin Ian King). * Add new predefined objects _BPC, _BPS, and _BPT (Erik Kaneda). * Add USB4 capabilities UUID (Erik Kaneda). * Add CXL ACPI device ID and _CBR object (Erik Kaneda). * MADT: add Multiprocessor Wakeup Structure (Erik Kaneda). * PCCT: add support for subtable type 5 (Erik Kaneda). * PPTT: add new version of subtable type 1 (Erik Kaneda). * Add SDEV secure access components (Erik Kaneda). * Add support for PHAT table (Erik Kaneda). * iASL: Add definitions for the VIOT table (Jean-Philippe Brucker). * acpisrc: Add missing conversion for VIOT support (Jean-Philippe Brucker). * IORT: Updates for revision E.b (Shameer Kolothum). - Rearrange message printing in ACPI-related code to avoid using the ACPICA's internal message printing macros outside ACPICA and do some related code cleanups (Rafael Wysocki). - Modify the device enumeration code to turn off all of the unused ACPI power resources at the end (Rafael Wysocki). - Change the ACPI power resources handling code to turn off unused ACPI power resources without checking their status which should not be necessary by the spec (Rafael Wysocki). - Add empty stubs for CPPC-related functions to be used when CONFIG_ACPI_CPPC_LIB is not set (Rafael Wysocki). - Simplify device enumeration code (Rafael Wysocki). - Change device enumeration code to use match_string() for string matching (Andy Shevchenko). - Modify irqresource_disabled() to retain the resouce flags that have been set already (Angela Czubak). - Add native backlight whitelist entry for GA401/GA502/GA503 (Luke Jones). - Modify the ACPI backlight driver to let the native backlight handling take over on hardware-reduced systems (Hans de Goede). - Introduce acpi_dev_get() and switch over the ACPI core code to using it (Andy Shevchenko). - Use kobj_attribute as callback argument instead of a local struct type in the CPPC linrary code (Nathan Chancellor). - Drop unneeded initializatio of a static variable from the ACPI processor driver (Tian Tao). - Drop unnecessary local variable assignment from the ACPI APEI code (Colin Ian King). - Document for_each_acpi_dev_match() macro (Andy Shevchenko). - Address assorted coding style issues in multiple places (Xiaofei Tan). - Capitalize TLAs in a few comments (Andy Shevchenko). - Correct assorted typos in comments (Tom Saeger)" * tag 'acpi-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (68 commits) ACPI: video: use native backlight for GA401/GA502/GA503 ACPI: APEI: remove redundant assignment to variable rc ACPI: utils: Capitalize abbreviations in the comments ACPI: utils: Document for_each_acpi_dev_match() macro ACPI: bus: Introduce acpi_dev_get() and reuse it in ACPI code ACPI: scan: Utilize match_string() API resource: Prevent irqresource_disabled() from erasing flags ACPI: CPPC: Replace cppc_attr with kobj_attribute ACPI: scan: Call acpi_get_object_info() from acpi_set_pnp_ids() ACPI: scan: Drop sta argument from acpi_init_device_object() ACPI: scan: Drop sta argument from acpi_add_single_object() ACPI: scan: Rearrange checks in acpi_bus_check_add() ACPI: scan: Fold acpi_bus_type_and_status() into its caller ACPI: video: Check LCD flag on ACPI-reduced-hardware devices ACPI: utils: Add acpi_reduced_hardware() helper ACPI: dock: fix some coding style issues ACPI: sysfs: fix some coding style issues ACPI: PM: add a missed blank line after declarations ACPI: custom_method: fix a coding style issue ACPI: CPPC: fix some coding style issues ...
| * \ Merge branch 'acpi-messages'Rafael J. Wysocki2021-04-261-3/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * acpi-messages: hwmon: acpi_power_meter: Get rid of ACPICA message printing IIO: acpi-als: Get rid of ACPICA message printing ACPI: utils: Introduce acpi_evaluation_failure_warn() ACPI: Drop unused ACPI_*_COMPONENT definitions and update documentation ACPI: sysfs: Get rid of ACPICA message printing
| | * | IIO: acpi-als: Get rid of ACPICA message printingRafael J. Wysocki2021-03-081-3/+1
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use acpi_evaluation_failure_warn() introduced previously instead of the ACPICA-specific ACPI_EXCEPTION() macro to log warning messages regarding ACPI object evaluation failures and drop the ACPI_MODULE_NAME() definition only used by the ACPICA message printing macro. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | Merge tag 'arm-drivers-5.13' of ↵Linus Torvalds2021-04-261-50/+50
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull ARM SoC driver updates from Arnd Bergmann: "Updates for SoC specific drivers include a few subsystems that have their own maintainers but send them through the soc tree: TEE/OP-TEE: - Add tracepoints around calls to secure world Memory controller drivers: - Minor fixes for Renesas, Exynos, Mediatek and Tegra platforms - Add debug statistics to Tegra20 memory controller - Update Tegra bindings and convert to dtschema ARM SCMI Firmware: - Support for modular SCMI protocols and vendor specific extensions - New SCMI IIO driver - Per-cpu DVFS The other driver changes are all from the platform maintainers directly and reflect the drivers that don't fit into any other subsystem as well as treewide changes for a particular platform. SoCFPGA: - Various cleanups contributed by Krzysztof Kozlowski Mediatek: - add MT8183 support to mutex driver - MMSYS: use per SoC array to describe the possible routing - add MMSYS support for MT8183 and MT8167 - add support for PMIC wrapper with integrated arbiter - add support for MT8192/MT6873 Tegra: - Bug fixes to PMC and clock drivers NXP/i.MX: - Update SCU power domain driver to keep console domain power on. - Add missing ADC1 power domain to SCU power domain driver. - Update comments for single global power domain in SCU power domain driver. - Add i.MX51/i.MX53 unique id support to i.MX SoC driver. NXP/FSL SoC driver updates for v5.13 - Add ACPI support for RCPM driver - Use generic io{read,write} for QE drivers after performance optimized for PowerPC - Fix QBMAN probe to cleanup HW states correctly for kexec - Various cleanup and style fix for QBMAN/QE/GUTS drivers OMAP: - Preparation to use devicetree for genpd - ti-sysc needs iorange check improved when the interconnect target module has no control registers listed - ti-sysc needs to probe l4_wkup and l4_cfg interconnects first to avoid issues with missing resources and unnecessary deferred probe - ti-sysc debug option can now detect more devices - ti-sysc now warns if an old incomplete devicetree data is found as we now rely on it being complete for am3 and 4 - soc init code needs to check for prcm and prm nodes for omap4/5 and dra7 - omap-prm driver needs to enable autoidle retention support for omap4 - omap5 clocks are missing gpmc and ocmc clock registers - pci-dra7xx now needs to use builtin_platform_driver instead of using builtin_platform_driver_probe for deferred probe to work Raspberry Pi: - Fix-up all RPi firmware drivers so as for unbind to happen in an orderly fashion - Support for RPi's PoE hat PWM bus Qualcomm - Improved detection for SCM calling conventions - Support for OEM specific wifi firmware path - Added drivers for SC7280/SM8350: RPMH, LLCC< AOSS QMP" * tag 'arm-drivers-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (165 commits) soc: aspeed: fix a ternary sign expansion bug memory: mtk-smi: Add device-link between smi-larb and smi-common memory: samsung: exynos5422-dmc: handle clk_set_parent() failure memory: renesas-rpc-if: fix possible NULL pointer dereference of resource clk: socfpga: fix iomem pointer cast on 64-bit soc: aspeed: Adapt to new LPC device tree layout pinctrl: aspeed-g5: Adapt to new LPC device tree layout ipmi: kcs: aspeed: Adapt to new LPC DTS layout ARM: dts: Remove LPC BMC and Host partitions dt-bindings: aspeed-lpc: Remove LPC partitioning soc: fsl: enable acpi support in RCPM driver soc: qcom: mdt_loader: Detect truncated read of segments soc: qcom: mdt_loader: Validate that p_filesz < p_memsz soc: qcom: pdr: Fix error return code in pdr_register_listener firmware: qcom_scm: Fix kernel-doc function names to match firmware: qcom_scm: Suppress sysfs bind attributes firmware: qcom_scm: Workaround lack of "is available" call on SC7180 firmware: qcom_scm: Reduce locking section for __get_convention() firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool Revert "soc: fsl: qe: introduce qe_io{read,write}* wrappers" ...
| * | | iio/scmi: Port driver to the new scmi_sensor_proto_ops interfaceCristian Marussi2021-03-301-50/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Port the scmi iio driver to the new SCMI sensor interface based on protocol handles and common devm_get_ops(). Link: https://lore.kernel.org/r/20210316124903.35011-26-cristian.marussi@arm.com Link: https://lore.kernel.org/r/20210330134711.1962-1-cristian.marussi@arm.com Acked-by: Jyoti Bhayana <jbhayana@google.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
* | | | iio: inv_mpu6050: Fully validate gyro and accel scale writesLars-Peter Clausen2021-04-071-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting the gyro or accelerometer scale the inv_mpu6050 driver ignores the integer part of the value. As a result e.g. all of 0.13309, 1.13309, 12345.13309, ... are accepted as a valid gyro scale and 0.13309 is the scale that gets set in all those cases. Make sure to check that the integer part of the scale value is 0 and reject it otherwise. Fixes: 09a642b78523 ("Invensense MPU6050 Device Driver.") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210405114441.24167-1-lars@metafoo.de Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: sx9310: Fix write_.._debounce()Gwendal Grignou2021-04-071-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check input to be sure it matches Semtech sx9310 specification and can fit into debounce register. Compare argument writen to thresh_.._period with read from same sysfs attribute: Before: Afer: write | read write | read -1 | 8 -1 fails: -EINVAL 0 | 8 0 | 0 1 | 0 1 | 0 2..15 | 2^log2(N) 2..15 | 2^log2(N) 16 | 0 >= 16 fails: -EINVAL Fixes: 1b6872015f0b ("iio: sx9310: Support setting debounce values") Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Cc: stable@vger.kernel.org Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20210331182222.219533-1-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: sx9310: Fix access to variable DT arrayGwendal Grignou2021-04-071-12/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the current code, we want to read 4 entries from DT array "semtech,combined-sensors". If there are less, we silently fail as of_property_read_u32_array() returns -EOVERFLOW. First count the number of entries and if between 1 and 4, collect the content of the array. Fixes: 5b19ca2c78a0 ("iio: sx9310: Set various settings from DT") Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210326184603.251683-2-gwendal@chromium.org Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: adc: Kconfig: make AD9467 depend on ADI_AXI_ADC symbolAlexandru Ardelean2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because a dependency on HAS_IOMEM and OF was added for the ADI AXI ADC driver, this makes the AD9467 driver have some build/dependency issues when OF is disabled (typically on ACPI archs like x86). This is because the selection of the AD9467 enforces the ADI_AXI_ADC symbol which is blocked by the OF (and potentially HAS_IOMEM) being disabled. To fix this, we make the AD9467 driver depend on the ADI_AXI_ADC symbol. The AD9467 driver cannot operate on it's own. It requires the ADI AXI ADC driver to stream data (or some similar IIO interface). So, the fix here is to make the AD9467 symbol depend on the ADI_AXI_ADC symbol. At some point this could become it's own subgroup of high-speed ADCs. Fixes: be24c65e9fa24 ("iio: adc: adi-axi-adc: add proper Kconfig dependencies") Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20210324182746.9337-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: magnetometer: yas530: Include right headerLinus Walleij2021-04-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To get access to the big endian byte order parsing helpers drivers need to include <asm/unaligned.h> and nothing else. Reported-by: kernel test robot <lkp@intel.com> Suggested-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210215153032.47962-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: magnetometer: yas530: Fix return value on error pathLinus Walleij2021-04-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a missed return variable assignment in the default errorpath of the switch statement in yas5xx_probe(). Fix it. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210215153023.47899-1-linus.walleij@linaro.org Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio:cdc:ad7150: Fix use of uninitialized retJonathan Cameron2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't appear to generate a warning on all versions of GCC, but 0-day reported it and the report looks valid. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: hrtimer-trigger: Fix potential integer overflow in ↵Gustavo A. R. Silva2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iio_hrtimer_store_sampling_frequency Add suffix ULL to constant 1000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is being used in a context that expects an expression of type unsigned long long, but it's currently evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1503062 ("Unintentional integer overflow") Fixes: dafcf4ed8392 ("iio: hrtimer: Allow sub Hz granularity") Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20210329205817.GA188755@embeddedor Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio:adc: Fix trivial typoJonathan Cameron2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "an" should be "and". Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20210401150810.227168-1-jic23@kernel.org
* | | | iio:adc:ad7476: Fix remove handlingJonathan Cameron2021-04-071-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver was in an odd half way state between devm based cleanup and manual cleanup (most of which was missing). I would guess something went wrong with a rebase or similar. Anyhow, this basically finishes the job as a precursor to improving the regulator handling. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset") Cc: Michael Hennerich <michael.hennerich@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210401171759.318140-2-jic23@kernel.org
* | | | iio:adc:ad_sigma_delta: Use IRQF_NO_AUTOEN rather than request and disableJonathan Cameron2021-04-071-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These devices are not able to mask the signal used as a data ready interrupt. As such they previously requested the irq then immediately disabled it. Now we can avoid the potential of a spurious interrupt by avoiding the irq being auto enabled in the first place. I'm not sure how this code could have been called with the irq already disabled, so I believe the conditional would always have been true and have removed it. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Alexandru Ardelean <ardeleanalex@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-8-jic23@kernel.org
* | | | iio:imu:adis: Use IRQF_NO_AUTOEN instead of irq request then disableJonathan Cameron2021-04-073-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a bit involved as the adis library code already has some sanity checking of the flags of the requested irq that we need to ensure is happy to pass through the IRQF_NO_AUTOEN flag untouched. Using this flag avoids us autoenabling the irq in the adis16460 and adis16475 drivers which cover parts that don't have any means of masking the interrupt on the device end. Note, compile tested only! Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Alexandru Ardelean <ardeleanalex@gmail.com> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-7-jic23@kernel.org
* | | | iio:chemical:scd30: Use IRQF_NO_AUTOEN to avoid irq request then disableJonathan Cameron2021-04-071-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new flag cleanly avoids the need for a dance where we request the interrupt only to immediately disabling it by ensuring it is not auto-enabled in the first place. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-6-jic23@kernel.org
* | | | iio:adc:sun4i-gpadc: Use new IRQF_NO_AUTOEN flag instead of request then disableJonathan Cameron2021-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new flag ensures a requested irq is not autoenabled, thus removing the need for the disable_irq() that follows and closing off any chance of spurious interrupts. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-5-jic23@kernel.org
* | | | iio:adc:nau7802: Use IRQF_NO_AUTOEN instead of request then disableJonathan Cameron2021-04-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whilst a race during interrupt enabling is probably not a problem, it is better to not enable the interrupt at all. The new IRQF_NO_AUTOEN flag allows us to do that. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-4-jic23@kernel.org
* | | | iio:adc:exynos-adc: Use new IRQF_NO_AUTOEN flag rather than separate ↵Jonathan Cameron2021-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | irq_disable() Disabling an irq before the driver has actually atempted to request it may work, but is definitely not as clean as just requesting it as normal but with the auto enable disabled. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-3-jic23@kernel.org
* | | | iio:adc:ad7766: Use new IRQF_NO_AUTOEN to reduce boilerplateJonathan Cameron2021-04-071-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As iio_poll_trigger() is safe against spurious interrupts when the trigger is not enabled, this is not a fix despite looking like a race. It is nice to simplify the code however so the interrupt is never enabled in the first place. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-2-jic23@kernel.org
* | | | iio: buffer: use sysfs_attr_init() on allocated attrsAlexandru Ardelean2021-04-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dynamically allocating sysfs attributes, it's a good idea to call sysfs_attr_init() on them to initialize lock_class_keys. This change does that. The lock_class_keys are set when the CONFIG_DEBUG_LOCK_ALLOC symbol is enabled. Which is [likely] one reason why I did not see this during development. I also am not able to see this even with CONFIG_DEBUG_LOCK_ALLOC enabled, so this may [likely] be reproduce-able on some system configurations. This was reported via: https://lore.kernel.org/linux-iio/CA+U=DsrsvGgXEF30-vXuXS_k=-mjSjiBwEEzwKb1hJVn1P98OA@mail.gmail.com/T/#u Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210402174226.630346-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: trigger: Fix strange (ladder-type) indentationAndy Shevchenko2021-04-071-13/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases indentation looks a bit weird with starting from = sign and being in a ladder-type style. Unify it across the module. While at it, add blank line after definition block where it needed, Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210402174911.44408-2-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: trigger: Replace explicit casting and wrong specifier with proper oneAndy Shevchenko2021-04-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By unknown reason device name is set with an index casted from int to unsigned long while at the same time with "%ld" specifier. Both parts seems wrong to me, thus replace replace explicit casting and wrong specifier with proper one, i.e. "%d". Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210402174911.44408-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: adc: stm32-dfsdm: drop __func__ while using Dynamic debugMugilraj Dhavachelvan2021-04-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dropped __func__ while using dev_dbg() and pr_debug() If the function name is desired, it can be configured using dynamic debug. Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210401154343.41527-1-dmugil2000@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio:adc: Drop false comment about lack of timestamp controlJonathan Cameron2021-04-074-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timestamp control has been a function implemented in the core of IIO for a long time, so this comment is incorrect and has clearly been cut and paste into all these drivers. The remainder of the comment added nothing and was confusing so dropped that as well. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210401145410.226917-1-jic23@kernel.org
* | | | iio:cdc:ad7150: Move driver out of staging.Jonathan Cameron2021-04-075-0/+698
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This capacitance to digital converter (CDC) driver is compliant with the IIO ABI. Note, not all features supported (e.g. window event modes) but the driver should be in a useful functional state. The cleanup was done against QEMU emulation of the device rather than actual hardware. Whilst this was a bit of an experiment, it made it easy to confirm that the driver remained in a consistent working state through the various refactors. If it worked in the first place, it should still be working after this cleanup. Given some IIO drivers require expensive hardware setups, (not particularly true with this one) the use of QEMU may provide a viable way forward for providing testing during code changes where previously we'd had to rely on sharp eyes and crossed fingers. Note, no explicit MAINTAINERS entry as it will be covered by the generic catch-alls for ADI and IIO drivers which are sufficient. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-25-jic23@kernel.org
* | | | iio:event: Add timeout event info typeJonathan Cameron2021-04-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For adaptive threshold events, the current value is compared with a (typically) low pass filtered version of the same signal that slowly tracks large scale changes. However, sometimes a step change can result in a large lag before the low pass filtered version begins to track the signal again. Timeouts can be used to made an instantaneous 'correction'. Documentation of this attribute is added in a later patch. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-11-jic23@kernel.org
* | | | iio: inv_mpu6050: Make interrupt optionalLars-Peter Clausen2021-04-071-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inv_mpu6050 driver requires an interrupt for buffered capture. But non buffered reading for measurements works just fine without an interrupt connected. Make the interrupt optional to support this case. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210325131046.13383-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: inv_mpu6050: Remove superfluous indio_dev->modes assignmentLars-Peter Clausen2021-04-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inv_mpu6050 driver manually assigns the indio_dev->modes property. But this is not necessary since it will be setup in iio_trigger_buffer_setup(). Remove the manual assignment. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210325131046.13383-1-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: buffer: return 0 for buffer getfd ioctl handlerAlexandru Ardelean2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Lars pointed out, we could either return the FD vs memcpy-ing it to the userspace data object. However, this comment exposed a bug. We should return 0 or negative from these ioctl() handlers. Because an ioctl() handler can also return IIO_IOCTL_UNHANDLED (which is positive 1), which means that the ioctl() handler doesn't support this ioctl number. Positive 1 could also be a valid FD number in some corner cases. The reason we did this is to be able to differentiate between an error code and an unsupported ioctl number; for unsupported ioctl numbers, the main loop should keep going. Maybe we should change this to a higher negative number, to avoid such cases when/if we add more ioctl() handlers. Cc: Lars-Peter Clausen <lars@metafoo.de> Fixes: f73f7f4da5818 ("iio: buffer: add ioctl() to support opening extra buffers for IIO device") Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210322084135.17536-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: Fix iio_read_channel_processed_scale()Linus Walleij2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code was checking if (ret) from the processed channel readout, not smart, we need to check if (ret < 0) as this will likely be something like IIO_VAL_INT. Fixes: 635ef601b238 ("iio: Provide iio_read_channel_processed_scale() API") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210323122705.1326362-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: adc: ad7923: register device with devm_iio_device_registerLucas Stankus2021-03-291-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Registers the device using the devm variant. This is the final step of converting the ad7923 to only use devm routines, meaning that the ad7923_remove() function is no longer needed to release resources on device detach. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/b0146465d52f4e259f5f95c83c71e72f065093da.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: adc: ad7923: use device-managed function for triggered bufferLucas Stankus2021-03-291-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Converts the iio_triggered_buffer_setup() call to its device-managed counterpart. With this, the error handling routine in the ad7923_probe() function becomes unnecessary as well as the iio_triggered_buffer_cleanup() call. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/fe46a45caaa788f333d78367968272de728f4a6e.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: adc: ad7923: use devm_add_action_or_reset for regulator disableLucas Stankus2021-03-291-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a device-managed action to handle disabling the driver's regulator on device detach. This slightly simplifies deinitialization and enables further conversion of the driver to device-managed routines without breaking the init order. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/49a7c0436ca1186313dbccf3d810d0cf38cb5b37.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: dac: Rudimentary typo fixBhaskar Chowdhury2021-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | s/concurent/concurrent/ Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20210323012215.451075-1-unixbhaskar@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: imu: inv_mpu6050: Use as standalone triggerLinus Walleij2021-03-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It may happen that the MPU6050 is the only hardware trigger available on your system such as this: > lsiio Device 003: hscdtd008a Device 001: mpu6050 Device 002: gp2ap002 Device 000: ab8500-gpadc Trigger 000: mpu6050-dev1 And when you want to use it to read periodically from your magnetometer like this: > iio_generic_buffer -a -c 100 -n hscdtd008a -t mpu6050-dev1 Then the following happens: [ 209.951334] Internal error: Oops: 5 [#1] SMP ARM (...) [ 209.981969] Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support) [ 209.988925] PC is at inv_scan_query_mpu6050+0x8/0xb8 [ 209.993914] LR is at inv_mpu6050_set_enable+0x40/0x194 This is because since we are not using any channels from the same device, the indio_dev->active_scan_mask is NULL. Just checking for that and bailing out is however not enough: we have to enable some kind of FIFO for the readout to work. So enable the temperature as a dummy FIFO and all works fine. Not suitable for backporting to stable. It is an odd corner case and does not represent a regression. Fixes: 09a642b78523 ("Invensense MPU6050 Device Driver.") Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210322132408.1003443-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio:accel:adis16201: Fix wrong axis assignment that prevents loadingJonathan Cameron2021-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whilst running some basic tests as part of writing up the dt-bindings for this driver (to follow), it became clear it doesn't actually load currently. iio iio:device1: tried to double register : in_incli_x_index adis16201 spi0.0: Failed to create buffer sysfs interfaces adis16201: probe of spi0.0 failed with error -16 Looks like a cut and paste / update bug. Fixes tag obviously not accurate but we don't want to bother carry thing back to before the driver moved out of staging. Fixes: 591298e54cea ("Staging: iio: accel: adis16201: Move adis16201 driver out of staging") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: <Stable@vger.kernel.org> Cc: Himanshu Jha <himanshujha199640@gmail.com> Cc: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210321182956.844652-1-jic23@kernel.org
* | | | iio: dac: Convert powerdown read callbacks to sysfs_emit()Lars-Peter Clausen2021-03-2919-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update DAC drivers powerdown attribute show callback to use the new sysfs_emit() function. sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-5-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: __iio_format_value(): Convert to sysfs_emit_at()Lars-Peter Clausen2021-03-291-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Convert __iio_format_value() and related functions to use this new interface. This conversion involves changing the signature of __iio_format_value() so that it similar to sysfs_emit_at() and takes the buffers start address and an offset where to write within the buffer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-4-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: iio_enum_available_read(): Convert to sysfs_emit_at()Lars-Peter Clausen2021-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Convert the iio_enum_available_read() function to use sysfs_emit_at() instead of scnprintf(). The conversion is straight forward, the only difference is that sysfs_emit_at() takes the buffers start address and an offset as parameters and already knows about the buffer's size limit. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-3-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | iio: core: Use sysfs_emit() (trivial bits)Lars-Peter Clausen2021-03-294-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. This patch converts the places in the iio core that follow the pattern of return s*printf(...) to return sysfs_emit(...) Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* | | | Merge tag 'iio-for-5.13a' of ↵Greg Kroah-Hartman2021-03-26156-1026/+4692
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 1st set of IIO/counter device support, features and cleanup in the 5.13 cycle Big set in here from Alexandru Ardelean enabling multiple buffer support. This includes providing a new directory per buffer that combines what was previously in buffer/ and scan_elements/. Old interfaces still in place for compatiblity. Note immuatable branch for scmi patches to allow for some significant rework going on in that subsystem. Merge required updating to reflect some changes in IIO. Late rebase to fix some wrong fixes tags due to some earlier rebases made necessary by messing up the immutable branch. IIO New Device Support * adi,ad5686 - Add info to support AD5673R and AD5677R * bosch,bmi088 - New driver supporting this accelerometer + gyroscope * cros_ec_mkbp - New driver for this proximity sensor that exposes a 'front' sensor. Very simple switch like device, but driver allows it to share interface with more sophisticated proximity sensors. * iio_scmi - New driver to support ARM SCMI protocol to expose underlying accelerometers and gyroscopes via this firmware interface. * st,st_magn - Add ID for IISMDC magnetometer. * ti,ads131e0 - New driver supporting ads131e04, ads131e06 and ads131e08 24 bit ADCs Counter New Device Support * IRQ or GPIO based counter - New driver for a conceptually simple counter that uses interrupts to perform the count. Features * core - Dual buffer supprt including: Various helpers to centralize handling of bufferer related elements. Document existing and new IOCTLs Register the IIO chrdev only if it can actually be used for anything. Rework attribute group creation in the core (lots of patches) Merge buffer/ and scan_elements/ entries into one list + maintain backwards compatible set. Introduce the internal logic and IOCTL to allow multiple buffers + access to an anon FD per buffer to actually read from it. Tidy up tools/iio/iio_generic_buffer and switch to new interfaces. Update ABI docs. A few follow up fixes, unsuprising as this was a huge bit of rework. - Move common case setting of trig->parent to the core. - Provide an iio_read_channel_processed_scale() to avoid loss of precision from iio_read_channel_processed() then applying integer scale. Use it in ntc_thermistor driver in hwmon. - Allow drivers to specify labels from elsewhere than DT. Use it for bmc150 and kxcjk-1013 labels related to position on 2 in one tablets. - Document label usage for proximity and accelerometer sensors. - Some local variable renames for consistency tools - Add -a parameter to iio_event_monitor to allow autoenabling of events. * acpi_als - Add trigger support for devices that don't support notification method. * adi,ad7124 - Allow more than 8 channels. This is a complex little device, but is capable of supporting up to 16 channels if the share certain configuration settings. * hrtimer-trigger - Support sampling frequency below 1Hz. * mediatek,mt8195-auxadc - Add compatible to binding docs (always also includes mt8173) * st,stm32-adc - Enable timetamps when not using DMA. * vishay,vcnl3020 - Sampling frequency control. Cleanup and minor fixes: * treewide - Use some getter and setter functions instead of opencoding. - Set of fixes for pointless casts in various drivers. - Avoid wrong kernel-doc marking on comment blocks. - Fix various other minor kernel-doc issues shown by W=1 * core - Use a signed temporary for IIO_VAL_FRACTIONAL_LOG2 to avoid odd casts. - Fix IIO_VAL_FRACTIONAL_LOG2 for values between -1.0 and 0.0 - Add unit tests for iio_format_value() * docs - Fix formatting/typos in iio_configfs.rst and buffers.rst - Add documentation of index in buffers.rst - Fix scan element description - Avoid some issues with HTML generation from ABI docs by moving duplicated defintions to more generic files. - Drop reference to long dead mailing list. * 104-quad - Remove left over deprecated IIO counter ABI. * adi,adi-axi-adc - Fix wrong bit of docs. * adi,ad5791 - Typos * adi,ad9834 - Switch to device managed functions in probe. * adi,adis* - Add and use helpers for locking to reduced duplication. * adi,adis16480 - Fix calculation of sampling frequency when using pulse per second input. * adi,adis16475 - Calculate the IMU scaled internal sampling rate and runtime depending on sysfs based configuration rather than getting from DT. Drop now unnecessary property from DT bindings doc. * cros_ec - Fix result of a series of recent changes that means extended buffer attributes turn up in the wrong place. Too complex to revert the various patches unfortunately so this is a bit messy. * fsl,mma3452 - Indentation cleanup. * hid-sensors - Size of storage needs to increase for some parts when using quaternions. - Move the get sensistivity attribute to hid-sensors-common to reduce duplication. Enable it for more device types. - Correctly handle relative sensitivity if reported that way including documenting the new ABI. * maxim,max517 - Use device managed functions in probe. * mediatek,mt6360-adc - Use asm/unaligned.h instead of directly including unaligned/be_byteshift.h * novuton,npcm-adc - Local lock instead of missusing mlock. * semtech,sx9500 - Typos * st,sensor - typo fix * st,spear-adc - Local lock instead of missusing mlock. * st,stm32-adc - Long standing HAS_IOMEM dependency fix. * st,stm32-counter - Remove left over deprecated IIO counter ABI. * ti,palmas-adc - Local lock instead of missusing mlock. * ti,tmp007 - Switch to device managed functions in probe. Other * MAINTAINERS - Move Peter Meerwald-Stadler to Credits at his request * tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (119 commits) iio: acpi_als: Add trigger support iio: acpi_als: Add local variable dev in probe iio: acpi_als: Add timestamp channel iio: adc: ad7292: Modify the bool initialization assignment iio: cros: unify hw fifo attributes without API changes iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant iio: event_monitor: Enable events before monitoring dt-bindings: iio: adc: Add compatible for Mediatek MT8195 iio:magnetometer: Add Support for ST IIS2MDC dt-bindings: iio: st,st-sensors add IIS2MDC. staging: iio: ad9832: kernel-doc fixes iio:dac:max517.c: Use devm_iio_device_register() iio:cros_ec_sensors: Fix a wrong function name in kernel doc. iio: buffer: kfifo_buf: kernel-doc, typo in function name. iio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names. iio: adc: adi-axi-adc: Drop false marking for kernel-doc iio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name iio: dac: ad5504: fix wrong part number in kernel-doc structure name. iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name iio: adc: ti-adc084s021: kernel-doc fixes, missing function names ...
| * | | Merge remote-tracking branch 'local/ib-iio-scmi-5.12-rc2-take3' into togregJonathan Cameron2021-03-265-0/+697
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updated to use devm_iio_kfifo_buffer_setup() in place of now removed devm_iio_kfifo_allocate() Take3 branch because first 2 versions including wrong version of patch.
| | * | iio/scmi: Adding support for IIO SCMI Based SensorsJyoti Bhayana2021-03-135-0/+708
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change provides ARM SCMI Protocol based IIO device. This driver provides support for Accelerometer and Gyroscope using SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jyoti Bhayana <jbhayana@google.com> Link: https://lore.kernel.org/r/20210212172235.507028-2-jbhayana@google.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20210309231259.78050-2-jbhayana@google.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add trigger supportGwendal Grignou2021-03-251-28/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As some firmware does not notify on illuminance changes, add a trigger to be able to query light via software (sysfs-trigger or hrtrigger). Add a hardware trigger set as the default trigger to maintain backward compatibility. Check iio_info reports the sensor as buffer capable: iio:device0: acpi-als (buffer capable) To test, check we can get data on demand on an Intel based chromebook: IIO_DEV="iio:device0" echo 1 > iio_sysfs_trigger/add_trigger cat trigger2/name > ${IIO_DEV}/trigger/current_trigger for i in ${IIO_DEV}/scan_elements/*_en ${IIO_DEV}/buffer/enable ; do echo 1 > $i done od -x /dev/${IIO_DEV} & echo 1 > trigger2/trigger_now Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-4-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add local variable dev in probeGwendal Grignou2021-03-251-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use dev = &device->dev in probe routine for clarity. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-3-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add timestamp channelGwendal Grignou2021-03-251-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add timestamp channel in list of channel, to allow retrieving timestamps when events are produced. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-2-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>