hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/arm/mach-omap2/pm24xx.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * OMAP2 Power Management Routines
34 *
....@@ -12,12 +13,9 @@
1213 * Igor Stoppa <igor.stoppa@nokia.com>
1314 *
1415 * Based on pm.c for omap1
15
- *
16
- * This program is free software; you can redistribute it and/or modify
17
- * it under the terms of the GNU General Public License version 2 as
18
- * published by the Free Software Foundation.
1916 */
2017
18
+#include <linux/cpu_pm.h>
2119 #include <linux/suspend.h>
2220 #include <linux/sched.h>
2321 #include <linux/proc_fs.h>
....@@ -29,8 +27,6 @@
2927 #include <linux/clk-provider.h>
3028 #include <linux/irq.h>
3129 #include <linux/time.h>
32
-#include <linux/gpio.h>
33
-#include <linux/platform_data/gpio-omap.h>
3430
3531 #include <asm/fncpy.h>
3632
....@@ -87,8 +83,6 @@
8783 l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL;
8884 omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0);
8985
90
- omap2_gpio_prepare_for_idle(0);
91
-
9286 /* One last check for pending IRQs to avoid extra latency due
9387 * to sleeping unnecessarily. */
9488 if (omap_irq_pending())
....@@ -100,8 +94,6 @@
10094 OMAP_SDRC_REGADDR(SDRC_POWER));
10195
10296 no_sleep:
103
- omap2_gpio_resume_after_idle();
104
-
10597 clk_enable(osc_ck);
10698
10799 /* clear CORE wake-up events */
....@@ -166,25 +158,27 @@
166158 return 0;
167159 if (__clk_is_enabled(osc_ck))
168160 return 0;
169
- if (omap_dma_running())
170
- return 0;
171161
172162 return 1;
173163 }
174164
175165 static void omap2_pm_idle(void)
176166 {
177
- if (!omap2_can_sleep()) {
178
- if (omap_irq_pending())
179
- return;
180
- omap2_enter_mpu_retention();
181
- return;
182
- }
167
+ int error;
183168
184169 if (omap_irq_pending())
185170 return;
186171
172
+ error = cpu_cluster_pm_enter();
173
+ if (error || !omap2_can_sleep()) {
174
+ omap2_enter_mpu_retention();
175
+ goto out_cpu_cluster_pm;
176
+ }
177
+
187178 omap2_enter_full_retention();
179
+
180
+out_cpu_cluster_pm:
181
+ cpu_cluster_pm_exit();
188182 }
189183
190184 static void __init prcm_setup_regs(void)