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.tar.gz rockbox-c643b85ce4367ac7026eaf40859ac1516d9e6287.zip |
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 5b71fbd847..46a5b9942f 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) | |||
129 | retval = true; | 129 | retval = true; |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | /* if USB is detected, re-enable the USB-devices */ | ||
133 | if (retval) | ||
134 | { | ||
135 | DEV_EN |= DEV_USB0; | ||
136 | DEV_EN |= DEV_USB1; | ||
137 | #if CONFIG_CPU == PP5020 | ||
138 | DEV_INIT2 |= INIT_USB; | ||
139 | #endif | ||
140 | } | ||
141 | |||
142 | return retval; | 132 | return retval; |
143 | } | 133 | } |
144 | 134 | ||
@@ -185,7 +175,22 @@ int usb_detect(void) | |||
185 | if (!usbstatus1) | 175 | if (!usbstatus1) |
186 | { /* We have just been disconnected */ | 176 | { /* We have just been disconnected */ |
187 | status = USB_EXTRACTED; | 177 | status = USB_EXTRACTED; |
178 | |||
179 | /* Disable USB devices */ | ||
180 | DEV_EN &=~ DEV_USB0; | ||
181 | DEV_EN &=~ DEV_USB1; | ||
182 | #if CONFIG_CPU == PP5020 | ||
183 | DEV_INIT2 &=~ INIT_USB; | ||
184 | #endif | ||
185 | |||
188 | return status; | 186 | return status; |
187 | } else { | ||
188 | /* if USB is detected, re-enable the USB-devices, otherwise make sure it's disabled */ | ||
189 | DEV_EN |= DEV_USB0; | ||
190 | DEV_EN |= DEV_USB1; | ||
191 | #if CONFIG_CPU == PP5020 | ||
192 | DEV_INIT2 |= INIT_USB; | ||
193 | #endif | ||
189 | } | 194 | } |
190 | 195 | ||
191 | /* Run the USB stack to request full bus power */ | 196 | /* Run the USB stack to request full bus power */ |