summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2021-05-13 16:01:13 -0600
committerCommit Bot <commit-bot@chromium.org>2021-05-19 19:57:44 +0000
commitdef759427d9bc1781e7b23a536694fd0ab8bb01f (patch)
treebb48994d08866dadd22f9ac8c6112a867a2c819c
parentba6eac081e5b4982346dc63059b4513786b379f7 (diff)
downloadchrome-ec-def759427d9bc1781e7b23a536694fd0ab8bb01f.tar.gz
zephyr: asurada: Enable power button and sequencing
BUG=b:180980668 BRANCH=none TEST=get powerbtn command in shell Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I1af4673b7eff84149e3aabad7ff09445a1f96e1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2895306 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--baseboard/asurada/build.mk1
-rw-r--r--baseboard/cherry/baseboard.c8
-rw-r--r--baseboard/goroh/baseboard.c8
-rw-r--r--power/build.mk2
-rw-r--r--power/it8xxx2.c (renamed from baseboard/asurada/power.c)0
-rw-r--r--zephyr/CMakeLists.txt3
-rw-r--r--zephyr/Kconfig.powerseq18
-rw-r--r--zephyr/projects/asurada/hayato/CMakeLists.txt3
-rw-r--r--zephyr/projects/asurada/hayato/include/gpio_map.h21
-rw-r--r--zephyr/projects/asurada/hayato/prj.conf12
10 files changed, 56 insertions, 20 deletions
diff --git a/baseboard/asurada/build.mk b/baseboard/asurada/build.mk
index fced6993eb..b0c152cb92 100644
--- a/baseboard/asurada/build.mk
+++ b/baseboard/asurada/build.mk
@@ -8,5 +8,4 @@
baseboard-y=baseboard.o
baseboard-y+=board_id.o
-baseboard-y+=power.o
baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
diff --git a/baseboard/cherry/baseboard.c b/baseboard/cherry/baseboard.c
index e75b1dd3b4..55131ebce5 100644
--- a/baseboard/cherry/baseboard.c
+++ b/baseboard/cherry/baseboard.c
@@ -90,14 +90,6 @@ __override void board_hibernate_late(void)
__builtin_unreachable();
}
-/* power signal list. Must match order of enum power_signal. */
-const struct power_signal_info power_signal_list[] = {
- {GPIO_PMIC_EC_PWRGD, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_AP_EC_WATCHDOG_L, POWER_SIGNAL_ACTIVE_LOW, "AP_WDT_ASSERTED"},
-};
-BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-
static void board_tcpc_init(void)
{
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
diff --git a/baseboard/goroh/baseboard.c b/baseboard/goroh/baseboard.c
index fb0731d7d7..b14521f76d 100644
--- a/baseboard/goroh/baseboard.c
+++ b/baseboard/goroh/baseboard.c
@@ -103,14 +103,6 @@ __override void board_hibernate_late(void)
__builtin_unreachable();
}
-/* power signal list. Must match order of enum power_signal. */
-const struct power_signal_info power_signal_list[] = {
- {GPIO_PMIC_EC_PWRGD, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_AP_EC_WATCHDOG_L, POWER_SIGNAL_ACTIVE_LOW, "AP_WDT_ASSERTED"},
-};
-BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-
/* Detect subboard */
static void board_tcpc_init(void)
{
diff --git a/power/build.mk b/power/build.mk
index e2b86a055e..f78605b18f 100644
--- a/power/build.mk
+++ b/power/build.mk
@@ -17,7 +17,7 @@ power-$(CONFIG_CHIPSET_ECDRIVEN)+=ec_driven.o
power-$(CONFIG_CHIPSET_ICELAKE)+=icelake.o intel_x86.o
power-$(CONFIG_CHIPSET_MT817X)+=mt817x.o
power-$(CONFIG_CHIPSET_MT8183)+=mt8183.o
-power-$(CONFIG_CHIPSET_MT8192)+=mt8192.o
+power-$(CONFIG_CHIPSET_MT8192)+=it8xxx2.o mt8192.o
power-$(CONFIG_CHIPSET_CEZANNE)+=amd_x86.o
power-$(CONFIG_CHIPSET_RK3288)+=rk3288.o
power-$(CONFIG_CHIPSET_RK3399)+=rk3399.o
diff --git a/baseboard/asurada/power.c b/power/it8xxx2.c
index 7d758b29bd..7d758b29bd 100644
--- a/baseboard/asurada/power.c
+++ b/power/it8xxx2.c
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 4d7a2430eb..6d542b350b 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -261,6 +261,9 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_INTEL
"${PLATFORM_EC}/power/intel_x86.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_HOST_SLEEP
"${PLATFORM_EC}/power/host_sleep.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_MT8192
+ "${PLATFORM_EC}/power/it8xxx2.c"
+ "${PLATFORM_EC}/power/mt8192.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_SC7180
"${PLATFORM_EC}/power/qcom.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_SC7280
diff --git a/zephyr/Kconfig.powerseq b/zephyr/Kconfig.powerseq
index 010ea0d1eb..d5d6df3a88 100644
--- a/zephyr/Kconfig.powerseq
+++ b/zephyr/Kconfig.powerseq
@@ -125,6 +125,24 @@ endif # PLATFORM_EC_POWERSEQ_ICELAKE
endif # PLATFORM_EC_POWERSEQ_INTEL
+menuconfig PLATFORM_EC_POWERSEQ_IT8XXX2
+ bool "Enable shimming common ITE8xxx2 power sequencing code"
+ depends on AP_ARM_MTK_MT8192
+ default y
+ help
+ Enable shimming platform/ec AP power sequencing code for
+ IT8xxx2.
+
+if PLATFORM_EC_POWERSEQ_IT8XXX2
+
+config PLATFORM_EC_POWERSEQ_MT8192
+ bool "Use common MT8192 code for power sequencing"
+ default y
+ help
+ Use the Comet Lake code for power sequencing.
+
+endif # PLATFORM_EC_POWERSEQ_ITE8XXX2
+
config PLATFORM_EC_POWERSEQ_SC7180
bool "SC7180 power sequencing"
depends on AP_ARM_QUALCOMM_SC7180
diff --git a/zephyr/projects/asurada/hayato/CMakeLists.txt b/zephyr/projects/asurada/hayato/CMakeLists.txt
index 1685dd6812..56eaed01ce 100644
--- a/zephyr/projects/asurada/hayato/CMakeLists.txt
+++ b/zephyr/projects/asurada/hayato/CMakeLists.txt
@@ -9,4 +9,7 @@ set(BOARD_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hayato)
+set(PLATFORM_EC_BASEBOARD "${PLATFORM_EC}/baseboard/asurada" CACHE PATH
+ "Path to the platform/ec baseboard directory")
+
zephyr_include_directories(include)
diff --git a/zephyr/projects/asurada/hayato/include/gpio_map.h b/zephyr/projects/asurada/hayato/include/gpio_map.h
index 1c9752ca6e..180134049a 100644
--- a/zephyr/projects/asurada/hayato/include/gpio_map.h
+++ b/zephyr/projects/asurada/hayato/include/gpio_map.h
@@ -27,7 +27,24 @@
* #define EC_CROS_GPIO_INTERRUPTS \
* GPIO_INT(NAMED_GPIO(h1_ec_pwr_btn_odl), GPIO_INT_EDGE_BOTH, button_print)
*/
-#define EC_CROS_GPIO_INTERRUPTS \
- GPIO_INT(GPIO_LID_OPEN, GPIO_INT_EDGE_BOTH, lid_interrupt)
+#define EC_CROS_GPIO_INTERRUPTS \
+ GPIO_INT(GPIO_LID_OPEN, \
+ GPIO_INT_EDGE_BOTH, lid_interrupt) \
+ GPIO_INT(GPIO_POWER_BUTTON_L, \
+ GPIO_INT_EDGE_BOTH, power_button_interrupt)
+
+
+
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+
+/*
+ * TODO(b:188674805) create a driver to pull this information from DeviceTree
+ */
+enum power_signal {
+ PMIC_PWR_GOOD,
+ AP_IN_S3_L,
+ AP_WDT_ASSERTED,
+ POWER_SIGNAL_COUNT,
+};
#endif /* __ZEPHYR_GPIO_MAP_H */
diff --git a/zephyr/projects/asurada/hayato/prj.conf b/zephyr/projects/asurada/hayato/prj.conf
index 3d7c1959ca..5188b5692a 100644
--- a/zephyr/projects/asurada/hayato/prj.conf
+++ b/zephyr/projects/asurada/hayato/prj.conf
@@ -6,11 +6,13 @@ CONFIG_CROS_EC=y
CONFIG_PLATFORM_EC=y
CONFIG_SHIMMED_TASKS=y
+CONFIG_KERNEL_SHELL=y
CONFIG_PLATFORM_EC_BRINGUP=y
# SoC configuration
CONFIG_AP=y
CONFIG_AP_ARM_MTK_MT8192=y
+CONFIG_HAS_TASK_CHIPSET=y
# ADC Driver
CONFIG_ADC_ITE_IT8XXX2=y
@@ -27,6 +29,16 @@ CONFIG_PLATFORM_EC_I2C=y
# Lid Switch
CONFIG_PLATFORM_EC_LID_SWITCH=y
+# Power Button
+CONFIG_PLATFORM_EC_POWER_BUTTON=y
+
+# Power Sequencing
+CONFIG_PLATFORM_EC_POWERSEQ=y
+CONFIG_PLATFORM_EC_POWERSEQ_HOST_SLEEP=y
+CONFIG_PLATFORM_EC_POWERSEQ_IT8XXX2=y
+CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
+CONFIG_PLATFORM_EC_CHIPSET_RESET_HOOK=y
+
# Serial Host Interface (SHI) device.
CONFIG_CROS_SHI_IT8XXX2=y