forked from len0rd/rockbox
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
This commit is contained in:
parent
a8d1cfdec8
commit
c6309633a1
4 changed files with 28 additions and 12 deletions
|
|
@ -55,3 +55,10 @@ void pcf50606_init(void)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pcf50606_reset_timeout(void)
|
||||||
|
{
|
||||||
|
int level = disable_irq_save();
|
||||||
|
pcf50606_write(PCF5060X_OOCC1, pcf50606_read(PCF5060X_OOCC1) | TOTRST);
|
||||||
|
restore_irq(level);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ void pcf50606_i2c_outb(unsigned char byte);
|
||||||
unsigned char pcf50606_i2c_inb(bool ack);
|
unsigned char pcf50606_i2c_inb(bool ack);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR)
|
#if (defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(COWON_D2)) && !defined (SIMULATOR)
|
||||||
void pcf50606_reset_timeout(void);
|
void pcf50606_reset_timeout(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR)
|
#if (defined(IAUDIO_X5) || defined(IAUDIO_M5)) && !defined (SIMULATOR)
|
||||||
#include "pcf50606.h"
|
|
||||||
#include "lcd-remote-target.h"
|
#include "lcd-remote-target.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if (defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(COWON_D2)) \
|
||||||
|
&& !defined (SIMULATOR)
|
||||||
|
#include "pcf50606.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Shared by sim **/
|
/** Shared by sim **/
|
||||||
int last_sent_battery_level = 100;
|
int last_sent_battery_level = 100;
|
||||||
|
|
@ -788,7 +791,7 @@ void sys_poweroff(void)
|
||||||
/* If the main thread fails to shut down the system, we will force a
|
/* If the main thread fails to shut down the system, we will force a
|
||||||
power off after an 20 second timeout - 28 seconds if recording */
|
power off after an 20 second timeout - 28 seconds if recording */
|
||||||
if (shutdown_timeout == 0) {
|
if (shutdown_timeout == 0) {
|
||||||
#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
|
#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(COWON_D2)
|
||||||
pcf50606_reset_timeout(); /* Reset timer on first attempt only */
|
pcf50606_reset_timeout(); /* Reset timer on first attempt only */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
|
|
@ -806,7 +809,7 @@ void cancel_shutdown(void)
|
||||||
{
|
{
|
||||||
logf("cancel_shutdown()");
|
logf("cancel_shutdown()");
|
||||||
|
|
||||||
#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
|
#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(COWON_D2)
|
||||||
/* TODO: Move some things to target/ tree */
|
/* TODO: Move some things to target/ tree */
|
||||||
if (shutdown_timeout)
|
if (shutdown_timeout)
|
||||||
pcf50606_reset_timeout();
|
pcf50606_reset_timeout();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
#include "pcf50606.h"
|
#include "pcf50606.h"
|
||||||
#include "button-target.h"
|
#include "button-target.h"
|
||||||
#include "tuner.h"
|
#include "tuner.h"
|
||||||
|
#include "backlight-target.h"
|
||||||
|
#include "powermgmt.h"
|
||||||
|
|
||||||
void power_init(void)
|
void power_init(void)
|
||||||
{
|
{
|
||||||
|
|
@ -50,8 +52,13 @@ void power_init(void)
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
{
|
{
|
||||||
/* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
|
/* Turn the backlight off first to avoid a bright stripe on power-off */
|
||||||
pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
|
_backlight_off();
|
||||||
|
sleep(HZ/10);
|
||||||
|
|
||||||
|
/* Power off the player using the same mechanism as the OF */
|
||||||
|
GPIOA_CLEAR = (1<<7);
|
||||||
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
|
@ -64,12 +71,11 @@ void EXT3(void)
|
||||||
|
|
||||||
if (data[0] & 0x04)
|
if (data[0] & 0x04)
|
||||||
{
|
{
|
||||||
/* ONKEY1S: don't reset the timeout, because we want a way to power off
|
/* ONKEY1S */
|
||||||
the player in the event of a crashed plugin or UIE/panic, etc. */
|
if (!charger_inserted())
|
||||||
#if 0
|
sys_poweroff();
|
||||||
/* ONKEY1S: reset timeout as we're using SW poweroff */
|
else
|
||||||
pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1: TOTRST=1 */
|
pcf50606_reset_timeout();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[2] & 0x08)
|
if (data[2] & 0x08)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue