summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2012-03-04 11:41:25 +0100
committerBertrik Sikken <bertrik@sikken.nl>2012-03-04 12:23:05 +0100
commitf6e17e86fed65cb503199691d69973e83c45ddbf (patch)
tree78134652dba68a308ccf45f62156e0e419382388
parentf8de21f4603657ac7f8e22fc36f269e6a1fab0f8 (diff)
downloadrockbox-f6e17e86fed65cb503199691d69973e83c45ddbf.tar.gz
rockbox-f6e17e86fed65cb503199691d69973e83c45ddbf.zip
AMSv2: add proper definitions for charge current
Change-Id: I6a14570e94df1be62ae46816d2ff4e3f2b7bc21a
-rw-r--r--firmware/export/as3514.h25
-rw-r--r--firmware/target/arm/as3525/powermgmt-target.h8
-rw-r--r--firmware/target/arm/powermgmt-ascodec.c4
3 files changed, 24 insertions, 13 deletions
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h
index acf13444fa..85da14493f 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -363,14 +363,25 @@ extern void audiohw_set_sampr_dividers(int fsel);
363/* AS3514_CHARGER */ 363/* AS3514_CHARGER */
364#define TMPSUP_OFF (0x1 << 7) 364#define TMPSUP_OFF (0x1 << 7)
365#define CHG_I (0x7 << 4) 365#define CHG_I (0x7 << 4)
366#define CHG_I_400MA (0x7 << 4) 366#ifdef HAVE_AS3543 /* AS3543 uses charge current steps of 70 mA */
367#define CHG_I_350MA (0x6 << 4) 367#define CHG_I_55MA (0x0 << 4)
368#define CHG_I_300MA (0x5 << 4) 368#define CHG_I_70MA (0x1 << 4)
369#define CHG_I_250MA (0x4 << 4) 369#define CHG_I_140MA (0x2 << 4)
370#define CHG_I_200MA (0x3 << 4) 370#define CHG_I_210MA (0x3 << 4)
371#define CHG_I_150MA (0x2 << 4) 371#define CHG_I_280MA (0x4 << 4)
372#define CHG_I_100MA (0x1 << 4) 372#define CHG_I_350MA (0x5 << 4)
373#define CHG_I_420MA (0x6 << 4)
374#define CHG_I_460MA (0x7 << 4)
375#else /* AS3514 uses charge current steps of 50 mA */
373#define CHG_I_50MA (0x0 << 4) 376#define CHG_I_50MA (0x0 << 4)
377#define CHG_I_100MA (0x1 << 4)
378#define CHG_I_150MA (0x2 << 4)
379#define CHG_I_200MA (0x3 << 4)
380#define CHG_I_250MA (0x4 << 4)
381#define CHG_I_300MA (0x5 << 4)
382#define CHG_I_350MA (0x6 << 4)
383#define CHG_I_400MA (0x7 << 4)
384#endif
374#define CHG_V (0x7 << 1) 385#define CHG_V (0x7 << 1)
375#define CHG_V_4_25V (0x7 << 1) 386#define CHG_V_4_25V (0x7 << 1)
376#define CHG_V_4_20V (0x6 << 1) 387#define CHG_V_4_20V (0x6 << 1)
diff --git a/firmware/target/arm/as3525/powermgmt-target.h b/firmware/target/arm/as3525/powermgmt-target.h
index 3b459fa695..e0aa0ec4c3 100644
--- a/firmware/target/arm/as3525/powermgmt-target.h
+++ b/firmware/target/arm/as3525/powermgmt-target.h
@@ -39,7 +39,7 @@
39#define BATT_FULL_VOLTAGE 4160 39#define BATT_FULL_VOLTAGE 4160
40#define BATT_VAUTO_RECHARGE 4100 40#define BATT_VAUTO_RECHARGE 4100
41#define BATT_CHG_V CHG_V_4_20V 41#define BATT_CHG_V CHG_V_4_20V
42#define BATT_CHG_I CHG_I_150MA 42#define BATT_CHG_I CHG_I_140MA
43#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ 43#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
44 44
45#elif defined(SANSA_CLIPV2) 45#elif defined(SANSA_CLIPV2)
@@ -48,7 +48,7 @@
48#define BATT_FULL_VOLTAGE 4200 48#define BATT_FULL_VOLTAGE 4200
49#define BATT_VAUTO_RECHARGE 4100 49#define BATT_VAUTO_RECHARGE 4100
50#define BATT_CHG_V CHG_V_4_20V 50#define BATT_CHG_V CHG_V_4_20V
51#define BATT_CHG_I CHG_I_150MA 51#define BATT_CHG_I CHG_I_140MA
52#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ 52#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
53 53
54#elif defined(SANSA_E200V2) 54#elif defined(SANSA_E200V2)
@@ -75,7 +75,7 @@
75#define BATT_FULL_VOLTAGE 4200 75#define BATT_FULL_VOLTAGE 4200
76#define BATT_VAUTO_RECHARGE 4100 76#define BATT_VAUTO_RECHARGE 4100
77#define BATT_CHG_V CHG_V_4_20V 77#define BATT_CHG_V CHG_V_4_20V
78#define BATT_CHG_I CHG_I_200MA 78#define BATT_CHG_I CHG_I_210MA
79#define CHARGER_TOTAL_TIMER (4*3600*2) 79#define CHARGER_TOTAL_TIMER (4*3600*2)
80 80
81#elif defined(SANSA_CLIPZIP) 81#elif defined(SANSA_CLIPZIP)
@@ -84,7 +84,7 @@
84#define BATT_FULL_VOLTAGE 4160 84#define BATT_FULL_VOLTAGE 4160
85#define BATT_VAUTO_RECHARGE 4100 85#define BATT_VAUTO_RECHARGE 4100
86#define BATT_CHG_V CHG_V_4_20V 86#define BATT_CHG_V CHG_V_4_20V
87#define BATT_CHG_I CHG_I_150MA 87#define BATT_CHG_I CHG_I_140MA
88#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ 88#define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
89 89
90#elif defined(SANSA_C200V2) 90#elif defined(SANSA_C200V2)
diff --git a/firmware/target/arm/powermgmt-ascodec.c b/firmware/target/arm/powermgmt-ascodec.c
index c05fc7bf7a..0e4c8b7074 100644
--- a/firmware/target/arm/powermgmt-ascodec.c
+++ b/firmware/target/arm/powermgmt-ascodec.c
@@ -93,7 +93,7 @@ static void battery_voltage_sync(void)
93/* Disable charger and minimize all settings. Reset timers, etc. */ 93/* Disable charger and minimize all settings. Reset timers, etc. */
94static void disable_charger(void) 94static void disable_charger(void)
95{ 95{
96 ascodec_write_charger(TMPSUP_OFF | CHG_I_50MA | CHG_V_3_90V | CHG_OFF); 96 ascodec_write_charger(TMPSUP_OFF | CHG_OFF);
97 97
98 if (charge_state > DISCHARGING) 98 if (charge_state > DISCHARGING)
99 charge_state = DISCHARGING; /* Not an error state already */ 99 charge_state = DISCHARGING; /* Not an error state already */
@@ -126,7 +126,7 @@ void powermgmt_init_target(void)
126{ 126{
127 /* Everything CHARGER, OFF! */ 127 /* Everything CHARGER, OFF! */
128 ascodec_monitor_endofch(); 128 ascodec_monitor_endofch();
129 ascodec_write_charger(TMPSUP_OFF | CHG_I_50MA | CHG_V_3_90V | CHG_OFF); 129 ascodec_write_charger(TMPSUP_OFF | CHG_OFF);
130} 130}
131 131
132static inline void charger_plugged(void) 132static inline void charger_plugged(void)