summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-21 18:10:36 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-21 18:10:36 +0000
commit5667682dd204a07c52f057506fd2eef05bf63f2e (patch)
treea5f4f3cb22751362a9ed7774698ca55d27819d16 /firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
parentc3c15cce88481a2504eb492ba06b6a691d8e998d (diff)
downloadrockbox-5667682dd204a07c52f057506fd2eef05bf63f2e.tar.gz
rockbox-5667682dd204a07c52f057506fd2eef05bf63f2e.tar.bz2
rockbox-5667682dd204a07c52f057506fd2eef05bf63f2e.zip
Gigabeat S: Implement charging and power control to charge from AC or USB. Hold MENU while plugging USB cable to charge from USB without connecting. Under Windows, plugging USB for charging only but not connecting still needs to be properly handled (driver popup issue) but it will charge when connected normally-- no issue under Linux. Some accomodating changes made to powermgmt.c will soon be made nicer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/usb-imx31.c')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/usb-imx31.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
index 382bc326b7..a7314861c3 100644
--- a/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/usb-imx31.c
@@ -28,6 +28,7 @@
#include "usb_drv.h"
#include "usb-target.h"
#include "clkctl-imx31.h"
+#include "power-imx31.h"
#include "mc13783.h"
static int usb_status = USB_EXTRACTED;
@@ -53,8 +54,11 @@ static void enable_transceiver(bool enable)
void usb_connect_event(void)
{
- uint32_t status = mc13783_read(MC13783_INTERRUPT_SENSE0);
- usb_status = (status & MC13783_USB4V4S) ? USB_INSERTED : USB_EXTRACTED;
+ uint32_t status = mc13783_read(MC13783_INTERRUPT_SENSE0);
+ usb_status = (status & MC13783_USB4V4S) ?
+ USB_INSERTED : USB_EXTRACTED;
+ /* Notify power that USB charging is potentially available */
+ charger_usb_detect_event(usb_status);
}
int usb_detect(void)
@@ -81,7 +85,7 @@ void usb_init_device(void)
usb_connect_event();
/* Enable PMIC event */
- mc13783_enable_event(MC13783_USB4V4_EVENT);
+ mc13783_enable_event(MC13783_USB_EVENT);
}
void usb_enable(bool on)