Skip to content

Commit

Permalink
N4: Add new dyn_hotplug tunables
Browse files Browse the repository at this point in the history
Add up_timer_cnt and down_timer_cnt tunables to dynamic hotplug
section.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
  • Loading branch information
Stratos Karafotis committed Jul 7, 2014
1 parent eac62de commit a772c9b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sm/src/main/java/com/semaphore/sm/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ private void checkFirstRun() {
needRead = needRead || !prefs.contains("led_red") || !prefs.contains("read_ahead")
|| !prefs.contains("uv_lower_uv") || !prefs.contains("hp_enabled")
|| !prefs.contains("hp_max_online") || !prefs.contains("scaling_min_freq")
|| !prefs.contains("min_br") || !prefs.contains("dt_wake_enabled");
|| !prefs.contains("min_br") || !prefs.contains("dt_wake_enabled")
|| !prefs.contains("hp_up_timer_cnt");
if (Device == SemaDevices.I9000)
needRead = needRead || !prefs.contains("ab_max_br_threshold") || !prefs.contains("scaling_min_freq") ||
!prefs.contains("o_powersave_bias");
Expand Down
10 changes: 10 additions & 0 deletions sm/src/main/java/com/semaphore/sm/TabCPUFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ else if (key.equals(sp.hp_enabled.getName())) {
} else if (key.equals(sp.hp_up_threshold.getName())) {
sp.hp_up_threshold.setValue(sharedPreferences.getString(key, String.valueOf(sp.hp_up_threshold.getDefault())));
sp.hp_up_threshold.writeValue();
} else if (key.equals(sp.hp_up_timer_cnt.getName())) {
sp.hp_up_timer_cnt.setValue(sharedPreferences.getInt(key, sp.hp_up_timer_cnt.getDefault()));
sp.hp_up_timer_cnt.writeValue();
} else if (key.equals(sp.hp_down_timer_cnt.getName())) {
sp.hp_down_timer_cnt.setValue(sharedPreferences.getInt(key, sp.hp_down_timer_cnt.getDefault()));
sp.hp_down_timer_cnt.writeValue();
}
}

Expand Down Expand Up @@ -698,6 +704,10 @@ private void updateSummariesN4() {
pref.setSummary(String.valueOf(((SeekBarPreference) pref).getValue()));
pref = findPreference(sp.hp_max_online.getName());
pref.setSummary(String.valueOf(((SeekBarPreference) pref).getValue()));
pref = findPreference(sp.hp_up_timer_cnt.getName());
pref.setSummary(String.valueOf(((SeekBarPreference) pref).getValue()));
pref = findPreference(sp.hp_down_timer_cnt.getName());
pref.setSummary(String.valueOf(((SeekBarPreference) pref).getValue()));
}

private void updateSummariesI9000() {
Expand Down
16 changes: 16 additions & 0 deletions sm/src/main/java/com/semaphore/smproperties/SemaN4Properties.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class SemaN4Properties extends SemaCommonProperties {
public SMIntProperty hp_up_threshold;
public SMIntProperty hp_min_online;
public SMIntProperty hp_max_online;
public SMIntProperty hp_up_timer_cnt;
public SMIntProperty hp_down_timer_cnt;
public SMIntProperty min_br;
public SMIntProperty max_br;
public SMIntProperty br_mode;
Expand All @@ -63,6 +65,8 @@ public SemaN4Properties() {
hp_up_threshold = new SMIntProperty("hp_up_threshold", "/sys/module/dyn_hotplug/parameters/up_threshold", false, 1, 100, 25);
hp_min_online = new SMIntProperty("hp_min_online", "/sys/module/dyn_hotplug/parameters/min_online", false, 1, 4, 2);
hp_max_online = new SMIntProperty("hp_max_online", "/sys/module/dyn_hotplug/parameters/max_online", false, 1, 4, 4);
hp_up_timer_cnt = new SMIntProperty("hp_up_timer_cnt", "/sys/module/dyn_hotplug/parameters/up_timer_cnt", false, 1, 20, 2);
hp_down_timer_cnt = new SMIntProperty("hp_down_timer_cnt", "/sys/module/dyn_hotplug/parameters/down_timer_cnt", false, 1, 30, 10);

scheduler.basepath = "/sys/block/mmcblk0/queue/scheduler";

Expand Down Expand Up @@ -105,6 +109,8 @@ public void readValues() {
hp_up_threshold.readValue();
hp_min_online.readValue();
hp_max_online.readValue();
hp_up_timer_cnt.readValue();
hp_down_timer_cnt.readValue();

scheduler.readValue();
vibrator.readValue();
Expand Down Expand Up @@ -161,6 +167,8 @@ public void writeBatch() {
hp_min_online.writeBatch(cmds);
hp_max_online.writeBatch(cmds);
hp_up_threshold.writeBatch(cmds);
hp_up_timer_cnt.writeBatch(cmds);
hp_down_timer_cnt.writeBatch(cmds);

scheduler.writeBatch(cmds);
vibrator.writeBatch(cmds);
Expand Down Expand Up @@ -216,6 +224,8 @@ public void writeValues() {
hp_up_threshold.writeValue();
hp_min_online.writeValue();
hp_max_online.writeValue();
hp_up_timer_cnt.writeValue();
hp_down_timer_cnt.writeValue();

scheduler.writeValue();
vibrator.writeValue();
Expand Down Expand Up @@ -292,6 +302,8 @@ public void setPreferences(Context context) {
edit.putInt(hp_min_online.getName(), hp_min_online.getValue());
edit.putInt(hp_max_online.getName(), hp_max_online.getValue());
edit.putString(hp_up_threshold.getName(), hp_up_threshold.getValString());
edit.putInt(hp_up_timer_cnt.getName(), hp_up_timer_cnt.getValue());
edit.putInt(hp_down_timer_cnt.getName(), hp_down_timer_cnt.getValue());

edit.putString(scheduler.getName(), scheduler.getValue());
edit.putInt(vibrator.getName(), vibrator.getValue());
Expand Down Expand Up @@ -381,6 +393,8 @@ public void getPreferences(Context context) {
hp_min_online.setValue(prefs.getInt(hp_min_online.getName(), hp_min_online.getDefault()));
hp_max_online.setValue(prefs.getInt(hp_max_online.getName(), hp_max_online.getDefault()));
hp_up_threshold.setValue(prefs.getString(hp_up_threshold.getName(), hp_up_threshold.getDefString()));
hp_up_timer_cnt.setValue(prefs.getInt(hp_up_timer_cnt.getName(), hp_up_timer_cnt.getDefault()));
hp_down_timer_cnt.setValue(prefs.getInt(hp_down_timer_cnt.getName(), hp_down_timer_cnt.getDefault()));

scheduler.setValue(prefs.getString(scheduler.getName(), scheduler.getDefValue()));
vibrator.setValue(prefs.getInt(vibrator.getName(), vibrator.getDefault()));
Expand Down Expand Up @@ -464,6 +478,8 @@ public void resetDefaults() {
hp_up_threshold.setValue(hp_up_threshold.getDefault());
hp_min_online.setValue(hp_min_online.getDefault());
hp_max_online.setValue(hp_max_online.getDefault());
hp_up_timer_cnt.setValue(hp_up_timer_cnt.getDefault());
hp_down_timer_cnt.setValue(hp_down_timer_cnt.getDefault());

scheduler.setValue(scheduler.getDefValue());
vibrator.setValue(vibrator.getDefault());
Expand Down
6 changes: 5 additions & 1 deletion sm/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>

<string name="app_path">/data/data/com.semaphore.sm/scripts/"</string>
<string name="app_path">/data/data/com.semaphore.sm/scripts/</string>

<string name="str_cat_oc_title">Overclocking</string>
<string name="str_oc_title">LiveOC</string>
Expand Down Expand Up @@ -67,6 +67,8 @@
<string name="str_hp_enabled_title">Enabled</string>
<string name="str_hp_up_threshold_title">Up threshold</string>
<string name="str_hp_up_threshold_summary">Valid values 1-100</string>
<string name="str_hp_up_timer_cnt_title">Up timer counter</string>
<string name="str_hp_down_timer_cnt_title">Down timer counter</string>

<string-array name="array_gov_entries">
<item>Ondemand</item>
Expand Down Expand Up @@ -479,6 +481,8 @@ Do you want to continue?</string>
</string>
<string name="strMsgMinCores">Minimum number of online cores (1-4)</string>
<string name="strMsgMaxCores">Maximum number of online cores (1-4)</string>
<string name="strMsgUpTimerCnt">Up timer counter (1-20)</string>
<string name="strMsgDownTimerCnt">Down timer counter (1-30)</string>
<string name="strMsgVoltage">Voltage (in uV)</string>
<string name="strMsgVoltage2">Voltage</string>
<string name="strInfoMemory">Memory</string>
Expand Down
18 changes: 18 additions & 0 deletions sm/src/main/res/xml/preferences_cpu_n4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@
android:numeric="integer"
android:inputType="number"
android:dependency="hp_enabled" />
<com.semaphore.sm.SeekBarPreference
android:key="hp_up_timer_cnt"
android:title="@string/str_hp_up_timer_cnt_title"
android:dialogMessage="@string/strMsgUpTimerCnt"
android:defaultValue="2"
android:max="20"
semaphore:min="1"
semaphore:step="1"
android:dependency="hp_enabled" />
<com.semaphore.sm.SeekBarPreference
android:key="hp_down_timer_cnt"
android:title="@string/str_hp_down_timer_cnt_title"
android:dialogMessage="@string/strMsgDownTimerCnt"
android:defaultValue="10"
android:max="30"
semaphore:min="1"
semaphore:step="1"
android:dependency="hp_enabled" />
</PreferenceCategory>

<PreferenceCategory android:title="@string/str_undervolt_title">
Expand Down

0 comments on commit a772c9b

Please sign in to comment.