summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-04-28 15:16:16 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-02 19:09:20 +0000
commit43107cc85c802220cb50beebbaab387f77f269fb (patch)
tree05b88df872b85eacedd5c89dec5809b0b8270b7d
parent970772dbef059fcf42b4aabcde1ddd44f5f82c7e (diff)
downloadchrome-ec-43107cc85c802220cb50beebbaab387f77f269fb.tar.gz
lid_switch: Move LID_DEBOUNCE_US to public header
Make this symbol available to emulation tests that depend on the debounce time. This also lets us clean up some duplicate definitions in the board files too. BUG=b:228370390 BRANCH=none TEST=CQ Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I014e81733c2d196b214127bd49485bab7d02a613 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3615484 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r--board/coral/board.c1
-rw-r--r--board/eve/board.c1
-rw-r--r--board/reef/board.c1
-rw-r--r--board/reef_mchp/board.c1
-rw-r--r--common/lid_switch.c2
-rw-r--r--include/lid_switch.h5
6 files changed, 5 insertions, 6 deletions
diff --git a/board/coral/board.c b/board/coral/board.c
index d26978361a..21729489bc 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -118,7 +118,6 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
static void enable_input_devices(void);
DECLARE_DEFERRED(enable_input_devices);
-#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
void tablet_mode_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
diff --git a/board/eve/board.c b/board/eve/board.c
index a972cb4ebc..fb0fc4b87a 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -85,7 +85,6 @@ static void tcpc_alert_event(enum gpio_signal signal)
static void enable_input_devices(void);
DECLARE_DEFERRED(enable_input_devices);
-#define LID_DEBOUNCE_US (30 * MSEC)
void tablet_mode_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
diff --git a/board/reef/board.c b/board/reef/board.c
index 3dc5948fe3..e224169f3b 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -116,7 +116,6 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
static void enable_input_devices(void);
DECLARE_DEFERRED(enable_input_devices);
-#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
void tablet_mode_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index be24f34aa8..c9293ad080 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -152,7 +152,6 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
static void enable_input_devices(void);
DECLARE_DEFERRED(enable_input_devices);
-#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
void tablet_mode_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&enable_input_devices_data, LID_DEBOUNCE_US);
diff --git a/common/lid_switch.c b/common/lid_switch.c
index f8e1708f94..050bbd9512 100644
--- a/common/lid_switch.c
+++ b/common/lid_switch.c
@@ -18,8 +18,6 @@
#define CPUTS(outstr) cputs(CC_SWITCH, outstr)
#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
-#define LID_DEBOUNCE_US (30 * MSEC) /* Debounce time for lid switch */
-
/* if no X-macro is defined for LID switch GPIO, use GPIO_LID_OPEN as default */
#ifndef CONFIG_LID_SWITCH_GPIO_LIST
#define CONFIG_LID_SWITCH_GPIO_LIST LID_GPIO(GPIO_LID_OPEN)
diff --git a/include/lid_switch.h b/include/lid_switch.h
index 627a41d62c..93d093a21f 100644
--- a/include/lid_switch.h
+++ b/include/lid_switch.h
@@ -12,6 +12,11 @@
#include "stdbool.h"
/**
+ * Debounce time for lid switch
+ */
+#define LID_DEBOUNCE_US (30 * MSEC)
+
+/**
* Return non-zero if lid is open.
*
* Uses the debounced lid state, not the raw signal from the GPIO.