linux/drivers/pinctrl/meson
Viacheslav Bocharov 9777530157 pinctrl: meson: restore non-sleeping GPIO access
Commit 28f2406838 ("pinctrl: meson: mark the GPIO controller as
sleeping") set gpio_chip.can_sleep = true to work around
gpio-shared-proxy holding a spinlock across a sleeping pinctrl config
path. That locking bug is now fixed in the shared-proxy itself ("gpio:
shared-proxy: always serialize with a sleeping mutex"), so the
controller-wide workaround is no longer needed; the meson GPIO
controller does not sleep.

meson_gpio_get/set/direction_* access MMIO through regmap. The
regmap_mmio bus uses fast I/O (spinlock) locking, so these value
callbacks do not contain sleeping operations. Since gpio_chip.can_sleep
describes the get/set value path, restore can_sleep = false.

Marking the controller sleeping also broke atomic value consumers such
as w1-gpio (1-Wire bitbang): w1_io.c runs its read time slot under
local_irq_save() and uses the non-cansleep gpiod_set_value() /
gpiod_get_value(), which with can_sleep=true trigger WARN_ON(can_sleep)
in gpiolib on every transferred bit (from w1_gpio_write_bit() /
w1_gpio_read_bit() via w1_reset_bus() and w1_search()). The printk and
stack dump inside the IRQs-off, microsecond-scale time slot destroy the
bit timing, so reset/presence detection and ROM search fail: the bus
master registers but w1_master_slave_count stays at 0 and no devices
are found. Verified on an Amlogic A113X board (DS18B20 on GPIOA_14):
with can_sleep restored to false the warnings are gone and the sensor
is detected and read again.

This must not be applied or backported without the shared-proxy locking
fix above; otherwise the original Khadas VIM3 splat returns on boards
that genuinely share a meson GPIO.

Fixes: 28f2406838 ("pinctrl: meson: mark the GPIO controller as sleeping")
Link: https://lore.kernel.org/all/20260105150509.56537-1-bartosz.golaszewski@oss.qualcomm.com/
Signed-off-by: Viacheslav Bocharov <v@baodeep.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260625115718.1678991-3-v@baodeep.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-07-01 09:26:40 +02:00
..
Kconfig pinctrl: Kconfig: drop unneeded dependencies on OF_GPIO 2026-03-10 10:10:50 +01:00
Makefile pinctrl: Add driver support for Amlogic SoCs 2025-02-28 00:03:18 +01:00
pinctrl-amlogic-a4.c Pin control changes for the v7.2 kernel cycle: 2026-06-18 15:03:21 -07:00
pinctrl-amlogic-c3.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-amlogic-t7.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-a1.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-axg-pmx.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-axg-pmx.h pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-axg.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-g12a.c pinctrl: meson-g12a: add GPIOC_7 pcie_clkreqn pinmux 2025-08-19 14:18:38 +02:00
pinctrl-meson-gxbb.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson-gxl.c pinctrl: meson-gxl: add missing i2c_d pinmux 2025-08-28 23:06:03 +02:00
pinctrl-meson-s4.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson.c pinctrl: meson: restore non-sleeping GPIO access 2026-07-01 09:26:40 +02:00
pinctrl-meson.h pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson8-pmx.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson8-pmx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 446 2019-06-05 17:37:18 +02:00
pinctrl-meson8.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00
pinctrl-meson8b.c pinctrl: meson: Constify some structures 2024-08-23 18:01:42 +02:00