summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/philips/hdd1630/power-hdd1630.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/hdd1630/power-hdd1630.c')
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/power-hdd1630.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/firmware/target/arm/philips/hdd1630/power-hdd1630.c b/firmware/target/arm/philips/hdd1630/power-hdd1630.c
index ade2536154..03a5794791 100755
--- a/firmware/target/arm/philips/hdd1630/power-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/power-hdd1630.c
@@ -35,11 +35,30 @@ bool charger_enabled;
void power_init(void)
{
+ /* power off bit */
+ GPIOB_ENABLE |= 0x80;
+ GPIOB_OUTPUT_VAL |= 0x80;
+ GPIOB_OUTPUT_EN |= 0x80;
+
+ /* charger inserted bit */
+ GPIOE_ENABLE |= 0x20;
+ GPIOE_INPUT_VAL |= 0x20;
}
unsigned int power_input_status(void)
-{
- return POWER_INPUT_NONE;
+{
+ unsigned int status = POWER_INPUT_NONE;
+
+ /* AC charger */
+ if (GPIOE_INPUT_VAL & 0x20)
+ status |= POWER_INPUT_MAIN_CHARGER;
+
+ /* Do nothing with USB for now
+ if (GPIOE_INPUT_VAL & 0x4)
+ status |= POWER_INPUT_USB_CHARGER;
+ */
+
+ return status;
}
void ide_power_enable(bool on)
@@ -57,4 +76,8 @@ bool ide_powered(void)
void power_off(void)
{
+ /* power off bit */
+ GPIOB_ENABLE |= 0x80;
+ GPIOB_OUTPUT_VAL &= ~0x80;
+ GPIOB_OUTPUT_EN |= 0x80;
}