From 4f5f2dd1b7e6ec2dcd3a89229368df8bd5d31235 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Sat, 23 Sep 2017 01:13:08 -0700 Subject: power: Add flag to disable power signal at boot Add a new flag to allow boards to indicate if a power signal has to be enabled/disabled at boot. BUG=b:65421825 BRANCH=None TEST=make -j buildall Change-Id: Ibe7ab74e8191c58433087d8024b344d7e845f17e Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/679981 Reviewed-by: Aaron Durbin Reviewed-by: Nicolas Boichat --- include/power.h | 7 ++++++- power/common.c | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/power.h b/include/power.h index b5c2771d70..52316628fd 100644 --- a/include/power.h +++ b/include/power.h @@ -44,7 +44,9 @@ enum power_state { * +------------------------------------------------------+ * | 0 | Active level (low/high) | * +------------------------------------------------------+ - * | 1 : 32 | Reserved | + * | 1 | Signal interrupt state at boot | + * +------------------------------------------------------+ + * | 2 : 32 | Reserved | * +-----------------+------------------------------------+ */ @@ -52,6 +54,9 @@ enum power_state { #define POWER_SIGNAL_ACTIVE_LOW (0 << 0) #define POWER_SIGNAL_ACTIVE_HIGH (1 << 0) +#define POWER_SIGNAL_INTR_STATE (1 << 1) +#define POWER_SIGNAL_DISABLE_AT_BOOT (1 << 1) + /* Information on an power signal */ struct power_signal_info { enum gpio_signal gpio; /* GPIO for signal */ diff --git a/power/common.c b/power/common.c index 50a8096e0b..c489ab90cc 100644 --- a/power/common.c +++ b/power/common.c @@ -435,7 +435,10 @@ static void power_common_init(void) /* Enable interrupts for input signals */ for (i = 0; i < POWER_SIGNAL_COUNT; i++, s++) - power_signal_enable_interrupt(s->gpio); + if (s->flags & POWER_SIGNAL_DISABLE_AT_BOOT) + power_signal_disable_interrupt(s->gpio); + else + power_signal_enable_interrupt(s->gpio); /* * Update input state again since there is a small window -- cgit v1.2.1