summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx31
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-01-01 03:19:52 +0000
committerMichael Sevakis <jethead71@rockbox.org>2012-01-01 03:19:52 +0000
commit36bc6a1fd5273a22daf4e00e5da058250ab54774 (patch)
tree0ad1128efd7c414c20ea5de577d345b25be1592e /firmware/target/arm/imx31
parent7b22ea0d377f69ec7a0d7be7215ef3c560ce13e7 (diff)
downloadrockbox-36bc6a1fd5273a22daf4e00e5da058250ab54774.tar.gz
rockbox-36bc6a1fd5273a22daf4e00e5da058250ab54774.zip
Gigabeat S: Revert removal of usb_plugged in r31489
Synchronous cable read is still required because the timing of the receipt of the cable event cannot be known for sure-- basically it introduced a thread race between main and pmic. If a keypress is desired instead to enter BL USB mode a la AS3525, then it's possible to remove that. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31510 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/system-target.h1
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h
index 533b2a1bd3..44a97c7ca9 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-target.h
+++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h
@@ -85,6 +85,7 @@ struct ARM_REGS {
void dumpregs(void);
+bool usb_plugged(void);
void usb_connect_event(void);
/** Sector read/write filters **/
diff --git a/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c
index d967cd67f6..b157544016 100644
--- a/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c
+++ b/firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c
@@ -53,11 +53,16 @@ static void enable_transceiver(bool enable)
}
}
+/* Read the immediate state of the cable from the PMIC */
+bool usb_plugged(void)
+{
+ return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S;
+}
+
void usb_connect_event(void)
{
/* Read the immediate state of the cable from the PMIC */
- int status = (mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S)
- ? USB_INSERTED : USB_EXTRACTED;
+ int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED;
usb_status = status;
/* Notify power that USB charging is potentially available */
charger_usb_detect_event(status);