common: Add TABLET_MODE hook.

Add a hook to act when the a device is going in tablet mode and back.

BUG=chromium:606718
BRANCH=kevin
TEST=Test with evtest that an event is sent to the AP.

Change-Id: Ic9c3b158f1178504af41abff18b28de8e07fc7a7
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/380412
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Gwendal Grignou
2016-09-01 16:48:06 -07:00
committed by chrome-bot
parent 764b2e57e7
commit 4848d7e8fa
9 changed files with 32 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ static const struct hook_ptrs hook_list[] = {
{__hooks_chipset_reset, __hooks_chipset_reset_end},
{__hooks_ac_change, __hooks_ac_change_end},
{__hooks_lid_change, __hooks_lid_change_end},
{__hooks_tablet_mode_change, __hooks_tablet_mode_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},

View File

@@ -175,6 +175,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_LID_CHANGE))
__hooks_lid_change_end = .;
__hooks_tablet_mode_change = .;
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;

View File

@@ -127,6 +127,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_LID_CHANGE))
__hooks_lid_change_end = .;
__hooks_tablet_mode_change = .;
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;

View File

@@ -73,6 +73,10 @@ SECTIONS {
*(.rodata.HOOK_LID_CHANGE)
__hooks_lid_change_end = .;
__hooks_tablet_mode_change = .;
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
__hooks_pwrbtn_change = .;
*(.rodata.HOOK_POWER_BUTTON_CHANGE)
__hooks_pwrbtn_change_end = .;

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2016 The Chromium OS Authors. All rights reserved.
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -98,6 +98,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_LID_CHANGE))
__hooks_lid_change_end = .;
__hooks_tablet_mode_change = .;
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;

View File

@@ -117,6 +117,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_LID_CHANGE))
__hooks_lid_change_end = .;
__hooks_tablet_mode_change = .;
KEEP(*(.rodata.HOOK_TABLET_MODE_CHANGE))
__hooks_tablet_mode_change_end = .;
__hooks_pwrbtn_change = .;
KEEP(*(.rodata.HOOK_POWER_BUTTON_CHANGE))
__hooks_pwrbtn_change_end = .;

View File

@@ -2630,6 +2630,7 @@ struct ec_response_get_next_event {
/* Switches */
#define EC_MKBP_LID_OPEN 0
#define EC_MKBP_TABLET_MODE 1
/* Run keyboard factory test scanning */
#define EC_CMD_KEYBOARD_FACTORY_TEST 0x68

View File

@@ -138,6 +138,13 @@ enum hook_type {
*/
HOOK_LID_CHANGE,
/*
* Device in tablet mode (base behind lid).
*
* Hook routines are called from the TICK task.
*/
HOOK_TABLET_MODE_CHANGE,
/*
* Power button pressed or released. Based on debounced power button
* state, not raw GPIO input.

View File

@@ -48,6 +48,8 @@ extern const struct hook_data __hooks_ac_change[];
extern const struct hook_data __hooks_ac_change_end[];
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_pwrbtn_change[];
extern const struct hook_data __hooks_pwrbtn_change_end[];
extern const struct hook_data __hooks_charge_state_change[];