diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-11-02 20:53:46 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-02 20:54:17 -0400 |
commit | f3026cd07221b45079952546a94631e25908f4fc (patch) | |
tree | 5a5e812c5770142fd6744eaa6966d4a23ee1e0eb | |
parent | 06986d27f06528c8eb9f672a8f4913d3e3e7a307 (diff) | |
download | rockbox-f3026cd072.tar.gz rockbox-f3026cd072.zip |
xduoox3: Try to distinguish between "USB Plugged in" and "Charging"
Change-Id: I1879dbe6a95df215afa32012a72e1431c03a8653
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/xduoo_x3/power-xduoo_x3.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/xduoo_x3/power-xduoo_x3.c b/firmware/target/mips/ingenic_jz47xx/xduoo_x3/power-xduoo_x3.c index 9ae602ba56..c9bcb47fcd 100644 --- a/firmware/target/mips/ingenic_jz47xx/xduoo_x3/power-xduoo_x3.c +++ b/firmware/target/mips/ingenic_jz47xx/xduoo_x3/power-xduoo_x3.c @@ -23,15 +23,19 @@ #include "power.h" #include "cpu.h" -#define CHARGE_STAT_GPIO (32*1+6) /* STAT port */ +#define CHARGE_STAT_GPIO (32*1+6) /* STAT port */ +#define PIN_USB_DET (32*4+19) /* USB connected */ /* Detect which power sources are present. */ unsigned int power_input_status(void) { + int rval = POWER_INPUT_NONE; + if(!__gpio_get_pin(PIN_USB_DET)) + rval |= POWER_INPUT_USB; if(!__gpio_get_pin(CHARGE_STAT_GPIO)) - return POWER_INPUT_USB_CHARGER; + rval |= POWER_INPUT_USB_CHARGER; - return POWER_INPUT_NONE; + return rval; } void power_init(void) @@ -42,5 +46,5 @@ void power_init(void) bool charging_state(void) { - return (power_input_status() == POWER_INPUT_USB_CHARGER); + return (power_input_status() & POWER_INPUT_USB_CHARGER); } |