diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2013-04-17 09:32:56 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-04-21 18:35:53 -0400 |
commit | 0a4f841e9c473be84a1ed0c14f65058c29238ce1 (patch) | |
tree | 3dee0798633f85e9b4cb745eadd7a1258abda49f /arch | |
parent | 194db92fd20cd7733f1ee06b330af93e10dfe727 (diff) |
SH: cpuidle: initialize the driver's states directly
Like all the other drivers, let's initialize the structure a compile time
instead of init time.
The states #1 and #2 are not enabled by default. The init function will
check the features of the board in order to enable the state.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/kernel/cpu/shmobile/cpuidle.c | 92 |
1 files changed, 42 insertions, 50 deletions
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c index 4b277016f0f5..aae346811da4 100644 --- a/arch/sh/kernel/cpu/shmobile/cpuidle.c +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c | |||
@@ -53,60 +53,52 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev, | |||
53 | 53 | ||
54 | static struct cpuidle_device cpuidle_dev; | 54 | static struct cpuidle_device cpuidle_dev; |
55 | static struct cpuidle_driver cpuidle_driver = { | 55 | static struct cpuidle_driver cpuidle_driver = { |
56 | .name = "sh_idle", | 56 | .name = "sh_idle", |
57 | .owner = THIS_MODULE, | 57 | .owner = THIS_MODULE, |
58 | .en_core_tk_irqen = 1, | 58 | .en_core_tk_irqen = 1, |
59 | .states = { | ||
60 | { | ||
61 | .exit_latency = 1, | ||
62 | .target_residency = 1 * 2, | ||
63 | .power_usage = 3, | ||
64 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
65 | .enter = cpuidle_sleep_enter, | ||
66 | .name = "C1", | ||
67 | .desc = "SuperH Sleep Mode", | ||
68 | }, | ||
69 | { | ||
70 | .exit_latency = 100, | ||
71 | .target_residency = 1 * 2, | ||
72 | .power_usage = 1, | ||
73 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
74 | .enter = cpuidle_sleep_enter, | ||
75 | .name = "C2", | ||
76 | .desc = "SuperH Sleep Mode [SF]", | ||
77 | .disabled = true, | ||
78 | }, | ||
79 | { | ||
80 | .exit_latency = 2300, | ||
81 | .target_residency = 1 * 2, | ||
82 | .power_usage = 1, | ||
83 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
84 | .enter = cpuidle_sleep_enter, | ||
85 | .name = "C3", | ||
86 | .desc = "SuperH Mobile Standby Mode [SF]", | ||
87 | .disabled = true, | ||
88 | }, | ||
89 | }, | ||
90 | .safe_state_index = 0, | ||
91 | .state_count = 3, | ||
59 | }; | 92 | }; |
60 | 93 | ||
61 | void sh_mobile_setup_cpuidle(void) | 94 | void sh_mobile_setup_cpuidle(void) |
62 | { | 95 | { |
63 | struct cpuidle_device *dev = &cpuidle_dev; | 96 | if (sh_mobile_sleep_supported & SUSP_SH_SF) |
64 | struct cpuidle_driver *drv = &cpuidle_driver; | 97 | cpuidle_driver.states[1].disabled = false; |
65 | struct cpuidle_state *state; | ||
66 | int i = 0; | ||
67 | 98 | ||
68 | state = &drv->states[i++]; | 99 | if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) |
69 | snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); | 100 | cpuidle_driver.states[2].disabled = false; |
70 | strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN); | ||
71 | state->exit_latency = 1; | ||
72 | state->target_residency = 1 * 2; | ||
73 | state->power_usage = 3; | ||
74 | state->flags = 0; | ||
75 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
76 | state->enter = cpuidle_sleep_enter; | ||
77 | 101 | ||
78 | drv->safe_state_index = 0; | 102 | if (!cpuidle_register_driver(&cpuidle_driver)) |
79 | 103 | cpuidle_register_device(&cpuidle_dev); | |
80 | if (sh_mobile_sleep_supported & SUSP_SH_SF) { | ||
81 | state = &drv->states[i++]; | ||
82 | snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); | ||
83 | strncpy(state->desc, "SuperH Sleep Mode [SF]", | ||
84 | CPUIDLE_DESC_LEN); | ||
85 | state->exit_latency = 100; | ||
86 | state->target_residency = 1 * 2; | ||
87 | state->power_usage = 1; | ||
88 | state->flags = 0; | ||
89 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
90 | state->enter = cpuidle_sleep_enter; | ||
91 | } | ||
92 | |||
93 | if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) { | ||
94 | state = &drv->states[i++]; | ||
95 | snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); | ||
96 | strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", | ||
97 | CPUIDLE_DESC_LEN); | ||
98 | state->exit_latency = 2300; | ||
99 | state->target_residency = 1 * 2; | ||
100 | state->power_usage = 1; | ||
101 | state->flags = 0; | ||
102 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
103 | state->enter = cpuidle_sleep_enter; | ||
104 | } | ||
105 | |||
106 | drv->state_count = i; | ||
107 | dev->state_count = i; | ||
108 | |||
109 | cpuidle_register_driver(&cpuidle_driver); | ||
110 | |||
111 | cpuidle_register_device(dev); | ||
112 | } | 104 | } |