From 5eb2f7962d05eb49c540275444f90f957621ad40 Mon Sep 17 00:00:00 2001 From: plaidman Date: Sat, 11 May 2019 08:24:58 -0400 Subject: [PATCH] update CPU clock profiles and battery info for lakka-switch --- frontend/drivers/platform_unix.c | 4 ++ menu/cbs/menu_cbs_ok.c | 8 ++-- switch_performance_profiles.h | 64 ++++++++++++++++---------------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c index 9b06096feb..802dde546c 100644 --- a/frontend/drivers/platform_unix.c +++ b/frontend/drivers/platform_unix.c @@ -1089,7 +1089,11 @@ static bool frontend_unix_powerstate_check_acpi_sysfs( { const char *node = retro_dirent_get_name(entry); +#ifdef HAVE_LAKKA_SWITCH + if (node && strstr(node, "max170xx_battery")) +#else if (node && strstr(node, "BAT")) +#endif check_proc_acpi_sysfs_battery(node, &have_battery, &charging, seconds, percent); } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 67652f4747..a1d042d2f4 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2731,7 +2731,7 @@ static int action_ok_set_switch_cpu_profile(const char *path, char command[PATH_MAX_LENGTH] = {0}; #ifdef HAVE_LAKKA_SWITCH - snprintf(command, sizeof(command), "cpu-profile set %s", profile_name); + snprintf(command, sizeof(command), "cpu-profile set '%s'", profile_name); system(command); snprintf(command, sizeof(command), "Current profile set to %s", profile_name); @@ -2752,7 +2752,7 @@ static int action_ok_set_switch_cpu_profile(const char *path, runloop_msg_queue_push(command, 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - return menu_cbs_exit(); + return menu_cbs_exit(); } #endif @@ -2765,7 +2765,7 @@ static int action_ok_set_switch_gpu_profile(const char *path, char command[PATH_MAX_LENGTH] = {0}; - snprintf(command, sizeof(command), "gpu-profile set %s", profile_name); + snprintf(command, sizeof(command), "gpu-profile set '%s'", profile_name); system(command); @@ -2773,7 +2773,7 @@ static int action_ok_set_switch_gpu_profile(const char *path, runloop_msg_queue_push(command, 1, 90, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); - return menu_cbs_exit(); + return menu_cbs_exit(); } static int action_ok_set_switch_backlight(const char *path, diff --git a/switch_performance_profiles.h b/switch_performance_profiles.h index 15dde6eec7..8b121a2592 100644 --- a/switch_performance_profiles.h +++ b/switch_performance_profiles.h @@ -20,23 +20,21 @@ #if defined(HAVE_LAKKA_SWITCH) || defined(HAVE_LIBNX) #ifdef HAVE_LAKKA_SWITCH static char *SWITCH_GPU_PROFILES[] = { - "docked-overclock-3", - "docked-overclock-2", - "docked-overclock-1", - "docked", - "non-docked-overclock-5", - "non-docked-overclock-4", - "non-docked-overclock-3", - "non-docked-overclock-2", - "non-docked-overclock-1", - "non-docked", - "non-docked-underclock-1", - "non-docked-underclock-2", - "non-docked-underclock-3", + "Docked Stock +2", + "Docked Stock +1", + "Docked Stock Mode", + "Handheld Boost +3", + "Handheld Boost +2", + "Handheld Boost +1", + "Handheld Boost Mode", + "Handheld Stock +1", + "Handheld Stock Mode", + "Powersaving +2", + "Powersaving +1", + "Powersaving Mode", }; static char *SWITCH_GPU_SPEEDS[] = { - "998 Mhz", "921 Mhz", "844 Mhz", "768 Mhz", @@ -48,7 +46,8 @@ static char *SWITCH_GPU_SPEEDS[] = { "307 Mhz", "230 Mhz", "153 Mhz", - "76 Mhz"}; + "76 Mhz" +}; static int SWITCH_BRIGHTNESS[] = { 10, @@ -65,11 +64,14 @@ static int SWITCH_BRIGHTNESS[] = { static char *SWITCH_CPU_PROFILES[] = { #ifndef HAVE_LIBNX - "overclock-4", - "overclock-3", - "overclock-2", - "overclock-1", - "default", + // for switch-lakka - same as LIBNX but only by coincidence + "Maximum Performance", + "High Performance", + "Boost Performance", + "Stock Performance", + "Powersaving Mode 1", + "Powersaving Mode 2", + "Powersaving Mode 3", #else "Maximum Performance", "High Performance", @@ -86,11 +88,14 @@ static char *SWITCH_CPU_PROFILES[] = { static char *SWITCH_CPU_SPEEDS[] = { #ifndef HAVE_LIBNX - "1912 MHz", - "1734 MHz", - "1530 MHz", + // for switch-lakka - same as LIBNX but only by coincidence + "1785 MHz", + "1581 MHz", "1224 MHz", - "1020 MHz" + "1020 MHz", + "918 MHz", + "816 MHz", + "714 MHz" #else "1785 MHz", "1581 MHz", @@ -102,14 +107,9 @@ static char *SWITCH_CPU_SPEEDS[] = { #endif }; +#ifdef HAVE_LIBNX +// not used in switch-lakka static unsigned SWITCH_CPU_SPEEDS_VALUES[] = { -#ifndef HAVE_LIBNX - 1912000000, - 1734000000, - 1530000000, - 1224000000, - 1020000000 -#else 1785000000, 1581000000, 1224000000, @@ -117,8 +117,8 @@ static unsigned SWITCH_CPU_SPEEDS_VALUES[] = { 918000000, 816000000, 714000000 -#endif }; +#endif #endif