summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@chromium.org>2018-08-17 11:00:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-21 19:27:46 -0700
commitaf908bfce225415c01d56b3f57cfc399d8485d3e (patch)
tree73a798d47d9cb2002df7cb4836e6d5c7193ff997
parentb8af74cc4cf7a304ce8087fc60248ea037aad566 (diff)
downloadchrome-ec-af908bfce225415c01d56b3f57cfc399d8485d3e.tar.gz
common: add BASE_CHANGE hook
Add a hook to act when a detachable device is connected/disconnected from a base. BUG=b:73133611 BRANCH=nocturne TEST=Test with evtest that an event is sent to the AP. Change-Id: I21103fff88f19a197124095ee229eebb178dcf3d Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1180538 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-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/minute-ia/ec.lds.S4
-rw-r--r--core/nds32/ec.lds.S4
-rw-r--r--include/hooks.h7
-rw-r--r--include/link_defs.h2
8 files changed, 30 insertions, 0 deletions
diff --git a/common/hooks.c b/common/hooks.c
index 6b4bb8873d..bee2d5fc63 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -45,6 +45,7 @@ static const struct hook_ptrs hook_list[] = {
{__hooks_ac_change, __hooks_ac_change_end},
{__hooks_lid_change, __hooks_lid_change_end},
{__hooks_tablet_mode_change, __hooks_tablet_mode_change_end},
+ {__hooks_base_attached_change, __hooks_base_attached_change_end},
{__hooks_pwrbtn_change, __hooks_pwrbtn_change_end},
{__hooks_battery_soc_change, __hooks_battery_soc_change_end},
#ifdef CONFIG_CASE_CLOSED_DEBUG_V1
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index e4b15e4d15..cb7a426e60 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -191,6 +191,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
+ __hooks_base_attached_change = .;
+ KEEP(*(.rodata.HOOK_BASE_ATTACHED_CHANGE))
+ __hooks_base_attached_change_end = .;
+
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index 26515451d3..beec66f21e 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -132,6 +132,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
+ __hooks_base_attached_change = .;
+ KEEP(*(.rodata.HOOK_BASE_ATTACHED_CHANGE))
+ __hooks_base_attached_change_end = .;
+
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;
diff --git a/core/host/host_exe.lds b/core/host/host_exe.lds
index 4e19bb812a..8d59109b94 100644
--- a/core/host/host_exe.lds
+++ b/core/host/host_exe.lds
@@ -77,6 +77,10 @@ SECTIONS {
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
+ __hooks_base_attached_change = .;
+ KEEP(*(.rodata.HOOK_BASE_ATTACHED_CHANGE))
+ __hooks_base_attached_change_end = .;
+
__hooks_pwrbtn_change = .;
*(.rodata.HOOK_POWER_BUTTON_CHANGE)
__hooks_pwrbtn_change_end = .;
diff --git a/core/minute-ia/ec.lds.S b/core/minute-ia/ec.lds.S
index 5c8f9d6fce..88cc0d61e2 100644
--- a/core/minute-ia/ec.lds.S
+++ b/core/minute-ia/ec.lds.S
@@ -102,6 +102,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
+ __hooks_base_attached_change = .;
+ KEEP(*(.rodata.HOOK_BASE_ATTACHED_CHANGE))
+ __hooks_base_attached_change_end = .;
+
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;
diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S
index 5c1f8b6f79..2b822f2403 100644
--- a/core/nds32/ec.lds.S
+++ b/core/nds32/ec.lds.S
@@ -129,6 +129,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
+ __hooks_base_attached_change = .;
+ KEEP(*(.rodata.HOOK_BASE_ATTACHED_CHANGE))
+ __hooks_base_attached_change_end = .;
+
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;
diff --git a/include/hooks.h b/include/hooks.h
index d998523126..85ab1db8da 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -148,6 +148,13 @@ enum hook_type {
HOOK_TABLET_MODE_CHANGE,
/*
+ * Detachable device connected to a base.
+ *
+ * Hook routines are called from the TICK task.
+ */
+ HOOK_BASE_ATTACHED_CHANGE,
+
+ /*
* Power button pressed or released. Based on debounced power button
* state, not raw GPIO input.
*
diff --git a/include/link_defs.h b/include/link_defs.h
index 1ff5804bb9..b4488c076a 100644
--- a/include/link_defs.h
+++ b/include/link_defs.h
@@ -50,6 +50,8 @@ extern const struct hook_data __hooks_lid_change[];
extern const struct hook_data __hooks_lid_change_end[];
extern const struct hook_data __hooks_tablet_mode_change[];
extern const struct hook_data __hooks_tablet_mode_change_end[];
+extern const struct hook_data __hooks_base_attached_change[];
+extern const struct hook_data __hooks_base_attached_change_end[];
extern const struct hook_data __hooks_pwrbtn_change[];
extern const struct hook_data __hooks_pwrbtn_change_end[];
extern const struct hook_data __hooks_battery_soc_change[];