power_hikey: Simplify init function by pulling calculate_max_freq() in am: 65de27c56b
am: cde94cb666
Change-Id: I428014832e6e3e48fefb5403940ae808c9deebc6
diff --git a/power/power_hikey.c b/power/power_hikey.c
index ea63916..c53603c 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -76,20 +76,10 @@
close(fd);
}
-static void calculate_max_cpu_freq() {
- int32_t is_svelte = property_get_int32(SVELTE_PROP, 0);
-
- if (is_svelte) {
- char prop_buffer[PROPERTY_VALUE_MAX];
- int len = property_get(SVELTE_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
- max_cpu_freq = strndup(prop_buffer, len);
- len = property_get(SVELTE_LOW_POWER_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
- low_power_max_cpu_freq = strndup(prop_buffer, len);
- }
-}
-
static void power_init(struct power_module __unused *module)
{
+ int32_t is_svelte = property_get_int32(SVELTE_PROP, 0);
+
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
"20000");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_slack",
@@ -108,7 +98,14 @@
"1000000");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/io_is_busy", "0");
- calculate_max_cpu_freq();
+ if (is_svelte) {
+ char prop_buffer[PROPERTY_VALUE_MAX];
+ int len = property_get(SVELTE_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
+
+ max_cpu_freq = strndup(prop_buffer, len);
+ len = property_get(SVELTE_LOW_POWER_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
+ low_power_max_cpu_freq = strndup(prop_buffer, len);
+ }
}
static void power_set_interactive(struct power_module __unused *module, int on)