summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2021-06-17 18:39:39 +0800
committerCommit Bot <commit-bot@chromium.org>2021-07-28 18:37:47 +0000
commitb13e3b69fda40e60b33cc9963e8f05916f1f56b9 (patch)
tree06b1502add60fa0468d6a8475eb09545b406ebb1
parent5a3123ae33b5208b83698dd837f0ac57e4da8a91 (diff)
downloadchrome-ec-b13e3b69fda40e60b33cc9963e8f05916f1f56b9.tar.gz
zephyr: npcx_evb: Enable external power presence detection via GPIO
Enable the extpower_gpio.c module and connect the corresponding GPIOs and interrupts for npcx7/9_evb. BUG=none BRANCH=none TEST=saw the host event information when toggle the AC_PRESENT gpio Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ib9a74bffb34fdfca8ec307abfd33a4d09a960843 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3058716 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/projects/npcx_evb/npcx7/gpio.dts1
-rw-r--r--zephyr/projects/npcx_evb/npcx7/include/gpio_map.h1
-rw-r--r--zephyr/projects/npcx_evb/npcx7/prj.conf1
-rw-r--r--zephyr/projects/npcx_evb/npcx9/gpio.dts1
-rw-r--r--zephyr/projects/npcx_evb/npcx9/include/gpio_map.h1
-rw-r--r--zephyr/projects/npcx_evb/npcx9/prj.conf1
6 files changed, 6 insertions, 0 deletions
diff --git a/zephyr/projects/npcx_evb/npcx7/gpio.dts b/zephyr/projects/npcx_evb/npcx7/gpio.dts
index 37676efec4..3f10215613 100644
--- a/zephyr/projects/npcx_evb/npcx7/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx7/gpio.dts
@@ -18,6 +18,7 @@
};
ac_present {
gpios = <&gpio7 4 (GPIO_INPUT | GPIO_PULL_UP)>;
+ enum-name = "GPIO_AC_PRESENT";
label = "AC_PRESENT";
};
power_button_l {
diff --git a/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h b/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
index 7f4c2f9643..8073daad90 100644
--- a/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
+++ b/zephyr/projects/npcx_evb/npcx7/include/gpio_map.h
@@ -25,6 +25,7 @@
* GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
*/
#define EC_CROS_GPIO_INTERRUPTS \
+ GPIO_INT(GPIO_AC_PRESENT, GPIO_INT_EDGE_BOTH, extpower_interrupt) \
GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt) \
GPIO_INT(GPIO_POWER_BUTTON_L, GPIO_INT_EDGE_BOTH, \
power_button_interrupt)
diff --git a/zephyr/projects/npcx_evb/npcx7/prj.conf b/zephyr/projects/npcx_evb/npcx7/prj.conf
index 04f287d025..5bc2922e47 100644
--- a/zephyr/projects/npcx_evb/npcx7/prj.conf
+++ b/zephyr/projects/npcx_evb/npcx7/prj.conf
@@ -5,6 +5,7 @@
CONFIG_CROS_EC=y
CONFIG_PLATFORM_EC=y
CONFIG_PLATFORM_EC_BRINGUP=y
+CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_POWER_BUTTON=y
CONFIG_SHIMMED_TASKS=y
diff --git a/zephyr/projects/npcx_evb/npcx9/gpio.dts b/zephyr/projects/npcx_evb/npcx9/gpio.dts
index 37676efec4..3f10215613 100644
--- a/zephyr/projects/npcx_evb/npcx9/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx9/gpio.dts
@@ -18,6 +18,7 @@
};
ac_present {
gpios = <&gpio7 4 (GPIO_INPUT | GPIO_PULL_UP)>;
+ enum-name = "GPIO_AC_PRESENT";
label = "AC_PRESENT";
};
power_button_l {
diff --git a/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h b/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
index 7f4c2f9643..8073daad90 100644
--- a/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
+++ b/zephyr/projects/npcx_evb/npcx9/include/gpio_map.h
@@ -25,6 +25,7 @@
* GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
*/
#define EC_CROS_GPIO_INTERRUPTS \
+ GPIO_INT(GPIO_AC_PRESENT, GPIO_INT_EDGE_BOTH, extpower_interrupt) \
GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt) \
GPIO_INT(GPIO_POWER_BUTTON_L, GPIO_INT_EDGE_BOTH, \
power_button_interrupt)
diff --git a/zephyr/projects/npcx_evb/npcx9/prj.conf b/zephyr/projects/npcx_evb/npcx9/prj.conf
index c2f6720f79..a901b00adc 100644
--- a/zephyr/projects/npcx_evb/npcx9/prj.conf
+++ b/zephyr/projects/npcx_evb/npcx9/prj.conf
@@ -5,6 +5,7 @@
CONFIG_CROS_EC=y
CONFIG_PLATFORM_EC=y
CONFIG_PLATFORM_EC_BRINGUP=y
+CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_POWER_BUTTON=y
CONFIG_SHIMMED_TASKS=y