From 886060475e25d04b9eb1753dbbaea0db8b78a0d4 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 11 Apr 2024 11:54:02 -0400 Subject: 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 --- apps/debug_menu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 245cd38627..07640c3937 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -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; } -- cgit v1.2.3