diff options
author | Emilio López <turl@tuxfamily.org> | 2012-08-30 20:28:35 +0000 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-11-14 09:06:12 +0100 |
commit | 2d25f375eff7487015f1b68c12f7292d7368b6cc (patch) | |
tree | 0a1270821c6c082afb6a7add1f781eb9d814c23b | |
parent | e040b45c8e4e54c8df9d6c714fc8164427f8a33b (diff) | |
download | device_samsung_tuna-2d25f375eff7487015f1b68c12f7292d7368b6cc.zip device_samsung_tuna-2d25f375eff7487015f1b68c12f7292d7368b6cc.tar.gz device_samsung_tuna-2d25f375eff7487015f1b68c12f7292d7368b6cc.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.
-rw-r--r-- | power/power_tuna.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/power/power_tuna.c b/power/power_tuna.c index bc996cb..c5852d7 100644 --- a/power/power_tuna.c +++ b/power/power_tuna.c @@ -137,7 +137,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", |