summaryrefslogtreecommitdiff
path: root/board/reef
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2017-02-06 11:55:21 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-10 19:02:55 -0800
commitf30a8cf6863e6f2a491e8baff73632e6faf371d0 (patch)
tree44705231bd7ec9651636adb28f5035a067ee64ca /board/reef
parent16ce25ce44d2d74c08d33f6277b8528793d7389d (diff)
downloadchrome-ec-f30a8cf6863e6f2a491e8baff73632e6faf371d0.tar.gz
charger_profile: support multiple battery voltage range thresholds
Current fast charge assumes only one battery voltage threshold range for charger profile override. However we have multiple battery voltage threshold ranges for few batteries hence added a code which can consider multiple battery threshold ranges and choose respective charge profile. BUG=chrome-os-partner:62653 BRANCH=none TEST=Manually tested on Electro. Manipulate smp_cos4870 & sonycorp battery voltage & temperature ranges and observed correct charge profile is selected. Change-Id: Icddc047e608cc8f63cd0c19be716e0f7908ca715 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/438804 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board/reef')
-rw-r--r--board/reef/battery.c102
1 files changed, 61 insertions, 41 deletions
diff --git a/board/reef/battery.c b/board/reef/battery.c
index a76bd92d1d..776e9c125a 100644
--- a/board/reef/battery.c
+++ b/board/reef/battery.c
@@ -31,6 +31,11 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
+enum fast_chg_voltage_ranges {
+ VOLTAGE_RANGE_0,
+ VOLTAGE_RANGE_1,
+};
+
enum temp_range {
TEMP_RANGE_0,
TEMP_RANGE_1,
@@ -69,8 +74,8 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
[TEMP_RANGE_0] = {
.temp_c = TEMPC_TENTHS_OF_DEG(-1),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
@@ -78,8 +83,8 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
[TEMP_RANGE_1] = {
.temp_c = TEMPC_TENTHS_OF_DEG(15),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 944,
- [VOLTAGE_RANGE_HIGH] = 472,
+ [VOLTAGE_RANGE_0] = 944,
+ [VOLTAGE_RANGE_1] = 472,
},
},
@@ -87,8 +92,8 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
[TEMP_RANGE_2] = {
.temp_c = TEMPC_TENTHS_OF_DEG(20),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 1416,
- [VOLTAGE_RANGE_HIGH] = 1416,
+ [VOLTAGE_RANGE_0] = 1416,
+ [VOLTAGE_RANGE_1] = 1416,
},
},
@@ -96,8 +101,8 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
[TEMP_RANGE_3] = {
.temp_c = TEMPC_TENTHS_OF_DEG(45),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 3300,
- [VOLTAGE_RANGE_HIGH] = 3300,
+ [VOLTAGE_RANGE_0] = 3300,
+ [VOLTAGE_RANGE_1] = 3300,
},
},
@@ -105,8 +110,8 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
[TEMP_RANGE_4] = {
.temp_c = TEMPC_TENTHS_OF_DEG(CHARGER_PROF_TEMP_C_LAST_RANGE),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
};
@@ -114,7 +119,10 @@ static const struct fast_charge_profile fast_charge_smp_cos4870_info[] = {
static const struct fast_charge_params fast_chg_params_smp_cos4870 = {
.total_temp_ranges = ARRAY_SIZE(fast_charge_smp_cos4870_info),
.default_temp_range_profile = TEMP_RANGE_2,
- .vtg_low_limit_mV = 8000,
+ .voltage_mV = {
+ [VOLTAGE_RANGE_0] = 8000,
+ [VOLTAGE_RANGE_1] = CHARGER_PROF_VOLTAGE_MV_LAST_RANGE,
+ },
.chg_profile_info = &fast_charge_smp_cos4870_info[0],
};
@@ -140,8 +148,8 @@ static const struct fast_charge_profile fast_charge_sonycorp_info[] = {
[TEMP_RANGE_0] = {
.temp_c = TEMPC_TENTHS_OF_DEG(9),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 1200,
- [VOLTAGE_RANGE_HIGH] = 1200,
+ [VOLTAGE_RANGE_0] = 1200,
+ [VOLTAGE_RANGE_1] = 1200,
},
},
@@ -149,8 +157,8 @@ static const struct fast_charge_profile fast_charge_sonycorp_info[] = {
[TEMP_RANGE_1] = {
.temp_c = TEMPC_TENTHS_OF_DEG(CHARGER_PROF_TEMP_C_LAST_RANGE),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 2250,
- [VOLTAGE_RANGE_HIGH] = 2250,
+ [VOLTAGE_RANGE_0] = 2250,
+ [VOLTAGE_RANGE_1] = 2250,
},
},
};
@@ -158,7 +166,10 @@ static const struct fast_charge_profile fast_charge_sonycorp_info[] = {
static const struct fast_charge_params fast_chg_params_sonycorp = {
.total_temp_ranges = ARRAY_SIZE(fast_charge_sonycorp_info),
.default_temp_range_profile = TEMP_RANGE_1,
- .vtg_low_limit_mV = 8000,
+ .voltage_mV = {
+ [VOLTAGE_RANGE_0] = 8000,
+ [VOLTAGE_RANGE_1] = CHARGER_PROF_VOLTAGE_MV_LAST_RANGE,
+ },
.chg_profile_info = &fast_charge_sonycorp_info[0],
};
@@ -185,8 +196,8 @@ static const struct fast_charge_profile fast_charge_panasonic_info[] = {
[TEMP_RANGE_0] = {
.temp_c = TEMPC_TENTHS_OF_DEG(-1),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
@@ -194,8 +205,8 @@ static const struct fast_charge_profile fast_charge_panasonic_info[] = {
[TEMP_RANGE_1] = {
.temp_c = TEMPC_TENTHS_OF_DEG(60),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 3072,
- [VOLTAGE_RANGE_HIGH] = 3072,
+ [VOLTAGE_RANGE_0] = 3072,
+ [VOLTAGE_RANGE_1] = 3072,
},
},
@@ -203,8 +214,8 @@ static const struct fast_charge_profile fast_charge_panasonic_info[] = {
[TEMP_RANGE_2] = {
.temp_c = TEMPC_TENTHS_OF_DEG(CHARGER_PROF_TEMP_C_LAST_RANGE),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
};
@@ -212,7 +223,10 @@ static const struct fast_charge_profile fast_charge_panasonic_info[] = {
static const struct fast_charge_params fast_chg_params_panasonic = {
.total_temp_ranges = ARRAY_SIZE(fast_charge_panasonic_info),
.default_temp_range_profile = TEMP_RANGE_1,
- .vtg_low_limit_mV = 8000,
+ .voltage_mV = {
+ [VOLTAGE_RANGE_0] = 8000,
+ [VOLTAGE_RANGE_1] = CHARGER_PROF_VOLTAGE_MV_LAST_RANGE,
+ },
.chg_profile_info = &fast_charge_panasonic_info[0],
};
@@ -239,8 +253,8 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
[TEMP_RANGE_0] = {
.temp_c = TEMPC_TENTHS_OF_DEG(0),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
@@ -248,8 +262,8 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
[TEMP_RANGE_1] = {
.temp_c = TEMPC_TENTHS_OF_DEG(10),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 1752,
- [VOLTAGE_RANGE_HIGH] = 1752,
+ [VOLTAGE_RANGE_0] = 1752,
+ [VOLTAGE_RANGE_1] = 1752,
},
},
@@ -257,8 +271,8 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
[TEMP_RANGE_2] = {
.temp_c = TEMPC_TENTHS_OF_DEG(45),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 5200,
- [VOLTAGE_RANGE_HIGH] = 5200,
+ [VOLTAGE_RANGE_0] = 5200,
+ [VOLTAGE_RANGE_1] = 5200,
},
},
@@ -266,8 +280,8 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
[TEMP_RANGE_3] = {
.temp_c = TEMPC_TENTHS_OF_DEG(60),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 2920,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 2920,
+ [VOLTAGE_RANGE_1] = 0,
},
},
@@ -275,8 +289,8 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
[TEMP_RANGE_4] = {
.temp_c = TEMPC_TENTHS_OF_DEG(CHARGER_PROF_TEMP_C_LAST_RANGE),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
};
@@ -284,7 +298,10 @@ static const struct fast_charge_profile fast_charge_smp_c22n1626_info[] = {
static const struct fast_charge_params fast_chg_params_smp_c22n1626 = {
.total_temp_ranges = ARRAY_SIZE(fast_charge_smp_c22n1626_info),
.default_temp_range_profile = TEMP_RANGE_2,
- .vtg_low_limit_mV = 8200,
+ .voltage_mV = {
+ [VOLTAGE_RANGE_0] = 8200,
+ [VOLTAGE_RANGE_1] = CHARGER_PROF_VOLTAGE_MV_LAST_RANGE,
+ },
.chg_profile_info = &fast_charge_smp_c22n1626_info[0],
};
@@ -293,8 +310,8 @@ static const struct fast_charge_profile fast_charge_cpt_c22n1626_info[] = {
[TEMP_RANGE_0] = {
.temp_c = TEMPC_TENTHS_OF_DEG(-1),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
@@ -302,8 +319,8 @@ static const struct fast_charge_profile fast_charge_cpt_c22n1626_info[] = {
[TEMP_RANGE_1] = {
.temp_c = TEMPC_TENTHS_OF_DEG(60),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 5200,
- [VOLTAGE_RANGE_HIGH] = 5200,
+ [VOLTAGE_RANGE_0] = 5200,
+ [VOLTAGE_RANGE_1] = 5200,
},
},
@@ -311,8 +328,8 @@ static const struct fast_charge_profile fast_charge_cpt_c22n1626_info[] = {
[TEMP_RANGE_2] = {
.temp_c = TEMPC_TENTHS_OF_DEG(CHARGER_PROF_TEMP_C_LAST_RANGE),
.current_mA = {
- [VOLTAGE_RANGE_LOW] = 0,
- [VOLTAGE_RANGE_HIGH] = 0,
+ [VOLTAGE_RANGE_0] = 0,
+ [VOLTAGE_RANGE_1] = 0,
},
},
};
@@ -320,7 +337,10 @@ static const struct fast_charge_profile fast_charge_cpt_c22n1626_info[] = {
static const struct fast_charge_params fast_chg_params_cpt_c22n1626 = {
.total_temp_ranges = ARRAY_SIZE(fast_charge_cpt_c22n1626_info),
.default_temp_range_profile = TEMP_RANGE_1,
- .vtg_low_limit_mV = 8000,
+ .voltage_mV = {
+ [VOLTAGE_RANGE_0] = 8000,
+ [VOLTAGE_RANGE_1] = CHARGER_PROF_VOLTAGE_MV_LAST_RANGE,
+ },
.chg_profile_info = &fast_charge_cpt_c22n1626_info[0],
};