]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
pinctrl: msm: Add sleep pinctrl state transitions
authorEvan Green <evgreen@chromium.org>
Fri, 16 Nov 2018 18:58:53 +0000 (10:58 -0800)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 19 Nov 2018 14:40:27 +0000 (15:40 +0100)
Add PM suspend callbacks to the msm core driver that select the
sleep and default pinctrl states. Then wire those callbacks up
in the sdm845 driver, for those boards that may have GPIO hogs
that need to change state during suspend.

Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/qcom/pinctrl-msm.c
drivers/pinctrl/qcom/pinctrl-msm.h
drivers/pinctrl/qcom/pinctrl-sdm845.c

index 7c7d083e2c0dcd6859f1e5ff3170be1d6bc3a130..87cbebe217fd2d74851f8158ac4c507f1bce14ab 100644 (file)
@@ -1072,6 +1072,25 @@ static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
                }
 }
 
+static int msm_pinctrl_suspend(struct device *dev)
+{
+       struct msm_pinctrl *pctrl = dev_get_drvdata(dev);
+
+       return pinctrl_force_sleep(pctrl->pctrl);
+}
+
+static int msm_pinctrl_resume(struct device *dev)
+{
+       struct msm_pinctrl *pctrl = dev_get_drvdata(dev);
+
+       return pinctrl_force_default(pctrl->pctrl);
+}
+
+SIMPLE_DEV_PM_OPS(msm_pinctrl_dev_pm_ops, msm_pinctrl_suspend,
+                 msm_pinctrl_resume);
+
+EXPORT_SYMBOL(msm_pinctrl_dev_pm_ops);
+
 int msm_pinctrl_probe(struct platform_device *pdev,
                      const struct msm_pinctrl_soc_data *soc_data)
 {
index 29172fdf5882c1b04ca7224a6738041e8c5d2425..c12048e54a6f01439eef9fa88bf061538d4ba2cf 100644 (file)
@@ -123,6 +123,8 @@ struct msm_pinctrl_soc_data {
        unsigned int ntiles;
 };
 
+extern const struct dev_pm_ops msm_pinctrl_dev_pm_ops;
+
 int msm_pinctrl_probe(struct platform_device *pdev,
                      const struct msm_pinctrl_soc_data *soc_data);
 int msm_pinctrl_remove(struct platform_device *pdev);
index 2ab7a88857579b2c2b98c61475c57af3870fed70..c97f20fca5fd315701da90b1b4bb8d7b8269c47a 100644 (file)
@@ -1300,6 +1300,7 @@ static const struct of_device_id sdm845_pinctrl_of_match[] = {
 static struct platform_driver sdm845_pinctrl_driver = {
        .driver = {
                .name = "sdm845-pinctrl",
+               .pm = &msm_pinctrl_dev_pm_ops,
                .of_match_table = sdm845_pinctrl_of_match,
        },
        .probe = sdm845_pinctrl_probe,