Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275454
b: refs/heads/master
c: b73b5c4
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Nov 11, 2011
1 parent b1a7673 commit 9ae2130
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 41 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: 9b49139b34a66907662e0be8efe79316dc63f8e0
refs/heads/master: b73b5c493ac001870bd9faf565a61908c82f52d8
52 changes: 23 additions & 29 deletions trunk/arch/arm/mach-shmobile/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,65 +26,59 @@ void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = {
};

static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
struct cpuidle_state *state)
struct cpuidle_driver *drv,
int index)
{
ktime_t before, after;
int requested_state = state - &dev->states[0];

dev->last_state = &dev->states[requested_state];
before = ktime_get();

local_irq_disable();
local_fiq_disable();

shmobile_cpuidle_modes[requested_state]();
shmobile_cpuidle_modes[index]();

local_irq_enable();
local_fiq_enable();

after = ktime_get();
return ktime_to_ns(ktime_sub(after, before)) >> 10;
dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10;

return index;
}

static struct cpuidle_device shmobile_cpuidle_dev;
static struct cpuidle_driver shmobile_cpuidle_driver = {
.name = "shmobile_cpuidle",
.owner = THIS_MODULE,
.states[0] = {
.name = "C1",
.desc = "WFI",
.exit_latency = 1,
.target_residency = 1 * 2,
.flags = CPUIDLE_FLAG_TIME_VALID,
},
.safe_state_index = 0, /* C1 */
.state_count = 1,
};

void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev);
void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);

static int shmobile_cpuidle_init(void)
{
struct cpuidle_device *dev = &shmobile_cpuidle_dev;
struct cpuidle_state *state;
struct cpuidle_driver *drv = &shmobile_cpuidle_driver;
int i;

cpuidle_register_driver(&shmobile_cpuidle_driver);

for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
dev->states[i].name[0] = '\0';
dev->states[i].desc[0] = '\0';
dev->states[i].enter = shmobile_cpuidle_enter;
}

i = CPUIDLE_DRIVER_STATE_START;

state = &dev->states[i++];
snprintf(state->name, CPUIDLE_NAME_LEN, "C1");
strncpy(state->desc, "WFI", CPUIDLE_DESC_LEN);
state->exit_latency = 1;
state->target_residency = 1 * 2;
state->power_usage = 3;
state->flags = 0;
state->flags |= CPUIDLE_FLAG_TIME_VALID;

dev->safe_state = state;
dev->state_count = i;
for (i = 0; i < CPUIDLE_STATE_MAX; i++)
drv->states[i].enter = shmobile_cpuidle_enter;

if (shmobile_cpuidle_setup)
shmobile_cpuidle_setup(dev);
shmobile_cpuidle_setup(drv);

cpuidle_register_driver(drv);

dev->state_count = drv->state_count;
cpuidle_register_device(dev);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-shmobile/include/mach/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extern int clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *);
extern void shmobile_handle_irq_gic(struct pt_regs *);
extern struct platform_suspend_ops shmobile_suspend_ops;
struct cpuidle_device;
struct cpuidle_driver;
extern void (*shmobile_cpuidle_modes[])(void);
extern void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev);
extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);

extern void sh7367_init_irq(void);
extern void sh7367_add_early_devices(void);
Expand Down
14 changes: 5 additions & 9 deletions trunk/arch/arm/mach-shmobile/pm-sh7372.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,22 +402,18 @@ static void sh7372_setup_a3sm(unsigned long msk, unsigned long msk2)

#ifdef CONFIG_CPU_IDLE

static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
static void sh7372_cpuidle_setup(struct cpuidle_driver *drv)
{
struct cpuidle_state *state;
int i = dev->state_count;
struct cpuidle_state *state = &drv->states[drv->state_count];

state = &dev->states[i];
snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN);
state->exit_latency = 10;
state->target_residency = 20 + 10;
state->power_usage = 1; /* perhaps not */
state->flags = 0;
state->flags |= CPUIDLE_FLAG_TIME_VALID;
shmobile_cpuidle_modes[i] = sh7372_enter_core_standby;
state->flags = CPUIDLE_FLAG_TIME_VALID;
shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_core_standby;

dev->state_count = i + 1;
drv->state_count++;
}

static void sh7372_cpuidle_init(void)
Expand Down

0 comments on commit 9ae2130

Please sign in to comment.