mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 03:11:16 +00:00
nyx: Add alternate power saving modes
T210: By default max power savings is enabled. By changing `newpowersave=` to 0, it reverts to the old behavior of smaller power savings. This was added to mitigate some strange DRAM chips, hanging from constant frequency change of a 800 MHz - 1600 MHz back and forth. T210B01: Defaults to a simple loop with no power savings. That's because of untrained ram.
This commit is contained in:
parent
c13eabcde8
commit
cf175fc00d
4 changed files with 40 additions and 7 deletions
|
@ -64,6 +64,7 @@ void set_nyx_default_configuration()
|
|||
n_cfg.verification = 1;
|
||||
n_cfg.ums_emmc_rw = 0;
|
||||
n_cfg.jc_disable = 0;
|
||||
n_cfg.new_powersave = 1;
|
||||
}
|
||||
|
||||
int create_config_entry()
|
||||
|
@ -205,6 +206,9 @@ int create_nyx_config_entry()
|
|||
f_puts("\njcdisable=", &fp);
|
||||
itoa(n_cfg.jc_disable, lbuf, 10);
|
||||
f_puts(lbuf, &fp);
|
||||
f_puts("\nnewpowersave=", &fp);
|
||||
itoa(n_cfg.new_powersave, lbuf, 10);
|
||||
f_puts(lbuf, &fp);
|
||||
f_puts("\n", &fp);
|
||||
|
||||
f_close(&fp);
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef struct _nyx_config
|
|||
u32 verification;
|
||||
u32 ums_emmc_rw;
|
||||
u32 jc_disable;
|
||||
u32 new_powersave;
|
||||
} nyx_config;
|
||||
|
||||
void set_default_configuration();
|
||||
|
|
|
@ -2235,6 +2235,30 @@ static void _nyx_main_menu(lv_theme_t * th)
|
|||
}
|
||||
}
|
||||
|
||||
static void _nyx_gui_loop_powersave_ram()
|
||||
{
|
||||
// Saves 280 mW.
|
||||
while (true)
|
||||
{
|
||||
minerva_change_freq(FREQ_1600); // Takes 295 us.
|
||||
|
||||
lv_task_handler();
|
||||
|
||||
minerva_change_freq(FREQ_800); // Takes 80 us.
|
||||
}
|
||||
}
|
||||
|
||||
static void _nyx_gui_loop_powersave_cpu()
|
||||
{
|
||||
// Saves 75 mW.
|
||||
while (true)
|
||||
{
|
||||
lv_task_handler();
|
||||
|
||||
bpmp_usleep(HALT_COP_MAX_CNT); // Takes 200 us.
|
||||
}
|
||||
}
|
||||
|
||||
void nyx_load_and_run()
|
||||
{
|
||||
memset(&system_tasks, 0, sizeof(system_maintenance_tasks_t));
|
||||
|
@ -2293,13 +2317,15 @@ void nyx_load_and_run()
|
|||
lv_task_once(task_run_sd_errors);
|
||||
}
|
||||
|
||||
while (true)
|
||||
// Gui loop.
|
||||
if (h_cfg.t210b01)
|
||||
{
|
||||
minerva_change_freq(FREQ_1600); // Takes 295us.
|
||||
|
||||
lv_task_handler();
|
||||
|
||||
minerva_change_freq(FREQ_800); // Takes 80us. Saves 280mW.
|
||||
//bpmp_usleep(HALT_COP_MAX_CNT); // Taskes 200us. Saves 75mW.
|
||||
// Minerva not supported on T210B01 yet. No power saving.
|
||||
while (true)
|
||||
lv_task_handler();
|
||||
}
|
||||
else if (n_cfg.new_powersave)
|
||||
_nyx_gui_loop_powersave_ram(); // Alternate DRAM frequencies. Higher power savings.
|
||||
else
|
||||
_nyx_gui_loop_powersave_cpu(); // Suspend CPU. Lower power savings.
|
||||
}
|
||||
|
|
|
@ -280,6 +280,8 @@ void load_saved_configuration()
|
|||
n_cfg.ums_emmc_rw = atoi(kv->val) == 1;
|
||||
else if (!strcmp("jcdisable", kv->key))
|
||||
n_cfg.jc_disable = atoi(kv->val) == 1;
|
||||
else if (!strcmp("newpowersave", kv->key))
|
||||
n_cfg.new_powersave = atoi(kv->val) == 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue