diff options
| author | Barry Wardell <rockbox@barrywardell.net> | 2008-02-19 15:25:07 +0000 |
|---|---|---|
| committer | Barry Wardell <rockbox@barrywardell.net> | 2008-02-19 15:25:07 +0000 |
| commit | c643b85ce4367ac7026eaf40859ac1516d9e6287 (patch) | |
| tree | d6d26580ccf556dd6336d1dd3c7833e4e143a27e | |
| parent | 1a39029c685dfdcde1bf6f2a2177b195d736a1a7 (diff) | |
| download | rockbox-c643b85ce4367ac7026eaf40859ac1516d9e6287.zip rockbox-c643b85ce4367ac7026eaf40859ac1516d9e6287.tar.gz rockbox-c643b85ce4367ac7026eaf40859ac1516d9e6287.tar.bz2 rockbox-c643b85ce4367ac7026eaf40859ac1516d9e6287.tar.xz | |
FS#8588: disable USB device again when USB is disconnected on PortalPlayer targets. Previously, the USB device was left on after USB disconnection causing extra battery drain. This alleviates this problem somewhat, although it seems like battery drain may still be higher after a USB disconnection, so we're still missing something.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16354 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/usb-fw-pp502x.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c index 5b71fbd..46a5b99 100644 --- a/firmware/target/arm/usb-fw-pp502x.c +++ b/firmware/target/arm/usb-fw-pp502x.c @@ -129,16 +129,6 @@ static bool usb_pin_detect(void) retval = true; #endif - /* if USB is detected, re-enable the USB-devices */ - if (retval) - { - DEV_EN |= DEV_USB0; - DEV_EN |= DEV_USB1; -#if CONFIG_CPU == PP5020 - DEV_INIT2 |= INIT_USB; -#endif - } - return retval; } @@ -185,7 +175,22 @@ int usb_detect(void) if (!usbstatus1) { /* We have just been disconnected */ status = USB_EXTRACTED; + + /* Disable USB devices */ + DEV_EN &=~ DEV_USB0; + DEV_EN &=~ DEV_USB1; +#if CONFIG_CPU == PP5020 + DEV_INIT2 &=~ INIT_USB; +#endif + return status; + } else { + /* if USB is detected, re-enable the USB-devices, otherwise make sure it's disabled */ + DEV_EN |= DEV_USB0; + DEV_EN |= DEV_USB1; +#if CONFIG_CPU == PP5020 + DEV_INIT2 |= INIT_USB; +#endif } /* Run the USB stack to request full bus power */ |