diff options
Diffstat (limited to 'firmware/export')
| -rw-r--r-- | firmware/export/config-h300.h | 3 | ||||
| -rw-r--r-- | firmware/export/power.h | 1 | ||||
| -rw-r--r-- | firmware/export/powermgmt.h | 30 |
3 files changed, 31 insertions, 3 deletions
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 806ae0a..ded20c9 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -72,6 +72,9 @@ /* Define this if the platform can charge batteries */ #define HAVE_CHARGING 1 +/* For units with a hardware charger that reports charge state */ +#define HAVE_CHARGE_STATE 1 + /* define this if the hardware can be powered off while charging */ #define HAVE_POWEROFF_WHILE_CHARGING diff --git a/firmware/export/power.h b/firmware/export/power.h index bf64552..9f91e25 100644 --- a/firmware/export/power.h +++ b/firmware/export/power.h @@ -25,6 +25,7 @@ extern bool charger_enabled; void power_init(void); bool charger_inserted(void); +bool charging_state(void); void charger_enable(bool on); void ide_power_enable(bool on); bool ide_powered(void); diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 3c4a61f..25c18ea 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -79,18 +79,38 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute #endif /* HAVE_CHARGE_CTRL */ -#if defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) +#if defined(HAVE_CHARGE_CTRL) || \ + (CONFIG_BATTERY == BATT_LIION2200) || \ + defined(HAVE_CHARGE_STATE) typedef enum { DISCHARGING, CHARGING, +#ifdef HAVE_CHARGE_CTRL TOPOFF, TRICKLE +#endif } charge_state_type; /* tells what the charger is doing */ extern charge_state_type charge_state; #endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ +#ifdef HAVE_CHARGING +/* + * Flag that the charger has been plugged in/removed: this is set for exactly + * one time through the power loop when the charger has been plugged in. + */ +typedef enum { + NO_CHARGER, + CHARGER_UNPLUGGED, /* transient state */ + CHARGER_PLUGGED, /* transient state */ + CHARGER +} charger_input_state_type; + +/* tells the state of the charge input */ +extern charger_input_state_type charger_input_state; +#endif + #ifdef HAVE_MMC /* Values for Ondio */ # define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ # define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ @@ -106,9 +126,13 @@ extern charge_state_type charge_state; # define CURRENT_MIN_CHG 70 /* minimum charge current */ # define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ -# define CURRENT_MAX_CHG 350 /* maximum charging current */ +# ifdef IRIVER_H300_SERIES +# define CURRENT_MAX_CHG 650 /* maximum charging current */ +# else +# define CURRENT_MAX_CHG 350 /* maximum charging current */ +# endif # define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ -#endif /* HAVE_MMC */ +#endif /* not HAVE_MMC */ extern unsigned int bat; /* filtered battery voltage, centivolts */ extern unsigned short power_history[POWER_HISTORY_LEN]; |