Commit c9b3bce1 authored by Bich HEMON's avatar Bich HEMON Committed by Marc Kleine-Budde

can: m_can: select pinctrl state in each suspend/resume function

Make sure to apply the correct pin state in suspend/resume callbacks.
Putting pins in sleep state saves power.
Signed-off-by: default avatarBich Hemon <bich.hemon@st.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent ffd137f7
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/iopoll.h> #include <linux/iopoll.h>
#include <linux/can/dev.h> #include <linux/can/dev.h>
#include <linux/pinctrl/consumer.h>
/* napi related */ /* napi related */
#define M_CAN_NAPI_WEIGHT 64 #define M_CAN_NAPI_WEIGHT 64
...@@ -1700,6 +1701,8 @@ static __maybe_unused int m_can_suspend(struct device *dev) ...@@ -1700,6 +1701,8 @@ static __maybe_unused int m_can_suspend(struct device *dev)
m_can_clk_stop(priv); m_can_clk_stop(priv);
} }
pinctrl_pm_select_sleep_state(dev);
priv->can.state = CAN_STATE_SLEEPING; priv->can.state = CAN_STATE_SLEEPING;
return 0; return 0;
...@@ -1710,6 +1713,8 @@ static __maybe_unused int m_can_resume(struct device *dev) ...@@ -1710,6 +1713,8 @@ static __maybe_unused int m_can_resume(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct m_can_priv *priv = netdev_priv(ndev); struct m_can_priv *priv = netdev_priv(ndev);
pinctrl_pm_select_default_state(dev);
m_can_init_ram(priv); m_can_init_ram(priv);
priv->can.state = CAN_STATE_ERROR_ACTIVE; priv->can.state = CAN_STATE_ERROR_ACTIVE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment