1
0
Fork 0
forked from len0rd/rockbox

usb_plugged() is PP only

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31489 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2011-12-31 18:43:59 +00:00
parent df09274768
commit 2115eac7bb
13 changed files with 14 additions and 33 deletions

View file

@ -112,7 +112,8 @@ void power_off(void)
unsigned int power_input_status(void)
{
return usb_plugged() ? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
return (usb_detect == USB_INSERTED)
? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
}
bool charging_state(void)

View file

@ -21,7 +21,7 @@
#include "powermgmt.h"
#include "power-imx233.h"
#include "usb-target.h"
#include "usb.h"
#include "string.h"
//#define LOGF_ENABLE
#include "logf.h"
@ -60,7 +60,7 @@ void powermgmt_init_target(void)
void charging_algorithm_step(void)
{
bool is_5v_present = usb_plugged();
bool is_5v_present = usb_detect() == USB_INSERTED;
/* initial state & 5v -> battery transition */
if(!is_5v_present && charge_state != DISCHARGING)

View file

@ -68,12 +68,7 @@ void usb_init_device(void)
int usb_detect(void)
{
return usb_plugged() ? USB_INSERTED : USB_EXTRACTED;
}
bool usb_plugged(void)
{
return !!(HW_POWER_STS & HW_POWER_STS__VBUSVALID);
return (HW_POWER_STS & HW_POWER_STS__VBUSVALID) ? USB_INSERTED : USB_EXTRACTED;
}
void usb_enable(bool on)

View file

@ -29,6 +29,5 @@
void usb_insert_int(void);
void usb_remove_int(void);
bool usb_plugged(void);
#endif /* USB_TARGET_H */

View file

@ -54,15 +54,11 @@ 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)
{
int status = usb_plugged() ? USB_INSERTED : USB_EXTRACTED;
/* Read the immediate state of the cable from the PMIC */
int status = (mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_USB4V4S)
? USB_INSERTED : USB_EXTRACTED;
usb_status = status;
/* Notify power that USB charging is potentially available */
charger_usb_detect_event(status);

View file

@ -26,8 +26,6 @@
#endif
void usb_connect_event(void);
/* Read the immediate state of the cable from the PMIC */
bool usb_plugged(void);
/** Sector read/write filters **/

View file

@ -28,6 +28,4 @@
#define USB_DRIVER_CLOSE
#endif
bool usb_plugged(void); /* Returns instantaneous state - always */
#endif

View file

@ -45,11 +45,6 @@ void usb_attach(void)
usb_enable(true);
}
bool usb_plugged(void)
{
return true;
}
void usb_enable(bool on)
{
if(on)

View file

@ -24,6 +24,7 @@
#include "config.h"
#include "system-arm.h"
#include <stdbool.h>
#ifdef CPU_PP
/* TODO: This header is actually portalplayer specific, and should be
@ -50,6 +51,7 @@
#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
void usb_pin_init(void);
bool usb_plugged(void);
static inline void udelay(unsigned usecs)
{

View file

@ -73,6 +73,4 @@ int usb_detect(void)
return USB_EXTRACTED;
}
/* No different for now */
bool usb_plugged(void) __attribute__((alias("usb_detect")));

View file

@ -23,7 +23,6 @@
void usb_insert_int(void);
void firewire_insert_int(void);
bool usb_plugged(void); /* Returns instantaneous state - always */
#ifdef HAVE_BOOTLOADER_USB_MODE
#define USB_DRIVER_CLOSE