summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc780x
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2009-07-26 19:41:24 +0000
committerRob Purchase <shotofadds@rockbox.org>2009-07-26 19:41:24 +0000
commitc6309633a1b33c85b1920c61126ad03f262ab215 (patch)
treee33b3855c02f2ae601d231330ca9cabdfd7beba4 /firmware/target/arm/tcc780x
parenta8d1cfdec8f62f976ba03713da07b88bd927fce5 (diff)
Re-work D2 power off behaviour.
* Inhibit PCF timeout during shutdown and while charging * Power off the player using the same mechanism as the OF (GPIO) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22056 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tcc780x')
-rw-r--r--firmware/target/arm/tcc780x/cowond2/power-cowond2.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
index aed6a1911b..5897370735 100644
--- a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
@@ -25,6 +25,8 @@
#include "pcf50606.h"
#include "button-target.h"
#include "tuner.h"
+#include "backlight-target.h"
+#include "powermgmt.h"
void power_init(void)
{
@@ -50,8 +52,13 @@ void power_init(void)
void power_off(void)
{
- /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
- pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
+ /* Turn the backlight off first to avoid a bright stripe on power-off */
+ _backlight_off();
+ sleep(HZ/10);
+
+ /* Power off the player using the same mechanism as the OF */
+ GPIOA_CLEAR = (1<<7);
+ while(true);
}
#ifndef BOOTLOADER
@@ -64,12 +71,11 @@ void EXT3(void)
if (data[0] & 0x04)
{
- /* ONKEY1S: don't reset the timeout, because we want a way to power off
- the player in the event of a crashed plugin or UIE/panic, etc. */
-#if 0
- /* ONKEY1S: reset timeout as we're using SW poweroff */
- pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1: TOTRST=1 */
-#endif
+ /* ONKEY1S */
+ if (!charger_inserted())
+ sys_poweroff();
+ else
+ pcf50606_reset_timeout();
}
if (data[2] & 0x08)