summaryrefslogtreecommitdiffstats
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-e0df9952fd.tar.gz
rockbox-e0df9952fd.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)
bool ata_disk_is_active(void)
{
- return ata_state >= ATA_SPINUP;
+ return ata_disk_can_poweroff() ? (ata_state >= ATA_SPINUP) : 0;
}
void 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)
bool ata_disk_is_active(void)
{
- return ata_powered;
+ return ata_disk_can_poweroff() ? ata_powered : 0;
}
static int ata_set_feature(uint32_t feature, uint32_t param)