From f15e6ff061f716b576851c1001625c09c5d62a24 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Sun, 3 Jan 2010 13:07:30 +0000 Subject: [PATCH] Onda VX747: fix USB charging detection git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24160 a1c6a512-1295-4272-9138-f99709370657 --- .../mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c index 19d634873c..e2e66c86ac 100644 --- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c +++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c @@ -24,18 +24,21 @@ #include "jz4740.h" /* TQ7051 chip */ -#define UNK_GPIO (32*1+30) /* STAT port */ +#define CHARGE_STAT_GPIO (32*1+30) /* STAT port */ #define USB_CHARGER_GPIO (32*3+28) #if CONFIG_CHARGING /* Detect which power sources are present. */ unsigned int power_input_status(void) { - unsigned int status = 0; + unsigned int status = POWER_INPUT_NONE; if (__gpio_get_pin(USB_CHARGER_GPIO)) status |= POWER_INPUT_USB_CHARGER; + if(!__gpio_get_pin(CHARGE_STAT_GPIO)) + status |= POWER_INPUT_USB; + return status; } #endif @@ -43,11 +46,12 @@ unsigned int power_input_status(void) void power_init(void) { __gpio_as_input(USB_CHARGER_GPIO); + __gpio_as_input(CHARGE_STAT_GPIO); } bool charging_state(void) { - return false; + return power_input_status() & POWER_INPUT_USB; } #if CONFIG_TUNER