summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */