summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/hm60x
diff options
context:
space:
mode:
authorAndrew Ryabinin <ryabinin.a.a@gmail.com>2012-04-21 12:49:38 +0400
committerAndrew Ryabinin <ryabinin.a.a@gmail.com>2012-04-22 00:00:24 +0400
commit1060d30bdd9961ced908e4e7a06fada04a50965e (patch)
tree42da0158e3f9c387dcc565a2c348e44cafc559ce /firmware/target/arm/rk27xx/hm60x
parent2d3c43dffeb048297313cd9333731d47d66010a0 (diff)
hm60x: Fix charger detection.
Change-Id: Icde96e90303a9b6f3d399f3c25f24cc0b7d8576b
Diffstat (limited to 'firmware/target/arm/rk27xx/hm60x')
-rw-r--r--firmware/target/arm/rk27xx/hm60x/power-hm60x.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/firmware/target/arm/rk27xx/hm60x/power-hm60x.c b/firmware/target/arm/rk27xx/hm60x/power-hm60x.c
index 45cc390d13..538d00f5ec 100644
--- a/firmware/target/arm/rk27xx/hm60x/power-hm60x.c
+++ b/firmware/target/arm/rk27xx/hm60x/power-hm60x.c
@@ -40,10 +40,18 @@ void power_init(void)
unsigned int power_input_status(void)
{
- return (usb_detect() == USB_INSERTED) ? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
+ unsigned int status = POWER_INPUT_NONE;
+
+ if (!(GPIO_PADR & 0x80))
+ status |= POWER_INPUT_MAIN_CHARGER;
+
+ if (usb_detect() == USB_INSERTED)
+ status |= POWER_INPUT_USB_CHARGER;
+
+ return status;
}
bool charging_state(void)
{
- return true;
+ return (bool)(!(GPIO_PADR & 0x80));
}