Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280424
b: refs/heads/master
c: 767c0f3
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Dec 25, 2011
1 parent 35c0e7f commit 885391c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 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: 0f966d74cf77a9140a025464a287e1d2fee8a1fc
refs/heads/master: 767c0f3aed74be56f268709f5347e6c86d52b408
3 changes: 1 addition & 2 deletions trunk/arch/arm/mach-shmobile/include/mach/sh7372.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,10 @@ struct platform_device;
struct sh7372_pm_domain {
struct generic_pm_domain genpd;
struct dev_power_governor *gov;
void (*suspend)(void);
int (*suspend)(void);
void (*resume)(void);
unsigned int bit_shift;
bool no_debug;
bool stay_on;
};

static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
Expand Down
49 changes: 28 additions & 21 deletions trunk/arch/arm/mach-shmobile/pm-sh7372.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ static int pd_power_down(struct generic_pm_domain *genpd)
struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
unsigned int mask = 1 << sh7372_pd->bit_shift;

if (sh7372_pd->suspend)
sh7372_pd->suspend();
if (sh7372_pd->suspend) {
int ret = sh7372_pd->suspend();

if (sh7372_pd->stay_on)
return 0;
if (ret)
return ret;
}

if (__raw_readl(PSTR) & mask) {
unsigned int retry_count;
Expand All @@ -113,9 +114,6 @@ static int __pd_power_up(struct sh7372_pm_domain *sh7372_pd, bool do_resume)
unsigned int retry_count;
int ret = 0;

if (sh7372_pd->stay_on)
goto out;

if (__raw_readl(PSTR) & mask)
goto out;

Expand Down Expand Up @@ -148,10 +146,11 @@ static int pd_power_up(struct generic_pm_domain *genpd)
return __pd_power_up(to_sh7372_pd(genpd), true);
}

static void sh7372_a4r_suspend(void)
static int sh7372_a4r_suspend(void)
{
sh7372_intcs_suspend();
__raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
return 0;
}

static bool pd_active_wakeup(struct device *dev)
Expand Down Expand Up @@ -243,7 +242,6 @@ struct sh7372_pm_domain sh7372_a4r = {
.gov = &pm_domain_always_on_gov,
.suspend = sh7372_a4r_suspend,
.resume = sh7372_intcs_resume,
.stay_on = true,
};

struct sh7372_pm_domain sh7372_a3rv = {
Expand All @@ -256,29 +254,40 @@ struct sh7372_pm_domain sh7372_a3ri = {
.bit_shift = 8,
};

static int sh7372_a4s_suspend(void)
{
/*
* The A4S domain contains the CPU core and therefore it should
* only be turned off if the CPU is in use.
*/
return -EBUSY;
}

struct sh7372_pm_domain sh7372_a4s = {
.genpd.name = "A4S",
.bit_shift = 10,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
.stay_on = true,
.suspend = sh7372_a4s_suspend,
};

static int sh7372_a3sp_suspend(void)
{
/*
* Serial consoles make use of SCIF hardware located in A3SP,
* keep such power domain on if "no_console_suspend" is set.
*/
return console_suspend_enabled ? -EBUSY : 0;
}

struct sh7372_pm_domain sh7372_a3sp = {
.genpd.name = "A3SP",
.bit_shift = 11,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
.suspend = sh7372_a3sp_suspend,
};

static void sh7372_a3sp_init(void)
{
/* serial consoles make use of SCIF hardware located in A3SP,
* keep such power domain on if "no_console_suspend" is set.
*/
sh7372_a3sp.stay_on = !console_suspend_enabled;
}

struct sh7372_pm_domain sh7372_a3sg = {
.genpd.name = "A3SG",
.bit_shift = 13,
Expand Down Expand Up @@ -508,7 +517,7 @@ static int sh7372_enter_suspend(suspend_state_t suspend_state)
/* convert INTC mask and sense to SYSC mask and sense */
sh7372_setup_sysc(msk, msk2);

if (!sh7372_a3sp.stay_on &&
if (!console_suspend_enabled &&
sh7372_a4s.genpd.status == GPD_STATE_POWER_OFF) {
/* enter A4S sleep with PLLC0 off */
pr_debug("entering A4S\n");
Expand Down Expand Up @@ -544,8 +553,6 @@ void __init sh7372_pm_init(void)
/* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */
__raw_writel(0, PDNSEL);

sh7372_a3sp_init();

sh7372_suspend_init();
sh7372_cpuidle_init();
}

0 comments on commit 885391c

Please sign in to comment.