summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2017-04-27 12:48:08 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-09 23:20:07 -0700
commite8982ea3cd66941e518b829a37834a534e71b3bc (patch)
treef0c54e0a9a710c52fef3651d426476c57aa7920a
parent600df851c5565237a38f5ba0edda2beef8db618c (diff)
downloadchrome-ec-e8982ea3cd66941e518b829a37834a534e71b3bc.tar.gz
Allow lid-less configuration
power_button_x86.c and switch.c assume there is a lid switch. This patch separate them so that a board with power button but with no lid can be configured properly. This patch also moves backlight control to the board directory so that only the boards with a backlight turn it on/off when power state changes. BUG=none BRANCH=none TEST=boot fizz. make buildall. Change-Id: If4070cdc4b1221fae68b35ec3497335d81f192fd Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/489602 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--board/chell/board.c2
-rw-r--r--board/eve/board.c2
-rw-r--r--board/glados/board.c2
-rw-r--r--board/poppy/board.c14
-rw-r--r--board/reef/board.c13
-rw-r--r--board/wheatley/board.c2
-rw-r--r--common/power_button_x86.c2
-rw-r--r--common/switch.c5
-rw-r--r--power/intel_x86.c4
9 files changed, 42 insertions, 4 deletions
diff --git a/board/chell/board.c b/board/chell/board.c
index d08a81abba..9d34ea058a 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -402,6 +402,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 1);
gpio_set_level(GPIO_PP1800_DX_DMIC_EN, 1);
}
@@ -410,6 +411,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 0);
gpio_set_level(GPIO_PP1800_DX_DMIC_EN, 0);
}
diff --git a/board/eve/board.c b/board/eve/board.c
index fc87d1d1dc..b3299cb8d0 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -612,6 +612,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
if (!tablet_get_mode() && lid_is_open())
trackpad_wake_enable(1);
}
@@ -620,6 +621,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
trackpad_wake_enable(0);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
diff --git a/board/glados/board.c b/board/glados/board.c
index 7ef71dd915..e77be19e93 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -393,6 +393,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 1);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 1);
@@ -414,6 +415,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume,
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 0);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 0);
}
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 0bdbd8edc2..09478521d4 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -831,3 +831,17 @@ struct motion_sensor_t motion_sensors[] = {
},
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+/* Called on AP S3 -> S0 transition */
+static void board_chipset_resume(void)
+{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
+
+/* Called on AP S0 -> S3 transition */
+static void board_chipset_suspend(void)
+{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
diff --git a/board/reef/board.c b/board/reef/board.c
index 23247c4f95..1b8a27ad50 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -734,6 +734,19 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* FIXME(dhendrix): Add CHIPSET_RESUME and CHIPSET_SUSPEND
hooks to enable/disable sensors? */
+/* Called on AP S3 -> S0 transition */
+static void board_chipset_resume(void)
+{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
+
+/* Called on AP S0 -> S3 transition */
+static void board_chipset_suspend(void)
+{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/*
* FIXME(dhendrix): Weak symbol hack until we can get a better solution for
diff --git a/board/wheatley/board.c b/board/wheatley/board.c
index c404475734..bd451c0428 100644
--- a/board/wheatley/board.c
+++ b/board/wheatley/board.c
@@ -347,6 +347,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 1);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 1);
@@ -368,6 +369,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume,
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 0);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 0);
}
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index f83d0f81ab..658a422463 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -410,6 +410,7 @@ static void powerbtn_x86_init(void)
}
DECLARE_HOOK(HOOK_INIT, powerbtn_x86_init, HOOK_PRIO_DEFAULT);
+#ifdef CONFIG_LID_SWITCH
/**
* Handle switch changes based on lid event.
*/
@@ -420,6 +421,7 @@ static void powerbtn_x86_lid_change(void)
power_button_pch_pulse();
}
DECLARE_HOOK(HOOK_LID_CHANGE, powerbtn_x86_lid_change, HOOK_PRIO_DEFAULT);
+#endif
/**
* Handle debounced power button changing state.
diff --git a/common/switch.c b/common/switch.c
index de6e170940..93650c2629 100644
--- a/common/switch.c
+++ b/common/switch.c
@@ -43,10 +43,15 @@ static void switch_update(void)
else
*memmap_switches &= ~EC_SWITCH_POWER_BUTTON_PRESSED;
+#ifdef CONFIG_LID_SWITCH
if (lid_is_open())
*memmap_switches |= EC_SWITCH_LID_OPEN;
else
*memmap_switches &= ~EC_SWITCH_LID_OPEN;
+#else
+ /* For lid-less systems, lid looks always open */
+ *memmap_switches |= EC_SWITCH_LID_OPEN;
+#endif
if ((flash_get_protect() & EC_FLASH_PROTECT_GPIO_ASSERTED) == 0)
*memmap_switches |= EC_SWITCH_WRITE_PROTECT_DISABLED;
diff --git a/power/intel_x86.c b/power/intel_x86.c
index 6b87c88d83..c9e28f3d6f 100644
--- a/power/intel_x86.c
+++ b/power/intel_x86.c
@@ -295,8 +295,6 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state)
return POWER_S3S5;
}
- gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);
-
/* Enable wireless */
wireless_set_state(WIRELESS_ON);
@@ -321,8 +319,6 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state)
/* Call hooks before we remove power rails */
hook_notify(HOOK_CHIPSET_SUSPEND);
- gpio_set_level(GPIO_ENABLE_BACKLIGHT, 0);
-
/* Suspend wireless */
wireless_set_state(WIRELESS_SUSPEND);