summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben.chen2@quanta.corp-partner.google.com <ben.chen2@quanta.corp-partner.google.com>2019-08-01 14:08:20 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-23 10:41:13 +0000
commit737b99d7cc72a89ff931d976c70977294f027831 (patch)
tree14060fac009fa1a9b7a1015deb52c8e7a035dec5
parent45fc143161963b53856f8869088239cf44fea265 (diff)
downloadchrome-ec-737b99d7cc72a89ff931d976c70977294f027831.tar.gz
Hatch: add board-specific hook to disable/enable KB backlight
This patch add enable/disable kb backlight during suspend/resume. BUG=b:138326244 BRANCH=master TEST=None Change-Id: I8c88d63c0d6a5a425e2210b9edca91da174b7429 Signed-off-by: ben.chen2@quanta.corp-partner.google.com Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730373 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Tested-by: David Huang <David.Huang@quantatw.com>
-rw-r--r--baseboard/hatch/baseboard.c19
-rw-r--r--baseboard/hatch/baseboard.h4
2 files changed, 16 insertions, 7 deletions
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
index 58f795ed9f..040c2f2659 100644
--- a/baseboard/hatch/baseboard.c
+++ b/baseboard/hatch/baseboard.c
@@ -22,6 +22,7 @@
#include "i2c.h"
#include "keyboard_scan.h"
#include "power.h"
+#include "stdbool.h"
#include "tcpci.h"
#include "timer.h"
#include "usbc_ppc.h"
@@ -80,6 +81,12 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************/
/* Chipset callbacks/hooks */
+__attribute__((weak)) bool board_has_kb_backlight(void)
+{
+ /* Default enable keyboard backlight */
+ return true;
+}
+
/* Called on AP S5 -> S3 transition */
static void baseboard_chipset_startup(void)
{
@@ -91,18 +98,16 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, baseboard_chipset_startup,
/* Called on AP S0iX -> S0 transition */
static void baseboard_chipset_resume(void)
{
- /* TODD(b/122266850): Need to fill out this hook */
- /* Enable keyboard backlight */
- gpio_set_level(GPIO_EC_KB_BL_EN, 1);
+ if (board_has_kb_backlight())
+ gpio_set_level(GPIO_EC_KB_BL_EN, 1);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, baseboard_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S0iX transition */
static void baseboard_chipset_suspend(void)
{
- /* TODD(b/122266850): Need to fill out this hook */
- /* Disable keyboard backlight */
- gpio_set_level(GPIO_EC_KB_BL_EN, 0);
+ if (board_has_kb_backlight())
+ gpio_set_level(GPIO_EC_KB_BL_EN, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, baseboard_chipset_suspend,
HOOK_PRIO_DEFAULT);
@@ -110,7 +115,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, baseboard_chipset_suspend,
/* Called on AP S3 -> S5 transition */
static void baseboard_chipset_shutdown(void)
{
- /* TODD(b/122266850): Need to fill out this hook */
+
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, baseboard_chipset_shutdown,
HOOK_PRIO_DEFAULT);
diff --git a/baseboard/hatch/baseboard.h b/baseboard/hatch/baseboard.h
index b9832b1c06..dac40e9293 100644
--- a/baseboard/hatch/baseboard.h
+++ b/baseboard/hatch/baseboard.h
@@ -8,6 +8,8 @@
#ifndef __CROS_EC_BASEBOARD_H
#define __CROS_EC_BASEBOARD_H
+#include "stdbool.h"
+
/*
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
@@ -185,6 +187,8 @@ enum mst_source {
};
/* Forward declare common (within Hatch) board-specific functions */
+bool board_has_kb_backlight(void);
+unsigned char get_board_sku(void);
void board_reset_pd_mcu(void);
void baseboard_mst_enable_control(enum mst_source, int level);