diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 13:13:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 13:13:52 -0500 |
commit | 3c00303206c3a1ccd86579efdc90bc35f140962e (patch) | |
tree | 66170c84b5ddaeb102aea3530517a26657b6ea29 /arch/sh/kernel/cpu/shmobile | |
parent | 83dbb15e9cd78a3619e3db36777e2f81d09b2914 (diff) | |
parent | efb90582c575084723cc14302c1300cb26c7e01f (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
cpuidle: Single/Global registration of idle states
cpuidle: Split cpuidle_state structure and move per-cpu statistics fields
cpuidle: Remove CPUIDLE_FLAG_IGNORE and dev->prepare()
cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning
ACPI: Export FADT pm_profile integer value to userspace
thermal: Prevent polling from happening during system suspend
ACPI: Drop ACPI_NO_HARDWARE_INIT
ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast()
PNPACPI: Simplify disabled resource registration
ACPI: Fix possible recursive locking in hwregs.c
ACPI: use kstrdup()
mrst pmu: update comment
tools/power turbostat: less verbose debugging
Diffstat (limited to 'arch/sh/kernel/cpu/shmobile')
-rw-r--r-- | arch/sh/kernel/cpu/shmobile/cpuidle.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c index 7d98f909a8ac..1cc257c9b1e3 100644 --- a/arch/sh/kernel/cpu/shmobile/cpuidle.c +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c | |||
@@ -26,11 +26,12 @@ static unsigned long cpuidle_mode[] = { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | static int cpuidle_sleep_enter(struct cpuidle_device *dev, | 28 | static int cpuidle_sleep_enter(struct cpuidle_device *dev, |
29 | struct cpuidle_state *state) | 29 | struct cpuidle_driver *drv, |
30 | int index) | ||
30 | { | 31 | { |
31 | unsigned long allowed_mode = arch_hwblk_sleep_mode(); | 32 | unsigned long allowed_mode = arch_hwblk_sleep_mode(); |
32 | ktime_t before, after; | 33 | ktime_t before, after; |
33 | int requested_state = state - &dev->states[0]; | 34 | int requested_state = index; |
34 | int allowed_state; | 35 | int allowed_state; |
35 | int k; | 36 | int k; |
36 | 37 | ||
@@ -47,11 +48,13 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev, | |||
47 | */ | 48 | */ |
48 | k = min_t(int, allowed_state, requested_state); | 49 | k = min_t(int, allowed_state, requested_state); |
49 | 50 | ||
50 | dev->last_state = &dev->states[k]; | ||
51 | before = ktime_get(); | 51 | before = ktime_get(); |
52 | sh_mobile_call_standby(cpuidle_mode[k]); | 52 | sh_mobile_call_standby(cpuidle_mode[k]); |
53 | after = ktime_get(); | 53 | after = ktime_get(); |
54 | return ktime_to_ns(ktime_sub(after, before)) >> 10; | 54 | |
55 | dev->last_residency = (int)ktime_to_ns(ktime_sub(after, before)) >> 10; | ||
56 | |||
57 | return k; | ||
55 | } | 58 | } |
56 | 59 | ||
57 | static struct cpuidle_device cpuidle_dev; | 60 | static struct cpuidle_device cpuidle_dev; |
@@ -63,19 +66,19 @@ static struct cpuidle_driver cpuidle_driver = { | |||
63 | void sh_mobile_setup_cpuidle(void) | 66 | void sh_mobile_setup_cpuidle(void) |
64 | { | 67 | { |
65 | struct cpuidle_device *dev = &cpuidle_dev; | 68 | struct cpuidle_device *dev = &cpuidle_dev; |
69 | struct cpuidle_driver *drv = &cpuidle_driver; | ||
66 | struct cpuidle_state *state; | 70 | struct cpuidle_state *state; |
67 | int i; | 71 | int i; |
68 | 72 | ||
69 | cpuidle_register_driver(&cpuidle_driver); | ||
70 | 73 | ||
71 | for (i = 0; i < CPUIDLE_STATE_MAX; i++) { | 74 | for (i = 0; i < CPUIDLE_STATE_MAX; i++) { |
72 | dev->states[i].name[0] = '\0'; | 75 | drv->states[i].name[0] = '\0'; |
73 | dev->states[i].desc[0] = '\0'; | 76 | drv->states[i].desc[0] = '\0'; |
74 | } | 77 | } |
75 | 78 | ||
76 | i = CPUIDLE_DRIVER_STATE_START; | 79 | i = CPUIDLE_DRIVER_STATE_START; |
77 | 80 | ||
78 | state = &dev->states[i++]; | 81 | state = &drv->states[i++]; |
79 | snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); | 82 | snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); |
80 | strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN); | 83 | strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN); |
81 | state->exit_latency = 1; | 84 | state->exit_latency = 1; |
@@ -85,10 +88,10 @@ void sh_mobile_setup_cpuidle(void) | |||
85 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 88 | state->flags |= CPUIDLE_FLAG_TIME_VALID; |
86 | state->enter = cpuidle_sleep_enter; | 89 | state->enter = cpuidle_sleep_enter; |
87 | 90 | ||
88 | dev->safe_state = state; | 91 | drv->safe_state_index = i-1; |
89 | 92 | ||
90 | if (sh_mobile_sleep_supported & SUSP_SH_SF) { | 93 | if (sh_mobile_sleep_supported & SUSP_SH_SF) { |
91 | state = &dev->states[i++]; | 94 | state = &drv->states[i++]; |
92 | snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); | 95 | snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); |
93 | strncpy(state->desc, "SuperH Sleep Mode [SF]", | 96 | strncpy(state->desc, "SuperH Sleep Mode [SF]", |
94 | CPUIDLE_DESC_LEN); | 97 | CPUIDLE_DESC_LEN); |
@@ -101,7 +104,7 @@ void sh_mobile_setup_cpuidle(void) | |||
101 | } | 104 | } |
102 | 105 | ||
103 | if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) { | 106 | if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) { |
104 | state = &dev->states[i++]; | 107 | state = &drv->states[i++]; |
105 | snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); | 108 | snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); |
106 | strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", | 109 | strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", |
107 | CPUIDLE_DESC_LEN); | 110 | CPUIDLE_DESC_LEN); |
@@ -113,7 +116,10 @@ void sh_mobile_setup_cpuidle(void) | |||
113 | state->enter = cpuidle_sleep_enter; | 116 | state->enter = cpuidle_sleep_enter; |
114 | } | 117 | } |
115 | 118 | ||
119 | drv->state_count = i; | ||
116 | dev->state_count = i; | 120 | dev->state_count = i; |
117 | 121 | ||
122 | cpuidle_register_driver(&cpuidle_driver); | ||
123 | |||
118 | cpuidle_register_device(dev); | 124 | cpuidle_register_device(dev); |
119 | } | 125 | } |