D2: Charging detection, plus basic PCF50606 interrupt handler.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17088 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
660dbac5c9
commit
b14c2de523
3 changed files with 45 additions and 1 deletions
|
@ -99,12 +99,15 @@
|
|||
|
||||
#define CONFIG_I2C I2C_TCC780X
|
||||
|
||||
#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_DEFAULT 1600 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
|
||||
/* Hardware controlled charging */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if you have a TCC7801 */
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
|
||||
#define IRQ_PRIORITY_TABLE ((volatile unsigned int *)0xF30010A0)
|
||||
|
||||
#define EXT3_IRQ_MASK (1<<3)
|
||||
#define TIMER0_IRQ_MASK (1<<6)
|
||||
#define DAI_RX_IRQ_MASK (1<<14)
|
||||
#define DAI_TX_IRQ_MASK (1<<15)
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
|
||||
void power_init(void)
|
||||
{
|
||||
unsigned char data[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
|
||||
|
||||
/* Clear pending interrupts from pcf50606 */
|
||||
pcf50606_read_multiple(0x02, data, 3);
|
||||
|
||||
/* Set outputs as per OF - further investigation required. */
|
||||
pcf50606_write(PCF5060X_DCDEC1, 0xe4);
|
||||
pcf50606_write(PCF5060X_IOREGC, 0xf5);
|
||||
|
@ -36,6 +41,10 @@ void power_init(void)
|
|||
pcf50606_write(PCF5060X_DCUDC1, 0xe7);
|
||||
pcf50606_write(PCF5060X_LPREGC1, 0x0);
|
||||
pcf50606_write(PCF5060X_LPREGC2, 0x2);
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
IEN |= EXT3_IRQ_MASK; /* Unmask EXT3 */
|
||||
#endif
|
||||
}
|
||||
|
||||
void ide_power_enable(bool on)
|
||||
|
@ -54,6 +63,37 @@ void power_off(void)
|
|||
pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
void EXT3(void)
|
||||
{
|
||||
unsigned char data[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
|
||||
|
||||
/* Clear pending interrupts from pcf50606 */
|
||||
int fiq_status = disable_fiq_save();
|
||||
pcf50606_read_multiple(0x02, data, 3);
|
||||
|
||||
if (data[0] & 0x04)
|
||||
{
|
||||
/* ONKEY1S: reset timeout as we're using SW poweroff */
|
||||
pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1: TOTRST=1 */
|
||||
}
|
||||
|
||||
if (data[2] & 0x08)
|
||||
{
|
||||
/* TODO: Touchscreen pen down event, do something about it */
|
||||
}
|
||||
|
||||
restore_fiq(fiq_status);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
bool charger_inserted(void)
|
||||
{
|
||||
return (GPIOC & (1<<26)) ? false:true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* SIMULATOR */
|
||||
|
||||
bool charger_inserted(void)
|
||||
|
|
Loading…
Reference in a new issue