pinctrl: starfive: Fix gpiomon erro
authorJianlong Huang <jianlong.huang@starfivetech.com>
Thu, 7 Jul 2022 08:47:24 +0000 (16:47 +0800)
committerJianlong Huang <jianlong.huang@starfivetech.com>
Thu, 7 Jul 2022 08:48:22 +0000 (16:48 +0800)
If enable CONFIG_PM, 'pm_runtime_get_sync' will return erro

Signed-off-by: Jianlong Huang <jianlong.huang@starfivetech.com>
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c

index 3d3237c..56c7415 100755 (executable)
@@ -19,6 +19,7 @@
 #include <linux/pinctrl/pinconf.h>
 #include <linux/pinctrl/pinconf-generic.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/module.h>
@@ -895,6 +896,9 @@ static int starfive_jh7110_sys_gpio_register(struct platform_device *pdev,
        pctl->gc.irq.handler = handle_bad_irq;
        pctl->gc.irq.init_hw = starfive_jh7110_sys_init_hw;
 
+       if (IS_ENABLED(CONFIG_PM))
+               pm_runtime_enable(dev);
+
        ret = platform_get_irq(pdev, 0);
        if (ret < 0)
                return ret;
@@ -1595,6 +1599,9 @@ static int starfive_jh7110_aon_gpio_register(struct platform_device *pdev,
        pctl->gc.irq.handler = handle_bad_irq;
        pctl->gc.irq.init_hw = starfive_jh7110_aon_init_hw;
 
+       if (IS_ENABLED(CONFIG_PM))
+               pm_runtime_enable(dev);
+
        ret = platform_get_irq(pdev, 0);
        if (ret < 0)
                return ret;