From f6e17e86fed65cb503199691d69973e83c45ddbf Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Sun, 4 Mar 2012 11:41:25 +0100 Subject: [PATCH] AMSv2: add proper definitions for charge current Change-Id: I6a14570e94df1be62ae46816d2ff4e3f2b7bc21a --- firmware/export/as3514.h | 25 +++++++++++++------ firmware/target/arm/as3525/powermgmt-target.h | 8 +++--- firmware/target/arm/powermgmt-ascodec.c | 4 +-- 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); /* AS3514_CHARGER */ #define TMPSUP_OFF (0x1 << 7) #define CHG_I (0x7 << 4) -#define CHG_I_400MA (0x7 << 4) -#define CHG_I_350MA (0x6 << 4) -#define CHG_I_300MA (0x5 << 4) -#define CHG_I_250MA (0x4 << 4) -#define CHG_I_200MA (0x3 << 4) -#define CHG_I_150MA (0x2 << 4) -#define CHG_I_100MA (0x1 << 4) +#ifdef HAVE_AS3543 /* AS3543 uses charge current steps of 70 mA */ +#define CHG_I_55MA (0x0 << 4) +#define CHG_I_70MA (0x1 << 4) +#define CHG_I_140MA (0x2 << 4) +#define CHG_I_210MA (0x3 << 4) +#define CHG_I_280MA (0x4 << 4) +#define CHG_I_350MA (0x5 << 4) +#define CHG_I_420MA (0x6 << 4) +#define CHG_I_460MA (0x7 << 4) +#else /* AS3514 uses charge current steps of 50 mA */ #define CHG_I_50MA (0x0 << 4) +#define CHG_I_100MA (0x1 << 4) +#define CHG_I_150MA (0x2 << 4) +#define CHG_I_200MA (0x3 << 4) +#define CHG_I_250MA (0x4 << 4) +#define CHG_I_300MA (0x5 << 4) +#define CHG_I_350MA (0x6 << 4) +#define CHG_I_400MA (0x7 << 4) +#endif #define CHG_V (0x7 << 1) #define CHG_V_4_25V (0x7 << 1) #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 @@ #define BATT_FULL_VOLTAGE 4160 #define BATT_VAUTO_RECHARGE 4100 #define BATT_CHG_V CHG_V_4_20V -#define BATT_CHG_I CHG_I_150MA +#define BATT_CHG_I CHG_I_140MA #define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ #elif defined(SANSA_CLIPV2) @@ -48,7 +48,7 @@ #define BATT_FULL_VOLTAGE 4200 #define BATT_VAUTO_RECHARGE 4100 #define BATT_CHG_V CHG_V_4_20V -#define BATT_CHG_I CHG_I_150MA +#define BATT_CHG_I CHG_I_140MA #define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ #elif defined(SANSA_E200V2) @@ -75,7 +75,7 @@ #define BATT_FULL_VOLTAGE 4200 #define BATT_VAUTO_RECHARGE 4100 #define BATT_CHG_V CHG_V_4_20V -#define BATT_CHG_I CHG_I_200MA +#define BATT_CHG_I CHG_I_210MA #define CHARGER_TOTAL_TIMER (4*3600*2) #elif defined(SANSA_CLIPZIP) @@ -84,7 +84,7 @@ #define BATT_FULL_VOLTAGE 4160 #define BATT_VAUTO_RECHARGE 4100 #define BATT_CHG_V CHG_V_4_20V -#define BATT_CHG_I CHG_I_150MA +#define BATT_CHG_I CHG_I_140MA #define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */ #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) /* Disable charger and minimize all settings. Reset timers, etc. */ static void disable_charger(void) { - ascodec_write_charger(TMPSUP_OFF | CHG_I_50MA | CHG_V_3_90V | CHG_OFF); + ascodec_write_charger(TMPSUP_OFF | CHG_OFF); if (charge_state > DISCHARGING) charge_state = DISCHARGING; /* Not an error state already */ @@ -126,7 +126,7 @@ void powermgmt_init_target(void) { /* Everything CHARGER, OFF! */ ascodec_monitor_endofch(); - ascodec_write_charger(TMPSUP_OFF | CHG_I_50MA | CHG_V_3_90V | CHG_OFF); + ascodec_write_charger(TMPSUP_OFF | CHG_OFF); } static inline void charger_plugged(void)