]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pinctrl: qcom: Register functions before enabling pinctrl
authorAlexandre MINETTE <contact@alex-min.fr>
Tue, 19 May 2026 07:16:33 +0000 (09:16 +0200)
committerLinus Walleij <linusw@kernel.org>
Thu, 11 Jun 2026 13:03:02 +0000 (15:03 +0200)
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@alex-min.fr>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
drivers/pinctrl/qcom/pinctrl-msm.c

index 6771f5eb29e4a58f62810efe8f63707ccf189b33..11db6564c44dfeeb637dff5cf9c24831497c3394 100644 (file)
@@ -1591,11 +1591,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];
@@ -1605,6 +1605,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;