summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-09-18 08:13:24 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-09-18 08:26:14 -0400
commite0df9952fd13904da646adae0409b5c76c67f298 (patch)
treefaebef53c892535a8b1984eea87889f53f08afe7
parentc71b6265b09aa3ff017e17e3a1eb4c260aef816d (diff)
downloadrockbox-e0df9952fd13904da646adae0409b5c76c67f298.tar.gz
rockbox-e0df9952fd13904da646adae0409b5c76c67f298.zip
ata: Alter ata_is_active() when drive doesn't support power management
Due to the heisenberg principle, we don't want to check the battery level when the ATA drive is "spun up". Unfortunately some ATA devices *cough most SD adapters cough* don't support mandatory ATA power management commands like flushing caches and (safely) shutting down so we have to leave them "spinning". This leads to us never updating our battery status with these out-of-spec devices. Work around this issue by having is_active() always return false if that's what we have. Change-Id: I629f3fdbc7e5cffb0a4d546c80cb5fca8529c0e6
-rw-r--r--firmware/drivers/ata.c2
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 7b9c4910cf..b4d8a388ec 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -845,7 +845,7 @@ void ata_spindown(int seconds)
845 845
846bool ata_disk_is_active(void) 846bool ata_disk_is_active(void)
847{ 847{
848 return ata_state >= ATA_SPINUP; 848 return ata_disk_can_poweroff() ? (ata_state >= ATA_SPINUP) : 0;
849} 849}
850 850
851void ata_sleepnow(void) 851void ata_sleepnow(void)
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c
index 9629b3e30f..ee192ae3d1 100644
--- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c
@@ -521,7 +521,7 @@ static void ata_set_active(void)
521 521
522bool ata_disk_is_active(void) 522bool ata_disk_is_active(void)
523{ 523{
524 return ata_powered; 524 return ata_disk_can_poweroff() ? ata_powered : 0;
525} 525}
526 526
527static int ata_set_feature(uint32_t feature, uint32_t param) 527static int ata_set_feature(uint32_t feature, uint32_t param)