linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/5] pinctrl: introduce the concept of a GPIO pin function category
@ 2025-07-02  8:45 Bartosz Golaszewski
  2025-07-02  8:45 ` [PATCH RFC 1/5] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Bartosz Golaszewski @ 2025-07-02  8:45 UTC (permalink / raw)
  To: Linus Walleij, Bjorn Andersson, Konrad Dybcio, Alexey Klimov
  Cc: linux-gpio, linux-kernel, linux-arm-msm, Bartosz Golaszewski

Note: this really is an RFC. Please don't spend too much time revieweing
the code in detail. I'd like to figure out if that's a good approach at
all first. Also: while I tested it on sm8650-qrd and sc8280xp-crd, the
last patch cannot be applied until all Qualcomm platforms are converted.

Problem: when pinctrl core binds pins to a consumer device and the
pinmux ops of the underlying driver are marked as strict, the pin in
question can no longer be requested as a GPIO using the GPIO descriptor
API. It will result in the following error:

[    5.095688] sc8280xp-tlmm f100000.pinctrl: pin GPIO_25 already requested by regulator-edp-3p3; cannot claim for f100000.pinctrl:570
[    5.107822] sc8280xp-tlmm f100000.pinctrl: error -EINVAL: pin-25 (f100000.pinctrl:570)

This typically makes sense except when the pins are muxed to a function
that actually says "GPIO". Of course, the function name is just a string
so it has no meaning to the pinctrl subsystem.

We have many Qualcomm SoCs (and I can imagine it's a common pattern in
other platforms as well) where we mux a pin to "gpio" function using the
`pinctrl-X` property in order to configure bias or drive-strength and
then access it using the gpiod API. This makes it impossible to mark the
pin controller module as "strict".

This series proposes to introduce a concept of a sub-category of
pinfunctions: GPIO functions where the above is not true and the pin
muxed as a GPIO can still be accessed via the GPIO consumer API even for
strict pinmuxers.

The first patch implements this functionality in pinctrl core, the
second adds local infrastructure to pinctrl-msm, next we convert two
Qualcomm platforms as examples and then finally enable the strict flag
in pinctrl-msm.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Bartosz Golaszewski (5):
      pinctrl: allow to mark pin functions as requestable GPIOs
      pinctrl: qcom: add infrastructure for marking pin functions as GPIOs
      pinctrl: qcom: sm8650: mark the `gpio` pin function as a non-strict function
      pinctrl: qcom: sc8280xp: mark the `gpio` pin function as a non-strict function
      pinctrl: qcom: make the pinmuxing strict

 drivers/pinctrl/pinmux.c                | 17 +++++++++++++++--
 drivers/pinctrl/qcom/pinctrl-msm.c      | 10 ++++++++++
 drivers/pinctrl/qcom/pinctrl-msm.h      |  5 +++++
 drivers/pinctrl/qcom/pinctrl-sc8280xp.c |  2 +-
 drivers/pinctrl/qcom/pinctrl-sm8650.c   |  2 +-
 include/linux/pinctrl/pinctrl.h         | 14 ++++++++++++++
 include/linux/pinctrl/pinmux.h          |  2 ++
 7 files changed, 48 insertions(+), 4 deletions(-)
---
base-commit: 1343433ed38923a21425c602e92120a1f1db5f7a
change-id: 20250701-pinctrl-gpio-pinfuncs-de82bd9aac43

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-07-04 16:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02  8:45 [PATCH RFC 0/5] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-07-02  8:45 ` [PATCH RFC 1/5] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-07-02  8:45 ` [PATCH RFC 2/5] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-07-02  8:45 ` [PATCH RFC 3/5] pinctrl: qcom: sm8650: mark the `gpio` pin function as a non-strict function Bartosz Golaszewski
2025-07-02 10:55   ` Konrad Dybcio
2025-07-02 22:50   ` Dmitry Baryshkov
2025-07-03  8:17     ` Bartosz Golaszewski
2025-07-04 16:50       ` Dmitry Baryshkov
2025-07-02  8:45 ` [PATCH RFC 4/5] pinctrl: qcom: sc8280xp: " Bartosz Golaszewski
2025-07-02  8:45 ` [PATCH RFC 5/5] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski
2025-07-02 11:03 ` [PATCH RFC 0/5] pinctrl: introduce the concept of a GPIO pin function category Konrad Dybcio
2025-07-03 22:39 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).