iPod Classic: use PMU interrupts to detect USB and FW

Change-Id: I9be733e1a943ddeb99335d362f81f74879eeb94b
This commit is contained in:
Cástor Muñoz 2016-05-25 23:43:26 +02:00
parent f6ed4f8306
commit daee722455
6 changed files with 44 additions and 22 deletions

View file

@ -119,17 +119,12 @@ void usb_charging_maxcurrent_change(int maxcurrent)
unsigned int power_input_status(void)
{
/* This checks if USB Vbus is present. */
if (!(PDAT(12) & 0x8)) return POWER_INPUT_USB_CHARGER;
/* If USB Vbus is not present, check if we have a positive power balance
regardless. This would indicate FireWire charging. Note that this will
drop to POWER_INPUT_NONE if FireWire isn't able to supply enough current
for device operation, e.g. during disk spinup. */
if (PDAT(11) & 0x20) return POWER_INPUT_NONE;
/* Looks like we have FireWire power. */
return POWER_INPUT_MAIN_CHARGER;
unsigned int status = POWER_INPUT_NONE;
if (usb_detect() == USB_INSERTED)
status |= POWER_INPUT_USB_CHARGER;
if (pmu_firewire_present())
status |= POWER_INPUT_MAIN_CHARGER;
return status;
}
bool charging_state(void)