Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71102
b: refs/heads/master
c: e6c5eb9
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Oct 18, 2007
1 parent d2ca74e commit 45810c5
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 126 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 26398a70ea35f153feb799fa850c71685667712b
refs/heads/master: e6c5eb9541f2197a3ffab90b1c7a3250a9b51bf6
20 changes: 3 additions & 17 deletions trunk/arch/arm/mach-omap1/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,27 +599,15 @@ static void (*saved_idle)(void) = NULL;

/*
* omap_pm_prepare - Do preliminary suspend work.
* @state: suspend state we're entering.
*
*/
static int omap_pm_prepare(suspend_state_t state)
static int omap_pm_prepare(void)
{
int error = 0;

/* We cannot sleep in idle until we have resumed */
saved_idle = pm_idle;
pm_idle = NULL;

switch (state)
{
case PM_SUSPEND_STANDBY:
case PM_SUSPEND_MEM:
break;
default:
return -EINVAL;
}

return error;
return 0;
}


Expand Down Expand Up @@ -647,16 +635,14 @@ static int omap_pm_enter(suspend_state_t state)

/**
* omap_pm_finish - Finish up suspend sequence.
* @state: State we're coming out of.
*
* This is called after we wake back up (or if entering the sleep state
* failed).
*/

static int omap_pm_finish(suspend_state_t state)
static void omap_pm_finish(void)
{
pm_idle = saved_idle;
return 0;
}


Expand Down
20 changes: 3 additions & 17 deletions trunk/arch/arm/mach-omap2/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,12 @@ void omap2_pm_idle(void)
local_irq_enable();
}

static int omap2_pm_prepare(suspend_state_t state)
static int omap2_pm_prepare(void)
{
int error = 0;

/* We cannot sleep in idle until we have resumed */
saved_idle = pm_idle;
pm_idle = NULL;

switch (state)
{
case PM_SUSPEND_STANDBY:
case PM_SUSPEND_MEM:
break;

default:
return -EINVAL;
}

return error;
return 0;
}

#define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \
Expand Down Expand Up @@ -356,10 +343,9 @@ static int omap2_pm_enter(suspend_state_t state)
return ret;
}

static int omap2_pm_finish(suspend_state_t state)
static void omap2_pm_finish(void)
{
pm_idle = saved_idle;
return 0;
}

static struct platform_suspend_ops omap_pm_ops = {
Expand Down
53 changes: 5 additions & 48 deletions trunk/arch/blackfin/mach-common/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,15 @@ void bfin_pm_suspend_standby_enter(void)
#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */
}


/*
* bfin_pm_prepare - Do preliminary suspend work.
* @state: suspend state we're entering.
* bfin_pm_valid - Tell the PM core that we only support the standby sleep
* state
* @state: suspend state we're checking.
*
*/
static int bfin_pm_prepare(suspend_state_t state)
static int bfin_pm_valid(suspend_state_t state)
{
int error = 0;

switch (state) {
case PM_SUSPEND_STANDBY:
break;

case PM_SUSPEND_MEM:
return -ENOTSUPP;

default:
return -EINVAL;
}

return error;
return (state == PM_SUSPEND_STANDBY);
}

/*
Expand All @@ -135,38 +122,8 @@ static int bfin_pm_enter(suspend_state_t state)
return 0;
}

/*
* bfin_pm_finish - Finish up suspend sequence.
* @state: State we're coming out of.
*
* This is called after we wake back up (or if entering the sleep state
* failed).
*/
static int bfin_pm_finish(suspend_state_t state)
{
switch (state) {
case PM_SUSPEND_STANDBY:
break;

case PM_SUSPEND_MEM:
return -ENOTSUPP;

default:
return -EINVAL;
}

return 0;
}

static int bfin_pm_valid(suspend_state_t state)
{
return (state == PM_SUSPEND_STANDBY);
}

struct platform_suspend_ops bfin_pm_ops = {
.prepare = bfin_pm_prepare,
.enter = bfin_pm_enter,
.finish = bfin_pm_finish,
.valid = bfin_pm_valid,
};

Expand Down
34 changes: 22 additions & 12 deletions trunk/arch/powerpc/platforms/52xx/lite5200_pm.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/suspend.h>
#include <asm/io.h>
#include <asm/time.h>
#include <asm/mpc52xx.h>
Expand All @@ -18,6 +18,8 @@ static void __iomem *sram;
static const int sram_size = 0x4000; /* 16 kBytes */
static void __iomem *mbar;

static suspend_state_t lite5200_pm_target_state;

static int lite5200_pm_valid(suspend_state_t state)
{
switch (state) {
Expand All @@ -29,13 +31,22 @@ static int lite5200_pm_valid(suspend_state_t state)
}
}

static int lite5200_pm_prepare(suspend_state_t state)
static int lite5200_pm_set_target(suspend_state_t state)
{
if (lite5200_pm_valid(state)) {
lite5200_pm_target_state = state;
return 0;
}
return -EINVAL;
}

static int lite5200_pm_prepare(void)
{
/* deep sleep? let mpc52xx code handle that */
if (state == PM_SUSPEND_STANDBY)
return mpc52xx_pm_prepare(state);
if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
return mpc52xx_pm_prepare();

if (state != PM_SUSPEND_MEM)
if (lite5200_pm_target_state != PM_SUSPEND_MEM)
return -EINVAL;

/* map registers */
Expand Down Expand Up @@ -190,24 +201,23 @@ static int lite5200_pm_enter(suspend_state_t state)
return 0;
}

static int lite5200_pm_finish(suspend_state_t state)
static void lite5200_pm_finish(void)
{
/* deep sleep? let mpc52xx code handle that */
if (state == PM_SUSPEND_STANDBY) {
return mpc52xx_pm_finish(state);
}
return 0;
if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
mpc52xx_pm_finish();
}

static struct pm_ops lite5200_pm_ops = {
static struct platform_suspend_ops lite5200_pm_ops = {
.valid = lite5200_pm_valid,
.set_target = lite5200_pm_set_target,
.prepare = lite5200_pm_prepare,
.enter = lite5200_pm_enter,
.finish = lite5200_pm_finish,
};

int __init lite5200_pm_init(void)
{
pm_set_ops(&lite5200_pm_ops);
suspend_set_ops(&lite5200_pm_ops);
return 0;
}
9 changes: 2 additions & 7 deletions trunk/arch/powerpc/platforms/52xx/mpc52xx_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,8 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level)
return 0;
}

int mpc52xx_pm_prepare(suspend_state_t state)
int mpc52xx_pm_prepare(void)
{
if (state != PM_SUSPEND_STANDBY)
return -EINVAL;

/* map the whole register space */
mbar = mpc52xx_find_and_map("mpc5200");
if (!mbar) {
Expand Down Expand Up @@ -166,15 +163,13 @@ int mpc52xx_pm_enter(suspend_state_t state)
return 0;
}

int mpc52xx_pm_finish(suspend_state_t state)
void mpc52xx_pm_finish(void)
{
/* call board resume code */
if (mpc52xx_suspend.board_resume_finish)
mpc52xx_suspend.board_resume_finish(mbar);

iounmap(mbar);

return 0;
}

static struct platform_suspend_ops mpc52xx_pm_ops = {
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/acpi/sleep/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state)

/**
* acpi_pm_prepare - Do preliminary suspend work.
* @pm_state: ignored
*
* If necessary, set the firmware waking vector and do arch-specific
* nastiness to get the wakeup code to the waking vector.
*/

static int acpi_pm_prepare(suspend_state_t pm_state)
static int acpi_pm_prepare(void)
{
int error = acpi_sleep_prepare(acpi_target_sleep_state);

Expand Down Expand Up @@ -160,13 +159,12 @@ static int acpi_pm_enter(suspend_state_t pm_state)

/**
* acpi_pm_finish - Finish up suspend sequence.
* @pm_state: ignored
*
* This is called after we wake back up (or if entering the sleep state
* failed).
*/

static int acpi_pm_finish(suspend_state_t pm_state)
static void acpi_pm_finish(void)
{
u32 acpi_state = acpi_target_sleep_state;

Expand All @@ -184,7 +182,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
init_8259A(0);
}
#endif
return 0;
}

static int acpi_pm_state_valid(suspend_state_t pm_state)
Expand Down
6 changes: 4 additions & 2 deletions trunk/include/asm-powerpc/mpc52xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <asm/prom.h>
#endif /* __ASSEMBLY__ */

#include <linux/suspend.h>


/* ======================================================================== */
/* Structures mapping of some unit register set */
Expand Down Expand Up @@ -267,9 +269,9 @@ extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
extern int __init lite5200_pm_init(void);

/* lite5200 calls mpc5200 suspend functions, so here they are */
extern int mpc52xx_pm_prepare(suspend_state_t);
extern int mpc52xx_pm_prepare(void);
extern int mpc52xx_pm_enter(suspend_state_t);
extern int mpc52xx_pm_finish(suspend_state_t);
extern void mpc52xx_pm_finish(void);
extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
#endif
#endif /* CONFIG_PM */
Expand Down
13 changes: 5 additions & 8 deletions trunk/include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ typedef int __bitwise suspend_state_t;
* @prepare() fails. If @set_target() fails (ie. returns nonzero),
* @prepare(), @enter() and @finish() will not be called by the PM core.
* This callback is optional. However, if it is implemented, the argument
* passed to @prepare(), @enter() and @finish() is meaningless and should
* be ignored.
* passed to @enter() is meaningless and should be ignored.
*
* @prepare: Prepare the platform for entering the system sleep state indicated
* by @set_target() or represented by the argument if @set_target() is not
* implemented.
* by @set_target().
* @prepare() is called right after devices have been suspended (ie. the
* appropriate .suspend() method has been executed for each device) and
* before the nonboot CPUs are disabled (it is executed with IRQs enabled).
Expand All @@ -67,18 +65,17 @@ typedef int __bitwise suspend_state_t;
*
* @finish: Called when the system has just left a sleep state, right after
* the nonboot CPUs have been enabled and before devices are resumed (it is
* executed with IRQs enabled). If @set_target() is not implemented, the
* argument represents the sleep state being left.
* executed with IRQs enabled).
* This callback is optional, but should be implemented by the platforms
* that implement @prepare(). If implemented, it is always called after
* @enter() (even if @enter() fails).
*/
struct platform_suspend_ops {
int (*valid)(suspend_state_t state);
int (*set_target)(suspend_state_t state);
int (*prepare)(suspend_state_t state);
int (*prepare)(void);
int (*enter)(suspend_state_t state);
int (*finish)(suspend_state_t state);
void (*finish)(void);
};

#ifdef CONFIG_SUSPEND
Expand Down
12 changes: 3 additions & 9 deletions trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ int suspend_valid_only_mem(suspend_state_t state)
return state == PM_SUSPEND_MEM;
}


static inline void pm_finish(suspend_state_t state)
{
if (suspend_ops->finish)
suspend_ops->finish(state);
}

/**
* suspend_prepare - Do prep work before entering low-power state.
*
Expand Down Expand Up @@ -171,7 +164,7 @@ int suspend_devices_and_enter(suspend_state_t state)
goto Resume_console;
}
if (suspend_ops->prepare) {
error = suspend_ops->prepare(state);
error = suspend_ops->prepare();
if (error)
goto Resume_devices;
}
Expand All @@ -180,7 +173,8 @@ int suspend_devices_and_enter(suspend_state_t state)
suspend_enter(state);

enable_nonboot_cpus();
pm_finish(state);
if (suspend_ops->finish)
suspend_ops->finish();
Resume_devices:
device_resume();
Resume_console:
Expand Down

0 comments on commit 45810c5

Please sign in to comment.