hm60x: Fix charger detection.

Change-Id: Icde96e90303a9b6f3d399f3c25f24cc0b7d8576b
This commit is contained in:
Andrew Ryabinin 2012-04-21 12:49:38 +04:00
parent 2d3c43dffe
commit 1060d30bdd

View file

@ -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));
}