summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-02-01 12:55:39 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-03 05:39:18 +0000
commit0cfc6a087f103dfa1a03d5e6671844ddd4ac8c14 (patch)
treeaa3d87439408be8b28203f08d453b3e29d3baed6
parentc9adf202e3b1d50bda52fda9cb2f9cff918d64b4 (diff)
downloadchrome-ec-0cfc6a087f103dfa1a03d5e6671844ddd4ac8c14.tar.gz
hooks: add hook for battery state of charge change
Add hook for battery state of charge change. Hook will be used to cleanup the samus charging workarounds to follow. BUG=none BRANCH=samus TEST=make -j buildall Change-Id: I99cbb8264783802139cac689804b056623063695 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245252 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--common/charge_state_v2.c1
-rw-r--r--common/hooks.c1
-rw-r--r--core/cortex-m/ec.lds.S4
-rw-r--r--core/cortex-m0/ec.lds.S4
-rw-r--r--core/host/host_exe.lds4
-rw-r--r--core/nds32/ec.lds.S4
-rw-r--r--include/hooks.h7
-rw-r--r--include/link_defs.h2
8 files changed, 27 insertions, 0 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 5e3df653c6..2487f05fe5 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -773,6 +773,7 @@ wait_for_it:
(is_full != prev_full)) {
show_charging_progress();
prev_charge = curr.batt.state_of_charge;
+ hook_notify(HOOK_BATTERY_SOC_CHANGE);
#ifdef HAS_TASK_PDCMD
host_command_pd_send_status();
#endif
diff --git a/common/hooks.c b/common/hooks.c
index f95d531947..c07a3d1d1c 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -45,6 +45,7 @@ static const struct hook_ptrs hook_list[] = {
{__hooks_lid_change, __hooks_lid_change_end},
{__hooks_pwrbtn_change, __hooks_pwrbtn_change_end},
{__hooks_charge_state_change, __hooks_charge_state_change_end},
+ {__hooks_battery_soc_change, __hooks_battery_soc_change_end},
{__hooks_tick, __hooks_tick_end},
{__hooks_second, __hooks_second_end},
};
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index b5818560b9..915a8224f6 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -135,6 +135,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHARGE_STATE_CHANGE))
__hooks_charge_state_change_end = .;
+ __hooks_battery_soc_change = .;
+ KEEP(*(.rodata.HOOK_BATTERY_SOC_CHANGE))
+ __hooks_battery_soc_change_end = .;
+
__hooks_tick = .;
KEEP(*(.rodata.HOOK_TICK))
__hooks_tick_end = .;
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index c3ba800b0e..facbee1742 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -123,6 +123,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHARGE_STATE_CHANGE))
__hooks_charge_state_change_end = .;
+ __hooks_battery_soc_change = .;
+ KEEP(*(.rodata.HOOK_BATTERY_SOC_CHANGE))
+ __hooks_battery_soc_change_end = .;
+
__hooks_tick = .;
KEEP(*(.rodata.HOOK_TICK))
__hooks_tick_end = .;
diff --git a/core/host/host_exe.lds b/core/host/host_exe.lds
index 48f2c6bc19..e61b2d1c48 100644
--- a/core/host/host_exe.lds
+++ b/core/host/host_exe.lds
@@ -72,6 +72,10 @@ SECTIONS {
*(.rodata.HOOK_CHARGE_STATE_CHANGE)
__hooks_charge_state_change_end = .;
+ __hooks_battery_soc_change = .;
+ *(.rodata.HOOK_BATTERY_SOC_CHANGE)
+ __hooks_battery_soc_change_end = .;
+
__hooks_tick = .;
*(.rodata.HOOK_TICK)
__hooks_tick_end = .;
diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S
index f66412cd6d..8a8927f11a 100644
--- a/core/nds32/ec.lds.S
+++ b/core/nds32/ec.lds.S
@@ -113,6 +113,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHARGE_STATE_CHANGE))
__hooks_charge_state_change_end = .;
+ __hooks_battery_soc_change = .;
+ KEEP(*(.rodata.HOOK_BATTERY_SOC_CHANGE))
+ __hooks_battery_soc_change_end = .;
+
__hooks_tick = .;
KEEP(*(.rodata.HOOK_TICK))
__hooks_tick_end = .;
diff --git a/include/hooks.h b/include/hooks.h
index a4a518354a..15ab778c5b 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -139,6 +139,13 @@ enum hook_type {
HOOK_CHARGE_STATE_CHANGE,
/*
+ * Battery state of charge changed
+ *
+ * Hook routines are called from the charger task.
+ */
+ HOOK_BATTERY_SOC_CHANGE,
+
+ /*
* Periodic tick, every HOOK_TICK_INTERVAL.
*
* Hook routines will be called from the TICK task.
diff --git a/include/link_defs.h b/include/link_defs.h
index 67ae9779d2..cfb7f0ced2 100644
--- a/include/link_defs.h
+++ b/include/link_defs.h
@@ -46,6 +46,8 @@ extern const struct hook_data __hooks_pwrbtn_change[];
extern const struct hook_data __hooks_pwrbtn_change_end[];
extern const struct hook_data __hooks_charge_state_change[];
extern const struct hook_data __hooks_charge_state_change_end[];
+extern const struct hook_data __hooks_battery_soc_change[];
+extern const struct hook_data __hooks_battery_soc_change_end[];
extern const struct hook_data __hooks_tick[];
extern const struct hook_data __hooks_tick_end[];
extern const struct hook_data __hooks_second[];