Skip to content

Commit

Permalink
Add support for Snapdragon 8 Elite
Browse files Browse the repository at this point in the history
  • Loading branch information
libxzr committed Nov 1, 2024
1 parent 9242e51 commit 87ff821
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 6 deletions.
44 changes: 42 additions & 2 deletions app/src/main/java/xzr/konabess/ChipInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum type {
cliffs_singleBin,
cliffs_7_singleBin,
kalama_sg_singleBin,
sun,
unknown
}

Expand All @@ -32,7 +33,7 @@ public static int getMaxTableLevels(type type) {
|| type == ChipInfo.type.kalama || type == ChipInfo.type.diwali
|| type == ChipInfo.type.ukee_singleBin || type == ChipInfo.type.pineapple
|| type == ChipInfo.type.cliffs_singleBin || type == ChipInfo.type.cliffs_7_singleBin
|| type == ChipInfo.type.kalama_sg_singleBin)
|| type == ChipInfo.type.kalama_sg_singleBin || type == ChipInfo.type.sun)
return 16;
return 11;
}
Expand All @@ -44,7 +45,7 @@ public static boolean shouldIgnoreVoltTable(type type) {
|| type == ChipInfo.type.kalama || type == ChipInfo.type.diwali
|| type == ChipInfo.type.ukee_singleBin || type == ChipInfo.type.pineapple
|| type == ChipInfo.type.cliffs_singleBin || type == ChipInfo.type.cliffs_7_singleBin
|| type == ChipInfo.type.kalama_sg_singleBin;
|| type == ChipInfo.type.kalama_sg_singleBin || type == ChipInfo.type.sun;
}

public static boolean checkChipGeneral(type input) {
Expand Down Expand Up @@ -103,6 +104,8 @@ public static String name2chipdesc(type t, Activity activity) {
return activity.getResources().getString(R.string.sd7pg3);
case kalama_sg_singleBin:
return activity.getResources().getString(R.string.sdg3xg2);
case sun:
return activity.getResources().getString(R.string.sd8e);
}
return activity.getResources().getString(R.string.unknown);
}
Expand Down Expand Up @@ -144,6 +147,8 @@ else if (ChipInfo.which == type.cliffs_singleBin
return rpmh_levels_cliffs.levels;
else if (ChipInfo.which == type.kalama_sg_singleBin)
return rpmh_levels_kalama.levels;
else if (ChipInfo.which == type.sun)
return rpmh_levels_sun.levels;

return new int[]{};
}
Expand Down Expand Up @@ -182,6 +187,8 @@ else if (ChipInfo.which == type.cliffs_singleBin
return rpmh_levels_cliffs.level_str;
else if (ChipInfo.which == type.kalama_sg_singleBin)
return rpmh_levels_kalama.level_str;
else if (ChipInfo.which == type.sun)
return rpmh_levels_sun.level_str;

return new String[]{};
}
Expand Down Expand Up @@ -588,4 +595,37 @@ private static class rpmh_levels_cliffs {
"SUPER_TURBO_NO_CPR"
};
}

private static class rpmh_levels_sun {
public static final int[] levels = {16, 48, 50, 52, 56, 60, 64, 72, 80, 96, 128, 144, 192,
224, 256, 288, 320, 336, 384, 400, 416, 432, 448, 452, 464, 480};
public static final String[] level_str = {
"RETENTION",
"MIN_SVS",
"LOW_SVS_D3", // todo: Synchronize the actual name from regulator headers
"LOW_SVS_D2",
"LOW_SVS_D1",
"LOW_SVS_D0",
"LOW_SVS",
"LOW_SVS_P1",
"LOW_SVS_L1",
"LOW_SVS_L2",
"SVS",
"SVS_L0",
"SVS_L1",
"SVS_L2",
"NOM",
"NOM_L0",
"NOM_L1",
"NOM_L2",
"TURBO",
"TURBO_L0",
"TURBO_L1",
"TURBO_L2",
"TURBO_L3",
"TURBO_L4", // todo: Synchronize the actual name from regulator headers
"SUPER_TURBO",
"SUPER_TURBO_NO_CPR"
};
}
}
12 changes: 8 additions & 4 deletions app/src/main/java/xzr/konabess/GpuTableEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public static void decode() throws Exception {
|| ChipInfo.which == ChipInfo.type.yupik
|| ChipInfo.which == ChipInfo.type.kalama
|| ChipInfo.which == ChipInfo.type.diwali
|| ChipInfo.which == ChipInfo.type.pineapple)
|| ChipInfo.which == ChipInfo.type.pineapple
|| ChipInfo.which == ChipInfo.type.sun)
&& this_line.contains("qcom,gpu-pwrlevels-")
&& !this_line.contains("compatible = ")) {
start = i;
Expand All @@ -116,7 +117,8 @@ public static void decode() throws Exception {
|| ChipInfo.which == ChipInfo.type.yupik
|| ChipInfo.which == ChipInfo.type.kalama
|| ChipInfo.which == ChipInfo.type.diwali
|| ChipInfo.which == ChipInfo.type.pineapple)) {
|| ChipInfo.which == ChipInfo.type.pineapple
|| ChipInfo.which == ChipInfo.type.sun)) {
end = i;
if (end >= start) {
decode_bin(lines_in_dts.subList(start, end + 1));
Expand Down Expand Up @@ -231,7 +233,8 @@ public static List<String> genTable() {
|| ChipInfo.which == ChipInfo.type.yupik
|| ChipInfo.which == ChipInfo.type.kalama
|| ChipInfo.which == ChipInfo.type.diwali
|| ChipInfo.which == ChipInfo.type.pineapple) {
|| ChipInfo.which == ChipInfo.type.pineapple
|| ChipInfo.which == ChipInfo.type.sun) {
for (int bin_id = 0; bin_id < bins.size(); bin_id++) {
lines.add("qcom,gpu-pwrlevels-" + bins.get(bin_id).id + " {");
lines.addAll(bins.get(bin_id).header);
Expand Down Expand Up @@ -563,7 +566,8 @@ public static int min_level_chip_offset() throws Exception {
|| ChipInfo.which == ChipInfo.type.pineapple
|| ChipInfo.which == ChipInfo.type.cliffs_singleBin
|| ChipInfo.which == ChipInfo.type.cliffs_7_singleBin
|| ChipInfo.which == ChipInfo.type.kalama_sg_singleBin)
|| ChipInfo.which == ChipInfo.type.kalama_sg_singleBin
|| ChipInfo.which == ChipInfo.type.sun)
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
8 changes: 8 additions & 0 deletions app/src/main/java/xzr/konabess/KonaBessCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,14 @@ public static void checkDevice(Context context) throws IOException {
dtb.id = i;
dtb.type = ChipInfo.type.kalama_sg_singleBin;
dtbs.add(dtb);
} else if (checkChip(context, i, "Sun v2 SoC")
|| checkChip(context, i, "Sun Alt. Thermal Profile v2 SoC")
|| checkChip(context, i, "SunP v2 SoC")
|| checkChip(context, i, "SunP v2 Alt. Thermal Profile SoC")) {
dtb dtb = new dtb();
dtb.id = i;
dtb.type = ChipInfo.type.sun;
dtbs.add(dtb);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/xzr/konabess/KonaBessStr.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ else if (ChipInfo.which == ChipInfo.type.cliffs_7_singleBin)
return convert_bins_cliffs_7(which, activity);
else if (ChipInfo.which == ChipInfo.type.kalama_sg_singleBin)
return convert_bins_kalama_sg(which, activity);
else if (ChipInfo.which == ChipInfo.type.sun)
return convert_bins_sun(which, activity);

throw new Exception();
}
Expand Down Expand Up @@ -212,6 +214,10 @@ public static String convert_bins_kalama_sg(int which, Activity activity) {
return activity.getResources().getString(R.string.unknown_table) + which;
}

public static String convert_bins_sun(int which, Activity activity) {
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 @@ -131,4 +131,5 @@
<string name="sd8sg3">Snapdragon 8sGen3</string>
<string name="sd7pg3">Snapdragon 7+Gen3</string>
<string name="sdg3xg2">Snapdragon G3x Gen2</string>
<string name="sd8e">Snapdragon 8 Elite</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 @@ -130,4 +130,5 @@
<string name="sd8sg3">骁龙8sGen3</string>
<string name="sd7pg3">骁龙7+Gen3</string>
<string name="sdg3xg2">骁龙 G3x Gen2</string>
<string name="sd8e">骁龙 8 Elite</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 @@ -130,4 +130,5 @@
<string name="sd8sg3">Snapdragon 8sGen3</string>
<string name="sd7pg3">Snapdragon 7+Gen3</string>
<string name="sdg3xg2">Snapdragon G3x Gen2</string>
<string name="sd8e">Snapdragon 8 Elite</string>
</resources>

0 comments on commit 87ff821

Please sign in to comment.