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>2023-03-24 18:25:36 +0000
commit45b4c4cfe874acc2f45c347e910a7ae945b06101 (patch)
tree0edf91c71bd2fd7e51ca77f2e3f642d42e9e5f7e
parentdaa98348b2d8d02dc2e9c67c2368e68631661e69 (diff)
downloadchrome-ec-45b4c4cfe874acc2f45c347e910a7ae945b06101.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> (cherry picked from commit 43107cc85c802220cb50beebbaab387f77f269fb) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369571 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@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 5a35c39d19..3c831f2adb 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -119,7 +119,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 dc612266e7..692edf4158 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -86,7 +86,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 7c35e51121..bc4333945c 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -117,7 +117,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 3709b7d9e9..64e40b676b 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -153,7 +153,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.