summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-05-05 12:42:07 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-09 22:29:40 +0000
commit5be73aa62a6ce6ccb72624c128c3dd76b5ac828b (patch)
tree45565c6d46303e0ebe3f0615bdf568f2808f4e92
parentf53ec2533fc46bb6ceb955715b4be8d1be4cbe37 (diff)
downloadchrome-ec-5be73aa62a6ce6ccb72624c128c3dd76b5ac828b.tar.gz
charger: Move base_responsive to charger_base.c
This variable is not used in the main charger file. Move it over to the base file by creating a setup function for the base, calling it from the charger_setup() function. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69448 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Idbdb7639cb51e65de2c77303545221cca25c8865 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510245 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Tested-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
-rw-r--r--common/charge_state_v2.c3
-rw-r--r--common/charger_base.c7
-rw-r--r--include/charger_base.h4
3 files changed, 11 insertions, 3 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index a570f00ab9..bd52a682f5 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -1106,8 +1106,9 @@ static void charger_setup(const struct charger_info *info)
chg_ctl_mode = CHARGE_CONTROL_NORMAL;
shutdown_target_time.val = 0UL;
battery_seems_dead = 0;
+ if (IS_ENABLED(CONFIG_EC_EC_COMM_BATTERY_CLIENT))
+ charger_base_setup();
#ifdef CONFIG_EC_EC_COMM_BATTERY_CLIENT
- base_responsive = 0;
curr.input_voltage = CHARGE_VOLTAGE_UNINITIALIZED;
battery_dynamic[BATT_IDX_BASE].flags = EC_BATT_FLAG_INVALID_DATA;
charge_base = -1;
diff --git a/common/charger_base.c b/common/charger_base.c
index af76b1f51c..127229068c 100644
--- a/common/charger_base.c
+++ b/common/charger_base.c
@@ -21,7 +21,7 @@
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
/* Base has responded to one of our commands already. */
-int base_responsive;
+static int base_responsive;
int charge_base;
int prev_charge_base;
static int prev_current_base;
@@ -642,5 +642,10 @@ DECLARE_CONSOLE_COMMAND(chgdualdebug, command_chgdualdebug,
"[charge (auto|<current>)|discharge (auto|<current>)]",
"Manually control dual-battery charging algorithm.");
+void charger_base_setup(void)
+{
+ base_responsive = 0;
+}
+
/* Reset the base on S5->S0 transition. */
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_base_reset, HOOK_PRIO_DEFAULT);
diff --git a/include/charger_base.h b/include/charger_base.h
index 2f9a589e05..511ec2b4ab 100644
--- a/include/charger_base.h
+++ b/include/charger_base.h
@@ -12,7 +12,6 @@
struct charge_state_data;
-extern int base_responsive;
extern int charge_base;
extern int prev_charge_base;
@@ -42,4 +41,7 @@ bool base_connected(void)
}
#endif
+/* Set up the charger task for the base */
+void charger_base_setup(void);
+
#endif /* __CROS_EC_CHARGER_BASE_H */