vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 3 | * Copyright (C) 2018 The LineageOS Project |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are |
| 7 | * met: |
| 8 | * * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above |
| 11 | * copyright notice, this list of conditions and the following |
| 12 | * disclaimer in the documentation and/or other materials provided |
| 13 | * with the distribution. |
| 14 | * * Neither the name of The Linux Foundation nor the names of its |
| 15 | * contributors may be used to endorse or promote products derived |
| 16 | * from this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 25 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 28 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #define LOG_NIDEBUG 0 |
| 32 | |
| 33 | #include <errno.h> |
Craig Tatlor | adf8a1c | 2018-05-21 17:22:31 +0100 | [diff] [blame] | 34 | #include <time.h> |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 35 | #include <string.h> |
| 36 | #include <sys/types.h> |
| 37 | #include <sys/stat.h> |
| 38 | #include <fcntl.h> |
| 39 | #include <dlfcn.h> |
| 40 | #include <stdlib.h> |
| 41 | |
Michael Bestas | 1add9ac | 2018-03-25 22:56:44 +0300 | [diff] [blame] | 42 | #define LOG_TAG "QCOM PowerHAL" |
Ethan Chen | a42f4a8 | 2018-03-01 21:31:15 -0800 | [diff] [blame] | 43 | #include <log/log.h> |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 44 | #include <hardware/hardware.h> |
| 45 | #include <hardware/power.h> |
| 46 | |
| 47 | #include "utils.h" |
| 48 | #include "metadata-defs.h" |
| 49 | #include "hint-data.h" |
| 50 | #include "performance.h" |
| 51 | #include "power-common.h" |
| 52 | |
| 53 | #define MIN_FREQ_CPU0_DISP_OFF 400000 |
| 54 | #define MIN_FREQ_CPU0_DISP_ON 960000 |
| 55 | |
Corinna Vinschen | ed3426d | 2018-04-10 11:57:37 +0200 | [diff] [blame] | 56 | const char *scaling_min_freq[4] = { |
| 57 | "/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", |
| 58 | "/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq", |
| 59 | "/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq", |
| 60 | "/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq" |
Nikhil Kumar Kansal | 1bd0289 | 2015-07-22 18:47:46 +0530 | [diff] [blame] | 61 | }; |
| 62 | |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 63 | /** |
Zhao Wei Liew | 143f807 | 2018-11-02 00:33:14 +0000 | [diff] [blame] | 64 | * Returns true if the target is MSM8916. |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 65 | */ |
| 66 | static bool is_target_8916(void) |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 67 | { |
Zhao Wei Liew | 143f807 | 2018-11-02 00:33:14 +0000 | [diff] [blame] | 68 | static int is_8916 = -1; |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 69 | int soc_id; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 70 | |
Zhao Wei Liew | 143f807 | 2018-11-02 00:33:14 +0000 | [diff] [blame] | 71 | if (is_8916 >= 0) |
| 72 | return is_8916; |
| 73 | |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 74 | soc_id = get_soc_id(); |
Zhao Wei Liew | 143f807 | 2018-11-02 00:33:14 +0000 | [diff] [blame] | 75 | is_8916 = soc_id == 206 || (soc_id >= 247 && soc_id <= 250); |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 76 | |
| 77 | return is_8916; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 78 | } |
| 79 | |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 80 | static int current_power_profile = PROFILE_BALANCED; |
| 81 | |
| 82 | static int profile_high_performance_8916[3] = { |
| 83 | 0x1C00, 0x0901, CPU0_MIN_FREQ_TURBO_MAX, |
| 84 | }; |
| 85 | |
| 86 | static int profile_high_performance_8939[11] = { |
| 87 | SCHED_BOOST_ON, 0x1C00, 0x0901, |
| 88 | CPU0_MIN_FREQ_TURBO_MAX, CPU1_MIN_FREQ_TURBO_MAX, |
| 89 | CPU2_MIN_FREQ_TURBO_MAX, CPU3_MIN_FREQ_TURBO_MAX, |
| 90 | CPU4_MIN_FREQ_TURBO_MAX, CPU5_MIN_FREQ_TURBO_MAX, |
| 91 | CPU6_MIN_FREQ_TURBO_MAX, CPU7_MIN_FREQ_TURBO_MAX, |
| 92 | }; |
| 93 | |
| 94 | static int profile_power_save_8916[1] = { |
| 95 | CPU0_MAX_FREQ_NONTURBO_MAX, |
| 96 | }; |
| 97 | |
| 98 | static int profile_power_save_8939[5] = { |
| 99 | CPUS_ONLINE_MAX_LIMIT_2, |
| 100 | CPU0_MAX_FREQ_NONTURBO_MAX, CPU1_MAX_FREQ_NONTURBO_MAX, |
| 101 | CPU2_MAX_FREQ_NONTURBO_MAX, CPU3_MAX_FREQ_NONTURBO_MAX, |
| 102 | }; |
| 103 | |
| 104 | #ifdef INTERACTION_BOOST |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 105 | int get_number_of_profiles() |
| 106 | { |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 107 | return 3; |
| 108 | } |
| 109 | #endif |
| 110 | |
dianlujitao | 8780cb7 | 2019-02-23 20:24:57 +0800 | [diff] [blame] | 111 | static int set_power_profile(void *data) |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 112 | { |
dianlujitao | 8780cb7 | 2019-02-23 20:24:57 +0800 | [diff] [blame] | 113 | int profile = data ? *((int*)data) : 0; |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 114 | int ret = -EINVAL; |
| 115 | const char *profile_name = NULL; |
| 116 | |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 117 | if (profile == current_power_profile) |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 118 | return 0; |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 119 | |
| 120 | ALOGV("%s: Profile=%d", __func__, profile); |
| 121 | |
| 122 | if (current_power_profile != PROFILE_BALANCED) { |
| 123 | undo_hint_action(DEFAULT_PROFILE_HINT_ID); |
| 124 | ALOGV("%s: Hint undone", __func__); |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 125 | current_power_profile = PROFILE_BALANCED; |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | if (profile == PROFILE_POWER_SAVE) { |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 129 | ret = perform_hint_action(DEFAULT_PROFILE_HINT_ID, |
| 130 | is_target_8916() ? profile_power_save_8916 : |
| 131 | profile_power_save_8939, |
| 132 | is_target_8916() ? ARRAY_SIZE(profile_power_save_8916) : |
| 133 | ARRAY_SIZE(profile_power_save_8939)); |
| 134 | profile_name = "powersave"; |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 135 | |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 136 | } else if (profile == PROFILE_HIGH_PERFORMANCE) { |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 137 | ret = perform_hint_action(DEFAULT_PROFILE_HINT_ID, |
| 138 | is_target_8916() ? profile_high_performance_8916 : |
| 139 | profile_high_performance_8939, |
| 140 | is_target_8916() ? ARRAY_SIZE(profile_high_performance_8916) : |
| 141 | ARRAY_SIZE(profile_high_performance_8939)); |
| 142 | profile_name = "performance"; |
| 143 | |
| 144 | } else if (profile == PROFILE_BALANCED) { |
| 145 | ret = 0; |
| 146 | profile_name = "balanced"; |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 147 | } |
| 148 | |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 149 | if (ret == 0) { |
| 150 | current_power_profile = profile; |
| 151 | ALOGD("%s: Set %s mode", __func__, profile_name); |
| 152 | } |
| 153 | return ret; |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static int resources_interaction_fling_boost[] = { |
| 157 | ALL_CPUS_PWR_CLPS_DIS, |
| 158 | SCHED_BOOST_ON, |
| 159 | SCHED_PREFER_IDLE_DIS, |
| 160 | 0x20D |
| 161 | }; |
| 162 | |
| 163 | static int resources_interaction_boost[] = { |
| 164 | ALL_CPUS_PWR_CLPS_DIS, |
| 165 | SCHED_PREFER_IDLE_DIS, |
| 166 | 0x20D |
| 167 | }; |
| 168 | |
| 169 | static int resources_launch[] = { |
| 170 | ALL_CPUS_PWR_CLPS_DIS, |
| 171 | SCHED_BOOST_ON, |
| 172 | SCHED_PREFER_IDLE_DIS, |
| 173 | 0x20F, |
| 174 | 0x1C00, |
| 175 | 0x4001, |
| 176 | 0x4101, |
| 177 | 0x4201 |
| 178 | }; |
| 179 | |
tomascus | 8b038b1 | 2019-02-19 17:15:58 +1100 | [diff] [blame] | 180 | static int process_activity_launch_hint(void *data) |
| 181 | { |
| 182 | static int launch_handle = -1; |
| 183 | static int launch_mode = 0; |
| 184 | |
| 185 | // release lock early if launch has finished |
| 186 | if (!data) { |
| 187 | if (CHECK_HANDLE(launch_handle)) { |
| 188 | release_request(launch_handle); |
| 189 | launch_handle = -1; |
| 190 | } |
| 191 | launch_mode = 0; |
| 192 | return HINT_HANDLED; |
| 193 | } |
| 194 | |
| 195 | if (!launch_mode) { |
| 196 | launch_handle = interaction_with_handle(launch_handle, 5000, |
| 197 | ARRAY_SIZE(resources_launch), resources_launch); |
| 198 | if (!CHECK_HANDLE(launch_handle)) { |
| 199 | ALOGE("Failed to perform launch boost"); |
| 200 | return HINT_NONE; |
| 201 | } |
| 202 | launch_mode = 1; |
| 203 | } |
| 204 | return HINT_HANDLED; |
| 205 | } |
| 206 | |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 207 | int power_hint_override(power_hint_t hint, void *data) |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 208 | { |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 209 | static struct timespec s_previous_boost_timespec; |
| 210 | struct timespec cur_boost_timespec; |
| 211 | long long elapsed_time; |
| 212 | static int s_previous_duration = 0; |
| 213 | int duration; |
| 214 | |
| 215 | if (hint == POWER_HINT_SET_PROFILE) { |
dianlujitao | 8780cb7 | 2019-02-23 20:24:57 +0800 | [diff] [blame] | 216 | if (set_power_profile(data) < 0) |
Corinna Vinschen | 8599e3c | 2018-08-26 22:11:49 +0200 | [diff] [blame] | 217 | ALOGE("Setting power profile failed. perfd not started?"); |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 218 | return HINT_HANDLED; |
| 219 | } |
| 220 | |
| 221 | // Skip other hints in high/low power modes |
| 222 | if (current_power_profile == PROFILE_POWER_SAVE || |
| 223 | current_power_profile == PROFILE_HIGH_PERFORMANCE) { |
| 224 | return HINT_HANDLED; |
| 225 | } |
| 226 | |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 227 | switch (hint) { |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 228 | case POWER_HINT_INTERACTION: |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 229 | duration = 500; // 500ms by default |
| 230 | if (data) { |
| 231 | int input_duration = *((int*)data); |
| 232 | if (input_duration > duration) { |
| 233 | duration = (input_duration > 5000) ? 5000 : input_duration; |
| 234 | } |
| 235 | } |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 236 | |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 237 | clock_gettime(CLOCK_MONOTONIC, &cur_boost_timespec); |
| 238 | |
| 239 | elapsed_time = calc_timespan_us(s_previous_boost_timespec, cur_boost_timespec); |
| 240 | // don't hint if previous hint's duration covers this hint's duration |
| 241 | if ((s_previous_duration * 1000) > (elapsed_time + duration * 1000)) { |
| 242 | return HINT_HANDLED; |
| 243 | } |
| 244 | s_previous_boost_timespec = cur_boost_timespec; |
| 245 | s_previous_duration = duration; |
| 246 | |
| 247 | if (duration >= 1500) { |
| 248 | interaction(duration, ARRAY_SIZE(resources_interaction_fling_boost), |
| 249 | resources_interaction_fling_boost); |
| 250 | } else { |
| 251 | interaction(duration, ARRAY_SIZE(resources_interaction_boost), |
| 252 | resources_interaction_boost); |
| 253 | } |
| 254 | return HINT_HANDLED; |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 255 | case POWER_HINT_LAUNCH: |
tomascus | 8b038b1 | 2019-02-19 17:15:58 +1100 | [diff] [blame] | 256 | return process_activity_launch_hint(data); |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 257 | case POWER_HINT_VIDEO_ENCODE: /* Do nothing for encode case */ |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 258 | return HINT_HANDLED; |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 259 | case POWER_HINT_VIDEO_DECODE: /* Do nothing for decode case */ |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 260 | return HINT_HANDLED; |
Nikhil Kumar Kansal | 1bd0289 | 2015-07-22 18:47:46 +0530 | [diff] [blame] | 261 | default: |
dianlujitao | 46ac4af | 2018-03-25 18:08:45 +0800 | [diff] [blame] | 262 | break; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 263 | } |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 264 | return HINT_NONE; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 265 | } |
| 266 | |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 267 | int set_interactive_override(int on) |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 268 | { |
| 269 | char governor[80]; |
| 270 | char tmp_str[NODE_MAX]; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 271 | |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 272 | if (get_scaling_governor_check_cores(governor, sizeof(governor), CPU0) == -1) { |
| 273 | if (get_scaling_governor_check_cores(governor, sizeof(governor), CPU1) == -1) { |
| 274 | if (get_scaling_governor_check_cores(governor, sizeof(governor), CPU2) == -1) { |
| 275 | if (get_scaling_governor_check_cores(governor, sizeof(governor), CPU3) == -1) { |
Nikhil Kumar Kansal | 1bd0289 | 2015-07-22 18:47:46 +0530 | [diff] [blame] | 276 | ALOGE("Can't obtain scaling governor."); |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 277 | return HINT_NONE; |
Nikhil Kumar Kansal | 1bd0289 | 2015-07-22 18:47:46 +0530 | [diff] [blame] | 278 | } |
| 279 | } |
| 280 | } |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | if (!on) { |
| 284 | /* Display off. */ |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 285 | if (is_target_8916()) { |
Ethan Chen | 4b4acdf | 2018-03-01 21:41:04 -0800 | [diff] [blame] | 286 | if (is_interactive_governor(governor)) { |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 287 | int resource_values[] = { |
| 288 | TR_MS_50, THREAD_MIGRATION_SYNC_OFF |
| 289 | }; |
Zhao Wei Liew | 5a81c9a | 2016-06-26 21:29:34 +0800 | [diff] [blame] | 290 | perform_hint_action(DISPLAY_STATE_HINT_ID, |
| 291 | resource_values, ARRAY_SIZE(resource_values)); |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 292 | } |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 293 | } else { |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 294 | if (is_interactive_governor(governor)) { |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 295 | int resource_values[] = { |
| 296 | TR_MS_CPU0_50, TR_MS_CPU4_50, THREAD_MIGRATION_SYNC_OFF |
| 297 | }; |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 298 | |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 299 | /* Set CPU0 MIN FREQ to 400Mhz avoid extra peak power |
| 300 | impact in volume key press */ |
| 301 | snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_OFF); |
| 302 | if (sysfs_write(scaling_min_freq[0], tmp_str) != 0) { |
| 303 | if (sysfs_write(scaling_min_freq[1], tmp_str) != 0) { |
| 304 | if (sysfs_write(scaling_min_freq[2], tmp_str) != 0) { |
| 305 | if (sysfs_write(scaling_min_freq[3], tmp_str) != 0) { |
| 306 | ALOGE("Failed to write to %s", SCALING_MIN_FREQ); |
| 307 | } |
| 308 | } |
| 309 | } |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 310 | } |
Zhao Wei Liew | 5a81c9a | 2016-06-26 21:29:34 +0800 | [diff] [blame] | 311 | perform_hint_action(DISPLAY_STATE_HINT_ID, |
| 312 | resource_values, ARRAY_SIZE(resource_values)); |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 313 | } |
| 314 | } |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 315 | } else { |
| 316 | /* Display on. */ |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 317 | if (is_target_8916()) { |
Zhao Wei Liew | 5a81c9a | 2016-06-26 21:29:34 +0800 | [diff] [blame] | 318 | if (is_interactive_governor(governor)) { |
| 319 | undo_hint_action(DISPLAY_STATE_HINT_ID); |
| 320 | } |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 321 | } else { |
Zhao Wei Liew | 5a81c9a | 2016-06-26 21:29:34 +0800 | [diff] [blame] | 322 | if (is_interactive_governor(governor)) { |
dianlujitao | ce3ca5c | 2018-03-25 17:37:31 +0800 | [diff] [blame] | 323 | /* Recovering MIN_FREQ in display ON case */ |
| 324 | snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_ON); |
| 325 | if (sysfs_write(scaling_min_freq[0], tmp_str) != 0) { |
| 326 | if (sysfs_write(scaling_min_freq[1], tmp_str) != 0) { |
| 327 | if (sysfs_write(scaling_min_freq[2], tmp_str) != 0) { |
| 328 | if (sysfs_write(scaling_min_freq[3], tmp_str) != 0) { |
| 329 | ALOGE("Failed to write to %s", SCALING_MIN_FREQ); |
| 330 | } |
| 331 | } |
| 332 | } |
Nikhil Kumar Kansal | 1bd0289 | 2015-07-22 18:47:46 +0530 | [diff] [blame] | 333 | } |
Zhao Wei Liew | 5a81c9a | 2016-06-26 21:29:34 +0800 | [diff] [blame] | 334 | undo_hint_action(DISPLAY_STATE_HINT_ID); |
| 335 | } |
Michael Bestas | 47636f6 | 2018-05-25 21:30:28 +0300 | [diff] [blame] | 336 | } |
Zhao Wei Liew | 6fe5252 | 2016-07-19 19:57:06 +0800 | [diff] [blame] | 337 | } |
vaibhav bhalla | eef51ad | 2015-02-23 20:11:59 +0530 | [diff] [blame] | 338 | return HINT_HANDLED; |
| 339 | } |