[PATCH AUTOSEL 6.18] pinctrl: qcom: Register functions before enabling pinctrl
From: Sasha Levin
Date: Mon Aug 31 2026 - 10:05:06 EST
From: Alexandre MINETTE <contact@xxxxxxxxxxx>
[ Upstream commit 981aefd53b3cdafae0e45332a1023b80d67f52be ]
pinctrl consumers can request states while the pinctrl core enables the
controller. On Qualcomm pinctrl drivers this can happen before the SoC
function list has been registered, which leaves the function table
incomplete during state lookup.
On APQ8064 this can fail while claiming pinctrl hogs:
apq8064-pinctrl 800000.pinctrl: invalid function ps_hold in map table
apq8064-pinctrl 800000.pinctrl: error claiming hogs: -22
apq8064-pinctrl 800000.pinctrl: could not claim hogs: -22
Register Qualcomm pinctrl with devm_pinctrl_register_and_init(), add the
SoC pin functions, and only then enable the pinctrl device.
Signed-off-by: Alexandre MINETTE <contact@xxxxxxxxxxx>
Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linusw@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
LLM Generated explanations, may be completely bogus:
The background checks finished and line up with the earlier analysis:
- **Fix commit not in tree** — no local match for "Register functions
before enabling pinctrl" or Alexandre MINETTE patches under
`drivers/pinctrl/qcom/`.
- **Regression confirmed in 6.18.44** — `6f6835beab99c` ("use generic
pin function helpers") is an ancestor of the `v6.18.44` tag, so the
buggy probe order is present in this stable tree.
- **Precedent exists** — `2aca5c591ef4e` ("pinctrl: samsung: defer
pinctrl_enable") uses the same deferred-enable pattern.
- **`b4 dig` failed** — wrong invocation syntax; lore lookup was done
via web search instead.
**Verdict for Linux 6.18.44: YES** — this is a small regression fix for
APQ8064 (and any qcom pinctrl with self-hogs) since v6.18.0.
drivers/pinctrl/qcom/pinctrl-msm.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 424b14bc29e96..eabd6563629a7 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -1577,11 +1577,11 @@ int msm_pinctrl_probe(struct platform_device *pdev,
pctrl->desc.pins = pctrl->soc->pins;
pctrl->desc.npins = pctrl->soc->npins;
- pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &pctrl->desc, pctrl);
- if (IS_ERR(pctrl->pctrl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
- return PTR_ERR(pctrl->pctrl);
- }
+ ret = devm_pinctrl_register_and_init(&pdev->dev, &pctrl->desc,
+ pctrl, &pctrl->pctrl);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "Couldn't register pinctrl driver\n");
for (i = 0; i < soc_data->nfunctions; i++) {
func = &soc_data->functions[i];
@@ -1591,6 +1591,11 @@ int msm_pinctrl_probe(struct platform_device *pdev,
return ret;
}
+ ret = pinctrl_enable(pctrl->pctrl);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "Couldn't enable pinctrl driver\n");
+
ret = msm_gpio_init(pctrl);
if (ret)
return ret;
--
2.53.0