mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
imx233: fix usb_detect() to be consistent with vbus detection
The STMP3700 has unreliable vbusvalid irq so we need to use vdd5gtvddio. Therefore, using the vbusvalid bit produces inconsistent results between events and detect. Fix that by making power handle all the usb detect stuff. Change-Id: Ic521b2f6677602e184fe46352c5359f4b4ba8d56
This commit is contained in:
parent
187017bad1
commit
46416c619d
3 changed files with 11 additions and 1 deletions
|
|
@ -84,6 +84,15 @@ static struct current_step_bit_t g_4p2_charge_limit_bits[] =
|
|||
#define USE_VBUSVALID
|
||||
#endif
|
||||
|
||||
bool imx233_power_usb_detect(void)
|
||||
{
|
||||
#ifdef USE_VBUSVALID
|
||||
return BF_RD(POWER_STS, VBUSVALID);
|
||||
#else
|
||||
return BF_RD(POWER_STS, VDD5V_GT_VDDIO);
|
||||
#endif
|
||||
}
|
||||
|
||||
void INT_VDD5V(void)
|
||||
{
|
||||
#ifdef USE_VBUSVALID
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ void imx233_power_init(void);
|
|||
void imx233_power_set_charge_current(unsigned current); /* in mA */
|
||||
void imx233_power_set_stop_current(unsigned current); /* in mA */
|
||||
void imx233_power_enable_batadj(bool enable);
|
||||
bool imx233_power_usb_detect(void);
|
||||
|
||||
enum imx233_regulator_t
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void usb_init_device(void)
|
|||
|
||||
int usb_detect(void)
|
||||
{
|
||||
return BF_RD(POWER_STS, VBUSVALID) ? USB_INSERTED : USB_EXTRACTED;
|
||||
return imx233_power_usb_detect() ? USB_INSERTED : USB_EXTRACTED;
|
||||
}
|
||||
|
||||
void usb_enable(bool on)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue