pinctrl: mediatek: Add pm_ops to pinctrl-paris
authorNicolas Boichat <drinkcat@chromium.org>
Wed, 8 May 2019 07:33:30 +0000 (15:33 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Sat, 1 Jun 2019 17:40:16 +0000 (19:40 +0200)
pinctrl variants that include pinctrl-paris.h (and not
pinctrl-mtk-common.h) also need to use pm_ops to setup
wake mask properly, so copy over the pm_ops from common
to paris variant.

It is not easy to merge the 2 copies (or move
mtk_eint_suspend/resume to mtk-eint.c), as we need to
dereference pctrl->eint, and struct mtk_pinctrl *pctl has a
different structure definition for v1 and v2 (which is
what paris variant uses).

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Acked-by: Sean Wang <sean.wang@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/mediatek/pinctrl-paris.c
drivers/pinctrl/mediatek/pinctrl-paris.h

index d3b34e9a7507ec6526eb74e61e257039bad2626a..923264d0e9ef2c595b93d559bc04fb209e736045 100644 (file)
@@ -926,3 +926,22 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
 
        return 0;
 }
+
+static int mtk_paris_pinctrl_suspend(struct device *device)
+{
+       struct mtk_pinctrl *pctl = dev_get_drvdata(device);
+
+       return mtk_eint_do_suspend(pctl->eint);
+}
+
+static int mtk_paris_pinctrl_resume(struct device *device)
+{
+       struct mtk_pinctrl *pctl = dev_get_drvdata(device);
+
+       return mtk_eint_do_resume(pctl->eint);
+}
+
+const struct dev_pm_ops mtk_paris_pinctrl_pm_ops = {
+       .suspend_noirq = mtk_paris_pinctrl_suspend,
+       .resume_noirq = mtk_paris_pinctrl_resume,
+};
index 37146caa667d8c8db363c82dd8dec2da77cccb31..3d43771074e6de0cc0d1e108d4148dbef7290b7b 100644 (file)
@@ -60,4 +60,6 @@
 int mtk_paris_pinctrl_probe(struct platform_device *pdev,
                            const struct mtk_pin_soc *soc);
 
+extern const struct dev_pm_ops mtk_paris_pinctrl_pm_ops;
+
 #endif /* __PINCTRL_PARIS_H */