summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-08-26 16:43:28 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-29 02:43:31 +0000
commitd986a057af8246e6062b60f223a5ecbcdd6144de (patch)
treece9ad8276ae0f4c930f02b101e777f548ed0f3c9
parentdeed6c7cd265fe0cbfd2d64e3082cd8d8b9a2f38 (diff)
downloadchrome-ec-d986a057af8246e6062b60f223a5ecbcdd6144de.tar.gz
power_button: Add CONFIG_POWER_BUTTON_TO_PCH_CUSTOM
Allow board to provide board_pwrbtn_to_pch function to override the default behavior of gpio_set_level(GPIO_PCH_PWRBTN_L, level) as the means for asserting power button signal to PCH. BUG=b:164921478 BRANCH=zork TEST=power button timing Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I8f5ffb2759318fdc941155b60be8bf4aa7dd4771 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2378557 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--common/power_button_x86.c5
-rw-r--r--include/config.h5
-rw-r--r--include/power_button.h7
3 files changed, 16 insertions, 1 deletions
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index 0d2d5e5b71..661f9b2a3d 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -145,7 +145,10 @@ static void set_pwrbtn_to_pch(int high, int init)
}
#endif
CPRINTS("PB PCH pwrbtn=%s", high ? "HIGH" : "LOW");
- gpio_set_level(GPIO_PCH_PWRBTN_L, high);
+ if (IS_ENABLED(CONFIG_POWER_BUTTON_TO_PCH_CUSTOM))
+ board_pwrbtn_to_pch(high);
+ else
+ gpio_set_level(GPIO_PCH_PWRBTN_L, high);
}
void power_button_pch_press(void)
diff --git a/include/config.h b/include/config.h
index bcd6671516..1a6f1767a9 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3016,6 +3016,11 @@
*/
#define CONFIG_DSW_PWROK_TO_PWRBTN_US (95 * MSEC)
+/*
+ * Board provides board_pwrbtn_to_pch function instead of GPIO_PCH_PWRBTN_L
+ * as the means for asserting power button signal to PCH.
+ */
+#undef CONFIG_POWER_BUTTON_TO_PCH_CUSTOM
/* Compile common code for AP power state machine */
#undef CONFIG_POWER_COMMON
diff --git a/include/power_button.h b/include/power_button.h
index 23fd4b1bf4..167ca21e2b 100644
--- a/include/power_button.h
+++ b/include/power_button.h
@@ -62,4 +62,11 @@ void power_button_pch_pulse(void);
*/
int64_t get_time_dsw_pwrok(void);
+/**
+ * This must be defined when CONFIG_POWER_BUTTON_TO_PCH_CUSTOM is defined. This
+ * allows a board to override the default behavior of
+ * gpio_set_level(GPIO_PCH_PWRBTN_L, level).
+ */
+void board_pwrbtn_to_pch(int level);
+
#endif /* __CROS_EC_POWER_BUTTON_H */