summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-01-23 15:43:37 +0000
committerNils Wallménius <nils@rockbox.org>2007-01-23 15:43:37 +0000
commit1b85f60ae0b0c1e24595e9551ce5eee10f15b182 (patch)
treea9cd95362fc8e63032647476acf4fa1cbfe1825a
parentb2e50906a4af3176d03dff98af4a260709bdad96 (diff)
downloadrockbox-1b85f60ae0b0c1e24595e9551ce5eee10f15b182.tar.gz
rockbox-1b85f60ae0b0c1e24595e9551ce5eee10f15b182.zip
Permanently enable powering down the disk when it's sleeping for supported targets (iriver h1xx, h3xx and h10, iaudio x5, gigabeat and archos recorders)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12094 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang8
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c3
-rw-r--r--apps/settings_menu.c11
-rw-r--r--firmware/drivers/ata.c21
-rw-r--r--firmware/export/ata.h1
-rw-r--r--firmware/powermgmt.c4
8 files changed, 10 insertions, 42 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index a4f937c986..9e85f848af 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3850,16 +3850,16 @@
3850</phrase> 3850</phrase>
3851<phrase> 3851<phrase>
3852 id: LANG_POWEROFF 3852 id: LANG_POWEROFF
3853 desc: disk poweroff flag 3853 desc: DEPRECATED
3854 user: 3854 user:
3855 <source> 3855 <source>
3856 *: "Disk Poweroff" 3856 *: ""
3857 </source> 3857 </source>
3858 <dest> 3858 <dest>
3859 *: "Disk Poweroff" 3859 *: deprecated
3860 </dest> 3860 </dest>
3861 <voice> 3861 <voice>
3862 *: "Disk Poweroff" 3862 *: ""
3863 </voice> 3863 </voice>
3864</phrase> 3864</phrase>
3865<phrase> 3865<phrase>
diff --git a/apps/settings.c b/apps/settings.c
index 01ede41b3e..c7794e1015 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -489,9 +489,6 @@ void settings_apply(void)
489 dac_line_in(global_settings.line_in); 489 dac_line_in(global_settings.line_in);
490#endif 490#endif
491 mpeg_id3_options(global_settings.id3_v1_first); 491 mpeg_id3_options(global_settings.id3_v1_first);
492#ifdef HAVE_ATA_POWER_OFF
493 ata_poweroff(global_settings.disk_poweroff);
494#endif
495 492
496 set_poweroff_timeout(global_settings.poweroff); 493 set_poweroff_timeout(global_settings.poweroff);
497 494
diff --git a/apps/settings.h b/apps/settings.h
index eee24f187b..3ff3fe6244 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -281,7 +281,6 @@ struct user_settings
281 int ff_rewind_min_step; /* FF/Rewind minimum step size */ 281 int ff_rewind_min_step; /* FF/Rewind minimum step size */
282 int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */ 282 int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */
283 int disk_spindown; /* time until disk spindown, in seconds (0=off) */ 283 int disk_spindown; /* time until disk spindown, in seconds (0=off) */
284 bool disk_poweroff; /* whether to cut disk power after spindown or not */
285 int buffer_margin; /* MP3 buffer watermark margin, in seconds */ 284 int buffer_margin; /* MP3 buffer watermark margin, in seconds */
286 285
287 int peak_meter_release; /* units per read out */ 286 int peak_meter_release; /* units per read out */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 313524ba81..bffee257d1 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -268,9 +268,6 @@ const struct settings_list settings[] = {
268#endif 268#endif
269 /* disk */ 269 /* disk */
270#ifndef HAVE_MMC 270#ifndef HAVE_MMC
271#ifdef HAVE_ATA_POWER_OFF
272 OFFON_SETTING(0,disk_poweroff,false,"disk poweroff",NULL),
273#endif
274 {F_T_INT,GS(disk_spindown),INT(5),"disk spindown",NULL,UNUSED}, 271 {F_T_INT,GS(disk_spindown),INT(5),"disk spindown",NULL,UNUSED},
275#endif /* HAVE_MMC */ 272#endif /* HAVE_MMC */
276 /* browser */ 273 /* browser */
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 04fd64b1ca..1a19bb18c8 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -1104,14 +1104,6 @@ static bool spindown(void)
1104 ata_spindown, 1, 3, 254, NULL ); 1104 ata_spindown, 1, 3, 254, NULL );
1105} 1105}
1106 1106
1107#ifdef HAVE_ATA_POWER_OFF
1108static bool poweroff(void)
1109{
1110 bool rc = set_bool(str(LANG_POWEROFF), &global_settings.disk_poweroff);
1111 ata_poweroff(global_settings.disk_poweroff);
1112 return rc;
1113}
1114#endif /* HAVE_ATA_POWEROFF */
1115#endif /* !HAVE_MMC */ 1107#endif /* !HAVE_MMC */
1116 1108
1117#if CONFIG_CODEC == MAS3507D 1109#if CONFIG_CODEC == MAS3507D
@@ -2116,9 +2108,6 @@ static bool disk_settings_menu(void)
2116 2108
2117 static const struct menu_item items[] = { 2109 static const struct menu_item items[] = {
2118 { ID2P(LANG_SPINDOWN), spindown }, 2110 { ID2P(LANG_SPINDOWN), spindown },
2119#ifdef HAVE_ATA_POWER_OFF
2120 { ID2P(LANG_POWEROFF), poweroff },
2121#endif
2122#ifdef HAVE_DIRCACHE 2111#ifdef HAVE_DIRCACHE
2123 { ID2P(LANG_DIRCACHE_ENABLE), dircache }, 2112 { ID2P(LANG_DIRCACHE_ENABLE), dircache },
2124#endif 2113#endif
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 4dd0fdcc49..349f76c0ec 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -63,6 +63,10 @@
63 63
64#define READ_TIMEOUT 5*HZ 64#define READ_TIMEOUT 5*HZ
65 65
66#ifdef HAVE_ATA_POWER_OFF
67#define ATA_POWER_OFF_TIMEOUT 2*HZ
68#endif
69
66static struct mutex ata_mtx; 70static struct mutex ata_mtx;
67int ata_device; /* device 0 (master) or 1 (slave) */ 71int ata_device; /* device 0 (master) or 1 (slave) */
68 72
@@ -75,9 +79,6 @@ static bool spinup = false;
75static bool sleeping = true; 79static bool sleeping = true;
76static bool poweroff = false; 80static bool poweroff = false;
77static long sleep_timeout = 5*HZ; 81static long sleep_timeout = 5*HZ;
78#ifdef HAVE_ATA_POWER_OFF
79static int poweroff_timeout = 2*HZ;
80#endif
81#ifdef HAVE_LBA48 82#ifdef HAVE_LBA48
82static bool lba48 = false; /* set for 48 bit addressing */ 83static bool lba48 = false; /* set for 48 bit addressing */
83#endif 84#endif
@@ -561,16 +562,6 @@ void ata_spindown(int seconds)
561 sleep_timeout = seconds * HZ; 562 sleep_timeout = seconds * HZ;
562} 563}
563 564
564#ifdef HAVE_ATA_POWER_OFF
565void ata_poweroff(bool enable)
566{
567 if (enable)
568 poweroff_timeout = 2*HZ;
569 else
570 poweroff_timeout = 0;
571}
572#endif
573
574bool ata_disk_is_active(void) 565bool ata_disk_is_active(void)
575{ 566{
576 return !sleeping; 567 return !sleeping;
@@ -654,8 +645,8 @@ static void ata_thread(void)
654 } 645 }
655 } 646 }
656#ifdef HAVE_ATA_POWER_OFF 647#ifdef HAVE_ATA_POWER_OFF
657 if ( !spinup && sleeping && poweroff_timeout && !poweroff && 648 if ( !spinup && sleeping && !poweroff &&
658 TIME_AFTER( current_tick, last_sleep + poweroff_timeout )) 649 TIME_AFTER( current_tick, last_sleep + ATA_POWER_OFF_TIMEOUT ))
659 { 650 {
660 mutex_lock(&ata_mtx); 651 mutex_lock(&ata_mtx);
661 ide_power_enable(false); 652 ide_power_enable(false);
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index a2cb8ab975..915a71f536 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -38,7 +38,6 @@
38 38
39extern void ata_enable(bool on); 39extern void ata_enable(bool on);
40extern void ata_spindown(int seconds); 40extern void ata_spindown(int seconds);
41extern void ata_poweroff(bool enable);
42extern void ata_sleep(void); 41extern void ata_sleep(void);
43extern void ata_sleepnow(void); 42extern void ata_sleepnow(void);
44extern bool ata_disk_is_active(void); 43extern bool ata_disk_is_active(void);
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 2fef005b84..7f796abde5 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -30,7 +30,6 @@
30#include "ata.h" 30#include "ata.h"
31#include "power.h" 31#include "power.h"
32#include "button.h" 32#include "button.h"
33#include "ata.h"
34#include "audio.h" 33#include "audio.h"
35#include "mp3_playback.h" 34#include "mp3_playback.h"
36#include "usb.h" 35#include "usb.h"
@@ -638,9 +637,6 @@ static void handle_auto_poweroff(void)
638 remote_backlight_set_timeout(2); 637 remote_backlight_set_timeout(2);
639#endif 638#endif
640 ata_spindown(3); 639 ata_spindown(3);
641#ifdef HAVE_ATA_POWER_OFF
642 ata_poweroff(true);
643#endif
644 low_battery = true; 640 low_battery = true;
645 } else if (low_battery && (battery_percent > 11)) { 641 } else if (low_battery && (battery_percent > 11)) {
646 backlight_set_timeout(10); 642 backlight_set_timeout(10);