summaryrefslogtreecommitdiffstats
path: root/power-8916.c
diff options
context:
space:
mode:
authorNikhil Kumar Kansal <nkansal@codeaurora.org>2015-07-22 18:47:46 +0530
committerMichael Bestas <mkbestas@lineageos.org>2019-10-23 01:12:56 +0300
commit886567a1540f5af41122bee36cc4ef7549e4024e (patch)
tree4a31b0d4c1d41252254547b22d70a53bd2575d50 /power-8916.c
parent783a1886b55abf388befa372aacf918508d7f031 (diff)
downloadvendor_qcom_opensource_power-886567a1540f5af41122bee36cc4ef7549e4024e.tar.gz
vendor_qcom_opensource_power-886567a1540f5af41122bee36cc4ef7549e4024e.tar.bz2
vendor_qcom_opensource_power-886567a1540f5af41122bee36cc4ef7549e4024e.zip
power: Fix to handle min freq changes when CPU cores hotplugged.
Finds which CPU cores is online and does following below 1.Gets scaling governor 2.Sets scaling min freq Change-Id: I209a6228294c945e943ff285ac8f38b7f97337d6
Diffstat (limited to 'power-8916.c')
-rw-r--r--power-8916.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/power-8916.c b/power-8916.c
index 4c50972..9006730 100644
--- a/power-8916.c
+++ b/power-8916.c
@@ -51,6 +51,13 @@
#define MIN_FREQ_CPU0_DISP_OFF 400000
#define MIN_FREQ_CPU0_DISP_ON 960000
+char scaling_min_freq[4][80] ={
+ "sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq",
+ "sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq",
+ "sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq",
+ "sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq"
+};
+
static int saved_dcvs_cpu0_slack_max = -1;
static int saved_dcvs_cpu0_slack_min = -1;
static int saved_mpdecision_slack_max = -1;
@@ -101,6 +108,8 @@ int power_hint_override(struct power_module *module, power_hint_t hint,
return HINT_HANDLED;
case POWER_HINT_VIDEO_DECODE: /*Do nothing for encode case */
return HINT_HANDLED;
+ default:
+ return HINT_HANDLED;
}
return HINT_NONE;
}
@@ -113,11 +122,15 @@ int set_interactive_override(struct power_module *module, int on)
int rc;
ALOGI("Got set_interactive hint");
-
- if (get_scaling_governor(governor, sizeof(governor)) == -1) {
- ALOGE("Can't obtain scaling governor.");
-
- return HINT_HANDLED;
+ if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU0) == -1) {
+ if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU1) == -1) {
+ if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU2) == -1) {
+ if (get_scaling_governor_check_cores(governor, sizeof(governor),CPU3) == -1) {
+ ALOGE("Can't obtain scaling governor.");
+ return HINT_HANDLED;
+ }
+ }
+ }
}
if (!on) {
@@ -148,11 +161,17 @@ int set_interactive_override(struct power_module *module, int on)
/* Set CPU0 MIN FREQ to 400Mhz avoid extra peak power
impact in volume key press */
snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_OFF);
- if (sysfs_write(SCALING_MIN_FREQ, tmp_str) != 0) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
- }
- rc = 1;
+ if (sysfs_write(scaling_min_freq[0], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[1], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[2], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[3], tmp_str) != 0) {
+ if(!slack_node_rw_failed) {
+ ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
+ }
+ rc = 1;
+ }
+ }
+ }
}
if (!display_hint_sent) {
@@ -184,13 +203,19 @@ int set_interactive_override(struct power_module *module, int on)
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
/* Recovering MIN_FREQ in display ON case */
- snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_ON);
- if (sysfs_write(SCALING_MIN_FREQ, tmp_str) != 0) {
- if(!slack_node_rw_failed) {
- ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
- }
- rc = 1;
- }
+ snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_ON);
+ if (sysfs_write(scaling_min_freq[0], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[1], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[2], tmp_str) != 0) {
+ if (sysfs_write(scaling_min_freq[3], tmp_str) != 0) {
+ if(!slack_node_rw_failed) {
+ ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
+ }
+ rc = 1;
+ }
+ }
+ }
+ }
undo_hint_action(DISPLAY_STATE_HINT_ID);
display_hint_sent = 0;
}