Commit 4247d7f2 authored by Ruihai Zhou's avatar Ruihai Zhou Committed by Mark Brown

spi: spi-mt65xx: Support sleep pin control

Supports configuring sleep pin control during system suspend to prevent
potential power leakage and additional power consumption.
Signed-off-by: default avatarRuihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Link: https://msgid.link/r/20240108120802.7601-1-zhouruihai@huaqin.corp-partner.google.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6613476e
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/platform_data/spi-mt65xx.h> #include <linux/platform_data/spi-mt65xx.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -1316,6 +1317,8 @@ static int mtk_spi_suspend(struct device *dev) ...@@ -1316,6 +1317,8 @@ static int mtk_spi_suspend(struct device *dev)
clk_disable_unprepare(mdata->spi_hclk); clk_disable_unprepare(mdata->spi_hclk);
} }
pinctrl_pm_select_sleep_state(dev);
return 0; return 0;
} }
...@@ -1325,6 +1328,8 @@ static int mtk_spi_resume(struct device *dev) ...@@ -1325,6 +1328,8 @@ static int mtk_spi_resume(struct device *dev)
struct spi_controller *host = dev_get_drvdata(dev); struct spi_controller *host = dev_get_drvdata(dev);
struct mtk_spi *mdata = spi_controller_get_devdata(host); struct mtk_spi *mdata = spi_controller_get_devdata(host);
pinctrl_pm_select_default_state(dev);
if (!pm_runtime_suspended(dev)) { if (!pm_runtime_suspended(dev)) {
ret = clk_prepare_enable(mdata->spi_clk); ret = clk_prepare_enable(mdata->spi_clk);
if (ret < 0) { if (ret < 0) {
......
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