Skip to content

Commit b764a58

Browse files
tmlindlinusw
authored andcommitted
gpio: omap: Remove custom PM calls and use cpu_pm instead
For a long time the gpio-omap custom PM calls have been annoying me so let's replace them with cpu_pm instead. This will enable GPIO PM for deeper idle states on omap4. And we can handle GPIO PM for omap2/3/4 in the same way. Note that with this patch we are also slightly changing GPIO PM to be less aggressive for omap3 and only will idle GPIO when PER context may be lost. For omap2, we don't need to save context and don't want to remove any triggering so let's add a quirk flag for that. Let's do this all in a single patch to avoid a situation where old custom calls still are used with new code. Cc: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Keerthy <j-keerthy@ti.com> Cc: Ladislav Michl <ladis@linux-mips.org> Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent ec0daae commit b764a58

File tree

4 files changed

+116
-96
lines changed

4 files changed

+116
-96
lines changed

arch/arm/mach-omap2/pm24xx.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* published by the Free Software Foundation.
1919
*/
2020

21+
#include <linux/cpu_pm.h>
2122
#include <linux/suspend.h>
2223
#include <linux/sched.h>
2324
#include <linux/proc_fs.h>
@@ -29,8 +30,6 @@
2930
#include <linux/clk-provider.h>
3031
#include <linux/irq.h>
3132
#include <linux/time.h>
32-
#include <linux/gpio.h>
33-
#include <linux/platform_data/gpio-omap.h>
3433

3534
#include <asm/fncpy.h>
3635

@@ -87,7 +86,7 @@ static int omap2_enter_full_retention(void)
8786
l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL;
8887
omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0);
8988

90-
omap2_gpio_prepare_for_idle(0);
89+
cpu_cluster_pm_enter();
9190

9291
/* One last check for pending IRQs to avoid extra latency due
9392
* to sleeping unnecessarily. */
@@ -100,7 +99,7 @@ static int omap2_enter_full_retention(void)
10099
OMAP_SDRC_REGADDR(SDRC_POWER));
101100

102101
no_sleep:
103-
omap2_gpio_resume_after_idle();
102+
cpu_cluster_pm_exit();
104103

105104
clk_enable(osc_ck);
106105

arch/arm/mach-omap2/pm34xx.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
* published by the Free Software Foundation.
1919
*/
2020

21+
#include <linux/cpu_pm.h>
2122
#include <linux/pm.h>
2223
#include <linux/suspend.h>
2324
#include <linux/interrupt.h>
2425
#include <linux/module.h>
2526
#include <linux/list.h>
2627
#include <linux/err.h>
27-
#include <linux/gpio.h>
2828
#include <linux/clk.h>
2929
#include <linux/delay.h>
3030
#include <linux/slab.h>
3131
#include <linux/omap-dma.h>
3232
#include <linux/omap-gpmc.h>
33-
#include <linux/platform_data/gpio-omap.h>
3433

3534
#include <trace/events/power.h>
3635

@@ -197,7 +196,6 @@ void omap_sram_idle(void)
197196
int mpu_next_state = PWRDM_POWER_ON;
198197
int per_next_state = PWRDM_POWER_ON;
199198
int core_next_state = PWRDM_POWER_ON;
200-
int per_going_off;
201199
u32 sdrc_pwr = 0;
202200

203201
mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
@@ -227,10 +225,8 @@ void omap_sram_idle(void)
227225
pwrdm_pre_transition(NULL);
228226

229227
/* PER */
230-
if (per_next_state < PWRDM_POWER_ON) {
231-
per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
232-
omap2_gpio_prepare_for_idle(per_going_off);
233-
}
228+
if (per_next_state == PWRDM_POWER_OFF)
229+
cpu_cluster_pm_enter();
234230

235231
/* CORE */
236232
if (core_next_state < PWRDM_POWER_ON) {
@@ -295,8 +291,8 @@ void omap_sram_idle(void)
295291
pwrdm_post_transition(NULL);
296292

297293
/* PER */
298-
if (per_next_state < PWRDM_POWER_ON)
299-
omap2_gpio_resume_after_idle();
294+
if (per_next_state == PWRDM_POWER_OFF)
295+
cpu_cluster_pm_exit();
300296
}
301297

302298
static void omap3_pm_idle(void)

0 commit comments

Comments
 (0)