summaryrefslogtreecommitdiff
path: root/board/spherion
diff options
context:
space:
mode:
authorBen Chen <ben.chen2@quanta.corp-partner.google.com>2021-06-09 09:06:46 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-16 07:37:57 +0000
commita1815d00eedc0bcaa81220f861a3fa9b5ae38753 (patch)
treed56e450a226d7d0669dbb8a28fe0b883658c231b /board/spherion
parentd73bb872f1278ef741d85203c42969aa3a7b2c75 (diff)
downloadchrome-ec-a1815d00eedc0bcaa81220f861a3fa9b5ae38753.tar.gz
spherion: support thermal charge policy
supports skin temperature thermal policy from charge current setting via charger temperature threshols hit/release. setting input max current to 3.1A. The charging limitation is listed below: While NB in OS, sample temperature as chager task Tsens < 48 degree C , No limitation Tesen > 48 degree C , Limit charge current at 3.1A Tsens > 52 degree C , Limit charge current at 2.2A BUG=b:183174897 BRANCH=asurada TEST=The thermal test report PASS, make builadall PASS. Change-Id: I1d66fb133324e186c58a716b9c61e07b3edbdd7e Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2962200 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/spherion')
-rw-r--r--board/spherion/battery.c42
-rw-r--r--board/spherion/board.h6
2 files changed, 47 insertions, 1 deletions
diff --git a/board/spherion/battery.c b/board/spherion/battery.c
index 0bdbfbfee1..3613a4750c 100644
--- a/board/spherion/battery.c
+++ b/board/spherion/battery.c
@@ -4,8 +4,13 @@
*/
#include "battery.h"
+#include "battery_smart.h"
#include "battery_fuel_gauge.h"
+#include "charge_state.h"
+#include "chipset.h"
#include "gpio.h"
+#include "temp_sensor.h"
+#include "util.h"
const struct board_batt_params board_battery_info[] = {
[BATTERY_C235] = {
@@ -67,3 +72,40 @@ const struct board_batt_params board_battery_info[] = {
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_PANASONIC_AP15O5L;
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int charger_temp, charger_temp_c;
+ int on;
+
+ /* charge confrol if the system is on, otherwise turn it off */
+ on = chipset_in_state(CHIPSET_STATE_ON);
+ if (!on)
+ return 0;
+
+ /* charge control if outside of allowable temperature range */
+ if (curr->state == ST_CHARGE) {
+ temp_sensor_read(TEMP_SENSOR_CHARGER, &charger_temp);
+ charger_temp_c = K_TO_C(charger_temp);
+ if (charger_temp_c > 52)
+ curr->requested_current = MIN(curr->requested_current,
+ 2200);
+ else if (charger_temp_c > 48)
+ curr->requested_current = MIN(curr->requested_current,
+ CONFIG_CHARGER_MAX_INPUT_CURRENT);
+ }
+
+ return 0;
+}
+
+enum ec_status charger_profile_override_get_param(uint32_t param,
+ uint32_t *value)
+{
+ return EC_RES_INVALID_PARAM;
+}
+
+enum ec_status charger_profile_override_set_param(uint32_t param,
+ uint32_t value)
+{
+ return EC_RES_INVALID_PARAM;
+}
diff --git a/board/spherion/board.h b/board/spherion/board.h
index 201b0d82e0..a27258bc94 100644
--- a/board/spherion/board.h
+++ b/board/spherion/board.h
@@ -35,10 +35,14 @@
/* Keyboard backliht */
#define CONFIG_PWM_KBLIGHT
+/* Charger*/
+#define CONFIG_CHARGER_MAX_INPUT_CURRENT 3100
+#define CONFIG_CHARGER_PROFILE_OVERRIDE
+
/* PD / USB-C / PPC */
#define CONFIG_USB_PD_DEBUG_LEVEL 3
#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
#define PD_MAX_VOLTAGE_MV 20000
#define PD_OPERATING_POWER_MW 15000
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */