MLK-20682 reset: gpio-reset: add suspend/resume callback
The reset PIN may loss its state when system suspend due to GPIO controller power off. Set pinctrl as "sleep" state to keep PIN voltage during system suspend, and configurate pinctrl as "default" state after system resume back. Because GPIO resume back earlier than gpio-reset, then GPIO signal can control the PIN voltage again. Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com> Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com> (cherry picked from commit ea5a9cdc1941afc36fd0f5a223ea762b85512130)5.4-rM2-2.2.x-imx-squashed
parent
80fcea5b45
commit
a9c85cb2d8
|
@ -167,6 +167,25 @@ static struct of_device_id gpio_reset_dt_ids[] = {
|
|||
{ }
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int gpio_reset_suspend(struct device *dev)
|
||||
{
|
||||
pinctrl_pm_select_sleep_state(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static int gpio_reset_resume(struct device *dev)
|
||||
{
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct dev_pm_ops gpio_reset_pm_ops = {
|
||||
SET_LATE_SYSTEM_SLEEP_PM_OPS(gpio_reset_suspend, gpio_reset_resume)
|
||||
};
|
||||
|
||||
static struct platform_driver gpio_reset_driver = {
|
||||
.probe = gpio_reset_probe,
|
||||
.remove = gpio_reset_remove,
|
||||
|
@ -174,6 +193,7 @@ static struct platform_driver gpio_reset_driver = {
|
|||
.name = "gpio-reset",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(gpio_reset_dt_ids),
|
||||
.pm = &gpio_reset_pm_ops,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue