Skip to content

Commit c9b3bce

Browse files
BHESTMmarckleinebudde
authored andcommitted
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: Bich Hemon <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent ffd137f commit c9b3bce

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/can/m_can/m_can.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/pm_runtime.h>
2727
#include <linux/iopoll.h>
2828
#include <linux/can/dev.h>
29+
#include <linux/pinctrl/consumer.h>
2930

3031
/* napi related */
3132
#define M_CAN_NAPI_WEIGHT 64
@@ -1700,6 +1701,8 @@ static __maybe_unused int m_can_suspend(struct device *dev)
17001701
m_can_clk_stop(priv);
17011702
}
17021703

1704+
pinctrl_pm_select_sleep_state(dev);
1705+
17031706
priv->can.state = CAN_STATE_SLEEPING;
17041707

17051708
return 0;
@@ -1710,6 +1713,8 @@ static __maybe_unused int m_can_resume(struct device *dev)
17101713
struct net_device *ndev = dev_get_drvdata(dev);
17111714
struct m_can_priv *priv = netdev_priv(ndev);
17121715

1716+
pinctrl_pm_select_default_state(dev);
1717+
17131718
m_can_init_ram(priv);
17141719

17151720
priv->can.state = CAN_STATE_ERROR_ACTIVE;

0 commit comments

Comments
 (0)