1
0
Fork 0
forked from len0rd/rockbox

ata: Heavily rework sleep and poweroff logic

* Use of ata_disk_can_poweroff() was inverted, resulting in SATA SSDs
   getting powered off but leaving _everything_ else on, including spinning
   rust!
 * Replace the can_poweroff() heuristic with a test for the mandatory
   ATA power mgmt feature flag. Notably, the CF->SD adapters don't claim
   to support this!
 * Eliminate duplicated tests in sleep code
 * Wrap all poweroff-related code with HAVE_ATA_POWER_OFF
 * Don't ever use SLEEP command, only STANDBY_IMMEDIATE
 * Gate call to STANDBY_IMMEDIATE behind a can_poweroff() test
 * Prefer FLUSH_CACHE_EXT to FLUSH_CACHE where available.
 * Improve SSD detection heuristics to any of these:
   * Explicltly identifies as SSD (covers newer CF and SATA)
   * TRIM support
   * CFA compliant AND (CF level 0 OR high speed support)
 * Report SSD detection in debug menu

Change-Id: I7fcb83b6d6eabddc11c64326a573b08ab85412b5
This commit is contained in:
Solomon Peachy 2024-04-11 11:54:02 -04:00
parent 6cbcde13b9
commit 886060475e
3 changed files with 87 additions and 80 deletions

View file

@ -1074,7 +1074,7 @@ static bool view_battery(void)
lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]);
lcd_putsf(0, line++, "%s Switch: %s", "Battery",
lcd_putsf(0, line++, "%s Switch: %s", "Battery",
(st & POWER_INPUT_BATTERY) ? "On" : "Off");
y = chrgraw_adc_voltage();
@ -1405,6 +1405,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
volume_size( IF_MV(0,) NULL, &free );
simplelist_addline(
"Free: %ld MB", free / 1024);
simplelist_addline("SSD detected: %s", ata_disk_isssd() ? "yes" : "no");
simplelist_addline(
"Spinup time: %d ms", storage_spinup_time() * (1000/HZ));
i = identify_info[82] & (1<<3);
@ -1512,6 +1513,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
i = identify_info[0] & (1 << 7);
simplelist_addline(
"Removeable media: %s", i ? "yes" : "no");
return btn;
}