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:
CTCaer
2020-12-02 02:07:31 +02:00
parent c13eabcde8
commit cf175fc00d
4 changed files with 40 additions and 7 deletions

View File

@@ -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.
}