[PATCH v1 08/13] soc: mediatek: mtk-svs: add main_clk check during system-wide suspend

From: Roger Lu
Date: Mon Dec 26 2022 - 04:43:55 EST


SVS's main_clk might be disabled in svs_resume(). Therefore, if main_clk
is disabled and svs_suspend() is called by system-wide suspend stage,
return 0 directly.

Signed-off-by: Roger Lu <roger.lu@xxxxxxxxxxxx>
---
drivers/soc/mediatek/mtk-svs.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
index 2c1fbf11b554..934e7ea976b0 100644
--- a/drivers/soc/mediatek/mtk-svs.c
+++ b/drivers/soc/mediatek/mtk-svs.c
@@ -6,6 +6,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h>
+#include <linux/clk-provider.h>
#include <linux/completion.h>
#include <linux/cpuidle.h>
#include <linux/debugfs.h>
@@ -1543,6 +1544,9 @@ static int svs_suspend(struct device *dev)
int ret;
u32 idx;

+ if (!__clk_is_enabled(svsp->main_clk))
+ return 0;
+
for (idx = 0; idx < svsp->bank_max; idx++) {
svsb = &svsp->banks[idx];

--
2.18.0