summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/onda_vx747
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2010-01-03 13:07:30 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2010-01-03 13:07:30 +0000
commitf15e6ff061f716b576851c1001625c09c5d62a24 (patch)
treee7690cb4e9c5228868d30609f0bfb4084f556df1 /firmware/target/mips/ingenic_jz47xx/onda_vx747
parentf6017773a69aded80b427c63514e798d4199463f (diff)
downloadrockbox-f15e6ff061f716b576851c1001625c09c5d62a24.tar.gz
rockbox-f15e6ff061f716b576851c1001625c09c5d62a24.tar.bz2
rockbox-f15e6ff061f716b576851c1001625c09c5d62a24.zip
Onda VX747: fix USB charging detection
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24160 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx747')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/power-onda_vx747.c10
1 files 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