summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@chromium.org>2018-08-17 11:00:18 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-08-31 23:56:47 +0000
commite237f8685f18c8d8451759e923444e73403bc2e5 (patch)
treec0ed9abad77a4cc24286f94de0d1de377238a4e8
parent64904179470656fc42fda46aab638d63d0261c04 (diff)
downloadchrome-ec-e237f8685f18c8d8451759e923444e73403bc2e5.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> (cherry picked from commit af908bfce225415c01d56b3f57cfc399d8485d3e) Reviewed-on: https://chromium-review.googlesource.com/1184441 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 29c959cc7c88eddb4c34eb53b1407945f8033e8b) Reviewed-on: https://chromium-review.googlesource.com/1200080
-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[];