serial: stm32: select pinctrl state in each suspend/resume function
authorErwan Le Ray <erwan.leray@st.com>
Thu, 13 Jun 2019 13:49:53 +0000 (15:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Sep 2019 10:43:45 +0000 (12:43 +0200)
Select either pinctrl sleep state in suspend function or default state in
resume function.

Signed-off-by: Bich Hemon <bich.hemon@st.com>
Signed-off-by: Erwan Le Ray <erwan.leray@st.com>
Link: https://lore.kernel.org/r/1560433800-12255-4-git-send-email-erwan.leray@st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c

index 24a2261..7bb2bb9 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_wakeirq.h>
@@ -1373,6 +1374,8 @@ static int stm32_serial_suspend(struct device *dev)
        else
                stm32_serial_enable_wakeup(port, false);
 
+       pinctrl_pm_select_sleep_state(dev);
+
        return 0;
 }
 
@@ -1380,6 +1383,8 @@ static int stm32_serial_resume(struct device *dev)
 {
        struct uart_port *port = dev_get_drvdata(dev);
 
+       pinctrl_pm_select_default_state(dev);
+
        if (device_may_wakeup(dev))
                stm32_serial_enable_wakeup(port, false);