From e233bace58537dfd6c986c31bd7cb879aa9e31a5 Mon Sep 17 00:00:00 2001 From: jethead71 Date: Wed, 24 Dec 2008 19:36:37 +0000 Subject: [PATCH] H10 can distinguish USB and MAIN charger input so return proper flags. H100s were misconfigured and should use CHARGING_SIMPLE. Comment more on what charging types mean in config.h. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19582 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-h100.h | 3 +-- firmware/export/config-h120.h | 2 +- firmware/export/config.h | 14 ++++++++++---- firmware/target/arm/iriver/h10/power-h10.c | 12 +++++++++--- firmware/target/coldfire/iriver/h100/power-h100.c | 6 ------ 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 7f91e35fb..be718259f 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -110,8 +110,7 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ /* Hardware controlled charging */ - -#define CONFIG_CHARGING CHARGING_MONITOR /* FIXME: remove that once monitoring is fixed properly */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define current usage levels */ #define CURRENT_NORMAL 80 /* 16h playback on 1300mAh battery */ diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index b4a687b6d..4757d7708 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -110,7 +110,7 @@ #define BATTERY_TYPES_COUNT 1 /* only one type */ /* Hardware controlled charging */ -#define CONFIG_CHARGING CHARGING_MONITOR /* FIXME: remove that once monitoring is fixed properly */ +#define CONFIG_CHARGING CHARGING_SIMPLE /* define current usage levels */ #define CURRENT_NORMAL 80 /* 16h playback on 1300mAh battery */ diff --git a/firmware/export/config.h b/firmware/export/config.h index 1854f59d1..9bc6c7c77 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -116,12 +116,18 @@ /* CONFIG_CHARGING */ /* Generic types */ -#define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */ -#define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */ +#define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging + * (CPU cannot read charger state but may read + * when power is plugged-in). */ +#define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring + * (CPU is able to read HW charging state and + * when power is plugged-in). */ /* Mostly target-specific code in the /target tree */ -#define CHARGING_TARGET 3 - +#define CHARGING_TARGET 3 /* Any algorithm - usually software controlled + * charging or specific programming is required to + * use the charging hardware. */ + /* CONFIG_LCD */ #define LCD_SSD1815 1 /* as used by Archos Recorders and Ondios */ #define LCD_SSD1801 2 /* as used by Archos Player/Studio */ diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c index 1a1f6afbf..2535c5839 100644 --- a/firmware/target/arm/iriver/h10/power-h10.c +++ b/firmware/target/arm/iriver/h10/power-h10.c @@ -50,9 +50,15 @@ void power_init(void) unsigned int power_input_status(void) { - /* No separate source for USB and charges from USB on its own */ - return (GPIOF_INPUT_VAL & 0x08) ? - POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; + unsigned int status = POWER_INPUT_NONE; + + if (GPIOF_INPUT_VAL & 0x08) + status = POWER_INPUT_MAIN_CHARGER; + + if (GPIOL_INPUT_VAL & 0x04) + status |= POWER_INPUT_USB_CHARGER; + + return status; } void ide_power_enable(bool on) diff --git a/firmware/target/coldfire/iriver/h100/power-h100.c b/firmware/target/coldfire/iriver/h100/power-h100.c index 2717e42f4..1dcea9ce0 100644 --- a/firmware/target/coldfire/iriver/h100/power-h100.c +++ b/firmware/target/coldfire/iriver/h100/power-h100.c @@ -57,12 +57,6 @@ unsigned int power_input_status(void) POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; } -/* Returns true if the unit is charging the batteries. */ -bool charging_state(void) -{ - return (power_input_status() & POWER_INPUT_CHARGER) != 0; -} - #ifdef HAVE_SPDIF_POWER void spdif_power_enable(bool on) { -- 2.11.4.GIT