summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config-h300.h3
-rw-r--r--firmware/export/power.h1
-rw-r--r--firmware/export/powermgmt.h30
3 files changed, 31 insertions, 3 deletions
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 806ae0a079..ded20c9129 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -72,6 +72,9 @@
72/* Define this if the platform can charge batteries */ 72/* Define this if the platform can charge batteries */
73#define HAVE_CHARGING 1 73#define HAVE_CHARGING 1
74 74
75/* For units with a hardware charger that reports charge state */
76#define HAVE_CHARGE_STATE 1
77
75/* define this if the hardware can be powered off while charging */ 78/* define this if the hardware can be powered off while charging */
76#define HAVE_POWEROFF_WHILE_CHARGING 79#define HAVE_POWEROFF_WHILE_CHARGING
77 80
diff --git a/firmware/export/power.h b/firmware/export/power.h
index bf645522ef..9f91e25f15 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -25,6 +25,7 @@ extern bool charger_enabled;
25 25
26void power_init(void); 26void power_init(void);
27bool charger_inserted(void); 27bool charger_inserted(void);
28bool charging_state(void);
28void charger_enable(bool on); 29void charger_enable(bool on);
29void ide_power_enable(bool on); 30void ide_power_enable(bool on);
30bool ide_powered(void); 31bool ide_powered(void);
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 3c4a61fb87..25c18eabad 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
79 79
80#endif /* HAVE_CHARGE_CTRL */ 80#endif /* HAVE_CHARGE_CTRL */
81 81
82#if defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) 82#if defined(HAVE_CHARGE_CTRL) || \
83 (CONFIG_BATTERY == BATT_LIION2200) || \
84 defined(HAVE_CHARGE_STATE)
83typedef enum { 85typedef enum {
84 DISCHARGING, 86 DISCHARGING,
85 CHARGING, 87 CHARGING,
88#ifdef HAVE_CHARGE_CTRL
86 TOPOFF, 89 TOPOFF,
87 TRICKLE 90 TRICKLE
91#endif
88} charge_state_type; 92} charge_state_type;
89 93
90/* tells what the charger is doing */ 94/* tells what the charger is doing */
91extern charge_state_type charge_state; 95extern charge_state_type charge_state;
92#endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */ 96#endif /* defined(HAVE_CHARGE_CTRL) || (CONFIG_BATTERY == BATT_LIION2200) */
93 97
98#ifdef HAVE_CHARGING
99/*
100 * Flag that the charger has been plugged in/removed: this is set for exactly
101 * one time through the power loop when the charger has been plugged in.
102 */
103typedef enum {
104 NO_CHARGER,
105 CHARGER_UNPLUGGED, /* transient state */
106 CHARGER_PLUGGED, /* transient state */
107 CHARGER
108} charger_input_state_type;
109
110/* tells the state of the charge input */
111extern charger_input_state_type charger_input_state;
112#endif
113
94#ifdef HAVE_MMC /* Values for Ondio */ 114#ifdef HAVE_MMC /* Values for Ondio */
95# define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */ 115# define CURRENT_NORMAL 95 /* average, nearly proportional to 1/U */
96# define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */ 116# define CURRENT_USB 1 /* host powered in USB mode; avoid zero-div */
@@ -106,9 +126,13 @@ extern charge_state_type charge_state;
106 126
107# define CURRENT_MIN_CHG 70 /* minimum charge current */ 127# define CURRENT_MIN_CHG 70 /* minimum charge current */
108# define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */ 128# define MIN_CHG_V 8500 /* at 8.5v charger voltage get CURRENT_MIN_CHG */
109# define CURRENT_MAX_CHG 350 /* maximum charging current */ 129# ifdef IRIVER_H300_SERIES
130# define CURRENT_MAX_CHG 650 /* maximum charging current */
131# else
132# define CURRENT_MAX_CHG 350 /* maximum charging current */
133# endif
110# define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */ 134# define MAX_CHG_V 10250 /* anything over 10.25v gives CURRENT_MAX_CHG */
111#endif /* HAVE_MMC */ 135#endif /* not HAVE_MMC */
112 136
113extern unsigned int bat; /* filtered battery voltage, centivolts */ 137extern unsigned int bat; /* filtered battery voltage, centivolts */
114extern unsigned short power_history[POWER_HISTORY_LEN]; 138extern unsigned short power_history[POWER_HISTORY_LEN];