summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong Chang <rongchang@chromium.org>2012-08-06 11:12:26 +0800
committerRong Chang <rongchang@chromium.org>2012-08-06 04:05:54 -0700
commit3c0990d531e4d73d1feeecce69dc58748e2e7704 (patch)
treefd8235cfef4fe75e00ab13b3dee257ccf1d087b7
parentabdb1c16406b4a941396853f86071bc847476f48 (diff)
downloadchrome-ec-3c0990d531e4d73d1feeecce69dc58748e2e7704.tar.gz
Change link charging profile
Change vendor specific charging current table to meet battery specification. Signed-off-by: Rong Chang <rongchang@chromium.org> BUG=chrome-os-partner:12012 TEST=run firmware_ECCharging Original-Change-Id: I41a8060834bd02153d8c722ae5ffed7749226b83 Reviewed-on: https://gerrit.chromium.org/gerrit/29258 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org> Commit-Ready: Rong Chang <rongchang@chromium.org> (cherry picked from commit 6156c1b904b2e2ce9216b1472141ce263c64127e) Change-Id: Iae627e352c010133bd42f037a0f57e386b5e752b Reviewed-on: https://gerrit.chromium.org/gerrit/29267 Reviewed-by: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org>
-rw-r--r--common/battery_link.c107
1 files changed, 64 insertions, 43 deletions
diff --git a/common/battery_link.c b/common/battery_link.c
index 74e7944684..2a524dea38 100644
--- a/common/battery_link.c
+++ b/common/battery_link.c
@@ -8,15 +8,50 @@
#include "battery_pack.h"
/* Design capacity
- * Battery capacity = 8500 mAh
- * 1C = 8500 mA
+ * Battery capacity = 8200 mAh
+ * 1C = 8200 mA
*/
-#define C 8500
+#define C 8200
#define C_001 (int)(C * 0.01)
-#define C_01 (int)(C * 0.1)
-#define C_02 (int)(C * 0.2)
-#define C_05 (int)(C * 0.5)
-#define C_07 (int)(C * 0.7)
+/*
+ * Common charging currents:
+ * #define C_01 (int)(C * 0.1) == 820mA
+ * #define C_02 (int)(C * 0.2) == 1640mA
+ * #define C_05 (int)(C * 0.5) == 4100mA
+ * #define C_07 (int)(C * 0.7) == 5740mA
+ */
+
+enum {
+ TEMP_RANGE_10,
+ TEMP_RANGE_23,
+ TEMP_RANGE_35,
+ TEMP_RANGE_45,
+ TEMP_RANGE_50,
+ TEMP_RANGE_MAX
+};
+
+enum {
+ VOLT_RANGE_7200,
+ VOLT_RANGE_8000,
+ VOLT_RANGE_8400,
+ VOLT_RANGE_MAX
+};
+
+/* Vendor provided charging method
+ * temp : < 7.2V, 7.2V ~ 8.0V, 8.0V ~ 8.4V
+ * - 0 ~ 10 : 0.8A 1.6A 0.8A
+ * - 10 ~ 23 : 1.6A 4.0A 1.6A
+ * - 23 ~ 35 : 4.0A 4.0A 4.0A
+ * - 35 ~ 45 : 1.6A 4.0A 1.6A
+ * - 45 ~ 50 : 0.8A 1.6A 0.8A
+ */
+static const int const current_limit[TEMP_RANGE_MAX][VOLT_RANGE_MAX] = {
+ { 800, 1600, 800},
+ {1600, 4000, 1600},
+ {4000, 4000, 4000},
+ {1600, 4000, 1600},
+ { 800, 1600, 800},
+};
static const struct battery_info info = {
/* Designed voltage
@@ -29,28 +64,16 @@ static const struct battery_info info = {
.voltage_min = 6000,
/* Operation temperation range
- * 0 <= T_charge <= 45 deg C
+ * 0 <= T_charge <= 50 deg C
* -20 <= T_discharge <= 60 deg C
*
* The temperature values below should be deci-Kelvin
*/
.temp_charge_min = 0 * 10 + 2731,
- .temp_charge_max = 45 * 10 + 2731,
+ .temp_charge_max = 50 * 10 + 2731,
.temp_discharge_min = -20 * 10 + 2731,
.temp_discharge_max = 60 * 10 + 2731,
- /* Maximum discharging current
- * TODO(rong): Check if we need this in power manager
- *
- * 1.0C
- * 25 <= T_maxdischarge <= 45
- *
- * .current_discharge_max = C,
- * .temp_maxdisch_max = 45,
- * .temp_maxdisch_min = 25
- *
- */
-
/* Pre-charge voltage and current
* I <= 0.01C
*/
@@ -78,6 +101,7 @@ const struct battery_info *battery_get_info(void)
void battery_vendor_params(struct batt_params *batt)
{
int *desired_current = &batt->desired_current;
+ int temp_range, volt_range;
/* Hard limits
* - charging voltage < 8.4V
@@ -92,28 +116,25 @@ void battery_vendor_params(struct batt_params *batt)
return;
}
- /* Vendor provided charging method
- * temp : I - V , I - V
- * - 0 ~ 10 : 0.2C - 8.0V, 0.1C to 8.4V
- * - 10 ~ 23 : 0.5C - 8.0V, 0.2C to 8.4V
- * - 23 ~ 45 : 0.7C - 8.0V, 0.2C to 8.4V
- */
- if (batt->temperature <= celsius_to_deci_kelvin(10)) {
- if (batt->voltage < 8000)
- limit_value(desired_current, C_02);
- else
- limit_value(desired_current, C_01);
- } else if (batt->temperature <= celsius_to_deci_kelvin(23)) {
- if (batt->voltage < 8000)
- limit_value(desired_current, C_05);
- else
- limit_value(desired_current, C_02);
- } else {
- if (batt->voltage < 8000)
- limit_value(desired_current, C_07);
- else
- limit_value(desired_current, C_02);
- }
+ if (batt->temperature <= celsius_to_deci_kelvin(10))
+ temp_range = TEMP_RANGE_10;
+ else if (batt->temperature <= celsius_to_deci_kelvin(23))
+ temp_range = TEMP_RANGE_23;
+ else if (batt->temperature <= celsius_to_deci_kelvin(35))
+ temp_range = TEMP_RANGE_35;
+ else if (batt->temperature <= celsius_to_deci_kelvin(45))
+ temp_range = TEMP_RANGE_45;
+ else
+ temp_range = TEMP_RANGE_50;
+
+ if (batt->voltage < 7200)
+ volt_range = VOLT_RANGE_7200;
+ else if (batt->voltage < 8000)
+ volt_range = VOLT_RANGE_8000;
+ else
+ volt_range = VOLT_RANGE_8400;
+
+ limit_value(desired_current, current_limit[temp_range][volt_range]);
#ifndef CONFIG_SLOW_PRECHARGE
/* Trickle charging and pre-charging current should be 0.01 C */