platform/kernel/linux-starfive.git
21 months agoMerge tag 'icc-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc...
Greg Kroah-Hartman [Mon, 26 Sep 2022 17:25:32 +0000 (19:25 +0200)]
Merge tag 'icc-6.1-rc1' of git://git./linux/kernel/git/djakov/icc into char-misc-next

Grorgi writes:
  "interconnect changes for 6.1

   These are the interconnect changes for the 6.1-rc1 merge window, which
   this time are tiny. One is a series to convert the remove() callback of
   platform devices to return void instead of int. The other change is
   enabling modular support for a driver."

Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  interconnect: qcom: Kconfig: Make INTERCONNECT_QCOM tristate
  interconnect: imx: Make imx_icc_unregister() return void
  interconnect: Make icc_provider_del() return void
  interconnect: sm8450: Ignore return value of icc_provider_del() in .remove()
  interconnect: osm-l3: Ignore return value of icc_provider_del() in .remove()
  interconnect: msm8974: Ignore return value of icc_provider_del() in .remove()
  interconnect: icc-rpmh: Ignore return value of icc_provider_del() in .remove()
  interconnect: icc-rpm: Ignore return value of icc_provider_del() in .remove()
  interconnect: imx: Ignore return value of icc_provider_del() in .remove()

21 months agoMerge tag 'extcon-next-for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 26 Sep 2022 06:38:19 +0000 (08:38 +0200)]
Merge tag 'extcon-next-for-6.1' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:
  "Update extcon next for v6.1

   1. Add USB Type-C support to extcon-tusb320.c
    - Add TYPE-C interface and expose the supported supply current,
      direction and connector polarity via the TYPE-C interface."

* tag 'extcon-next-for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
  extcon: usbc-tusb320: fix kernel-doc warning
  extcon: usbc-tusb320: Add USB TYPE-C support
  extcon: usbc-tusb320: Factor out extcon into dedicated functions

21 months agoextcon: usbc-tusb320: fix kernel-doc warning
Rong Chen [Tue, 6 Sep 2022 04:04:29 +0000 (12:04 +0800)]
extcon: usbc-tusb320: fix kernel-doc warning

Fix the warning:
drivers/extcon/extcon-usbc-tusb320.c:19: warning: expecting prototype
for drivers/extcon/extcon-tusb320.c(). Prototype was for TUSB320_REG8()
instead

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Rong Chen <rong.a.chen@intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
21 months agoextcon: usbc-tusb320: Add USB TYPE-C support
Marek Vasut [Sat, 30 Jul 2022 18:05:00 +0000 (20:05 +0200)]
extcon: usbc-tusb320: Add USB TYPE-C support

The TI TUSB320 seems like a better fit for USB TYPE-C subsystem,
which can expose details collected by the TUSB320 in a far more
precise way than extcon. Since there are existing users in the
kernel and in DT which depend on the extcon interface, keep it
for now.

Add TYPE-C interface and expose the supported supply current,
direction and connector polarity via the TYPE-C interface.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
21 months agoextcon: usbc-tusb320: Factor out extcon into dedicated functions
Marek Vasut [Sat, 30 Jul 2022 18:04:59 +0000 (20:04 +0200)]
extcon: usbc-tusb320: Factor out extcon into dedicated functions

Move extcon code into separate functions in preparation for addition of
USB TYPE-C support. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
21 months agoMerge tag 'iio-for-6.1b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Sun, 25 Sep 2022 07:09:07 +0000 (09:09 +0200)]
Merge tag 'iio-for-6.1b' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

Second set of IIO new device support, features and cleanup for the 6.1 cycle.

Normal mixed bag of new device support with continuing trend that most new
devices are supported by extending existing drivers - a positive sign perhaps
that device manufacturers have somewhat stabilized their interfaces across
product generations. The BNO055 driver was however a substantial addition
including several additions to the IIO core.

There are a number of significant patch sets under review, so if the 6.0
cycle runs long I may send a 3rd pull request.

New device support
* adi,adxl313
  - Support for the ADXL312 and ADXL314 accelerometers.
* bosch,bmp280
  - Support for the BMP380 family of pressures sensors.
    Included considerable refactoring and modernization of the bmp280
    driver.
* bosch,bno055
  - New driver for this i2c/serial attached complex IMU.
* lltc,ltc2497
  - Support for the LTC2499 16 channel, 24bit ADC.
* st,pressure
  - Support for the LPS22DF pressure sensor
* st,lsm6dsx
  - Support for the LSM6DSTX (Mainly adding the ID and WAI)

Features
* core - to support the bosch,bno055 requirements
  - Support for linear acceleration channel type (effect  of gravity removed)
  - Pitch, yaw and roll modifiers for angle channels.
  - Standard serialnumber attribute documentation.
  - Binary attributes - to allow for calibration save and restore.
* adi,ad7923
  - Support extended range (wider supported input voltage range).
* bosch,bmp280
  - Add filter controls for some supported parts.
* microchip,mcp3911
  - Buffered capture support for this ADC.
  - Data ready interrupt support, including hiz control for line.
  - Oversampling ratio support.
* st,stm32-adc
  - Support ID registers on parts where they are present, providing
    discoverability of some features.

Fixes - late breaking fixes that I judged could wait for the merge window.
* adi,ad5593r
  - Add a missing STOP condition between address write and data read.
  - Check for related i2c functionality.
* adi,ad7923
  - Fix shift reporting for some variants supported by the driver.
* infinion,dps310
  - Work around a hardware issue where a chip can hang by adding a
    timeout and reset path.

Cleanups
* Continuing work to switch to new pm macros.
* MAINTAINERS
  - Drop duplication of wild card covered entry in ADI block and
    add missing entries to cover ltc294x binding files.
* bosch,bma400
  - Fix trivial smatch warning.
* bosch,bmp280
  - Fix broken links to datasheets
* lltc,ltc2497
  - Fix missing entry for ltc2499
* mexelis,mlx90614
  - Switch to get_avail() callback for _available attributes.
* microchip,mcp3911
  - Move to devm_ resource management for all elements of probe()

* tag 'iio-for-6.1b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (57 commits)
  iio: adc: mcp3911: add support for oversampling ratio
  dt-bindings: iio: adc: mcp3911: add microchip,data-ready-hiz entry
  iio: adc: mcp3911: add support for interrupts
  iio: adc: mcp3911: add support for buffers
  iio: adc: mcp3911: use resource-managed version of iio_device_register
  iio: accel: bma400: Fix smatch warning based on use of unintialized value.
  iio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS()
  iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr()
  iio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops
  iio: proximity: sx9360: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  iio: proximity: sx9324: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  iio: proximity: sx9310: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  docs: iio: add documentation for BNO055 driver
  iio: imu: add BNO055 I2C driver
  iio: imu: add BNO055 serdev driver
  dt-bindings: iio/imu: Add Bosch BNO055
  iio: document "serialnumber" sysfs attribute
  iio: document bno055 private sysfs attributes
  iio: imu: add Bosch Sensortec BNO055 core driver
  iio: add support for binary attributes
  ...

22 months agofirmware: google: Test spinlock on panic path to avoid lockups
Guilherme G. Piccoli [Fri, 9 Sep 2022 20:07:55 +0000 (17:07 -0300)]
firmware: google: Test spinlock on panic path to avoid lockups

Currently the gsmi driver registers a panic notifier as well as
reboot and die notifiers. The callbacks registered are called in
atomic and very limited context - for instance, panic disables
preemption and local IRQs, also all secondary CPUs (not executing
the panic path) are shutdown.

With that said, taking a spinlock in this scenario is a dangerous
invitation for lockup scenarios. So, fix that by checking if the
spinlock is free to acquire in the panic notifier callback - if not,
bail-out and avoid a potential hang.

Fixes: 74c5b31c6618 ("driver: Google EFI SMI")
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julius Werner <jwerner@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agobus: mvebu-mbus: use DEFINE_SHOW_ATTRIBUTE to simplify mvebu_{sdram/devs}_debug
Liu Shixin [Fri, 16 Sep 2022 14:12:44 +0000 (22:12 +0800)]
bus: mvebu-mbus: use DEFINE_SHOW_ATTRIBUTE to simplify mvebu_{sdram/devs}_debug

Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Link: https://lore.kernel.org/r/20220916141244.2174005-1-liushixin2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMAINTAINERS: Add header files under VMWARE VMCI DRIVER
Vishnu Dasa [Thu, 15 Sep 2022 03:13:21 +0000 (20:13 -0700)]
MAINTAINERS: Add header files under VMWARE VMCI DRIVER

Add include/linux/vmw_vmci* files under VMWARE VMCI DRIVER.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Bryan Tan <bryantan@vmware.com>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220915031321.1121-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomei: gsc: Remove redundant dev_err call
Shang XiaoJing [Fri, 23 Sep 2022 10:08:41 +0000 (18:08 +0800)]
mei: gsc: Remove redundant dev_err call

devm_ioremap_resource() prints error message in itself. Remove the
dev_err call to avoid redundant error message.

Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Link: https://lore.kernel.org/r/20220923100841.17719-1-shangxiaojing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomei: fix repeated words in comments
Jilin Yuan [Sun, 18 Sep 2022 10:04:31 +0000 (18:04 +0800)]
mei: fix repeated words in comments

Delete the redundant word 'from'.

Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Link: https://lore.kernel.org/r/20220918100431.28381-1-yuanjilin@cdjrlc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodrivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h
Gaosheng Cui [Tue, 13 Sep 2022 11:03:56 +0000 (19:03 +0800)]
drivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h

Remove the following orphan declarations from drivers/misc/sgi-xp/xp.h:
1. xp_nofault_PIOR_target
2. xp_error_PIOR
3. xp_nofault_PIOR

They have been removed since commit 9726bfcdb977 ("misc/sgi-xp:
remove SGI SN2 support"), so remove them.

Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20220913110356.764711-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: u-boot-env: fix crc32 casting type
Rafał Miłecki [Fri, 16 Sep 2022 12:21:00 +0000 (13:21 +0100)]
nvmem: u-boot-env: fix crc32 casting type

This fixes:
drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32

Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: lan9662-otp: add support
Horatiu Vultur [Fri, 16 Sep 2022 12:20:59 +0000 (13:20 +0100)]
nvmem: lan9662-otp: add support

Add support for OTP controller available on LAN9662. The OTPC controls
the access to a non-volatile memory. The size of the memory is 8KB.
The OTPC can access the memory based on an offset.
Implement both the read and the write functionality.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: lan9662-otpc: document Lan9662 OTPC
Horatiu Vultur [Fri, 16 Sep 2022 12:20:58 +0000 (13:20 +0100)]
dt-bindings: lan9662-otpc: document Lan9662 OTPC

Document Lan9662 OTP controller.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-12-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: u-boot-env: find Device Tree nodes for NVMEM cells
Rafał Miłecki [Fri, 16 Sep 2022 12:20:57 +0000 (13:20 +0100)]
nvmem: u-boot-env: find Device Tree nodes for NVMEM cells

DT binding allows specifying NVMEM cells as NVMEM device (provider)
subnodes. Looks for such subnodes when building NVMEM cells.

This allows NVMEM consumers to use U-Boot environment variables.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: Add SoC compatible for sm6115
Iskren Chernev [Fri, 16 Sep 2022 12:20:56 +0000 (13:20 +0100)]
dt-bindings: nvmem: Add SoC compatible for sm6115

Document SoC compatible for sm6115.

Reviewed-by: Caleb Connolly <caleb@connolly.tech>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-10-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: sort config symbols alphabetically
Rafał Miłecki [Fri, 16 Sep 2022 12:20:55 +0000 (13:20 +0100)]
nvmem: sort config symbols alphabetically

1. Match what most subsystems do
2. Simplify maintenance a bit
3. Reduce amount of conflicts for new drivers patches

While at it unify indent level in Makefile.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: prefix all symbols with NVMEM_
Rafał Miłecki [Fri, 16 Sep 2022 12:20:54 +0000 (13:20 +0100)]
nvmem: prefix all symbols with NVMEM_

This unifies all NVMEM symbols. They follow one style now.

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: qfprom: add IPQ8064 and SDM630 compatibles
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:20:53 +0000 (13:20 +0100)]
dt-bindings: nvmem: qfprom: add IPQ8064 and SDM630 compatibles

Document compatibles for QFPROM used on IPQ8064 and SDM630.  They are
compatible with generic QFPROM fallback.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: brcm_nvram: Use kzalloc for allocating only one element
Kenneth Lee [Fri, 16 Sep 2022 12:20:52 +0000 (13:20 +0100)]
nvmem: brcm_nvram: Use kzalloc for allocating only one element

Use kzalloc(...) rather than kcalloc(1, ...) because the number of
elements we are specifying in this case is 1, so kzalloc would
accomplish the same thing and we can simplify.

Signed-off-by: Kenneth Lee <klee33@uw.edu>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: mediatek: efuse: Add support for MT8188
Johnson Wang [Fri, 16 Sep 2022 12:20:51 +0000 (13:20 +0100)]
dt-bindings: nvmem: mediatek: efuse: Add support for MT8188

Add compatible for MT8188 SoC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Johnson Wang <johnson.wang@mediatek.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: core: add error handling for dev_set_name
Gaosheng Cui [Fri, 16 Sep 2022 12:20:50 +0000 (13:20 +0100)]
nvmem: core: add error handling for dev_set_name

The type of return value of dev_set_name is int, which may return
wrong result, so we add error handling for it to reclaim memory
of nvmem resource, and return early when an error occurs.

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomtd: allow getting MTD device associated with a specific DT node
Rafał Miłecki [Fri, 16 Sep 2022 12:20:49 +0000 (13:20 +0100)]
mtd: allow getting MTD device associated with a specific DT node

MTD subsystem API allows interacting with MTD devices (e.g. reading,
writing, handling bad blocks). So far a random driver could get MTD
device only by its name (get_mtd_device_nm()). This change allows
getting them also by a DT node.

This API is required for drivers handling DT defined MTD partitions in a
specific way (e.g. U-Boot (sub)partition with environment variables).

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: add driver handling U-Boot environment variables
Rafał Miłecki [Fri, 16 Sep 2022 12:20:48 +0000 (13:20 +0100)]
nvmem: add driver handling U-Boot environment variables

U-Boot stores its setup as environment variables. It's a list of
key-value pairs stored on flash device with a custom header.

This commit adds an NVMEM driver that:
1. Provides NVMEM access to environment vars binary data
2. Extracts variables as NVMEM cells

Current Linux's NVMEM sysfs API allows reading whole NVMEM data block.
It can be used by user-space tools for reading U-Boot env vars block
without the hassle of finding its location. Parsing will still need to
be re-done there.

Kernel-parsed NVMEM cells can be read however by Linux drivers. This may
be useful for Ethernet drivers for reading device MAC address which is
often stored as U-Boot env variable.

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
Lin Yujun [Wed, 14 Sep 2022 03:19:53 +0000 (11:19 +0800)]
slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register

No error handling is performed when platform_device_add()
return fails. Refer to the error handling of driver_set_override(),
add error handling for platform_device_add().

Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Link: https://lore.kernel.org/r/20220914031953.94061-1-linyujun809@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: core: Fix memleak in nvmem_register()
Gaosheng Cui [Fri, 16 Sep 2022 12:04:02 +0000 (13:04 +0100)]
nvmem: core: Fix memleak in nvmem_register()

dev_set_name will alloc memory for nvmem->dev.kobj.name in
nvmem_register, when nvmem_validate_keepouts failed, nvmem's
memory will be freed and return, but nobody will free memory
for nvmem->dev.kobj.name, there will be memleak, so moving
nvmem_validate_keepouts() after device_register() and let
the device core deal with cleaning name in error cases.

Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions")
Cc: stable@vger.kernel.org
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:10 +0000 (13:29 +0100)]
slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON

The Qualcomm common remote-proc code (CONFIG_QCOM_RPROC_COMMON) has
necessary stubs, so it is not needed for compile testing.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: simplify error paths with dev_err_probe
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:09 +0000 (13:29 +0100)]
slimbus: qcom-ngd: simplify error paths with dev_err_probe

Use dev_err_probe to skip printing of deferred probe errors and to
simplify error paths.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: cleanup in probe error path
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:08 +0000 (13:29 +0100)]
slimbus: qcom-ngd: cleanup in probe error path

Add proper error path in probe() to cleanup resources previously
acquired/allocated to fix warnings visible during probe deferral:

  notifier callback qcom_slim_ngd_ssr_notify already registered
  WARNING: CPU: 6 PID: 70 at kernel/notifier.c:28 notifier_chain_register+0x5c/0x90
  Modules linked in:
  CPU: 6 PID: 70 Comm: kworker/u16:1 Not tainted 6.0.0-rc3-next-20220830 #380
  Call trace:
   notifier_chain_register+0x5c/0x90
   srcu_notifier_chain_register+0x44/0x90
   qcom_register_ssr_notifier+0x38/0x4c
   qcom_slim_ngd_ctrl_probe+0xd8/0x400
   platform_probe+0x6c/0xe0
   really_probe+0xbc/0x2d4
   __driver_probe_device+0x78/0xe0
   driver_probe_device+0x3c/0x12c
   __device_attach_driver+0xb8/0x120
   bus_for_each_drv+0x78/0xd0
   __device_attach+0xa8/0x1c0
   device_initial_probe+0x18/0x24
   bus_probe_device+0xa0/0xac
   deferred_probe_work_func+0x88/0xc0
   process_one_work+0x1d4/0x320
   worker_thread+0x2cc/0x44c
   kthread+0x110/0x114
   ret_from_fork+0x10/0x20

Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:07 +0000 (13:29 +0100)]
slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure

Use correct error code, instead of previous 'ret' value, when printing
error from pdr_add_lookup() failure.

Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe()
Christophe JAILLET [Sun, 18 Sep 2022 06:27:33 +0000 (08:27 +0200)]
misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe()

'aux_bus' is freed in the remove function but not in the error handling
path of the probe.

Use devm_kzalloc() to simplify the remove function and fix the leak in the
probe.

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/17e19926669a1654e5f2495bf3b289581183d02e.1663482259.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Do not disable the pci device twice in gp_aux_bus_remove()
Christophe JAILLET [Sun, 18 Sep 2022 06:27:24 +0000 (08:27 +0200)]
misc: microchip: pci1xxxx: Do not disable the pci device twice in gp_aux_bus_remove()

gp_aux_bus_probe() uses pcim_enable_device(), so there is no point in
calling pci_disable_device() explicitly in the remove function.

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8a3a385b3ae15ee7497469ec3250302b626a018b.1663482259.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: use DEFINE_SIMPLE_DEV_PM_OPS() in place of the SIMPLE_DEV_...
Kumaravel Thiagarajan [Thu, 15 Sep 2022 09:47:29 +0000 (15:17 +0530)]
misc: microchip: pci1xxxx: use DEFINE_SIMPLE_DEV_PM_OPS() in place of the SIMPLE_DEV_PM_OPS() in pci1xxxx's gpio driver

build errors listed below and reported by Sudip Mukherjee
<sudipm.mukherjee@gmail.com> for the builds of
riscv, s390, csky, alpha and loongarch allmodconfig are fixed in
this patch.

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:311:12: error: 'pci1xxxx_gpio_resume' defined but not used [-Werror=unused-function]
  311 | static int pci1xxxx_gpio_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:295:12: error: 'pci1xxxx_gpio_suspend' defined but not used [-Werror=unused-function]
  295 | static int pci1xxxx_gpio_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~

Fixes: 4ec7ac90ff39 ("misc: microchip: pci1xxxx: Add power management functions - suspend & resume handlers.")
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Link: https://lore.kernel.org/r/20220915094729.646185-1-kumaravel.thiagarajan@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Remove duplicate include
Yihao Han [Tue, 13 Sep 2022 03:02:57 +0000 (20:02 -0700)]
misc: microchip: pci1xxxx: Remove duplicate include

Remove duplicate include in mchp_pci1xxxx_gpio.c

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220913030257.22352-1-hanyihao@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMerge tag 'gnss-6.1-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan...
Greg Kroah-Hartman [Thu, 22 Sep 2022 14:38:58 +0000 (16:38 +0200)]
Merge tag 'gnss-6.1-rc1' of https://git./linux/kernel/git/johan/gnss into char-misc-next

Johan writes:
  "GNSS updates for 6.1-rc1

   Here are the GNSS updates for 6.1-rc1, which includes a single IDA API
   cleanup.

   Everything has been in linux-next with no reported issues."

* tag 'gnss-6.1-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss:
  gnss: replace ida_simple API

22 months agocounter: Realign counter_comp comment block to 80 characters
William Breathitt Gray [Thu, 22 Sep 2022 11:20:57 +0000 (07:20 -0400)]
counter: Realign counter_comp comment block to 80 characters

The member documentation comment lines for struct counter_comp extend
past the 80-characters column boundary due to extra identation at the
start of each section. This patch realigns the comment block within the
80-characters boundary by removing these superfluous indents.

Reviewed-by: Yanteng Si <siyanteng@loongson.cn>
Link: https://lore.kernel.org/r/20220902120839.4260-1-william.gray@linaro.org/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/8294b04153c33602e9c3dd21ac90c1e99bd0fdaf.1663844776.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoiio: adc: mcp3911: add support for oversampling ratio
Marcus Folkesson [Mon, 15 Aug 2022 06:16:24 +0000 (08:16 +0200)]
iio: adc: mcp3911: add support for oversampling ratio

The chip supports oversampling ratio, so expose it to userspace.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220815061625.35568-9-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adc: mcp3911: add microchip,data-ready-hiz entry
Marcus Folkesson [Mon, 15 Aug 2022 06:16:23 +0000 (08:16 +0200)]
dt-bindings: iio: adc: mcp3911: add microchip,data-ready-hiz entry

The Data Ready Output Pin is either hard wired to work as high
impedance or push-pull. Make it configurable.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220815061625.35568-8-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: mcp3911: add support for interrupts
Marcus Folkesson [Mon, 15 Aug 2022 06:16:22 +0000 (08:16 +0200)]
iio: adc: mcp3911: add support for interrupts

Make it possible to read values upon interrupts.
Configure Data Ready Signal Output Pin to either HiZ or push-pull and
use it as interrupt source.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220815061625.35568-7-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: mcp3911: add support for buffers
Marcus Folkesson [Mon, 15 Aug 2022 06:16:21 +0000 (08:16 +0200)]
iio: adc: mcp3911: add support for buffers

Add support for buffers to make the driver fit for more use cases.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220815061625.35568-6-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: mcp3911: use resource-managed version of iio_device_register
Marcus Folkesson [Mon, 15 Aug 2022 06:16:20 +0000 (08:16 +0200)]
iio: adc: mcp3911: use resource-managed version of iio_device_register

Keep using managed resources as much as possible.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220815061625.35568-5-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: accel: bma400: Fix smatch warning based on use of unintialized value.
Jonathan Cameron [Sat, 17 Sep 2022 13:14:01 +0000 (14:14 +0100)]
iio: accel: bma400: Fix smatch warning based on use of unintialized value.

Only specific bits in this value are ever used and those are initialized,
but that is complex to reason about in a checker. Hence, initialize
the value to zero and avoid the complexity.

Smatch warning:
drivers/iio/accel/bma400_core.c:1287 bma400_tap_event_en()
error: uninitialized symbol 'field_value'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jagath Jog J <jagathjog1996@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Jagath Jog J <jagathjog1996@gmail.com>
Fixes: 961db2da159d ("iio: accel: bma400: Add support for single and double tap events")
Link: https://lore.kernel.org/r/20220917131401.2815486-1-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS()
Jonathan Cameron [Sun, 7 Aug 2022 18:56:18 +0000 (19:56 +0100)]
iio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS()

Using this new macro removes the need to mark the callbacks
__maybe_unused.  One slightly complexity in this case is that
the export will exist if CONFIG_PM is set, but only be used
if CONFIG_PM_SLEEP is also set. This is harmless.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Link: https://lore.kernel.org/r/20220807185618.1038812-7-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr()
Jonathan Cameron [Sun, 7 Aug 2022 18:56:17 +0000 (19:56 +0100)]
iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr()

These macros allow the compiler to remove unused pm ops functions without
needing to mark them maybe unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20220807185618.1038812-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops
Jonathan Cameron [Sun, 7 Aug 2022 18:56:16 +0000 (19:56 +0100)]
iio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops

If CONFIG_PM is not set, the pm_ptr() will ensure that the struct
dev_pm_ops and callbacks are removed without the need for __maybe_unused
markings.

In this case we can't simply use DEFINE_RUNTIME_DEV_PM_OPS() because
that would provide suspend and resume functions without the
checks the driver is doing before calling runtime_pm functions
(whether the necessary GPIO is provided).  It may be possible to
clean that up in future by moving the checks into the callbacks.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Link: https://lore.kernel.org/r/20220807185618.1038812-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: proximity: sx9360: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Sun, 7 Aug 2022 18:56:15 +0000 (19:56 +0100)]
iio: proximity: sx9360: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

These new macros avoid the need for marking the callbacks __maybe_unused
whilst ensuring both callbacks and structure may be dropped by the compiler
if CONFIG_PM_SLEEP is not enabled.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220807185618.1038812-4-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: proximity: sx9324: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Sun, 7 Aug 2022 18:56:14 +0000 (19:56 +0100)]
iio: proximity: sx9324: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

These new macros avoid the need for marking the callbacks __maybe_unused
whilst ensuring both callbacks and structure may be dropped by the compiler
if CONFIG_PM_SLEEP is not enabled.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220807185618.1038812-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: proximity: sx9310: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Sun, 7 Aug 2022 18:56:13 +0000 (19:56 +0100)]
iio: proximity: sx9310: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

These new macros avoid the need for marking the callbacks __maybe_unused
whilst ensuring both callbacks and structure may be dropped by the compiler
if CONFIG_PM_SLEEP is not enabled.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220807185618.1038812-2-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodocs: iio: add documentation for BNO055 driver
Andrea Merello [Wed, 7 Sep 2022 13:22:05 +0000 (15:22 +0200)]
docs: iio: add documentation for BNO055 driver

The bno055 driver is rather complex and have some oddities and not-obvious
things that worth to document (e.g. calibration files).

This patch also contains this [0] fix squashed in.

[0] https://lore.kernel.org/lkml/20220704034041.15448-1-bagasdotme@gmail.com/

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-15-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: imu: add BNO055 I2C driver
Andrea Merello [Wed, 7 Sep 2022 13:22:04 +0000 (15:22 +0200)]
iio: imu: add BNO055 I2C driver

Add an I2C driver for communicating to a BNO055 IMU via I2C bus and enable
the BNO055 core driver to work in this scenario.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-14-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: imu: add BNO055 serdev driver
Andrea Merello [Wed, 7 Sep 2022 13:22:03 +0000 (15:22 +0200)]
iio: imu: add BNO055 serdev driver

Add a serdev driver for communicating to a BNO055 IMU via serial bus, and
enable the BNO055 core driver to work in this scenario.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Link: https://lore.kernel.org/r/20220907132205.28021-13-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio/imu: Add Bosch BNO055
Andrea Merello [Wed, 7 Sep 2022 13:22:02 +0000 (15:22 +0200)]
dt-bindings: iio/imu: Add Bosch BNO055

Introduce new documentation file for the Bosch BNO055 IMU.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-12-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: document "serialnumber" sysfs attribute
Andrea Merello [Wed, 7 Sep 2022 13:22:01 +0000 (15:22 +0200)]
iio: document "serialnumber" sysfs attribute

Add ABI documentation for the new "serialnumber" sysfs attribute. The
first user is the bno055 IIO driver.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-11-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: document bno055 private sysfs attributes
Andrea Merello [Wed, 7 Sep 2022 13:22:00 +0000 (15:22 +0200)]
iio: document bno055 private sysfs attributes

Add ABI documentation for bno055 driver private sysfs attributes.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-10-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: imu: add Bosch Sensortec BNO055 core driver
Andrea Merello [Wed, 7 Sep 2022 13:21:59 +0000 (15:21 +0200)]
iio: imu: add Bosch Sensortec BNO055 core driver

Add the core driver for the BNO055 IMU from Bosch. This IMU can be
connected via both serial and I2C busses; separate patches will add support
for them.

The driver supports "AMG" (Accelerometer, Magnetometer, Gyroscope) mode,
that provides raw data from the said internal sensors, and a couple of
"fusion" modes (i.e. the IMU also does calculations in order to provide
euler angles, quaternions, linear acceleration and gravity measurements).

In fusion modes the AMG data is still available (with some calibration
refinements done by the IMU), but certain settings such as low pass filters
cut-off frequency and sensors' ranges are fixed, while in AMG mode they can
be customized; this is why AMG mode can still be interesting.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Link: https://lore.kernel.org/r/20220907132205.28021-9-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: add support for binary attributes
Andrea Merello [Wed, 7 Sep 2022 13:21:58 +0000 (15:21 +0200)]
iio: add support for binary attributes

When a IIO device is registered, the IIO core creates an attribute group on
its own, where it puts the channel attributes, and where it copies the
attributes in indio_dev->info->attrs.

Unfortunately it doesn't take care of binary attributes (i.e. it only
consider indio_dev->info->attrs->attrs, and it ignores
indio_dev->info->attrs->bin_attrs).

Fix this by making the IIO layer take care also of the binary attributes.

Note that while it is necessary to copy the non-binary attributes because
the IIO layer needs more room to add the channels attribute, it should be
enough to assign the bin_attrs pointer to the binary attributes pointed by
indio_dev->info->attrs->bin_attrs.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-8-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: event_monitor: add pitch, yaw and roll modifiers
Andrea Merello [Wed, 7 Sep 2022 13:21:57 +0000 (15:21 +0200)]
iio: event_monitor: add pitch, yaw and roll modifiers

Following the introduction of pitch, yaw and roll IIO modifiers, update the
event_monitor tool accordingly.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-7-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: document pitch, yaw, roll modifiers
Andrea Merello [Wed, 7 Sep 2022 13:21:56 +0000 (15:21 +0200)]
iio: document pitch, yaw, roll modifiers

Introduce ABI documentation for new modifiers used for reporting rotations
expressed as euler angles (i.e. yaw, pitch, roll).

It looks like we have some unit inconsistency along various IIO modifiers:
it seems that incli is in deg, angl is in radians and rot isn't documented,
but at least the adis16209 driver has rot in deg.

Here we use deg (so angl is the only one using radians).

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-6-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: add modifers for pitch, yaw, roll
Andrea Merello [Wed, 7 Sep 2022 13:21:55 +0000 (15:21 +0200)]
iio: add modifers for pitch, yaw, roll

Add modifiers for reporting rotations as euler angles (i.e. yaw, pitch and
roll).

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-5-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: event_monitor: add linear acceleration modifiers
Andrea Merello [Wed, 7 Sep 2022 13:21:54 +0000 (15:21 +0200)]
iio: event_monitor: add linear acceleration modifiers

Following the introduction of IIO linear acceleration modifiers, update the
event_monitor tool accordingly.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-4-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: document linear acceleration modifiers
Andrea Merello [Wed, 7 Sep 2022 13:21:53 +0000 (15:21 +0200)]
iio: document linear acceleration modifiers

Introduce ABI documentation for new IIO modifiers used for reporting
"linear acceleration" measures.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-3-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: add modifiers for linear acceleration
Andrea Merello [Wed, 7 Sep 2022 13:21:52 +0000 (15:21 +0200)]
iio: add modifiers for linear acceleration

Add IIO_MOD_LINEAR_X, IIO_MOD_LINEAR_Y and IIO_MOD_LINEAR_Z modifiers to te
IIO core, which is preparatory for adding the Bosch BNO055 IMU driver.

Bosch BNO055 IMU can report raw accelerations (among x, y and z axis) as
well as the so called "linear accelerations" (again, among x, y and z axis)
which is basically the acceleration after subtracting gravity and for which
those new modifiers are for.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220907132205.28021-2-andrea.merello@iit.it
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: dps310: Reset chip after timeout
Eddie James [Thu, 15 Sep 2022 19:57:19 +0000 (14:57 -0500)]
iio: pressure: dps310: Reset chip after timeout

The DPS310 chip has been observed to get "stuck" such that pressure
and temperature measurements are never indicated as "ready" in the
MEAS_CFG register. The only solution is to reset the device and try
again. In order to avoid continual failures, use a boolean flag to
only try the reset after timeout once if errors persist.

Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310")
Cc: <stable@vger.kernel.org>
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220915195719.136812-3-eajames@linux.ibm.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: dps310: Refactor startup procedure
Eddie James [Thu, 15 Sep 2022 19:57:18 +0000 (14:57 -0500)]
iio: pressure: dps310: Refactor startup procedure

Move the startup procedure into a function, and correct a missing
check on the return code for writing the PRS_CFG register.

Cc: <stable@vger.kernel.org>
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220915195719.136812-2-eajames@linux.ibm.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adi,ad7923: add adi,range-double property
Nuno Sá [Mon, 12 Sep 2022 08:12:23 +0000 (10:12 +0200)]
dt-bindings: iio: adi,ad7923: add adi,range-double property

Document the new property to enable doubling the analog input range.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220912081223.173584-4-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: ad7923: support extended range
Nuno Sá [Mon, 12 Sep 2022 08:12:22 +0000 (10:12 +0200)]
iio: adc: ad7923: support extended range

By default the driver was always setting the RANGE bit which means that
the analog input goes from 0 to VREF. However, we might want to have 0
to 2xVREF. This change adds a new Firmware property to allow for the
extended range while keeping the default behavior if nothing is provided.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220912081223.173584-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: ad7923: fix channel readings for some variants
Nuno Sá [Mon, 12 Sep 2022 08:12:21 +0000 (10:12 +0200)]
iio: adc: ad7923: fix channel readings for some variants

Some of the supported devices have 4 or 2 LSB trailing bits that should
not be taken into account. Hence we need to shift these bits out which
fits perfectly on the scan type shift property. This change fixes both
raw and buffered reads.

Fixes: f2f7a449707e ("iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924")
Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220912081223.173584-2-nuno.sa@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: stm32-adc: add id registers support
Olivier Moysan [Thu, 15 Sep 2022 13:54:52 +0000 (15:54 +0200)]
iio: adc: stm32-adc: add id registers support

Add support of identification registers to STM32 ADC.

By default the ADC hardware instance number is retrieved from
the compatible configuration data. Get the available ADC number
per ADC block, from hardware configuration register,
when this register exists.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220915135452.1712453-1-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: imu: st_lsm6dsx: add lsm6dstx device bindings
Lorenzo Bianconi [Thu, 15 Sep 2022 17:35:00 +0000 (19:35 +0200)]
dt-bindings: iio: imu: st_lsm6dsx: add lsm6dstx device bindings

Add device bindings for lsm6dstx IMU sensor.
Use lsm6dst as fallback device for lsm6dstx since it implements all the
features currently supported by lsm6dstx.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/dadc2acf88b0b73feac9a8980ad9af1658297bc1.1663262890.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: imu: st_lsm6dsx: add support to LSM6DSTX
Lorenzo Bianconi [Thu, 15 Sep 2022 17:34:59 +0000 (19:34 +0200)]
iio: imu: st_lsm6dsx: add support to LSM6DSTX

Add support to STM LSM6DSTX (acc + gyro) Mems sensor.
The LSM6DSTX sensor can use LSM6DST as fallback device since it
implements all the LSM6DSTX features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dstx.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/573a232b0f320b2ec92c56fa24393cfb275183fb.1663262890.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodrivers: iio: adc: ltc2497: Rename the LTC2499 iio device
Ciprian Regus [Fri, 16 Sep 2022 14:09:22 +0000 (17:09 +0300)]
drivers: iio: adc: ltc2497: Rename the LTC2499 iio device

Set the iio device's name based on the chip used for the
LTC2499 only. The most common way for IIO clients to interact
with a device is to address it based on it's name. By using
the dev_name() function, the name will be set based on a
i2c_client's kobj name, which has the format i2c_instance-i2c_address
(1-0076 for example). This is not ideal, since it makes a
requirement for userspace to have knowledge about the hardware
connections of the device.

The name field is set to NULL for the LTC2497 and LTC2496, so
that the old name can kept as it is, since changing it will
result in an ABI breakage.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-6-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodrivers: iio: adc: ltc2497: LTC2499 support
Ciprian Regus [Fri, 16 Sep 2022 14:09:21 +0000 (17:09 +0300)]
drivers: iio: adc: ltc2497: LTC2499 support

The LTC2499 is a 16-channel (eight differential), 24-bit,
ADC with Easy Drive technology and a 2-wire, I2C interface.

Implement support for the LTC2499 ADC by extending the LTC2497
driver. A new chip_info struct is added to differentiate between
chip types and resolutions when reading data from the device.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/2499fe.pdf
Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-5-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoAdd MAINTAINERS entries for LTC2497 and LTC2496
Ciprian Regus [Fri, 16 Sep 2022 14:09:20 +0000 (17:09 +0300)]
Add MAINTAINERS entries for LTC2497 and LTC2496

Update the MAINTAINERS file to include the path for the LTC2497
and LTC2496 devicetree bindings documentation.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-4-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adc: Add docs for LTC2499
Ciprian Regus [Fri, 16 Sep 2022 14:09:19 +0000 (17:09 +0300)]
dt-bindings: iio: adc: Add docs for LTC2499

Update the bindings documentation for ltc2497 to include the ltc2499.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220916140922.2506248-3-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoMAINTAINERS: Remove duplicate matching entry
Ciprian Regus [Fri, 16 Sep 2022 14:09:18 +0000 (17:09 +0300)]
MAINTAINERS: Remove duplicate matching entry

Remove the specific entry for ad5758, since
Documentation/devicetree/bindings/iio/*/adi,* already matches
the path.

Signed-off-by: Ciprian Regus <ciprian.regus@analog.com>
Link: https://lore.kernel.org/r/20220916140922.2506248-2-ciprian.regus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: ltc2497: Fix reading conversion results
Uwe Kleine-König [Mon, 15 Aug 2022 09:16:47 +0000 (09:16 +0000)]
iio: ltc2497: Fix reading conversion results

After the result of the previous conversion is read the chip
automatically starts a new conversion and doesn't accept new i2c
transfers until this conversion is completed which makes the function
return failure.

So add an early return iff the programming of the new address isn't
needed. Note this will not fix the problem in general, but all cases
that are currently used. Once this changes we get the failure back, but
this can be addressed when the need arises.

Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ")
Reported-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Denys Zagorui <dzagorui@cisco.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220815091647.1523532-1-dzagorui@cisco.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: Add more tunable config parameters for BMP380
Angel Iglesias [Mon, 12 Sep 2022 23:54:42 +0000 (01:54 +0200)]
iio: pressure: bmp280: Add more tunable config parameters for BMP380

Allows sampling frequency and IIR filter coefficients configuration
using sysfs ABI.

The IIR filter coefficient is configurable using the sysfs attribute
"filter_low_pass_3db_frequency".

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/876f8a2277f71672488e99aa02aae4239d530f51.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: pressure: bmp085: Add BMP380 compatible string
Angel Iglesias [Mon, 12 Sep 2022 23:53:50 +0000 (01:53 +0200)]
dt-bindings: iio: pressure: bmp085: Add BMP380 compatible string

Add bosch,bmp380 compatible string for the new family of sensors.
This family includes the BMP380, BMP384 and BMP388. The register map
in this family changes substantially and introduces new features
but core concepts and operations carryover from the previous iterations

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/67224da4ae308bb752fc8fdecc54345cedab6c21.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: Add support for BMP380 sensor family
Angel Iglesias [Mon, 12 Sep 2022 23:52:13 +0000 (01:52 +0200)]
iio: pressure: bmp280: Add support for BMP380 sensor family

Adds compatibility with the new generation of this sensor, the BMP380.

Includes basic sensor initialization to do pressure and temp
measurements and allows tuning oversampling settings for each channel.

The compensation algorithms are adapted from the device datasheet and
the repository https://github.com/BoschSensortec/BMP3-Sensor-API.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/f1da2a2f1bc5bb083f318335c23b4f3d9bb8e536.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: reorder i2c device tables declarations
Angel Iglesias [Mon, 12 Sep 2022 23:50:07 +0000 (01:50 +0200)]
iio: pressure: bmp280: reorder i2c device tables declarations

Change device tables declarations to forward order like in SPI codepath.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/a3969b60e428b9bd29ea1ebc6dd69aa5bbe59da0.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: Fix alignment for DMA safety
Angel Iglesias [Mon, 12 Sep 2022 23:48:21 +0000 (01:48 +0200)]
iio: pressure: bmp280: Fix alignment for DMA safety

Adds DMA-safe buffers to driver data struct to store raw data from sensors

The multiple buffers used thorough the driver share the same memory
allocated as part of the device data instance. The union containing
the buffers is aligned to allow safe usage with DMA operations, such
as regmap bulk read calls.

Updated measurement and calibration reading functions to use the safe
DMA buffers.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/7919793f7f63224d5ce413c66d648029683c17ac.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: simplify driver initialization logic
Angel Iglesias [Mon, 12 Sep 2022 23:47:31 +0000 (01:47 +0200)]
iio: pressure: bmp280: simplify driver initialization logic

Simplified common initialization logic of different sensor types
unifying calibration and initial configuration recovery.

Default config param values of each sensor type are stored inside
chip_info structure and used to initialize sensor data struct instance.

The helper functions for read each sensor type calibration are converted
to a callback available on the chip_info struct.

Separated bme280 specific calibration code from bmp280 function. Dropped
the additional chip_id argument in bmp280 code as is not longer required.
Now both bmp280/bme280 calibration function use same signature as bmp180.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/584c90f309e4f24bf2e4aa2b15c8577d288f978d.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: Simplify bmp280 calibration data reading
Angel Iglesias [Mon, 12 Sep 2022 23:46:42 +0000 (01:46 +0200)]
iio: pressure: bmp280: Simplify bmp280 calibration data reading

On bmp280 and bme280, the temperature and pressure calibration parameters
are available on a contiguous memory region. Considering this arrangement,
simplified the calibration reading function by using only one buffer
to read in batch temperature and pressure registers.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/96d81282c95006d857f4d836d2ff3ee0740a85a0.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: use FIELD_GET, FIELD_PREP and GENMASK
Angel Iglesias [Mon, 12 Sep 2022 23:45:49 +0000 (01:45 +0200)]
iio: pressure: bmp280: use FIELD_GET, FIELD_PREP and GENMASK

Cleaned and simplified register values construction and extraction
converting to use FIELD_PREP and FIELD_GET macros.

Replaced hardcoded bit masks with GENMASK macro.

Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/3cbe56f29c2a46bc5dc23c5b72e1b43c9207f44d.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: reorder local variables following reverse xmas tree
Angel Iglesias [Mon, 12 Sep 2022 23:44:52 +0000 (01:44 +0200)]
iio: pressure: bmp280: reorder local variables following reverse xmas tree

Reordered definitions of local variables following the reverse christmas
tree convention.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/363a106afbfe30ce590b80b1494c8b3322870f8a.1663025017.git.ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: dac: ad5593r: add check for i2c functionality
Nuno Sá [Tue, 13 Sep 2022 07:34:13 +0000 (09:34 +0200)]
iio: dac: ad5593r: add check for i2c functionality

Make sure that the needed i2c functionality is supported during probe.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20220913073413.140475-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: dac: ad5593r: Fix i2c read protocol requirements
Michael Hennerich [Tue, 13 Sep 2022 07:34:12 +0000 (09:34 +0200)]
iio: dac: ad5593r: Fix i2c read protocol requirements

For reliable operation across the full range of supported
interface rates, the AD5593R needs a STOP condition between
address write, and data read (like show in the datasheet Figure 40)
so in turn i2c_smbus_read_word_swapped cannot be used.

While at it, a simple helper was added to make the code simpler.

Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: temperature: mlx90614 Refactoring available filter attributes
Crt Mori [Tue, 6 Sep 2022 11:26:32 +0000 (13:26 +0200)]
iio: temperature: mlx90614 Refactoring available filter attributes

Change/refactor to the new way of defining available attribute values.

Signed-off-by: Crt Mori <cmo@melexis.com>
Link: https://lore.kernel.org/r/20220906112632.244453-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodrivers: iio: accel: adxl312 and adxl314 support
George Mois [Mon, 5 Sep 2022 13:20:18 +0000 (16:20 +0300)]
drivers: iio: accel: adxl312 and adxl314 support

ADXL312 and ADXL314 are small, thin, low power, 3-axis accelerometers
with high resolution (13-bit) measurement up to +/-12 g and +/- 200 g
respectively.

Implement support for ADXL312 and ADXL314 by extending the ADXL313
driver.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL312.pdf
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL314.pdf
Signed-off-by: George Mois <george.mois@analog.com>
Link: https://lore.kernel.org/r/20220905132018.364900-2-george.mois@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: accel: adxl313: Add compatibles for adxl312 and adxl314
George Mois [Mon, 5 Sep 2022 13:20:17 +0000 (16:20 +0300)]
dt-bindings: iio: accel: adxl313: Add compatibles for adxl312 and adxl314

Extend the adi,adxl313.yaml file with information regrding the
ADXL312 and ADXL314 devices.

Signed-off-by: George Mois <george.mois@analog.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220905132018.364900-1-george.mois@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: bmp280: fix datasheet links
Angel Iglesias [Mon, 12 Sep 2022 22:26:44 +0000 (00:26 +0200)]
iio: pressure: bmp280: fix datasheet links

Updated links for BMP280 and BME280 datasheets on Bosch website.
Datasheet of BMP180 is no longer available on the manufacturer's website,
changed the link to a copy hosted by a third party.

Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
Link: https://lore.kernel.org/r/20220912222645.377874-1-ang.iglesiasg@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: pressure: st_pressure: Add support for LPS22DF
Martyn Welch [Fri, 9 Sep 2022 16:16:10 +0000 (17:16 +0100)]
iio: pressure: st_pressure: Add support for LPS22DF

Add support for ST LPS22DF pressure sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lps22df.pdf
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Link: https://lore.kernel.org/r/20220909161611.780720-2-martyn.welch@collabora.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: st,st-sensors add LPS22DF.
Martyn Welch [Fri, 9 Sep 2022 16:16:09 +0000 (17:16 +0100)]
dt-bindings: iio: st,st-sensors add LPS22DF.

Add support for the ST LPS22DF, an I2C/SPI pressure sensor.

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220909161611.780720-1-martyn.welch@collabora.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoMerge tag 'misc-habanalabs-next-2022-09-21' of https://git.kernel.org/pub/scm/linux...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:21:19 +0000 (16:21 +0200)]
Merge tag 'misc-habanalabs-next-2022-09-21' of https://git./linux/kernel/git/ogabbay/linux into char-misc-next

Oded writes:

  "This tag contains habanalabs driver changes for v6.1:

   - Support new notifier event for device state change through eventfd.
   - Add uAPI to retrieve device attestation information for Gaudi2.
   - Add uAPI to retrieve the h/w status of all h/w blocks.
   - Add uAPI to control the running mode of the engine cores in Gaudi2.
   - Expose whether the device runs with secured firmware through the INFO ioctl
     and sysfs.
   - Support trace events in DMA allocations and MMU map/unmap operations.
   - Notify firmware when the device was acquired by a user process and when it
     was released. This is done as part of the RAS that the f/w performs.
   - Multiple bug fixes, refactors and renames.
   - Cleanup of error messages, moving some to debug level.
   - Enhance log prints in case of h/w error events for Gaudi2."

* tag 'misc-habanalabs-next-2022-09-21' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (68 commits)
  habanalabs: eliminate aggregate use warning
  habanalabs/gaudi: use 8KB aligned address for TPC kernels
  habanalabs: remove some f/w descriptor validations
  habanalabs: build ASICs from new to old
  habanalabs/gaudi2: allow user to flush PCIE by read
  habanalabs: failure to open device due to reset is debug level
  habanalabs/gaudi2: Remove unnecessary (void*) conversions
  habanalabs/gaudi2: add secured attestation info uapi
  habanalabs/gaudi2: add handling to pmmu events in eqe handler
  habanalabs/gaudi: change TPC Assert to use TPC DEC instead of QMAN err
  habanalabs: rename error info structure
  habanalabs/gaudi2: get f/w reset status register dynamically
  habanalabs/gaudi2: increase hard-reset sleep time to 2 sec
  habanalabs/gaudi2: print RAZWI info upon PCIe access error
  habanalabs: MMU invalidation h/w is per device
  habanalabs: new notifier events for device state
  habanalabs/gaudi2: free event irq if init fails
  habanalabs: fix resetting the DRAM BAR
  habanalabs: add support for new cpucp return codes
  habanalabs/gaudi2: read F/W security indication after hard reset
  ...

22 months agoMerge tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:16:03 +0000 (16:16 +0200)]
Merge tag 'coresight-next-v6.1' of git://git./linux/kernel/git/coresight/linux into char-misc-next

Suzuki writes:
  "coresight: Changes for v6.1

   Coresight trace subsystem updates for v6.1 includes:
     - Support for HiSilicon PTT trace
     - Coresight cleanup of sysfs accessor functions, reduced
       code size.
     - Expose coresight timestamp source for ETMv4+
     - DT binding updates to include missing properties
     - Minor documentation, Kconfig text fixes.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>"
* tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
  hwtracing: hisi_ptt: Fix up for "iommu/dma: Make header private"
  MAINTAINERS: Add maintainer for HiSilicon PTT driver
  docs: trace: Add HiSilicon PTT device driver documentation
  hwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device
  hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device
  iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
  coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  coresight: Make new csdev_access offsets unsigned
  coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors
  coresight: Re-use same function for similar sysfs register accessors
  coresight: Simplify sysfs accessors by using csdev_access abstraction
  coresight: Remove unused function parameter
  coresight: etm4x: docs: Add documentation for 'ts_source' sysfs interface
  coresight: etm4x: Expose default timestamp source in sysfs
  dt-bindings: arm: coresight-tmc: Add 'iommu' property
  dt-bindings: arm: coresight: Add 'power-domains' property
  coresight: docs: Fix a broken reference
  coresight: trbe: fix Kconfig "its" grammar

22 months agoMerge tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:04:24 +0000 (16:04 +0200)]
Merge tag 'iio-for-6.1a' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanup for 6.1

This includes Nuno Sa's work to move the IIO core over to generic firmware
properties rather than having DT specific code paths. Combined with Andy
Shevchenko's long term work on drivers, this leaves IIO in a good state for
handling other firmware types.

New device support
- liteon,ltrf216a
  * New driver and dt bindings to support this Light sensor.
- maxim,max11205
  * New driver for this 16bit single channel ADC.
- memsensing,msa311
  * New driver for this accelerometer. Includes a string helper for read/write.
- richtek,rtq6056
  * New driver and dt binding to support this current monitor used to measure
    power usage.
- yamaha,yas530
  * Support the YAS537 variant (series includes several fixes for other parts
    and new driver features).

Staging graduation
- adi,ad7746 CDC. Cleanup conducted against set of roadtest tests using
  the posted RFC of that framework.

Features
- core
  * Large rework to make all the core IIO code use generic firmware properties.
    Includes switching some drivers over as well using newly provided
    generic interfaces and allowing removal of DT specific ones.
  * Support for gesture event types for single and double tap. Used in
    bosch,bma400.
- atmel,at91-sama5d2
  * Add support for temperature sensor which uses two muxed inputs to estimate
    the temperature.
  * Handle trackx bits of EMR register to improve temp sampling accuracy.
  * Runtime PM support.
- liteon,ltrf216a
  * Add a _raw channel output to allow working around an issue with
    differing conversions equations that breaks some user space controls.
- mexelis,mlx90632
  * Support regulator control.
- ti,tsc2046
  * External reference voltage support.

Clean up and minor fixes
- Tree-wide
  * devm_clk_get_enabled() replacements of opencoded equivalent.
  * Remaining IIO_DMA_MINALIGN conversions (the staging/iio drivers).
  * Various minor warning and similar cleanup such as missing static
    markings.
  * strlcpy() to strscpy() for cases where return value not checked.
  * provide units.h entries for more HZ units and use them in drivers.
- dt-bindings cleanup
  * Drop maintainers listss where the email address is bouncing.
  * Switch spi devices over to using spi-peripheral.yaml
  * Add some missing unevaluatedProperties / additionalProperties: false
    entries.
- ABI docs
  * Add some missing channel type specific sampling frequency entries.
  * Add parameter names for callback parameters.
- MAINTAINERS
  * Fix wrong ADI forum links.
- core
  * lockdep class per device, to avoid an issue with nest when one IIO
    device is the consumer of another.
  * White space tweaks.
- asc,dlhl60d
  * Use get_unaligned_be24 to avoid some unusual data manipulation and masking.
- atmel,at91-sama5d2
  * Fix wrong max value.
  * Improve error handling when measuring pressure and touch.
  * Add locks to remove races on updating oversampling / sampling freq.
  * Add missing calls in suspend and resume path to ensure state is correctly
    brought up if buffered capture was in use when suspend happened.
  * Error out of write_raw() callback if buffered capture enabled to avoid
    unpredictable behavior.
  * Handle different versions having different oversampling ratio support and
    drop excess error checking.
  * Cleanup magic value defines where the name is just the value and hence
    hurts readability.
  * Use read_avail() callback to provide info on possible oversampling ratios.
  * Correctly handle variable bit depth when doing oversampling on different
    supported parts. Also handle higher oversampling ratios.
- fsl,imx8qxp
  * Don't ignore errors from regulator_get_voltage() so as to avoid some
    very surprising scaling.
- invensense,icp10100
  * Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS. UNIVERSAL rarely made
    sense and is now deprecated. In this driver we just avoid double disabling
    in some paths.
- maxim,max1363
  * Drop consumer channel map provision by platform data. There have been
    better ways of doing this for years and there are no in tree users.
- microchip,mcp3911
  * Update status to maintained.
- qcom,spmi-adc5
  * Support measurement of LDO output voltage.
- qcom,spmi-adc
  * Add missing channel available on SM6125 SoC.
- st,stmpe
  * Drop requirement on node name in binding now that driver correctly
    doesn't enforce it.
- stx104
  * Move to more appropriate addac directory
- ti,am335x
  * Document ti,am654-adc compatible already in use in tree.
- ti,hmc5843
  * Move dev_pm_ops out of header and use new pm macros to handle export.
- yamaha,yas530
  * Minor cleanups.

* tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (142 commits)
  iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().
  iio: adc: max1363: Drop provision to provide an IIO channel map via platform data
  iio: accel: bma400: Add support for single and double tap events
  iio: Add new event type gesture and use direction for single and double tap
  iio: Use per-device lockdep class for mlock
  iio: adc: add max11205 adc driver
  dt-bindings: iio: adc: Add max11205 documentation file
  iio: magnetometer: yamaha-yas530: Use dev_err_probe()
  iio: magnetometer: yamaha-yas530: Make strings const in chip info
  iio: magnetometer: yamaha-yas530: Use pointers as driver data
  iio: adc: tsc2046: silent spi_device_id warning
  iio: adc: tsc2046: add vref support
  dt-bindings: iio: adc: ti,tsc2046: add vref-supply property
  iio: light: ltrf216a: Add raw attribute
  dt-bindings: iio: Add missing (unevaluated|additional)Properties on child nodes
  MAINTAINERS: fix Analog Devices forum links
  iio/accel: fix repeated words in comments
  dt-bindings: iio: accel: add dt-binding schema for msa311 accel driver
  iio: add MEMSensing MSA311 3-axis accelerometer driver
  dt-bindings: vendor-prefixes: add MEMSensing Microsystems Co., Ltd.
  ...

22 months agoMerge tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:43:35 +0000 (15:43 +0200)]
Merge tag 'mhi-for-v6.1' of git://git./linux/kernel/git/mani/mhi into char-misc-next

Manivannan writes:
  "MHI Host
   --------

   - Print the modem name while probing the MHI host pci-generic driver. This has
     been exposed as a debug information so far but on a low storate embedded
     devices such as OpenWRT based products, this helps in identifying the
     attached modem without enabling the debug logs."

* tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi:
  bus: mhi: host: always print detected modem name

22 months agoMerge tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:42:42 +0000 (15:42 +0200)]
Merge tag 'fpga-for-6.1-rc1' of git://git./linux/kernel/git/fpga/linux-fpga into char-misc-next

Xu writes:

FPGA Manager changes for 6.1-rc1

DFL

- Matthew's change adds new device IDs supported by DFL.
- Dan's change uses array_size() for memory allocation to prevent
potential overflow

Microchip

- Conor's change adds MODULE_AUTHOR entry for microchip-spi driver
- Krzysztof's change refines dt-bindings

Intel m10 bmc secure update

- Russ's change adds new device ID supported by the driver

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-next branch).

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
  fpga: m10bmc-sec: d5005 bmc secure update driver
  fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
  dt-bindings: fpga: microchip,mpf-spi-fpga-mgr: use spi-peripheral-props.yaml
  fpga: microchip-spi: add missing module author entry
  fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards

22 months agoMerge branch 'icc-ignore-return-val' into icc-next
Georgi Djakov [Tue, 20 Sep 2022 12:57:00 +0000 (15:57 +0300)]
Merge branch 'icc-ignore-return-val' into icc-next

Today remove callbacks of platform devices return an int. This is unfortunate
because the device core ignores the return value and so the platform code only
emits a warning (and still removes the device).

The longterm quest is to make these remove callbacks return void instead.
This series is a preparation for that, with the goal to make the remove
callbacks obviously always return 0. This way when the prototype of
these functions is changed to return void, the change is straight
forward and easy to review.

Link: https://lore.kernel.org/r/20220718121409.171773-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Georgi Djakov <djakov@kernel.org>