diff options
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/usb-gigabeat-s.c | 9 |
1 files changed, 7 insertions, 2 deletions
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) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | /* Read the immediate state of the cable from the PMIC */ | ||
57 | bool usb_plugged(void) | ||
58 | { | ||
59 | return mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S; | ||
60 | } | ||
61 | |||
56 | void usb_connect_event(void) | 62 | void usb_connect_event(void) |
57 | { | 63 | { |
58 | /* Read the immediate state of the cable from the PMIC */ | 64 | /* Read the immediate state of the cable from the PMIC */ |
59 | int status = (mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S) | 65 | int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED; |
60 | ? USB_INSERTED : USB_EXTRACTED; | ||
61 | usb_status = status; | 66 | usb_status = status; |
62 | /* Notify power that USB charging is potentially available */ | 67 | /* Notify power that USB charging is potentially available */ |
63 | charger_usb_detect_event(status); | 68 | charger_usb_detect_event(status); |