extpower: Allow board to override signal debounce time

This is for boards on which AC_PRESENT can be expected to fluctuate
over a much longer period than the code was originally designed for.
Specifically, USB-PD systems may require several hundred milliseconds
for the state machine to settle before making decisions based on
AC_PRESENT status, for example, changing LED state.

BUG=chrome-os-partner:56471
BRANCH=none
TEST=Tested on Reef with follow-up patch

Change-Id: I370048cb79d1593a14077563ec8db8e8282afb16
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/378755
This commit is contained in:
David Hendricks
2016-08-30 18:03:35 -07:00
committed by chrome-bot
parent 6910f907a6
commit 74e60906c4
2 changed files with 5 additions and 3 deletions

View File

@@ -12,8 +12,6 @@
#include "host_command.h"
#include "timer.h"
#define EXTPOWER_DEBOUNCE_US (30 * MSEC)
static int debounced_extpower_presence;
int extpower_is_present(void)
@@ -45,7 +43,8 @@ DECLARE_DEFERRED(extpower_deferred);
void extpower_interrupt(enum gpio_signal signal)
{
/* Trigger deferred notification of external power change */
hook_call_deferred(&extpower_deferred_data, EXTPOWER_DEBOUNCE_US);
hook_call_deferred(&extpower_deferred_data,
CONFIG_EXTPOWER_DEBOUNCE_MS * MSEC);
}
static void extpower_init(void)

View File

@@ -812,6 +812,9 @@
/* Support detecting external power presence via a GPIO */
#undef CONFIG_EXTPOWER_GPIO
/* Default debounce time for external power signal */
#define CONFIG_EXTPOWER_DEBOUNCE_MS 30
/*****************************************************************************/
/* Number of cooling fans. Undef if none. */
#undef CONFIG_FANS