summaryrefslogtreecommitdiffstats
path: root/power
diff options
context:
space:
mode:
authorEmilio López <turl@tuxfamily.org>2012-08-30 20:28:35 +0000
committerEmilio López <turl@tuxfamily.org>2012-08-30 20:42:29 +0000
commit1829e5cf55c9d7e9bda7da72be17a0e7dedaf3d9 (patch)
tree06a199e84ab621f521aa260f1dab5ef485a4e367 /power
parented067655c1475f42800682eb6fe672169c38229e (diff)
downloaddevice_samsung_tuna-1829e5cf55c9d7e9bda7da72be17a0e7dedaf3d9.zip
device_samsung_tuna-1829e5cf55c9d7e9bda7da72be17a0e7dedaf3d9.tar.gz
device_samsung_tuna-1829e5cf55c9d7e9bda7da72be17a0e7dedaf3d9.tar.bz2
tuna: power: make sure we don't apply the screen off freq on screen on
This fixes issues when pressing the power button repeatedly in a short period of time. The "on" call might not run, and when we re-read the value on screen off to store it, we will be actually reading the capped screen off value. Make sure that's not the case.
Diffstat (limited to 'power')
-rw-r--r--power/power_tuna.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/power/power_tuna.c b/power/power_tuna.c
index 0a2aa8f..80330a1 100644
--- a/power/power_tuna.c
+++ b/power/power_tuna.c
@@ -135,7 +135,13 @@ static void tuna_power_set_interactive(struct power_module *module, int on)
/* read the current scaling max freq and save it before updating */
len = sysfs_read(SCALINGMAXFREQ_PATH, buf, sizeof(buf));
- if (len != -1)
+ /* make sure it's not the screen off freq, if the "on"
+ * call is skipped (can happen if you press the power
+ * button repeatedly) we might have read it. We should
+ * skip it if that's the case
+ */
+ if (len != -1 && strncmp(buf, screen_off_max_freq,
+ strlen(screen_off_max_freq)) != 0)
memcpy(scaling_max_freq, buf, sizeof(buf));
sysfs_write("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq",