.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * OMAP2 Power Management Routines |
---|
3 | 4 | * |
---|
.. | .. |
---|
12 | 13 | * Igor Stoppa <igor.stoppa@nokia.com> |
---|
13 | 14 | * |
---|
14 | 15 | * 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. |
---|
19 | 16 | */ |
---|
20 | 17 | |
---|
| 18 | +#include <linux/cpu_pm.h> |
---|
21 | 19 | #include <linux/suspend.h> |
---|
22 | 20 | #include <linux/sched.h> |
---|
23 | 21 | #include <linux/proc_fs.h> |
---|
.. | .. |
---|
29 | 27 | #include <linux/clk-provider.h> |
---|
30 | 28 | #include <linux/irq.h> |
---|
31 | 29 | #include <linux/time.h> |
---|
32 | | -#include <linux/gpio.h> |
---|
33 | | -#include <linux/platform_data/gpio-omap.h> |
---|
34 | 30 | |
---|
35 | 31 | #include <asm/fncpy.h> |
---|
36 | 32 | |
---|
.. | .. |
---|
87 | 83 | l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL; |
---|
88 | 84 | omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0); |
---|
89 | 85 | |
---|
90 | | - omap2_gpio_prepare_for_idle(0); |
---|
91 | | - |
---|
92 | 86 | /* One last check for pending IRQs to avoid extra latency due |
---|
93 | 87 | * to sleeping unnecessarily. */ |
---|
94 | 88 | if (omap_irq_pending()) |
---|
.. | .. |
---|
100 | 94 | OMAP_SDRC_REGADDR(SDRC_POWER)); |
---|
101 | 95 | |
---|
102 | 96 | no_sleep: |
---|
103 | | - omap2_gpio_resume_after_idle(); |
---|
104 | | - |
---|
105 | 97 | clk_enable(osc_ck); |
---|
106 | 98 | |
---|
107 | 99 | /* clear CORE wake-up events */ |
---|
.. | .. |
---|
166 | 158 | return 0; |
---|
167 | 159 | if (__clk_is_enabled(osc_ck)) |
---|
168 | 160 | return 0; |
---|
169 | | - if (omap_dma_running()) |
---|
170 | | - return 0; |
---|
171 | 161 | |
---|
172 | 162 | return 1; |
---|
173 | 163 | } |
---|
174 | 164 | |
---|
175 | 165 | static void omap2_pm_idle(void) |
---|
176 | 166 | { |
---|
177 | | - if (!omap2_can_sleep()) { |
---|
178 | | - if (omap_irq_pending()) |
---|
179 | | - return; |
---|
180 | | - omap2_enter_mpu_retention(); |
---|
181 | | - return; |
---|
182 | | - } |
---|
| 167 | + int error; |
---|
183 | 168 | |
---|
184 | 169 | if (omap_irq_pending()) |
---|
185 | 170 | return; |
---|
186 | 171 | |
---|
| 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 | + |
---|
187 | 178 | omap2_enter_full_retention(); |
---|
| 179 | + |
---|
| 180 | +out_cpu_cluster_pm: |
---|
| 181 | + cpu_cluster_pm_exit(); |
---|
188 | 182 | } |
---|
189 | 183 | |
---|
190 | 184 | static void __init prcm_setup_regs(void) |
---|