summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/chell/board.c12
-rw-r--r--board/coral/board.c19
-rw-r--r--board/elm/board.c4
-rw-r--r--board/eve/board.c12
-rw-r--r--board/fizz/board.c16
-rw-r--r--board/glados/board.c10
-rw-r--r--board/glkrvp/board.c10
-rw-r--r--board/jerry/board.c4
-rw-r--r--board/kahlee/board.c8
-rw-r--r--board/kevin/board.c8
-rw-r--r--board/llama/board.c4
-rw-r--r--board/nefario/board.c8
-rw-r--r--board/oak/board.c4
-rw-r--r--board/poppy/board.c16
-rw-r--r--board/reef/board.c19
-rw-r--r--board/reef_it8320/board.c19
-rw-r--r--board/rowan/board.c4
-rw-r--r--board/samus/board.c18
-rw-r--r--board/scarlet/board.c8
-rw-r--r--board/strago/board.c8
-rw-r--r--board/wheatley/board.c16
-rw-r--r--board/zoombini/board.c16
-rw-r--r--include/power.h27
-rw-r--r--power/common.c8
-rw-r--r--power/rk3399.c2
25 files changed, 157 insertions, 123 deletions
diff --git a/board/chell/board.c b/board/chell/board.c
index 1d56ceb237..e02513548a 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -82,13 +82,13 @@ void usb1_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
#ifdef CONFIG_POWER_S0IX
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#endif
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_N_PWRGD"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/coral/board.c b/board/coral/board.c
index c712a79711..ee5db6d899 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -127,16 +127,17 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
#ifdef CONFIG_POWER_S0IX
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#endif
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_SUSPWRNACK, 1, "SUSPWRNACK_DEASSERTED"},
-
- {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PGOOD"},
- {GPIO_PP3300_PG, 1, "PP3300_PG"},
- {GPIO_PP5000_PG, 1, "PP5000_PG"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_SUSPWRNACK, POWER_SIGNAL_ACTIVE_HIGH,
+ "SUSPWRNACK_DEASSERTED"},
+
+ {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PGOOD"},
+ {GPIO_PP3300_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP3300_PG"},
+ {GPIO_PP5000_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP5000_PG"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/elm/board.c b/board/elm/board.c
index 78989c7348..775960d424 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -76,8 +76,8 @@ void usb_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, 1, "POWER_GOOD"}, /* Active high */
- {GPIO_SUSPEND_L, 0, "SUSPEND#_ASSERTED"}, /* Active low */
+ {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
+ {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/eve/board.c b/board/eve/board.c
index 38d9102b89..b75281affa 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -155,12 +155,12 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
- {VW_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {VW_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L_PGOOD"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
+ {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L_PGOOD"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/fizz/board.c b/board/fizz/board.c
index 185140bc59..a4c256eed0 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -76,17 +76,17 @@ void vbus0_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#ifdef CONFIG_ESPI_VW_SIGNALS
- {VW_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {VW_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#else
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#endif
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L_PGOOD"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L_PGOOD"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/glados/board.c b/board/glados/board.c
index 3d626ff5e1..26cc595de7 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -99,11 +99,11 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_N_PWRGD"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/glkrvp/board.c b/board/glkrvp/board.c
index 1a1fcb42a3..5517371894 100644
--- a/board/glkrvp/board.c
+++ b/board/glkrvp/board.c
@@ -45,12 +45,12 @@
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L"},
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
- {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PGOOD"},
+ {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PGOOD"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/jerry/board.c b/board/jerry/board.c
index 4fb7fcc6a3..5c7eb8c41f 100644
--- a/board/jerry/board.c
+++ b/board/jerry/board.c
@@ -27,8 +27,8 @@
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, 1, "POWER_GOOD"},
- {GPIO_SUSPEND_L, 1, "SUSPEND#_ASSERTED"},
+ {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
+ {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_HIGH, "SUSPEND#_ASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/kahlee/board.c b/board/kahlee/board.c
index 529081b38d..365cbb28bf 100644
--- a/board/kahlee/board.c
+++ b/board/kahlee/board.c
@@ -85,10 +85,10 @@ void usb1_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S5_L, 1, "SLP_S5_DEASSERTED"},
- {GPIO_SPOK, 1, "SPOK_DEASSERTED"},
- {GPIO_P095VALW_PG, 1, "0.95VALW_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S5_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S5_DEASSERTED"},
+ {GPIO_SPOK, POWER_SIGNAL_ACTIVE_HIGH, "SPOK_DEASSERTED"},
+ {GPIO_P095VALW_PG, POWER_SIGNAL_ACTIVE_HIGH, "0.95VALW_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/kevin/board.c b/board/kevin/board.c
index fb66da0051..c10a93c0bd 100644
--- a/board/kevin/board.c
+++ b/board/kevin/board.c
@@ -122,10 +122,10 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP5000_PG, 1, "PP5000_PWR_GOOD"},
- {GPIO_TPS65261_PG, 1, "SYS_PWR_GOOD"},
- {GPIO_AP_CORE_PG, 1, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, 0, "SUSPEND_DEASSERTED"},
+ {GPIO_PP5000_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP5000_PWR_GOOD"},
+ {GPIO_TPS65261_PG, POWER_SIGNAL_ACTIVE_HIGH, "SYS_PWR_GOOD"},
+ {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
+ {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/llama/board.c b/board/llama/board.c
index 625f53cdb2..f7a5c869b2 100644
--- a/board/llama/board.c
+++ b/board/llama/board.c
@@ -31,8 +31,8 @@
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD_L, 0, "POWER_GOOD#"}, /* Active low */
- {GPIO_SUSPEND_L, 0, "SUSPEND#_ASSERTED"}, /* Active low */
+ {GPIO_SOC_POWER_GOOD_L, POWER_SIGNAL_ACTIVE_LOW, "POWER_GOOD#"},
+ {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/nefario/board.c b/board/nefario/board.c
index e766c64913..30657fcc78 100644
--- a/board/nefario/board.c
+++ b/board/nefario/board.c
@@ -109,10 +109,10 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP5000_PG, 1, "PP5000_PWR_GOOD"},
- {GPIO_RT621X_PG, 1, "SYS_PWR_GOOD"},
- {GPIO_AP_CORE_PG, 1, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, 0, "SUSPEND_DEASSERTED"},
+ {GPIO_PP5000_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP5000_PWR_GOOD"},
+ {GPIO_RT621X_PG, POWER_SIGNAL_ACTIVE_HIGH, "SYS_PWR_GOOD"},
+ {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
+ {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/oak/board.c b/board/oak/board.c
index 446edb56c5..c1e386a480 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -77,8 +77,8 @@ void usb_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, 1, "POWER_GOOD"}, /* Active high */
- {GPIO_SUSPEND_L, 0, "SUSPEND#_ASSERTED"}, /* Active low */
+ {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
+ {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 5e712063ca..53870f76a3 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -330,18 +330,18 @@ static void base_disable(void)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
#ifdef CONFIG_POWER_S0IX
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#endif
#ifdef CONFIG_ESPI_VW_SIGNALS
- {VW_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {VW_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#else
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#endif
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L_PGOOD"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L_PGOOD"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/reef/board.c b/board/reef/board.c
index f71bba079a..206e725af8 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -126,16 +126,17 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
#ifdef CONFIG_POWER_S0IX
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#endif
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_SUSPWRNACK, 1, "SUSPWRNACK_DEASSERTED"},
-
- {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PGOOD"},
- {GPIO_PP3300_PG, 1, "PP3300_PG"},
- {GPIO_PP5000_PG, 1, "PP5000_PG"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_SUSPWRNACK, POWER_SIGNAL_ACTIVE_HIGH,
+ "SUSPWRNACK_DEASSERTED"},
+
+ {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PGOOD"},
+ {GPIO_PP3300_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP3300_PG"},
+ {GPIO_PP5000_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP5000_PG"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 0b28899e02..ba48b29d0a 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -61,16 +61,17 @@
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
#ifdef CONFIG_POWER_S0IX
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#endif
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
- {GPIO_SUSPWRNACK, 1, "SUSPWRNACK_DEASSERTED"},
-
- {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PGOOD"},
- {GPIO_PP3300_PG, 1, "PP3300_PG"},
- {GPIO_PP5000_PG, 1, "PP5000_PG"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
+ {GPIO_SUSPWRNACK, POWER_SIGNAL_ACTIVE_HIGH,
+ "SUSPWRNACK_DEASSERTED"},
+
+ {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PGOOD"},
+ {GPIO_PP3300_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP3300_PG"},
+ {GPIO_PP5000_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP5000_PG"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/rowan/board.c b/board/rowan/board.c
index 132034f13f..a27eaf858c 100644
--- a/board/rowan/board.c
+++ b/board/rowan/board.c
@@ -78,8 +78,8 @@ void usb_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, 1, "POWER_GOOD"}, /* Active high */
- {GPIO_SUSPEND_L, 0, "SUSPEND#_ASSERTED"}, /* Active low */
+ {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
+ {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/samus/board.c b/board/samus/board.c
index 37ecbfeee3..01ad05e7a2 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -57,15 +57,15 @@ static void pd_mcu_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"},
- {GPIO_PP1200_PGOOD, 1, "PGOOD_PP1200"},
- {GPIO_PP1800_PGOOD, 1, "PGOOD_PP1800"},
- {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"},
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S5_L, 1, "SLP_S5_DEASSERTED"},
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_PCH_SUSWARN_L, 1, "SUSWARN_DEASSERTED"},
+ {GPIO_PP1050_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "PGOOD_PP1050"},
+ {GPIO_PP1200_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "PGOOD_PP1200"},
+ {GPIO_PP1800_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "PGOOD_PP1800"},
+ {GPIO_VCORE_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "PGOOD_VCORE"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S5_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S5_DEASSERTED"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_PCH_SUSWARN_L, POWER_SIGNAL_ACTIVE_HIGH, "SUSWARN_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 7ae9598490..154c72f9bb 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -85,10 +85,10 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1250_S3_PG, 1, "PP1250_S3_PWR_GOOD"},
- {GPIO_PP900_S0_PG, 1, "PP900_S0_PWR_GOOD"},
- {GPIO_AP_CORE_PG, 1, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, 0, "SUSPEND_DEASSERTED"},
+ {GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
+ {GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD"},
+ {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
+ {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/strago/board.c b/board/strago/board.c
index b2559b47ff..98c9c2618c 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -79,10 +79,10 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PWRGD"},
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"},
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4#_DEASSERTED"},
+ {GPIO_ALL_SYS_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "ALL_SYS_PWRGD"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_N_PWRGD"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3#_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4#_DEASSERTED"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/wheatley/board.c b/board/wheatley/board.c
index 88f39d2bc7..99d83d29f9 100644
--- a/board/wheatley/board.c
+++ b/board/wheatley/board.c
@@ -100,17 +100,17 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"},
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_N_PWRGD"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#ifdef CONFIG_ESPI_VW_SIGNALS
- {VW_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {VW_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#else
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#endif
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/board/zoombini/board.c b/board/zoombini/board.c
index 303e379ca5..8ffcd5f5cb 100644
--- a/board/zoombini/board.c
+++ b/board/zoombini/board.c
@@ -75,17 +75,17 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PCH_SLP_S0_L, 1, "SLP_S0_DEASSERTED"},
+ {GPIO_PCH_SLP_S0_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S0_DEASSERTED"},
#ifdef CONFIG_ESPI_VW_SIGNALS
- {VW_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {VW_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {VW_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {VW_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#else
- {GPIO_PCH_SLP_S3_L, 1, "SLP_S3_DEASSERTED"},
- {GPIO_PCH_SLP_S4_L, 1, "SLP_S4_DEASSERTED"},
+ {GPIO_PCH_SLP_S3_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S3_DEASSERTED"},
+ {GPIO_PCH_SLP_S4_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_S4_DEASSERTED"},
#endif /* defined(CONFIG_ESPI_VW_SIGNALS) */
- {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS_DEASSERTED"},
- {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_L_PGOOD"},
- {GPIO_PMIC_DPWROK, 1, "PMIC_DPWROK"},
+ {GPIO_PCH_SLP_SUS_L, POWER_SIGNAL_ACTIVE_HIGH, "SLP_SUS_DEASSERTED"},
+ {GPIO_RSMRST_L_PGOOD, POWER_SIGNAL_ACTIVE_HIGH, "RSMRST_L_PGOOD"},
+ {GPIO_PMIC_DPWROK, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_DPWROK"},
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
diff --git a/include/power.h b/include/power.h
index cdfcbcd173..9e0c29bd1b 100644
--- a/include/power.h
+++ b/include/power.h
@@ -36,10 +36,26 @@ enum power_state {
#endif
};
+/*
+ * Power signal flags:
+ *
+ * +-----------------+------------------------------------+
+ * | Bit # | Description |
+ * +------------------------------------------------------+
+ * | 0 | Active level (low/high) |
+ * +------------------------------------------------------+
+ * | 1 : 32 | Reserved |
+ * +-----------------+------------------------------------+
+ */
+
+#define POWER_SIGNAL_ACTIVE_STATE (1 << 0)
+#define POWER_SIGNAL_ACTIVE_LOW (0 << 0)
+#define POWER_SIGNAL_ACTIVE_HIGH (1 << 0)
+
/* Information on an power signal */
struct power_signal_info {
enum gpio_signal gpio; /* GPIO for signal */
- int level; /* GPIO level which sets signal bit */
+ uint32_t flags; /* See POWER_SIGNAL_* macros */
const char *name; /* Name of signal */
};
@@ -58,6 +74,15 @@ extern const struct power_signal_info power_signal_list[];
uint32_t power_get_signals(void);
/**
+ * Check if provided power signal is currently asserted.
+ *
+ * @param s Power signal that needs to be checked.
+ *
+ * @return 1 if power signal is asserted, 0 otherwise.
+ */
+int power_signal_is_asserted(const struct power_signal_info *s);
+
+/**
* Check for required inputs
*
* @param want Mask of signals which must be present (one or more
diff --git a/power/common.c b/power/common.c
index 4669d23d8a..d17a0c9336 100644
--- a/power/common.c
+++ b/power/common.c
@@ -92,6 +92,12 @@ static int power_signal_enable_interrupt(enum gpio_signal signal)
return gpio_enable_interrupt(signal);
}
+int power_signal_is_asserted(const struct power_signal_info *s)
+{
+ return power_signal_get_level(s->gpio) ==
+ !!(s->flags & POWER_SIGNAL_ACTIVE_STATE);
+}
+
/**
* Update input signals mask
*/
@@ -102,7 +108,7 @@ static void power_update_signals(void)
int i;
for (i = 0; i < POWER_SIGNAL_COUNT; i++, s++) {
- if (power_signal_get_level(s->gpio) == s->level)
+ if (power_signal_is_asserted(s))
inew |= 1 << i;
}
diff --git a/power/rk3399.c b/power/rk3399.c
index c4db25e48c..b2c898a5cd 100644
--- a/power/rk3399.c
+++ b/power/rk3399.c
@@ -593,7 +593,7 @@ static void power_signal_changed(void)
if (s->gpio < GPIO_IH_COUNT)
continue;
- if (gpio_get_level(s->gpio) == s->level)
+ if (power_signal_is_asserted(s))
inew |= 1 << i;
}