From nobody Fri Jun 19 07:51:08 2026 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 126232EFDA6 for ; Mon, 27 Apr 2026 02:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777255842; cv=none; b=siAYPgvLLGiKhZA9TvlFIcgYqhL+OwKsvEl5CADwNoC3PN6XfCtjsSkB6c0oLroYyOp1SUpsuvXt6KsHdCe/7YQ1MFIeKF3cJ1b0KcHvyjXJzAUGQZu7sBlpzDltVt15no/j9KyC18I1zrk+xn1S1tBEB1E7znSuW+9HVxXr+A0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777255842; c=relaxed/simple; bh=viJexUdqwfDtXJ6xLOWsVeVHZs9hpDIALfJkAe62pHo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tefL4kLRESJnZHi+2T91uXgKyPCGtS+ru/c2hcOG6LY8uq6xAuuQ6PQF1g7GByYpQgZcWBNwgW+lQaXQ+W0TvRfirYmMBnnnDWvmycIyAkP6kllLlCademjeomwcSCy41+t96t+JbRORQfCc3OcvwJ+Vtc++MLrkVo3VQyzjCh8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=jdEwHiAl; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jdEwHiAl" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-c70fb6aa323so3297971a12.3 for ; Sun, 26 Apr 2026 19:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1777255839; x=1777860639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eNGha38KYXK7mTaNFdD1kyRzSrZGKEbgGIpx5vaJrTA=; b=jdEwHiAlH44f8d1kc9uaLR0ka4iveQW76HvAA9ZX/ka1nwkC2L9r5KHD/ndh+i4YyB cP9807CcVCJ4I3NxdhNwTrDssHj46nK+SwLXturS82DedE/wRSw00L+iuhBWvGRWHoZC qiH6fYDlx85EjO9628ukimGdbsAavJaWGI/og= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777255839; x=1777860639; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eNGha38KYXK7mTaNFdD1kyRzSrZGKEbgGIpx5vaJrTA=; b=foXwSrQ2O66/UsXYI/aDVSCIO6QMvIAx+10zR6JbuGaj90zgfld7hWS8XqVCqRe2y1 kEt9uG7UaqYQrpUcJ2p06ai5s/3PC7kftgWR/Z/cdLIfn3V39+bOceo5/yG+FcO2cASe gNVBT51nQrWYXdkvILIZVKRqjXte8HsCWRO2sAmC/UKxBNpudSwtvFCw33FiObUBWCYS EaAcXI6p8x9HEnzdF27Zw9F13V7ENOzZQQ3LdOxusGcIPDtLtPDgKatIcwFVpa6qIHFv QV8sSb8rs3rKajdf1sjr33jboftLuU+V226sB9faGjo+IOoTqC0bAsvIY6AYU/Tjn44X oDDA== X-Forwarded-Encrypted: i=1; AFNElJ9FDbeT/LHPitIy6OKEHIPb0G3JObZPFyA4M4t236eBmkbE/hMxVbqTYxaC2XhScArsa/t/xndOG6vK7JU=@vger.kernel.org X-Gm-Message-State: AOJu0YwWjo8yQS+ee0fffDIgxNHGcERdyzY2NrXsry8T4B6So/tt4qzX 22JK1LXMBYZwSmmoLRN0NAHkQyJfhMl572HJa4WJxeawuUvMl7Iagu+44UjOcoYjfw== X-Gm-Gg: AeBDiev+6FqNB359Xt2VrzSsBzimX8GWWN1nD0H55rKpQ7iqKmzyW9JpHJRuKJsT+07 6ACLlcF2iObXALswikvTKZ6DB6hvx6bWCaa+U0+h2n3sbRIbAsCnyPsDGdm1IVsoRL8qYbURLnT CkKC5Dyf2lLRfC1WuykhLqn0TiegQkC7ikhcOgI4aEvRrGRX1ub9CB8lqdzjHhw2CRPnIf6340U CIamGoFCkT7vjgviaQQnn4/dZtQ6IMLdb2DUyRzwPYgSzEk+Ec0AnYReEZzOcrLyBoKQaQcbxOl bNBnlZ4UTI/GLwztmbYJ3wTGTthb3DCnkfaDv5KYDfycHsb2tFPkaKH6s9GqbFq+pfQszHxbpbr nLe9LHEyqQAEjBS2jQz29K971nG7wFbKZSitt8Jkj6gAW5Rgq/AJDFCMdadprrZWpNUNGqpYlPe OUCQ9h9mRfaWkcmzUzoRRvZTBq2JqUM4LKfEKlmqeujR5c95xtHHVMHuiOg3BdsK/5HsakRt4L6 ntyIFUE8QdjfV0aMhhFcBiQfXSEYA== X-Received: by 2002:a05:6a00:c81:b0:82c:dd31:b84a with SMTP id d2e1a72fcca58-82f8c908083mr40534324b3a.43.1777255839376; Sun, 26 Apr 2026 19:10:39 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:8f3b:cb24:e20a:84bd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82f8ebe41cfsm33097883b3a.43.2026.04.26.19.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Apr 2026 19:10:38 -0700 (PDT) From: Chen-Yu Tsai To: Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Linus Walleij Cc: Chen-Yu Tsai , linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: mediatek: paris: Directly modify registers to set GPIO direction Date: Mon, 27 Apr 2026 10:10:19 +0800 Message-ID: <20260427021021.2049015-1-wenst@chromium.org> X-Mailer: git-send-email 2.54.0.rc2.544.gc7ae2d5bb8-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pinctrl_gpio_direction_input() / pinctrl_gpio_direction_output() take the pinctrl mutex. This causes a gpiochip operations to need to sleep. Worse yet, the .can_sleep field in the gpiochip is not set. This causes the shared GPIO proxy to trip over, as it uses gpiod_cansleep() to check whether it can use a spinlock or needs a mutex. In this case, it ends up taking a spinlock, then calls pinctrl_gpio_direction_output(), which takes a mutex. This causes a huge warning. While this class of Mediatek hardware does not have separate clear/set registers, the pinctrl context has a spinlock that is taken whenever a register read-modify-write is done. Switch to directly setting the GPIO direction register bits to avoid the mutex. Signed-off-by: Chen-Yu Tsai --- drivers/pinctrl/mediatek/pinctrl-paris.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/med= iatek/pinctrl-paris.c index 6bf37d8085fa..e4c0bc27d984 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -886,19 +886,24 @@ static int mtk_gpio_set(struct gpio_chip *chip, unsig= ned int gpio, int value) =20 static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int g= pio) { - return pinctrl_gpio_direction_input(chip, gpio); + struct mtk_pinctrl *hw =3D gpiochip_get_data(chip); + const struct mtk_pin_desc *desc =3D &hw->soc->pins[gpio]; + + return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, 0); } =20 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int = gpio, int value) { + struct mtk_pinctrl *hw =3D gpiochip_get_data(chip); + const struct mtk_pin_desc *desc =3D &hw->soc->pins[gpio]; int ret; =20 ret =3D mtk_gpio_set(chip, gpio, value); if (ret) return ret; =20 - return pinctrl_gpio_direction_output(chip, gpio); + return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, 1); } =20 static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) --=20 2.54.0.rc2.544.gc7ae2d5bb8-goog