diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-12-01 08:39:51 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-12-01 08:39:51 -0500 |
| commit | 4e28ec3d5fe0b994fe87b2406d75d9c351ef4940 (patch) | |
| tree | af6fbb01ca736ff7e9f57bed685508bd74fc7cac /drivers | |
| parent | a2c1bc645e87346150516b3abf1933ed29d0f48b (diff) | |
| parent | 6af33995318fdfb4914fb1c5e67450fdb3d32084 (diff) | |
Merge back earlier cpuidle material for v4.10.
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/cpuidle/cpuidle-powernv.c | 2 | ||||
| -rw-r--r-- | drivers/cpuidle/cpuidle.c | 13 | ||||
| -rw-r--r-- | drivers/cpuidle/dt_idle_states.c | 6 | ||||
| -rw-r--r-- | drivers/cpuidle/governor.c | 4 | ||||
| -rw-r--r-- | drivers/cpuidle/governors/ladder.c | 2 | ||||
| -rw-r--r-- | drivers/cpuidle/governors/menu.c | 2 |
6 files changed, 19 insertions, 10 deletions
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index 7fe442ca38f4..0835a37a5f3a 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #define POWERNV_THRESHOLD_LATENCY_NS 200000 | 23 | #define POWERNV_THRESHOLD_LATENCY_NS 200000 |
| 24 | 24 | ||
| 25 | struct cpuidle_driver powernv_idle_driver = { | 25 | static struct cpuidle_driver powernv_idle_driver = { |
| 26 | .name = "powernv_idle", | 26 | .name = "powernv_idle", |
| 27 | .owner = THIS_MODULE, | 27 | .owner = THIS_MODULE, |
| 28 | }; | 28 | }; |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index c73207abb5a4..afc005b917fe 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -97,7 +97,17 @@ static int find_deepest_state(struct cpuidle_driver *drv, | |||
| 97 | return ret; | 97 | return ret; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | #ifdef CONFIG_SUSPEND | 100 | /* Set the current cpu to use the deepest idle state, override governors */ |
| 101 | void cpuidle_use_deepest_state(bool enable) | ||
| 102 | { | ||
| 103 | struct cpuidle_device *dev; | ||
| 104 | |||
| 105 | preempt_disable(); | ||
| 106 | dev = cpuidle_get_device(); | ||
| 107 | dev->use_deepest_state = enable; | ||
| 108 | preempt_enable(); | ||
| 109 | } | ||
| 110 | |||
| 101 | /** | 111 | /** |
| 102 | * cpuidle_find_deepest_state - Find the deepest available idle state. | 112 | * cpuidle_find_deepest_state - Find the deepest available idle state. |
| 103 | * @drv: cpuidle driver for the given CPU. | 113 | * @drv: cpuidle driver for the given CPU. |
| @@ -109,6 +119,7 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | |||
| 109 | return find_deepest_state(drv, dev, UINT_MAX, 0, false); | 119 | return find_deepest_state(drv, dev, UINT_MAX, 0, false); |
| 110 | } | 120 | } |
| 111 | 121 | ||
| 122 | #ifdef CONFIG_SUSPEND | ||
| 112 | static void enter_freeze_proper(struct cpuidle_driver *drv, | 123 | static void enter_freeze_proper(struct cpuidle_driver *drv, |
| 113 | struct cpuidle_device *dev, int index) | 124 | struct cpuidle_device *dev, int index) |
| 114 | { | 125 | { |
diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index a5c111b67f37..ffca4fc0061d 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c | |||
| @@ -38,6 +38,12 @@ static int init_state_node(struct cpuidle_state *idle_state, | |||
| 38 | * state enter function. | 38 | * state enter function. |
| 39 | */ | 39 | */ |
| 40 | idle_state->enter = match_id->data; | 40 | idle_state->enter = match_id->data; |
| 41 | /* | ||
| 42 | * Since this is not a "coupled" state, it's safe to assume interrupts | ||
| 43 | * won't be enabled when it exits allowing the tick to be frozen | ||
| 44 | * safely. So enter() can be also enter_freeze() callback. | ||
| 45 | */ | ||
| 46 | idle_state->enter_freeze = match_id->data; | ||
| 41 | 47 | ||
| 42 | err = of_property_read_u32(state_node, "wakeup-latency-us", | 48 | err = of_property_read_u32(state_node, "wakeup-latency-us", |
| 43 | &idle_state->exit_latency); | 49 | &idle_state->exit_latency); |
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index fb9f511cca23..4e78263e34a4 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/cpuidle.h> | 12 | #include <linux/cpuidle.h> |
| 14 | 13 | ||
| 15 | #include "cpuidle.h" | 14 | #include "cpuidle.h" |
| @@ -53,14 +52,11 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov) | |||
| 53 | if (cpuidle_curr_governor) { | 52 | if (cpuidle_curr_governor) { |
| 54 | list_for_each_entry(dev, &cpuidle_detected_devices, device_list) | 53 | list_for_each_entry(dev, &cpuidle_detected_devices, device_list) |
| 55 | cpuidle_disable_device(dev); | 54 | cpuidle_disable_device(dev); |
| 56 | module_put(cpuidle_curr_governor->owner); | ||
| 57 | } | 55 | } |
| 58 | 56 | ||
| 59 | cpuidle_curr_governor = gov; | 57 | cpuidle_curr_governor = gov; |
| 60 | 58 | ||
| 61 | if (gov) { | 59 | if (gov) { |
| 62 | if (!try_module_get(cpuidle_curr_governor->owner)) | ||
| 63 | return -EINVAL; | ||
| 64 | list_for_each_entry(dev, &cpuidle_detected_devices, device_list) | 60 | list_for_each_entry(dev, &cpuidle_detected_devices, device_list) |
| 65 | cpuidle_enable_device(dev); | 61 | cpuidle_enable_device(dev); |
| 66 | cpuidle_install_idle_handler(); | 62 | cpuidle_install_idle_handler(); |
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 63bd5a403e22..fe8f08948fcb 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/cpuidle.h> | 16 | #include <linux/cpuidle.h> |
| 17 | #include <linux/pm_qos.h> | 17 | #include <linux/pm_qos.h> |
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
| 20 | #include <linux/tick.h> | 19 | #include <linux/tick.h> |
| 21 | 20 | ||
| @@ -177,7 +176,6 @@ static struct cpuidle_governor ladder_governor = { | |||
| 177 | .enable = ladder_enable_device, | 176 | .enable = ladder_enable_device, |
| 178 | .select = ladder_select_state, | 177 | .select = ladder_select_state, |
| 179 | .reflect = ladder_reflect, | 178 | .reflect = ladder_reflect, |
| 180 | .owner = THIS_MODULE, | ||
| 181 | }; | 179 | }; |
| 182 | 180 | ||
| 183 | /** | 181 | /** |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 03d38c291de6..d9b5b9398a0f 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/tick.h> | 19 | #include <linux/tick.h> |
| 20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
| 21 | #include <linux/math64.h> | 21 | #include <linux/math64.h> |
| 22 | #include <linux/module.h> | ||
| 23 | 22 | ||
| 24 | /* | 23 | /* |
| 25 | * Please note when changing the tuning values: | 24 | * Please note when changing the tuning values: |
| @@ -484,7 +483,6 @@ static struct cpuidle_governor menu_governor = { | |||
| 484 | .enable = menu_enable_device, | 483 | .enable = menu_enable_device, |
| 485 | .select = menu_select, | 484 | .select = menu_select, |
| 486 | .reflect = menu_reflect, | 485 | .reflect = menu_reflect, |
| 487 | .owner = THIS_MODULE, | ||
| 488 | }; | 486 | }; |
| 489 | 487 | ||
| 490 | /** | 488 | /** |
