Skip to content

Commit

Permalink
konabess: Add initial support for sd8+gen1
Browse files Browse the repository at this point in the history
  • Loading branch information
libxzr committed Jul 19, 2022
1 parent 7933c90 commit 8301141
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 7 deletions.
32 changes: 31 additions & 1 deletion app/src/main/java/xzr/konabess/ChipInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ public enum type {
shima,
yupik,
waipio_singleBin,
cape_singleBin,
unknown
}

public static boolean shouldIgnoreVoltTable(type type) {
return type == ChipInfo.type.lahaina || type == ChipInfo.type.lahaina_singleBin
|| type == ChipInfo.type.shima || type == ChipInfo.type.yupik
|| type == ChipInfo.type.waipio_singleBin;
|| type == ChipInfo.type.waipio_singleBin || type == ChipInfo.type.cape_singleBin;
}

public static boolean checkChipGeneral(type input) {
Expand Down Expand Up @@ -65,6 +66,8 @@ public static String name2chipdesc(type t, Activity activity) {
return activity.getResources().getString(R.string.sd778g);
case waipio_singleBin:
return activity.getResources().getString(R.string.sd8g1_singlebin);
case cape_singleBin:
return activity.getResources().getString(R.string.sd8g1p_singlebin);
}
return activity.getResources().getString(R.string.unknown);
}
Expand All @@ -91,6 +94,8 @@ else if (ChipInfo.which == type.yupik)
return rpmh_levels_yupik.levels;
else if (ChipInfo.which == type.waipio_singleBin)
return rpmh_levels_waipio.levels;
else if (ChipInfo.which == type.cape_singleBin)
return rpmh_levels_cape.levels;

return new int[]{};
}
Expand All @@ -114,6 +119,8 @@ else if (ChipInfo.which == type.yupik)
return rpmh_levels_yupik.level_str;
else if (ChipInfo.which == type.waipio_singleBin)
return rpmh_levels_waipio.level_str;
else if (ChipInfo.which == type.cape_singleBin)
return rpmh_levels_cape.level_str;

return new String[]{};
}
Expand Down Expand Up @@ -348,4 +355,27 @@ private static class rpmh_levels_waipio {
};
}

private static class rpmh_levels_cape {
public static final int[] levels = {16, 48, 56, 64, 80, 96, 128, 144, 192, 224, 256, 320, 336, 352, 384, 400, 416};
public static final String[] level_str = {
"RETENTION",
"MIN_SVS",
"LOW_SVS_D1",
"LOW_SVS",
"LOW_SVS_L1",
"LOW_SVS_L2",
"SVS",
"SVS_L0",
"SVS_L1",
"SVS_L2",
"NOM",
"NOM_L1",
"NOM_L2",
"NOM_L3",
"TURBO",
"TURBO_L0",
"TURBO_L1"
};
}

}
18 changes: 12 additions & 6 deletions app/src/main/java/xzr/konabess/GpuTableEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public static void decode() throws Exception {
if ((ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile_singleBin
|| ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.waipio_singleBin)
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin)
&& this_line.equals("qcom,gpu-pwrlevels {")) {
start = i;
if (bin_position < 0)
Expand Down Expand Up @@ -119,7 +120,8 @@ public static void decode() throws Exception {
if (bracket == 0 && start >= 0 && (ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile_singleBin
|| ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.waipio_singleBin)) {
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin)) {
end = i;
if (end >= start) {
decode_bin(lines_in_dts.subList(start, end + 1));
Expand Down Expand Up @@ -225,7 +227,8 @@ public static List<String> genTable() {
} else if (ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile_singleBin
|| ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.waipio_singleBin) {
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin) {
lines.add("qcom,gpu-pwrlevels {");
lines.addAll(bins.get(0).header);
for (int pwr_level_id = 0; pwr_level_id < bins.get(0).levels.size(); pwr_level_id++) {
Expand Down Expand Up @@ -407,7 +410,8 @@ private static void offset_initial_level(int bin_id, int offset) throws Exceptio
if (ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile_singleBin
|| ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.waipio_singleBin) {
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin) {
offset_initial_level_old(offset);
return;
}
Expand Down Expand Up @@ -476,7 +480,8 @@ private static void patch_throttle_level() throws Exception {
if (ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile_singleBin
|| ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.waipio_singleBin) {
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin) {
patch_throttle_level_old();
return;
}
Expand Down Expand Up @@ -504,7 +509,8 @@ public static boolean canAddNewLevel(int binID, Context context) throws Exceptio
public static int min_level_chip_offset() throws Exception {
if (ChipInfo.which == ChipInfo.type.lahaina || ChipInfo.which == ChipInfo.type.lahaina_singleBin
|| ChipInfo.which == ChipInfo.type.shima || ChipInfo.which == ChipInfo.type.yupik
|| ChipInfo.which == ChipInfo.type.waipio_singleBin)
|| ChipInfo.which == ChipInfo.type.waipio_singleBin
|| ChipInfo.which == ChipInfo.type.cape_singleBin)
return 1;
if (ChipInfo.which == ChipInfo.type.kona || ChipInfo.which == ChipInfo.type.kona_singleBin
|| ChipInfo.which == ChipInfo.type.msmnile || ChipInfo.which == ChipInfo.type.msmnile_singleBin
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/xzr/konabess/KonaBessCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ public static void checkDevice(Context context) throws IOException {
dtb.id = i;
dtb.type = ChipInfo.type.waipio_singleBin;
dtbs.add(dtb);
} else if (checkChip(context, i, "Cape SoC")) {
dtb dtb = new dtb();
dtb.id = i;
dtb.type = ChipInfo.type.cape_singleBin;
dtbs.add(dtb);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/xzr/konabess/KonaBessStr.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ else if (ChipInfo.which == ChipInfo.type.yupik)
return convert_bins_yupik(which, activity);
else if (ChipInfo.which == ChipInfo.type.waipio_singleBin)
return convert_bins_waipio_singleBin(which, activity);
else if (ChipInfo.which == ChipInfo.type.cape_singleBin)
return convert_bins_cape_singleBin(which, activity);

throw new Exception();
}
Expand Down Expand Up @@ -128,6 +130,14 @@ public static String convert_bins_waipio_singleBin(int which, Activity activity)
return activity.getResources().getString(R.string.unknown_table) + which;
}

public static String convert_bins_cape_singleBin(int which, Activity activity) {
switch (which) {
case 0:
return activity.getResources().getString(R.string.sd8g1p_singlebin);
}
return activity.getResources().getString(R.string.unknown_table) + which;
}

public static String convert_level_params(String input, Activity activity) {
input = input.replace("qcom,", "");
if (input.equals("gpu-freq"))
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,5 @@
<string name="wait_importing">Daten importieren. Bitte warten…</string>
<string name="will_backup_to">Altes Image extrahieren nach</string>
<string name="yes">Ja</string>
<string name="sd8g1p_singlebin">Snapdragon 8+Gen1</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@
<string name="sd870">骁龙870</string>
<string name="sd778g">骁龙778G</string>
<string name="sd8g1_singlebin">骁龙8Gen1</string>
<string name="sd8g1p_singlebin">骁龙8+Gen1</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@
<string name="sd870">Snapdragon 870</string>
<string name="sd778g">Snapdragon 778G</string>
<string name="sd8g1_singlebin">Snapdragon 8Gen1</string>
<string name="sd8g1p_singlebin">Snapdragon 8+Gen1</string>
</resources>

0 comments on commit 8301141

Please sign in to comment.