From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx.adeep.su (mx.adeep.su [185.250.0.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4729B3DC4CE; Thu, 25 Jun 2026 11:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.250.0.168 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782388703; cv=none; b=GnrxsP3nXKpLfSjzsfUGwAk+EEfsEIrDpL/sap3bbIo48yopErt29dVIQjH78gsNGI3UqTpK5kXZW663fGy3t2nfbawE3QNfBTAshn3igVXHMGym1iRjUA04RRtJak7ol0cKBPBRs+JSL8uvGaeWcuuNqo75HTmbXRJSULd2+XE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782388703; c=relaxed/simple; bh=wNzAuXcWKf/3Wjv5an5ddI6FkHq3+dtPMgB0sEG19Rs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Whh8Rx80PPM4dchihdC5N5Zx+olFDmR+u/CMDUTXEL4R81wU4+guq1Pa9iu64gdcmnheq2fyNdJjSwk4dGelyKX/7hLqNlMRql3W0VdixbB2OdYBNauuyseS+T/Valys8Q1Na7ViQPWaggPz+Rg/Osc0PTVhBftsbS8TrV1Imb8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=baodeep.com; spf=pass smtp.mailfrom=baodeep.com; dkim=fail (2048-bit key) header.d=baodeep.com header.i=@baodeep.com header.b=Yibxn0dp reason="signature verification failed"; arc=none smtp.client-ip=185.250.0.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=baodeep.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baodeep.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baodeep.com header.i=@baodeep.com header.b="Yibxn0dp" Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 08E74170300; Thu, 25 Jun 2026 14:58:12 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baodeep.com; s=dkim; t=1782388700; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=tHBRfl9Vo3x4vHdC+OjdO88ymwe1Pfd1Y+88rPy3+7Y=; b=Yibxn0dpYcUtixpK9CEN3dPqAWNFVyUEIti9o3DVbUqkdztJzlm3K2sjjlFzSc/4vWby4X 7xypilkTmgxIhrQt0OLQxuk3mWzb+ywrnJDxBz4n9A+0N1jWDSI4v+w2DzqzfVGvZi/VXj Zd9hjwMv27VroThaUEghsz8LmJzInHjbsIqMAiPcSbj/UEZNYtgD6CTpswLOswGCkoRjqQ 5THkPf2M48U6N9ur+XDBor7yYY9b4T3jk3KM0e+p3qLp22gXvRpvFgSxnCcyaxpcJopnPV 0/7oorpf6HAThCCTrMS9LvIlwEHIHco1sPiMH2H0U/tpXjug/gBW8+cxzYDaNw== From: Viacheslav Bocharov To: Linus Walleij , Bartosz Golaszewski Cc: Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Marek Szyprowski , Robin Murphy , Diederik de Haas , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] pinctrl: meson: restore non-sleeping GPIO access Date: Thu, 25 Jun 2026 14:57:18 +0300 Message-ID: <20260625115718.1678991-3-v@baodeep.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260625115718.1678991-1-v@baodeep.com> References: <20260625115718.1678991-1-v@baodeep.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 Commit 28f240683871 ("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: 28f240683871 ("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 --- v1: https://lore.kernel.org/linux-gpio/20260610153329.937833-3-v@baodeep.com/ drivers/pinctrl/meson/pinctrl-meson.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 4507dc8b5563..18295b15ecd9 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -619,7 +619,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) pc->chip.set = meson_gpio_set; pc->chip.base = -1; pc->chip.ngpio = pc->data->num_pins; - pc->chip.can_sleep = true; + pc->chip.can_sleep = false; ret = gpiochip_add_data(&pc->chip, pc); if (ret) { -- 2.54.0