summaryrefslogtreecommitdiff
path: root/zephyr/projects/corsola
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/corsola')
-rw-r--r--zephyr/projects/corsola/BUILD.py139
-rw-r--r--zephyr/projects/corsola/CMakeLists.txt81
-rw-r--r--zephyr/projects/corsola/Kconfig52
-rw-r--r--zephyr/projects/corsola/adc_kingler.dts46
-rw-r--r--zephyr/projects/corsola/adc_krabby.dts38
-rw-r--r--zephyr/projects/corsola/adc_magikarp.dts63
-rw-r--r--zephyr/projects/corsola/adc_tentacruel.dts66
-rw-r--r--zephyr/projects/corsola/battery_kingler.dts15
-rw-r--r--zephyr/projects/corsola/battery_krabby.dts12
-rw-r--r--zephyr/projects/corsola/battery_magikarp.dts12
-rw-r--r--zephyr/projects/corsola/battery_steelix.dts24
-rw-r--r--zephyr/projects/corsola/battery_tentacruel.dts12
-rw-r--r--zephyr/projects/corsola/cbi_magikarp.dts36
-rw-r--r--zephyr/projects/corsola/cbi_steelix.dts95
-rw-r--r--zephyr/projects/corsola/cbi_tentacruel.dts36
-rw-r--r--zephyr/projects/corsola/common.dts25
-rw-r--r--zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts44
-rw-r--r--zephyr/projects/corsola/gpio_kingler.dts249
-rw-r--r--zephyr/projects/corsola/gpio_krabby.dts231
-rw-r--r--zephyr/projects/corsola/gpio_magikarp.dts237
-rw-r--r--zephyr/projects/corsola/gpio_steelix.dts255
-rw-r--r--zephyr/projects/corsola/gpio_tentacruel.dts235
-rw-r--r--zephyr/projects/corsola/host_interface_npcx.dts12
-rw-r--r--zephyr/projects/corsola/i2c_kingler.dts169
-rw-r--r--zephyr/projects/corsola/i2c_krabby.dts22
-rw-r--r--zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi138
-rw-r--r--zephyr/projects/corsola/i2c_magikarp.dts36
-rw-r--r--zephyr/projects/corsola/i2c_tentacruel.dts38
-rw-r--r--zephyr/projects/corsola/include/baseboard_usbc_config.h39
-rw-r--r--zephyr/projects/corsola/include/variant_db_detection.h33
-rw-r--r--zephyr/projects/corsola/interrupts_kingler.dts114
-rw-r--r--zephyr/projects/corsola/interrupts_krabby.dts110
-rw-r--r--zephyr/projects/corsola/interrupts_magikarp.dts115
-rw-r--r--zephyr/projects/corsola/interrupts_steelix.dts10
-rw-r--r--zephyr/projects/corsola/interrupts_tentacruel.dts115
-rw-r--r--zephyr/projects/corsola/keyboard_steelix.dts29
-rw-r--r--zephyr/projects/corsola/led_it81202_base.dtsi184
-rw-r--r--zephyr/projects/corsola/led_kingler.dts71
-rw-r--r--zephyr/projects/corsola/led_krabby.dts5
-rw-r--r--zephyr/projects/corsola/led_magikarp.dts136
-rw-r--r--zephyr/projects/corsola/led_steelix.dts55
-rw-r--r--zephyr/projects/corsola/led_tentacruel.dts118
-rw-r--r--zephyr/projects/corsola/motionsense_kingler.dts150
-rw-r--r--zephyr/projects/corsola/motionsense_krabby.dts146
-rw-r--r--zephyr/projects/corsola/motionsense_magikarp.dts199
-rw-r--r--zephyr/projects/corsola/motionsense_steelix.dts133
-rw-r--r--zephyr/projects/corsola/motionsense_tentacruel.dts199
-rw-r--r--zephyr/projects/corsola/npcx_keyboard.dts32
-rw-r--r--zephyr/projects/corsola/power_signal.dts26
-rw-r--r--zephyr/projects/corsola/prj.conf101
-rw-r--r--zephyr/projects/corsola/prj_it81202_base.conf93
-rw-r--r--zephyr/projects/corsola/prj_kingler.conf12
-rw-r--r--zephyr/projects/corsola/prj_krabby.conf9
-rw-r--r--zephyr/projects/corsola/prj_magikarp.conf27
-rw-r--r--zephyr/projects/corsola/prj_npcx993_base.conf95
-rw-r--r--zephyr/projects/corsola/prj_steelix.conf32
-rw-r--r--zephyr/projects/corsola/prj_tentacruel.conf26
-rw-r--r--zephyr/projects/corsola/src/board.c37
-rw-r--r--zephyr/projects/corsola/src/board_chipset.c49
-rw-r--r--zephyr/projects/corsola/src/hibernate.c22
-rw-r--r--zephyr/projects/corsola/src/kingler/board_steelix.c76
-rw-r--r--zephyr/projects/corsola/src/kingler/button.c35
-rw-r--r--zephyr/projects/corsola/src/kingler/i2c.c21
-rw-r--r--zephyr/projects/corsola/src/kingler/led.c52
-rw-r--r--zephyr/projects/corsola/src/kingler/led_steelix.c181
-rw-r--r--zephyr/projects/corsola/src/kingler/usb_pd_policy.c74
-rw-r--r--zephyr/projects/corsola/src/kingler/usbc_config.c317
-rw-r--r--zephyr/projects/corsola/src/krabby/charger_workaround.c93
-rw-r--r--zephyr/projects/corsola/src/krabby/hooks.c90
-rw-r--r--zephyr/projects/corsola/src/krabby/i2c.c19
-rw-r--r--zephyr/projects/corsola/src/krabby/keyboard_magikarp.c29
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_krabby.c31
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_magikarp.c44
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_tentacruel.c89
-rw-r--r--zephyr/projects/corsola/src/krabby/sensor_magikarp.c41
-rw-r--r--zephyr/projects/corsola/src/krabby/sensor_tentacruel.c41
-rw-r--r--zephyr/projects/corsola/src/krabby/temp_tentacruel.c129
-rw-r--r--zephyr/projects/corsola/src/krabby/usb_pd_policy.c88
-rw-r--r--zephyr/projects/corsola/src/krabby/usbc_config.c141
-rw-r--r--zephyr/projects/corsola/src/usb_pd_policy.c226
-rw-r--r--zephyr/projects/corsola/src/usbc_config.c319
-rw-r--r--zephyr/projects/corsola/src/variant_db_detection.c115
-rw-r--r--zephyr/projects/corsola/thermistor_tentacruel.dts140
-rw-r--r--zephyr/projects/corsola/usba.dts11
-rw-r--r--zephyr/projects/corsola/usba_steelix.dts10
-rw-r--r--zephyr/projects/corsola/usbc_kingler.dts56
-rw-r--r--zephyr/projects/corsola/usbc_krabby.dts59
-rw-r--r--zephyr/projects/corsola/usbc_magikarp.dts59
-rw-r--r--zephyr/projects/corsola/usbc_tentacruel.dts60
89 files changed, 7586 insertions, 0 deletions
diff --git a/zephyr/projects/corsola/BUILD.py b/zephyr/projects/corsola/BUILD.py
new file mode 100644
index 0000000000..4e82ab7926
--- /dev/null
+++ b/zephyr/projects/corsola/BUILD.py
@@ -0,0 +1,139 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Define zmake projects for corsola."""
+
+# Default chip is it81202bx, some variants will use NPCX9X.
+
+
+def register_corsola_project(
+ project_name,
+ chip="it81202bx",
+ extra_dts_overlays=(),
+ extra_kconfig_files=(),
+):
+ """Register a variant of corsola."""
+ register_func = register_binman_project
+ if chip.startswith("npcx"):
+ register_func = register_npcx_project
+
+ register_func(
+ project_name=project_name,
+ zephyr_board=chip,
+ dts_overlays=[
+ here / "common.dts",
+ here / "power_signal.dts",
+ here / "usba.dts",
+ *extra_dts_overlays,
+ ],
+ kconfig_files=[here / "prj.conf", *extra_kconfig_files],
+ )
+
+
+register_corsola_project(
+ "krabby",
+ extra_dts_overlays=[
+ here / "adc_krabby.dts",
+ here / "battery_krabby.dts",
+ here / "gpio_krabby.dts",
+ here / "i2c_krabby.dts",
+ here / "interrupts_krabby.dts",
+ here / "led_krabby.dts",
+ here / "motionsense_krabby.dts",
+ here / "usbc_krabby.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_krabby.conf",
+ ],
+)
+
+register_corsola_project(
+ project_name="kingler",
+ chip="npcx9m3f",
+ extra_dts_overlays=[
+ here / "adc_kingler.dts",
+ here / "battery_kingler.dts",
+ here / "host_interface_npcx.dts",
+ here / "i2c_kingler.dts",
+ here / "interrupts_kingler.dts",
+ here / "gpio_kingler.dts",
+ here / "npcx_keyboard.dts",
+ here / "led_kingler.dts",
+ here / "motionsense_kingler.dts",
+ here / "usbc_kingler.dts",
+ here / "default_gpio_pinctrl_kingler.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_npcx993_base.conf",
+ here / "prj_kingler.conf",
+ ],
+)
+
+register_corsola_project(
+ project_name="steelix",
+ chip="npcx9m3f",
+ extra_dts_overlays=[
+ here / "adc_kingler.dts",
+ here / "battery_steelix.dts",
+ here / "host_interface_npcx.dts",
+ here / "i2c_kingler.dts",
+ here / "interrupts_kingler.dts",
+ here / "interrupts_steelix.dts",
+ here / "cbi_steelix.dts",
+ here / "gpio_steelix.dts",
+ here / "npcx_keyboard.dts",
+ here / "keyboard_steelix.dts",
+ here / "led_steelix.dts",
+ here / "motionsense_kingler.dts",
+ here / "motionsense_steelix.dts",
+ here / "usba_steelix.dts",
+ here / "usbc_kingler.dts",
+ here / "default_gpio_pinctrl_kingler.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_npcx993_base.conf",
+ here / "prj_steelix.conf",
+ ],
+)
+
+
+register_corsola_project(
+ "tentacruel",
+ extra_dts_overlays=[
+ here / "adc_tentacruel.dts",
+ here / "battery_tentacruel.dts",
+ here / "cbi_tentacruel.dts",
+ here / "gpio_tentacruel.dts",
+ here / "i2c_tentacruel.dts",
+ here / "interrupts_tentacruel.dts",
+ here / "led_tentacruel.dts",
+ here / "motionsense_tentacruel.dts",
+ here / "usbc_tentacruel.dts",
+ here / "thermistor_tentacruel.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_tentacruel.conf",
+ ],
+)
+
+register_corsola_project(
+ "magikarp",
+ extra_dts_overlays=[
+ here / "adc_magikarp.dts",
+ here / "battery_magikarp.dts",
+ here / "cbi_magikarp.dts",
+ here / "gpio_magikarp.dts",
+ here / "i2c_magikarp.dts",
+ here / "interrupts_magikarp.dts",
+ here / "led_magikarp.dts",
+ here / "motionsense_magikarp.dts",
+ here / "usbc_magikarp.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_magikarp.conf",
+ ],
+)
diff --git a/zephyr/projects/corsola/CMakeLists.txt b/zephyr/projects/corsola/CMakeLists.txt
new file mode 100644
index 0000000000..fa899a0e77
--- /dev/null
+++ b/zephyr/projects/corsola/CMakeLists.txt
@@ -0,0 +1,81 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+cmake_minimum_required(VERSION 3.13.1)
+
+find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
+
+cros_ec_library_include_directories(include)
+
+# Include selected EC source from the baseboard
+zephyr_library_sources(
+ "src/board.c"
+ "src/board_chipset.c"
+ "src/hibernate.c"
+)
+
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "src/usbc_config.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "src/usb_pd_policy.c")
+zephyr_library_sources_ifdef(CONFIG_VARIANT_CORSOLA_DB_DETECTION
+ "src/variant_db_detection.c")
+
+if(DEFINED CONFIG_BOARD_KRABBY)
+ project(krabby)
+ zephyr_library_sources("src/krabby/hooks.c"
+ "src/krabby/charger_workaround.c"
+ "src/krabby/ppc_krabby.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/krabby/i2c.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usb_pd_policy.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usbc_config.c")
+elseif(DEFINED CONFIG_BOARD_KINGLER)
+ project(kingler)
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/kingler/i2c.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
+ "src/kingler/led.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/kingler/usb_pd_policy.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/kingler/usbc_config.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BUTTONS_RUNTIME_CONFIG
+ "src/kingler/button.c")
+elseif(DEFINED CONFIG_BOARD_STEELIX)
+ project(steelix)
+ zephyr_library_sources("src/kingler/board_steelix.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/kingler/i2c.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
+ "src/kingler/led_steelix.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/kingler/usb_pd_policy.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/kingler/usbc_config.c")
+
+elseif(DEFINED CONFIG_BOARD_TENTACRUEL)
+ project(tentacruel)
+ zephyr_library_sources("src/krabby/hooks.c"
+ "src/krabby/charger_workaround.c"
+ "src/krabby/sensor_tentacruel.c"
+ "src/krabby/temp_tentacruel.c"
+ "src/krabby/ppc_tentacruel.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/krabby/i2c.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usb_pd_policy.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usbc_config.c")
+
+elseif(DEFINED CONFIG_BOARD_MAGIKARP)
+ project(magikarp)
+ zephyr_library_sources("src/krabby/hooks.c"
+ "src/krabby/sensor_magikarp.c"
+ "src/krabby/ppc_magikarp.c"
+ "src/krabby/keyboard_magikarp.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/krabby/i2c.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usb_pd_policy.c")
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/krabby/usbc_config.c")
+
+endif()
+
diff --git a/zephyr/projects/corsola/Kconfig b/zephyr/projects/corsola/Kconfig
new file mode 100644
index 0000000000..4f66601c20
--- /dev/null
+++ b/zephyr/projects/corsola/Kconfig
@@ -0,0 +1,52 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+config BOARD_KRABBY
+ bool "Google Krabby Board"
+ help
+ Build Google Krabby reference board. Krabby has MediaTek MT8186 SoC
+ with ITE it81202-bx EC.
+
+config BOARD_KINGLER
+ bool "Google Kingler Board"
+ help
+ Build Google Kingler reference board. Krabby has MediaTek MT8186 SoC
+ with NPCX993FA0BX EC.
+
+config BOARD_STEELIX
+ bool "Google Steelix Board"
+ help
+ Build Google Steelix variant board. Steelix is a variant of Kingler
+ and has MediaTek MT8186 SoC with NPCX993FA0BX EC.
+
+config BOARD_TENTACRUEL
+ bool "Google Tentacruel Board"
+ help
+ Build Google Tentacruel variant board. Tentacruel is a variant of Krabby
+ and has MediaTek MT8186 SoC with ITE it81202-bx EC.
+
+config BOARD_MAGIKARP
+ bool "Google Magikarp Board"
+ help
+ Build Google Magikarp variant board. Magikarp is a variant of Krabby
+ and has MediaTek MT8186 SoC with ITE it81202-bx EC.
+
+config VARIANT_CORSOLA_DB_DETECTION
+ bool "Corsola Platform Runtime Daughter Board Detection"
+ depends on PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG
+ depends on PLATFORM_EC_USB_MUX_RUNTIME_CONFIG
+ help
+ Daughter board detection for Type-C subboard or HDMI subboard. This
+ includes pin configuration and driver loading.
+ default y
+
+config VARIANT_CORSOLA_USBA
+ bool "Corsola Platform USB-A support"
+ help
+ Support Corsola USB-A related functions. Enable this function if
+ it has USB-A ports.
+ depends on PLATFORM_EC_USBC
+ default y
+
+source "Kconfig.zephyr"
diff --git a/zephyr/projects/corsola/adc_kingler.dts b/zephyr/projects/corsola/adc_kingler.dts
new file mode 100644
index 0000000000..7b69abe48a
--- /dev/null
+++ b/zephyr/projects/corsola/adc_kingler.dts
@@ -0,0 +1,46 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Kingler and Steelix use the same dts, take care of this when modify it.
+ */
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+
+ adc_charger_pmon_r {
+ enum-name = "ADC_PSYS";
+ io-channels = <&adc0 0>;
+ /*
+ * ISL9238C PSYS output is 1.44 uA/W over 33K resistor.
+ */
+ mul = <21043>;
+ };
+ adc_ec_id0 {
+ enum-name = "ADC_ID_0";
+ io-channels = <&adc0 1>;
+ };
+ adc_ec_id1 {
+ enum-name = "ADC_ID_1";
+ io-channels = <&adc0 2>;
+ };
+ adc_charger_amon_r {
+ enum-name = "ADC_AMON_BMON";
+ io-channels = <&adc0 3>;
+ mul = <1000>;
+ div = <18>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_chan0_gp45
+ &adc0_chan1_gp44
+ &adc0_chan2_gp43
+ &adc0_chan3_gp42>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/adc_krabby.dts b/zephyr/projects/corsola/adc_krabby.dts
new file mode 100644
index 0000000000..be65e9eea7
--- /dev/null
+++ b/zephyr/projects/corsola/adc_krabby.dts
@@ -0,0 +1,38 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+
+ adc_vbus_c0 {
+ enum-name = "ADC_VBUS_C0";
+ io-channels = <&adc0 0>;
+ mul = <10>;
+ };
+ adc_board_id0 {
+ enum-name = "ADC_BOARD_ID_0";
+ io-channels = <&adc0 1>;
+ };
+ adc_board_id1 {
+ enum-name = "ADC_BOARD_ID_1";
+ io-channels = <&adc0 2>;
+ };
+ adc_vbus_c1 {
+ enum-name = "ADC_VBUS_C1";
+ io-channels = <&adc0 7>;
+ mul = <10>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_ch0_gpi0_default
+ &adc0_ch1_gpi1_default
+ &adc0_ch2_gpi2_default
+ &adc0_ch7_gpi7_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/adc_magikarp.dts b/zephyr/projects/corsola/adc_magikarp.dts
new file mode 100644
index 0000000000..358af6f0f4
--- /dev/null
+++ b/zephyr/projects/corsola/adc_magikarp.dts
@@ -0,0 +1,63 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <cros/thermistor/thermistor.dtsi>
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+ adc_vbus_c0 {
+ enum-name = "ADC_VBUS_C0";
+ io-channels = <&adc0 0>;
+ mul = <10>;
+ };
+ adc_board_id0 {
+ enum-name = "ADC_BOARD_ID_0";
+ io-channels = <&adc0 1>;
+ };
+ adc_board_id1 {
+ enum-name = "ADC_BOARD_ID_1";
+ io-channels = <&adc0 2>;
+ };
+ adc_vbus_c1 {
+ enum-name = "ADC_VBUS_C1";
+ io-channels = <&adc0 7>;
+ mul = <10>;
+ };
+ adc_ambient: ambient {
+ enum-name = "ADC_TEMP_SENSOR_2_AMBIENT";
+ io-channels = <&adc0 5>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_ch0_gpi0_default
+ &adc0_ch1_gpi1_default
+ &adc0_ch2_gpi2_default
+ &adc0_ch5_gpi5_default
+ &adc0_ch7_gpi7_default>;
+ pinctrl-names = "default";
+};
+
+/ {
+ temp_ambient: ambient {
+ compatible = "cros-ec,temp-sensor-thermistor";
+ thermistor = <&thermistor_3V3_30K9_47K_NCP15WB>;
+ adc = <&adc_ambient>;
+ };
+
+ named-temp-sensors {
+ compatible = "cros-ec,temp-sensors";
+ ambient {
+ sensor = <&temp_ambient>;
+ };
+ };
+};
+
+&thermistor_3V3_30K9_47K_NCP15WB {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/adc_tentacruel.dts b/zephyr/projects/corsola/adc_tentacruel.dts
new file mode 100644
index 0000000000..1b5e849589
--- /dev/null
+++ b/zephyr/projects/corsola/adc_tentacruel.dts
@@ -0,0 +1,66 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <cros/thermistor/thermistor.dtsi>
+
+/ {
+ named-adc-channels {
+ compatible = "named-adc-channels";
+ adc_vbus_c0 {
+ enum-name = "ADC_VBUS_C0";
+ io-channels = <&adc0 0>;
+ mul = <10>;
+ };
+ adc_board_id0 {
+ enum-name = "ADC_BOARD_ID_0";
+ io-channels = <&adc0 1>;
+ };
+ adc_board_id1 {
+ enum-name = "ADC_BOARD_ID_1";
+ io-channels = <&adc0 2>;
+ };
+ adc_vbus_c1 {
+ enum-name = "ADC_VBUS_C1";
+ io-channels = <&adc0 7>;
+ mul = <10>;
+ };
+ adc_ambient: ambient {
+ enum-name = "ADC_TEMP_SENSOR_2_AMBIENT";
+ io-channels = <&adc0 5>;
+ };
+ };
+};
+
+&adc0 {
+ status = "okay";
+ pinctrl-0 = <&adc0_ch0_gpi0_default
+ &adc0_ch1_gpi1_default
+ &adc0_ch2_gpi2_default
+ &adc0_ch5_gpi5_default
+ &adc0_ch7_gpi7_default>;
+ pinctrl-names = "default";
+};
+
+/ {
+ temp_ambient: ambient {
+ compatible = "cros-ec,temp-sensor-thermistor";
+ thermistor = <&thermistor_3V3_30K9_47K_NCP15WB>;
+ adc = <&adc_ambient>;
+ };
+
+ named-temp-sensors {
+ compatible = "cros-ec,temp-sensors";
+ ambient {
+ sensor = <&temp_ambient>;
+ };
+ temp_charger: charger {
+ sensor = <&charger>;
+ };
+ };
+};
+
+&thermistor_3V3_30K9_47K_NCP15WB {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/battery_kingler.dts b/zephyr/projects/corsola/battery_kingler.dts
new file mode 100644
index 0000000000..b01fb8a46d
--- /dev/null
+++ b/zephyr/projects/corsola/battery_kingler.dts
@@ -0,0 +1,15 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: smp_l20m3pg2 {
+ compatible = "smp,l20m3pg2", "battery-smart";
+ };
+ lgc_l20l3pg2 {
+ compatible = "lgc,l20l3pg2", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/battery_krabby.dts b/zephyr/projects/corsola/battery_krabby.dts
new file mode 100644
index 0000000000..ce41859182
--- /dev/null
+++ b/zephyr/projects/corsola/battery_krabby.dts
@@ -0,0 +1,12 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: c235 {
+ compatible = "celxpert,c235-41", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/battery_magikarp.dts b/zephyr/projects/corsola/battery_magikarp.dts
new file mode 100644
index 0000000000..bbdd6ac0c5
--- /dev/null
+++ b/zephyr/projects/corsola/battery_magikarp.dts
@@ -0,0 +1,12 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: smp_c31n1915 {
+ compatible = "smp,c31n1915", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/battery_steelix.dts b/zephyr/projects/corsola/battery_steelix.dts
new file mode 100644
index 0000000000..594c83478c
--- /dev/null
+++ b/zephyr/projects/corsola/battery_steelix.dts
@@ -0,0 +1,24 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: byd_l22b3pg0 {
+ compatible = "byd,l22b3pg0", "battery-smart";
+ };
+ celxpert_l22c3pg0 {
+ compatible = "celxpert,l22c3pg0", "battery-smart";
+ };
+ cosmx_l22x3pg0 {
+ compatible = "cosmx,l22x3pg0", "battery-smart";
+ };
+ smp_l22m3pg0 {
+ compatible = "smp,l22m3pg0", "battery-smart";
+ };
+ sunwoda_l22d3pg0 {
+ compatible = "sunwoda,l22d3pg0", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/battery_tentacruel.dts b/zephyr/projects/corsola/battery_tentacruel.dts
new file mode 100644
index 0000000000..f116c20a51
--- /dev/null
+++ b/zephyr/projects/corsola/battery_tentacruel.dts
@@ -0,0 +1,12 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: dynapack_c140254 {
+ compatible = "dynapack,c140254", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/cbi_magikarp.dts b/zephyr/projects/corsola/cbi_magikarp.dts
new file mode 100644
index 0000000000..5eac6b82c6
--- /dev/null
+++ b/zephyr/projects/corsola/cbi_magikarp.dts
@@ -0,0 +1,36 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ /* magikarp-specific fw_config fields. */
+ magikarp-fw-config {
+ compatible = "cros-ec,cbi-fw-config";
+ /*
+ * FW_CONFIG field to describe mainboard orientation in chassis.
+ */
+ base-gyro {
+ enum-name = "FW_BASE_GYRO";
+ start = <0>;
+ size = <2>;
+
+ None {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_NONE";
+ value = <0>;
+ };
+ icm42607 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_ICM42607";
+ value = <1>;
+ default;
+ };
+ bmi323 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_BMI323";
+ value = <2>;
+ };
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/cbi_steelix.dts b/zephyr/projects/corsola/cbi_steelix.dts
new file mode 100644
index 0000000000..f4918b1577
--- /dev/null
+++ b/zephyr/projects/corsola/cbi_steelix.dts
@@ -0,0 +1,95 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ steelix-fw-config {
+ compatible = "cros-ec,cbi-fw-config";
+
+ /*
+ * FW_CONFIG field to indicate the device is clamshell
+ * or convertible.
+ */
+ form_factor {
+ enum-name = "FORM_FACTOR";
+ start = <13>;
+ size = <3>;
+
+ convertible {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "CONVERTIBLE";
+ value = <1>;
+ };
+ clamshell {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "CLAMSHELL";
+ value = <0>;
+ };
+ };
+
+ /* FW_CONFIG field to indicate which DB is attached. */
+ db_config: db {
+ enum-name = "DB";
+ start = <0>;
+ size = <4>;
+
+ sub-board-1 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "DB_NONE";
+ value = <0>;
+ };
+ sub-board-2 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "DB_USBA_HDMI";
+ value = <1>;
+ };
+ sub-board-3 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "DB_USBA_HDMI_LTE";
+ value = <2>;
+ };
+ };
+ };
+
+ /* Steelix-specific ssfc fields. */
+ steelix-ssfc {
+ compatible = "named-cbi-ssfc";
+
+ /* SSFC field to identify BASE motion sensor. */
+ base-sensor {
+ enum-name = "BASE_SENSOR";
+ size = <3>;
+
+ base_sensor_0: bmi323 {
+ compatible = "named-cbi-ssfc-value";
+ status = "okay";
+ value = <1>;
+ default;
+ };
+ base_sensor_1: lsm6dsm {
+ compatible = "named-cbi-ssfc-value";
+ status = "okay";
+ value = <2>;
+ };
+ };
+
+ /* SSFC field to identify LID motion sensor. */
+ lid-sensor {
+ enum-name = "LID_SENSOR";
+ size = <3>;
+
+ lid_sensor_0: bma422 {
+ compatible = "named-cbi-ssfc-value";
+ status = "okay";
+ value = <1>;
+ default;
+ };
+ lid_sensor_1: lis2dw12 {
+ compatible = "named-cbi-ssfc-value";
+ status = "okay";
+ value = <2>;
+ };
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/cbi_tentacruel.dts b/zephyr/projects/corsola/cbi_tentacruel.dts
new file mode 100644
index 0000000000..2cd4594417
--- /dev/null
+++ b/zephyr/projects/corsola/cbi_tentacruel.dts
@@ -0,0 +1,36 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ /* tentacruel-specific fw_config fields. */
+ tentacruel-fw-config {
+ compatible = "cros-ec,cbi-fw-config";
+ /*
+ * FW_CONFIG field to describe mainboard orientation in chassis.
+ */
+ base-gyro {
+ enum-name = "FW_BASE_GYRO";
+ start = <8>;
+ size = <2>;
+
+ None {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_NONE";
+ value = <0>;
+ };
+ icm42607 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_ICM42607";
+ value = <1>;
+ default;
+ };
+ bmi323 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_BASE_BMI323";
+ value = <2>;
+ };
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/common.dts b/zephyr/projects/corsola/common.dts
new file mode 100644
index 0000000000..001dcc7ce3
--- /dev/null
+++ b/zephyr/projects/corsola/common.dts
@@ -0,0 +1,25 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/wake_mask_event_defines.h>
+
+/ {
+ ec-mkbp-host-event-wakeup-mask {
+ compatible = "ec-wake-mask-event";
+ wakeup-mask = <(
+ HOST_EVENT_AC_CONNECTED |
+ HOST_EVENT_AC_DISCONNECTED |
+ HOST_EVENT_LID_OPEN |
+ HOST_EVENT_POWER_BUTTON |
+ HOST_EVENT_HANG_DETECT |
+ HOST_EVENT_MODE_CHANGE)>;
+ };
+
+ ec-mkbp-event-wakeup-mask {
+ compatible = "ec-wake-mask-event";
+ wakeup-mask = <(MKBP_EVENT_KEY_MATRIX |
+ MKBP_EVENT_HOST_EVENT)>;
+ };
+};
diff --git a/zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts b/zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts
new file mode 100644
index 0000000000..604658a145
--- /dev/null
+++ b/zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts
@@ -0,0 +1,44 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Adds the &alt1_no_lpc_espi setting over the NPCX9 default setting. */
+&{/def-io-conf-list} {
+ pinmux = <&alt0_gpio_no_spip
+ &alt0_gpio_no_fpip
+ &alt1_no_pwrgd
+ &alt1_no_lpc_espi
+ &alta_no_peci_en
+ &altd_npsl_in1_sl
+ &altd_npsl_in2_sl
+ &altd_psl_in3_sl
+ &altd_psl_in4_sl
+ &alt7_no_ksi0_sl
+ &alt7_no_ksi1_sl
+ &alt7_no_ksi2_sl
+ &alt7_no_ksi3_sl
+ &alt7_no_ksi4_sl
+ &alt7_no_ksi5_sl
+ &alt7_no_ksi6_sl
+ &alt7_no_ksi7_sl
+ &alt8_no_kso00_sl
+ &alt8_no_kso01_sl
+ &alt8_no_kso02_sl
+ &alt8_no_kso03_sl
+ &alt8_no_kso04_sl
+ &alt8_no_kso05_sl
+ &alt8_no_kso06_sl
+ &alt8_no_kso07_sl
+ &alt9_no_kso08_sl
+ &alt9_no_kso09_sl
+ &alt9_no_kso10_sl
+ &alt9_no_kso11_sl
+ &alt9_no_kso12_sl
+ &alt9_no_kso13_sl
+ &alt9_no_kso14_sl
+ &alt9_no_kso15_sl
+ &alta_no_kso16_sl
+ &alta_no_kso17_sl
+ &altg_psl_gpo_sl>;
+};
diff --git a/zephyr/projects/corsola/gpio_kingler.dts b/zephyr/projects/corsola/gpio_kingler.dts
new file mode 100644
index 0000000000..9a827a06dd
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_kingler.dts
@@ -0,0 +1,249 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &gpio_ec_wp_l;
+ gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ /*
+ * In npcx9 series, gpio46, gpio47, and the whole gpio5 port
+ * belong to VHIF power well. On kingler, it is connencted to
+ * 1.8V.
+ */
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpio5 6 GPIO_INPUT>;
+ };
+ spi_ap_clk_ec {
+ gpios = <&gpio5 5 GPIO_INPUT>;
+ };
+ spi_ap_cs_ec_l {
+ gpios = <&gpio5 3 GPIO_INPUT>;
+ };
+ spi_ap_do_ec_di {
+ gpios = <&gpio4 6 GPIO_INPUT>;
+ };
+ spi_ap_di_ec_do {
+ gpios = <&gpio4 7 GPIO_INPUT>;
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpio5 1 (GPIO_INPUT | GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpio5 2 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpio5 4 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioc 6 GPIO_OUTPUT_LOW>;
+ };
+ en_ec_id_odl {
+ gpios = <&gpio7 6 GPIO_ODR_HIGH>;
+ };
+ sys_rst_odl {
+ gpios = <&gpioc 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ ec_i2c_sensor_scl {
+ gpios = <&gpiob 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_sensor_sda {
+ gpios = <&gpiob 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_usb_c0_scl {
+ gpios = <&gpio9 0 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c0_sda {
+ gpios = <&gpio8 7 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_scl {
+ gpios = <&gpio9 2 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_sda {
+ gpios = <&gpio9 1 GPIO_INPUT>;
+ };
+ ec_i2c_pwr_cbi_scl {
+ gpios = <&gpiod 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_pwr_cbi_sda {
+ gpios = <&gpiod 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_batt_scl {
+ gpios = <&gpio3 3 GPIO_INPUT>;
+ };
+ ec_i2c_batt_sda {
+ gpios = <&gpio3 6 GPIO_INPUT>;
+ };
+ ec_pen_chg_dis_odl {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpio8 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_wp_l: ec_wp_odl {
+ gpios = <&gpioe 3 (GPIO_INPUT | GPIO_ACTIVE_LOW |
+ GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l {
+ gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_tablet_mode_l: tablet_mode_l {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ec_ap_int_odl {
+ gpios = <&gpioc 1 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ gpio_ec_kso_02_inv: ec_kso_02_inv {
+ gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
+ };
+ gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl {
+ gpios = <&gpio8 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_BC12_INT_ODL";
+ };
+ ec_entering_rw {
+ gpios = <&gpio0 3 GPIO_OUTPUT_LOW>;
+ };
+ charger_prochot_odl {
+ gpios = <&gpiob 1 GPIO_INPUT>;
+ };
+ ec_rst_odl {
+ gpios = <&gpio7 7 GPIO_INPUT>;
+ };
+ gpio_lid_open: lid_open {
+ gpios = <&gpiod 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ gpio_acok_od: acok_od {
+ gpios = <&gpio0 0 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl {
+ gpios = <&gpio0 1 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpio0 2 GPIO_OUTPUT_LOW>;
+ };
+ packet_mode_en {
+ gpios = <&gpio7 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiod 4 GPIO_INPUT>;
+ };
+ /*
+ * In npcx9 series, gpio93-97, the whole gpioa port, and gpiob0
+ * belong to VSPI power rail. On kingler, it is connencted to
+ * 1.8V.
+ */
+ ap_sysrst_odl_r: ap_sysrst_odl_r {
+ gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioa 3 GPIO_INPUT>;
+ };
+ gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl {
+ gpios = <&gpio6 7 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PPC_INT_ODL";
+ };
+ pg_pp5000_z2_od {
+ gpios = <&gpio7 0 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpio6 2 GPIO_OUTPUT_LOW>;
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpio6 3 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpio4 0 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpiod 3 GPIO_OUTPUT_LOW>;
+ };
+ gpio_usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl {
+ gpios = <&gpio7 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_TCPC_INT_ODL";
+ };
+ gpio_usb_c0_tcpc_rst: usb_c0_tcpc_rst {
+ gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpio3 7 GPIO_INPUT>;
+ };
+ en_pp5000_z2 {
+ gpios = <&gpio3 4 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl {
+ gpios = <&gpioe 1 GPIO_INPUT>;
+ };
+ ec_batt_pres_odl {
+ gpios = <&gpioe 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ usb_a0_fault_odl {
+ gpios = <&gpioc 7 GPIO_INPUT>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpio6 1 GPIO_ODR_HIGH>;
+ };
+ ec_pmic_en_odl {
+ gpios = <&gpio7 4 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ gpio_ec_volup_btn_odl: ec_volup_btn_odl {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ec_voldn_btn_odl: ec_voldn_btn_odl {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ /* unimplemented GPIOs */
+ entering-rw {
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ };
+
+ /*
+ * aliases for sub-board GPIOs
+ */
+ aliases {
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <
+ &int_ac_present
+ &int_power_button
+ &int_lid_open
+ >;
+ };
+};
diff --git a/zephyr/projects/corsola/gpio_krabby.dts b/zephyr/projects/corsola/gpio_krabby.dts
new file mode 100644
index 0000000000..5f06609f43
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_krabby.dts
@@ -0,0 +1,231 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/gpio_defines.h>
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &ec_flash_wp_odl;
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ power_button_l: power_button_l {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ lid_open: lid_open {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ tablet_mode_l: tablet_mode_l {
+ gpios = <&gpioj 7 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpiod 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpiob 6 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpiom 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l: lid_accel_int_l {
+ gpios = <&gpiom 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ volume_down_l: volume_down_l {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ volume_up_l: volume_up_l {
+ gpios = <&gpiod 6 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioj 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ac_present: ac_present {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
+ };
+ ec_flash_wp_odl: ec_flash_wp_odl {
+ gpios = <&gpioi 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ };
+ spi0_cs: spi0_cs {
+ gpios = <&gpiom 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ };
+ usb_c0_ppc_bc12_int_odl: usb_c0_ppc_bc12_int_odl {
+ gpios = <&gpiod 1 GPIO_INPUT>;
+ };
+ usb_c1_bc12_charger_int_odl: usb_c1_bc12_charger_int_odl {
+ gpios = <&gpioj 4 GPIO_INPUT>;
+ };
+ ec_pmic_en_odl: ec_pmic_en_odl {
+ gpios = <&gpiod 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ en_pp5000_z2: en_pp5000_z2 {
+ gpios = <&gpioc 6 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioe 3 GPIO_OUTPUT_LOW>;
+ };
+ sys_rst_odl: sys_rst_odl {
+ gpios = <&gpiog 1 GPIO_ODR_LOW>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpiob 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ ap_sysrst_odl_r: ap_ec_sysrst_odl {
+ gpios = <&gpioj 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpioc 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ec_int_l: ec_int_l {
+ gpios = <&gpioe 6 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpiog 0 GPIO_OUTPUT_HIGH>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpioj 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpiob 7 GPIO_OUTPUT_LOW>;
+ };
+ usb_c0_ppc_frsinfo: usb_c0_ppc_frsinfo {
+ gpios = <&gpiof 0 GPIO_INPUT>;
+ };
+ ec_batt_pres_odl: ec_batt_pres_odl {
+ gpios = <&gpioc 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ en_ec_id_odl: en_ec_id_odl {
+ gpios = <&gpioh 5 GPIO_ODR_HIGH>;
+ };
+ entering_rw: entering_rw {
+ gpios = <&gpioc 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpiog 3 GPIO_OUTPUT_LOW>;
+ };
+ usb_a0_fault_odl: usb_a0_fault_odl {
+ gpios = <&gpioj 6 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpioh 4 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpioj 1 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpioj 3 GPIO_INPUT>;
+ };
+ gpio_packet_mode_en: packet_mode_en {
+ gpios = <&gpiod 4 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioc 4 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <&int_ac_present
+ &int_power_button
+ &int_lid_open>;
+ };
+
+ unused-pins {
+ compatible = "unused-gpios";
+
+ unused-gpios =
+ /* pg_pp5000_z2_od */
+ <&gpiod 2 GPIO_INPUT>,
+ /* pg_mt6315_proc_b_odl */
+ <&gpioe 1 GPIO_INPUT>,
+ /* ec_pen_chg_dis_odl */
+ <&gpioh 3 GPIO_ODR_HIGH>,
+ /* unnamed nc pins */
+ <&gpioa 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 7 GPIO_INPUT_PULL_DOWN>,
+ <&gpiod 7 GPIO_INPUT_PULL_DOWN>,
+ <&gpiof 1 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 0 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 5 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpiom 6 (GPIO_INPUT_PULL_DOWN | GPIO_VOLTAGE_1P8)>,
+ /* spi_clk_gpg6 */
+ <&gpiog 6 GPIO_INPUT_PULL_UP>,
+ /* spi_mosi_gpg4 */
+ <&gpiog 4 GPIO_OUTPUT_LOW>,
+ /* spi_miso_gpg5 */
+ <&gpiog 5 GPIO_OUTPUT_LOW>,
+ /* spi_cs_gpg7 */
+ <&gpiog 7 GPIO_OUTPUT_LOW>;
+ };
+};
+
+&pinctrl {
+ /* I2C property setting */
+ i2c0_clk_gpb3_default: i2c0_clk_gpb3_default {
+ gpio-voltage = "1v8";
+ };
+ i2c0_data_gpb4_default: i2c0_data_gpb4_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_clk_gpf2_default: i2c3_clk_gpf2_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_data_gpf3_default: i2c3_data_gpf3_default {
+ gpio-voltage = "1v8";
+ };
+ /* SHI property setting */
+ shi_mosi_gpm0_default: shi_mosi_gpm0_default {
+ gpio-voltage = "1v8";
+ };
+ shi_miso_gpm1_default: shi_miso_gpm1_default {
+ gpio-voltage = "1v8";
+ };
+ shi_clk_gpm4_default: shi_clk_gpm4_default {
+ gpio-voltage = "1v8";
+ };
+ shi_cs_gpm5_default: shi_cs_gpm5_default {
+ gpio-voltage = "1v8";
+ };
+};
diff --git a/zephyr/projects/corsola/gpio_magikarp.dts b/zephyr/projects/corsola/gpio_magikarp.dts
new file mode 100644
index 0000000000..cb9f6f1a0a
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_magikarp.dts
@@ -0,0 +1,237 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/gpio_defines.h>
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &ec_flash_wp_odl;
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ power_button_l: power_button_l {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ lid_open: lid_open {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ tablet_mode_l: tablet_mode_l {
+ gpios = <&gpioj 7 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpiod 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpiob 6 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpiom 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l: lid_accel_int_l {
+ gpios = <&gpiom 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ volume_down_l: volume_down_l {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ volume_up_l: volume_up_l {
+ gpios = <&gpiod 6 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioj 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ac_present: ac_present {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
+ };
+ ec_flash_wp_odl: ec_flash_wp_odl {
+ gpios = <&gpioi 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ };
+ spi0_cs: spi0_cs {
+ gpios = <&gpiom 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ };
+ usb_c0_ppc_int_odl: usb_c0_ppc_int_odl {
+ gpios = <&gpiod 1 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PPC_INT_ODL";
+ };
+ usb_c0_bc12_int_odl: usb_c0_bc12_int_odl {
+ gpios = <&gpiof 1 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_BC12_INT_ODL";
+ };
+ usb_c1_bc12_charger_int_odl: usb_c1_bc12_charger_int_odl {
+ gpios = <&gpioj 4 GPIO_INPUT>;
+ };
+ ec_pmic_en_odl: ec_pmic_en_odl {
+ gpios = <&gpiod 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ en_pp5000_z2: en_pp5000_z2 {
+ gpios = <&gpioc 6 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioe 3 GPIO_OUTPUT_LOW>;
+ };
+ sys_rst_odl: sys_rst_odl {
+ gpios = <&gpiog 1 GPIO_ODR_LOW>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpiob 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ ap_sysrst_odl_r: ap_ec_sysrst_odl {
+ gpios = <&gpioj 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpioc 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ec_int_l: ec_int_l {
+ gpios = <&gpioe 6 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpiog 0 GPIO_OUTPUT_HIGH>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpioj 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpiob 7 GPIO_OUTPUT_LOW>;
+ };
+ usb_c0_frs_en: usb_c0_frs_en {
+ gpios = <&gpiof 0 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_USB_C0_FRS_EN";
+ };
+ ec_batt_pres_odl: ec_batt_pres_odl {
+ gpios = <&gpioc 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ en_ec_id_odl: en_ec_id_odl {
+ gpios = <&gpioh 5 GPIO_ODR_HIGH>;
+ };
+ entering_rw: entering_rw {
+ gpios = <&gpioc 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpiog 3 GPIO_OUTPUT_LOW>;
+ };
+ usb_a0_fault_odl: usb_a0_fault_odl {
+ gpios = <&gpioj 6 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpioh 4 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpioj 1 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpioj 3 GPIO_INPUT>;
+ };
+ gpio_packet_mode_en: packet_mode_en {
+ gpios = <&gpiod 4 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioc 4 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <&int_ac_present
+ &int_power_button
+ &int_lid_open>;
+ };
+
+ unused-pins {
+ compatible = "unused-gpios";
+
+ unused-gpios =
+ /* pg_pp5000_z2_od */
+ <&gpiod 2 GPIO_INPUT>,
+ /* pg_mt6315_proc_b_odl */
+ <&gpioe 1 GPIO_INPUT>,
+ /* ec_pen_chg_dis_odl */
+ <&gpioh 3 GPIO_ODR_HIGH>,
+ /* unnamed nc pins */
+ <&gpioa 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 7 GPIO_INPUT_PULL_DOWN>,
+ /* reserved for b:241345809 */
+ <&gpiod 7 GPIO_OUTPUT_LOW>,
+ <&gpiog 2 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 0 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpiom 6 (GPIO_INPUT_PULL_DOWN | GPIO_VOLTAGE_1P8)>,
+ /* spi_clk_gpg6 */
+ <&gpiog 6 GPIO_INPUT_PULL_UP>,
+ /* spi_mosi_gpg4 */
+ <&gpiog 4 GPIO_OUTPUT_LOW>,
+ /* spi_miso_gpg5 */
+ <&gpiog 5 GPIO_OUTPUT_LOW>,
+ /* spi_cs_gpg7 */
+ <&gpiog 7 GPIO_OUTPUT_LOW>;
+ };
+};
+
+&pinctrl {
+ /* I2C property setting */
+ i2c0_clk_gpb3_default: i2c0_clk_gpb3_default {
+ gpio-voltage = "1v8";
+ };
+ i2c0_data_gpb4_default: i2c0_data_gpb4_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_clk_gpf2_default: i2c3_clk_gpf2_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_data_gpf3_default: i2c3_data_gpf3_default {
+ gpio-voltage = "1v8";
+ };
+ /* SHI property setting */
+ shi_mosi_gpm0_default: shi_mosi_gpm0_default {
+ gpio-voltage = "1v8";
+ };
+ shi_miso_gpm1_default: shi_miso_gpm1_default {
+ gpio-voltage = "1v8";
+ };
+ shi_clk_gpm4_default: shi_clk_gpm4_default {
+ gpio-voltage = "1v8";
+ };
+ shi_cs_gpm5_default: shi_cs_gpm5_default {
+ gpio-voltage = "1v8";
+ };
+};
diff --git a/zephyr/projects/corsola/gpio_steelix.dts b/zephyr/projects/corsola/gpio_steelix.dts
new file mode 100644
index 0000000000..14120e6d7d
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_steelix.dts
@@ -0,0 +1,255 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &gpio_ec_wp_l;
+ gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ /*
+ * In npcx9 series, gpio46, gpio47, and the whole gpio5 port
+ * belong to VHIF power well. On steelix, it is connencted to
+ * 1.8V.
+ */
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpio5 6 GPIO_INPUT>;
+ };
+ spi_ap_clk_ec {
+ gpios = <&gpio5 5 GPIO_INPUT>;
+ };
+ spi_ap_cs_ec_l {
+ gpios = <&gpio5 3 GPIO_INPUT>;
+ };
+ spi_ap_do_ec_di {
+ gpios = <&gpio4 6 GPIO_INPUT>;
+ };
+ spi_ap_di_ec_do {
+ gpios = <&gpio4 7 GPIO_INPUT>;
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpio5 1 (GPIO_INPUT | GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpio5 2 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpio5 4 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioc 6 GPIO_OUTPUT_LOW>;
+ };
+ en_ec_id_odl {
+ gpios = <&gpio7 6 GPIO_ODR_HIGH>;
+ };
+ sys_rst_odl {
+ gpios = <&gpioc 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ ec_i2c_sensor_scl {
+ gpios = <&gpiob 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_sensor_sda {
+ gpios = <&gpiob 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_usb_c0_scl {
+ gpios = <&gpio9 0 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c0_sda {
+ gpios = <&gpio8 7 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_scl {
+ gpios = <&gpio9 2 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_sda {
+ gpios = <&gpio9 1 GPIO_INPUT>;
+ };
+ ec_i2c_pwr_cbi_scl {
+ gpios = <&gpiod 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_pwr_cbi_sda {
+ gpios = <&gpiod 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_batt_scl {
+ gpios = <&gpio3 3 GPIO_INPUT>;
+ };
+ ec_i2c_batt_sda {
+ gpios = <&gpio3 6 GPIO_INPUT>;
+ };
+ en_pp5000_usb_a1_vbus: en_pp5000_usb_a1_vbus_x {
+ gpios = <&gpiof 5 GPIO_OUTPUT_LOW>;
+ };
+ usb_a1_fault_odl {
+ gpios = <&gpiof 4 GPIO_INPUT>;
+ };
+ ec_pen_chg_dis_odl {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpio8 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_wp_l: ec_wp_odl {
+ gpios = <&gpioe 3 (GPIO_INPUT | GPIO_ACTIVE_LOW |
+ GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l {
+ gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_tablet_mode_l: tablet_mode_l {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ec_ap_int_odl {
+ gpios = <&gpioc 1 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ gpio_ec_kso_02_inv: ec_kso_02_inv {
+ gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
+ };
+ gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl {
+ gpios = <&gpio8 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_BC12_INT_ODL";
+ };
+ ec_entering_rw {
+ gpios = <&gpio0 3 GPIO_OUTPUT_LOW>;
+ };
+ charger_prochot_odl {
+ gpios = <&gpiob 1 GPIO_INPUT>;
+ };
+ ec_rst_odl {
+ gpios = <&gpio7 7 GPIO_INPUT>;
+ };
+ gpio_lid_open: lid_open {
+ gpios = <&gpiod 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ gpio_acok_od: acok_od {
+ gpios = <&gpio0 0 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl {
+ gpios = <&gpio0 1 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpio0 2 GPIO_OUTPUT_LOW>;
+ };
+ packet_mode_en {
+ gpios = <&gpio7 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiod 4 GPIO_INPUT>;
+ };
+ /*
+ * In npcx9 series, gpio93-97, the whole gpioa port, and gpiob0
+ * belong to VSPI power well. On steelix, it is connencted to
+ * 1.8V.
+ */
+ ap_sysrst_odl_r: ap_sysrst_odl_r {
+ gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioa 3 GPIO_INPUT>;
+ };
+ gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl {
+ gpios = <&gpio6 7 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PPC_INT_ODL";
+ };
+ pg_pp5000_z2_od {
+ gpios = <&gpio7 0 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpio6 2 GPIO_OUTPUT_LOW>;
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpio6 3 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpio4 0 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpiod 3 GPIO_OUTPUT_LOW>;
+ };
+ gpio_usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl {
+ gpios = <&gpio7 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_TCPC_INT_ODL";
+ };
+ gpio_usb_c0_tcpc_rst: usb_c0_tcpc_rst {
+ gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpio3 7 GPIO_INPUT>;
+ };
+ en_pp5000_z2 {
+ gpios = <&gpio3 4 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl {
+ gpios = <&gpioe 1 GPIO_INPUT>;
+ };
+ ec_batt_pres_odl {
+ gpios = <&gpioe 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ usb_a0_fault_odl {
+ gpios = <&gpioc 7 GPIO_INPUT>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpio6 1 GPIO_ODR_HIGH>;
+ };
+ ec_pmic_en_odl {
+ gpios = <&gpio7 4 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ gpio_ec_volup_btn_odl: ec_volup_btn_odl {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ec_voldn_btn_odl: ec_voldn_btn_odl {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ /* unimplemented GPIOs */
+ entering-rw {
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ };
+
+ /*
+ * aliases for sub-board GPIOs
+ */
+ aliases {
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <
+ &int_ac_present
+ &int_power_button
+ &int_lid_open
+ >;
+ };
+};
diff --git a/zephyr/projects/corsola/gpio_tentacruel.dts b/zephyr/projects/corsola/gpio_tentacruel.dts
new file mode 100644
index 0000000000..a9ac9e8eac
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_tentacruel.dts
@@ -0,0 +1,235 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/gpio_defines.h>
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &ec_flash_wp_odl;
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ power_button_l: power_button_l {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ lid_open: lid_open {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ tablet_mode_l: tablet_mode_l {
+ gpios = <&gpioj 7 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpiod 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpiob 6 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpiom 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l: lid_accel_int_l {
+ gpios = <&gpiom 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ volume_down_l: volume_down_l {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ volume_up_l: volume_up_l {
+ gpios = <&gpiod 6 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioj 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ac_present: ac_present {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
+ };
+ ec_flash_wp_odl: ec_flash_wp_odl {
+ gpios = <&gpioi 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ };
+ spi0_cs: spi0_cs {
+ gpios = <&gpiom 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ };
+ usb_c0_ppc_int_odl: usb_c0_ppc_int_odl {
+ gpios = <&gpiod 1 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PPC_INT_ODL";
+ };
+ usb_c0_bc12_int_odl: usb_c0_bc12_int_odl {
+ gpios = <&gpiof 1 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_BC12_INT_ODL";
+ };
+ usb_c1_bc12_charger_int_odl: usb_c1_bc12_charger_int_odl {
+ gpios = <&gpioj 4 GPIO_INPUT>;
+ };
+ ec_pmic_en_odl: ec_pmic_en_odl {
+ gpios = <&gpiod 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ en_pp5000_z2: en_pp5000_z2 {
+ gpios = <&gpioc 6 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioe 3 GPIO_OUTPUT_LOW>;
+ };
+ sys_rst_odl: sys_rst_odl {
+ gpios = <&gpiog 1 GPIO_ODR_LOW>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpiob 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ ap_sysrst_odl_r: ap_ec_sysrst_odl {
+ gpios = <&gpioj 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpioc 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8 |
+ GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ec_int_l: ec_int_l {
+ gpios = <&gpioe 6 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpiog 0 GPIO_OUTPUT_HIGH>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpioj 0 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpiob 7 GPIO_OUTPUT_LOW>;
+ };
+ usb_c0_frs_en: usb_c0_frs_en {
+ gpios = <&gpiof 0 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_USB_C0_FRS_EN";
+ };
+ ec_batt_pres_odl: ec_batt_pres_odl {
+ gpios = <&gpioc 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ en_ec_id_odl: en_ec_id_odl {
+ gpios = <&gpioh 5 GPIO_ODR_HIGH>;
+ };
+ entering_rw: entering_rw {
+ gpios = <&gpioc 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpiog 3 GPIO_OUTPUT_LOW>;
+ };
+ usb_a0_fault_odl: usb_a0_fault_odl {
+ gpios = <&gpioj 6 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpioh 4 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpioj 1 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpioj 3 GPIO_INPUT>;
+ };
+ gpio_packet_mode_en: packet_mode_en {
+ gpios = <&gpiod 4 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioc 4 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <&int_ac_present
+ &int_power_button
+ &int_lid_open>;
+ };
+
+ unused-pins {
+ compatible = "unused-gpios";
+
+ unused-gpios =
+ /* pg_pp5000_z2_od */
+ <&gpiod 2 GPIO_INPUT>,
+ /* pg_mt6315_proc_b_odl */
+ <&gpioe 1 GPIO_INPUT>,
+ /* ec_pen_chg_dis_odl */
+ <&gpioh 3 GPIO_ODR_HIGH>,
+ /* unnamed nc pins */
+ <&gpioa 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioa 7 GPIO_INPUT_PULL_DOWN>,
+ <&gpiod 7 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 0 GPIO_INPUT_PULL_DOWN>,
+ <&gpioh 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 3 GPIO_INPUT_PULL_DOWN>,
+ <&gpioi 6 GPIO_INPUT_PULL_DOWN>,
+ <&gpiom 6 (GPIO_INPUT_PULL_DOWN | GPIO_VOLTAGE_1P8)>,
+ /* spi_clk_gpg6 */
+ <&gpiog 6 GPIO_INPUT_PULL_UP>,
+ /* spi_mosi_gpg4 */
+ <&gpiog 4 GPIO_OUTPUT_LOW>,
+ /* spi_miso_gpg5 */
+ <&gpiog 5 GPIO_OUTPUT_LOW>,
+ /* spi_cs_gpg7 */
+ <&gpiog 7 GPIO_OUTPUT_LOW>;
+ };
+};
+
+&pinctrl {
+ /* I2C property setting */
+ i2c0_clk_gpb3_default: i2c0_clk_gpb3_default {
+ gpio-voltage = "1v8";
+ };
+ i2c0_data_gpb4_default: i2c0_data_gpb4_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_clk_gpf2_default: i2c3_clk_gpf2_default {
+ gpio-voltage = "1v8";
+ };
+ i2c3_data_gpf3_default: i2c3_data_gpf3_default {
+ gpio-voltage = "1v8";
+ };
+ /* SHI property setting */
+ shi_mosi_gpm0_default: shi_mosi_gpm0_default {
+ gpio-voltage = "1v8";
+ };
+ shi_miso_gpm1_default: shi_miso_gpm1_default {
+ gpio-voltage = "1v8";
+ };
+ shi_clk_gpm4_default: shi_clk_gpm4_default {
+ gpio-voltage = "1v8";
+ };
+ shi_cs_gpm5_default: shi_cs_gpm5_default {
+ gpio-voltage = "1v8";
+ };
+};
diff --git a/zephyr/projects/corsola/host_interface_npcx.dts b/zephyr/projects/corsola/host_interface_npcx.dts
new file mode 100644
index 0000000000..14efa3c6b2
--- /dev/null
+++ b/zephyr/projects/corsola/host_interface_npcx.dts
@@ -0,0 +1,12 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* host interface */
+&shi {
+ status = "okay";
+ pinctrl-0 = <&shi_gp46_47_53_55>;
+ pinctrl-1 = <&shi_gpio_gp46_47_53_55>;
+ pinctrl-names = "default", "sleep";
+};
diff --git a/zephyr/projects/corsola/i2c_kingler.dts b/zephyr/projects/corsola/i2c_kingler.dts
new file mode 100644
index 0000000000..90390ab8a0
--- /dev/null
+++ b/zephyr/projects/corsola/i2c_kingler.dts
@@ -0,0 +1,169 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/usb_pd_tcpm.h>
+
+/*
+ * Kingler and Steelix use the same dts, take care of this when modify it.
+ */
+
+/ {
+ named-i2c-ports {
+ compatible = "named-i2c-ports";
+
+ i2c_sensor: sensor {
+ i2c-port = <&i2c0_0>;
+ enum-names = "I2C_PORT_SENSOR";
+ };
+ i2c_usb_c0: usb-c0 {
+ i2c-port = <&i2c1_0>;
+ remote-port = <7>;
+ enum-names = "I2C_PORT_USB_C0";
+ };
+ i2c_usb_c1: usb-c1 {
+ i2c-port = <&i2c2_0>;
+ enum-names = "I2C_PORT_USB_C1",
+ "I2C_PORT_USB_C1_TCPC",
+ "I2C_PORT_USB_C1_PPC";
+ };
+ i2c_charger: charger {
+ i2c-port = <&i2c3_0>;
+ enum-names = "I2C_PORT_POWER",
+ "I2C_PORT_EEPROM";
+ };
+ battery {
+ i2c-port = <&i2c5_0>;
+ remote-port = <1>;
+ enum-names = "I2C_PORT_BATTERY",
+ "I2C_PORT_VIRTUAL_BATTERY";
+ };
+ };
+};
+
+&i2c0_0 {
+ label = "I2C_SENSOR";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c0_0_sda_scl_gpb4_b5>;
+ pinctrl-names = "default";
+};
+
+&i2c_ctrl0 {
+ status = "okay";
+};
+
+&i2c1_0 {
+ label = "I2C_USB_C0";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST_PLUS>;
+ pinctrl-0 = <&i2c1_0_sda_scl_gp87_90>;
+ pinctrl-names = "default";
+
+ bc12_port0: pi3usb9201@5f {
+ compatible = "pericom,pi3usb9201";
+ status = "okay";
+ reg = <0x5f>;
+ irq = <&int_usb_c0_bc12>;
+ };
+
+ tcpc_port0: anx7447-tcpc@2c {
+ compatible = "analogix,anx7447-tcpc";
+ status = "okay";
+ reg = <0x2c>;
+ tcpc-flags = <(
+ TCPC_FLAGS_VBUS_MONITOR |
+ TCPC_FLAGS_ALERT_OD |
+ TCPC_FLAGS_CONTROL_VCONN |
+ TCPC_FLAGS_CONTROL_FRS)>;
+ };
+
+ ppc_port0: nx20p348x@72 {
+ compatible = "nxp,nx20p348x";
+ status = "okay";
+ reg = <0x72>;
+ };
+};
+
+&i2c_ctrl1 {
+ status = "okay";
+};
+
+&i2c2_0 {
+ label = "I2C_USB_C1";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST_PLUS>;
+ pinctrl-0 = <&i2c2_0_sda_scl_gp91_92>;
+ pinctrl-names = "default";
+
+ bc12_port1: rt1718s-bc12@40 {
+ compatible = "richtek,rt1718s-bc12";
+ status = "okay";
+ reg = <0x40>;
+ };
+
+ tcpc_port1: rt1718s-tcpc@40 {
+ compatible = "richtek,rt1718s-tcpc";
+ reg = <0x40>;
+ tcpc-flags = <(
+ TCPC_FLAGS_ALERT_OD |
+ TCPC_FLAGS_CONTROL_VCONN |
+ TCPC_FLAGS_CONTROL_FRS)>;
+ };
+
+ ppc_port1: nx20p348x@72 {
+ compatible = "nxp,nx20p348x";
+ status = "okay";
+ reg = <0x72>;
+ };
+
+ ps8743_mux_1: ps8743-mux-1@10 {
+ compatible = "parade,ps8743";
+ reg = <0x10>;
+ board-init = "ps8743_mux_1_board_init";
+ };
+};
+
+&i2c_ctrl2 {
+ status = "okay";
+};
+
+&i2c3_0 {
+ label = "I2C_PWR_CBI";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c3_0_sda_scl_gpd0_d1>;
+ pinctrl-names = "default";
+
+ charger: isl923x@9 {
+ compatible = "intersil,isl923x";
+ status = "okay";
+ reg = <0x9>;
+ };
+
+ cbi_eeprom: eeprom@50 {
+ compatible = "atmel,at24";
+ reg = <0x50>;
+ size = <2048>;
+ pagesize = <16>;
+ address-width = <8>;
+ timeout = <5>;
+ };
+};
+
+&i2c_ctrl3 {
+ status = "okay";
+};
+
+&i2c5_0 {
+ label = "I2C_BATTERY";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_STANDARD>;
+ pinctrl-0 = <&i2c5_0_sda_scl_gp33_36>;
+ pinctrl-names = "default";
+};
+
+&i2c_ctrl5 {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/i2c_krabby.dts b/zephyr/projects/corsola/i2c_krabby.dts
new file mode 100644
index 0000000000..a5dc03b655
--- /dev/null
+++ b/zephyr/projects/corsola/i2c_krabby.dts
@@ -0,0 +1,22 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_krabby_tentacruel.dtsi"
+
+&i2c0 {
+ charger: rt9490@53 {
+ compatible = "richtek,rt9490";
+ status = "okay";
+ reg = <0x53>;
+ };
+};
+
+&i2c4 {
+ tusb1064_mux_1: tusb1064-mux-1@44 {
+ compatible = "ti,tusb1064";
+ reg = <0x44>;
+ board-init = "tusb1064_mux_1_board_init";
+ };
+};
diff --git a/zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi b/zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi
new file mode 100644
index 0000000000..6fd153e1fa
--- /dev/null
+++ b/zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi
@@ -0,0 +1,138 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ named-i2c-ports {
+ compatible = "named-i2c-ports";
+
+ battery {
+ i2c-port = <&i2c1>;
+ remote-port = <1>;
+ enum-names = "I2C_PORT_BATTERY",
+ "I2C_PORT_VIRTUAL_BATTERY";
+ };
+ i2c_charger: charger {
+ i2c-port = <&i2c0>;
+ enum-names = "I2C_PORT_CHARGER",
+ "I2C_PORT_EEPROM";
+ };
+ i2c_sensor: sensor {
+ i2c-port = <&i2c3>;
+ enum-names = "I2C_PORT_SENSOR";
+ };
+ i2c_usb_c0: usb-c0 {
+ i2c-port = <&i2c2>;
+ enum-names = "I2C_PORT_USB_C0",
+ "I2C_PORT_USB_MUX0";
+ };
+ i2c_usb_c1: usb-c1 {
+ i2c-port = <&i2c4>;
+ enum-names = "I2C_PORT_USB_C1",
+ "I2C_PORT_USB_MUX1";
+ };
+ };
+
+};
+
+&pinctrl {
+ i2c3_clk_gpf2_sleep: i2c3_clk_gpf2_sleep {
+ pinmuxs = <&pinctrlf 2 IT8XXX2_ALT_DEFAULT>;
+ };
+ i2c3_data_gpf3_sleep: i2c3_data_gpf3_sleep {
+ pinmuxs = <&pinctrlf 3 IT8XXX2_ALT_DEFAULT>;
+ };
+};
+
+&i2c0 {
+ /* EC_I2C_PWR_CBI */
+ label = "I2C_PWR_CBI";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c0_clk_gpb3_default
+ &i2c0_data_gpb4_default>;
+ pinctrl-names = "default";
+
+ cbi_eeprom: eeprom@50 {
+ compatible = "atmel,at24";
+ reg = <0x50>;
+ size = <2048>;
+ pagesize = <16>;
+ address-width = <8>;
+ timeout = <5>;
+ };
+
+ bc12_port1: rt9490-bc12@53 {
+ compatible = "richtek,rt9490-bc12";
+ status = "okay";
+ reg = <0x53>;
+ irq = <&int_usb_c1_bc12_charger>;
+ };
+};
+
+&i2c1 {
+ /* EC_I2C_BATTERY */
+ label = "I2C_BATTERY";
+ status = "okay";
+ clock-frequency = <50000>;
+ pinctrl-0 = <&i2c1_clk_gpc1_default
+ &i2c1_data_gpc2_default>;
+ pinctrl-names = "default";
+ fifo-enable;
+};
+
+&i2c2 {
+ /* EC_I2C_USB_C0 */
+ label = "I2C_USB_C0";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c2_clk_gpf6_default
+ &i2c2_data_gpf7_default>;
+ pinctrl-names = "default";
+ /delete-property/ fifo-enable;
+
+ bc12_ppc_port0: rt1739@70 {
+ compatible = "richtek,rt1739";
+ status = "okay";
+ reg = <0x70>;
+ };
+
+ it5205_mux_0: it5205-mux-0@48 {
+ compatible = "ite,it5205";
+ reg = <0x48>;
+ };
+};
+
+&i2c3 {
+ /* EC_I2C_SENSOR */
+ label = "I2C_SENSOR";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ scl-gpios = <&gpiof 2 0>;
+ sda-gpios = <&gpiof 3 0>;
+ pinctrl-0 = <&i2c3_clk_gpf2_default
+ &i2c3_data_gpf3_default>;
+ pinctrl-1 = <&i2c3_clk_gpf2_sleep
+ &i2c3_data_gpf3_sleep>;
+ pinctrl-names = "default", "sleep";
+ prescale-scl-low = <1>;
+};
+
+&i2c4 {
+ /* EC_I2C_USB_C1 */
+ label = "I2C_USB_C1";
+ status = "okay";
+ clock-frequency = <I2C_BITRATE_FAST>;
+ pinctrl-0 = <&i2c4_clk_gpe0_default
+ &i2c4_data_gpe7_default>;
+ pinctrl-names = "default";
+ prescale-scl-low = <1>;
+
+ ppc_port1: syv682x@40 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x40>;
+ frs_en_gpio = <&gpio_ec_x_gpio1>;
+ };
+};
diff --git a/zephyr/projects/corsola/i2c_magikarp.dts b/zephyr/projects/corsola/i2c_magikarp.dts
new file mode 100644
index 0000000000..fbf5ed6337
--- /dev/null
+++ b/zephyr/projects/corsola/i2c_magikarp.dts
@@ -0,0 +1,36 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_krabby_tentacruel.dtsi"
+
+&i2c0 {
+ charger: rt9490@53 {
+ compatible = "richtek,rt9490";
+ status = "okay";
+ reg = <0x53>;
+ };
+};
+
+&i2c2 {
+ bc12_port0: pi3usb9201@5f {
+ compatible = "pericom,pi3usb9201";
+ status = "okay";
+ reg = <0x5f>;
+ irq = <&int_usb_c0_bc12>;
+ };
+ ppc_port0: syv682x@40 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x40>;
+ frs_en_gpio = <&usb_c0_frs_en>;
+ };
+};
+
+&i2c4 {
+ ps8743_mux_1: ps8743-mux-1@10 {
+ compatible = "parade,ps8743";
+ reg = <0x10>;
+ };
+};
diff --git a/zephyr/projects/corsola/i2c_tentacruel.dts b/zephyr/projects/corsola/i2c_tentacruel.dts
new file mode 100644
index 0000000000..a635adcf5c
--- /dev/null
+++ b/zephyr/projects/corsola/i2c_tentacruel.dts
@@ -0,0 +1,38 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_krabby_tentacruel.dtsi"
+
+&i2c0 {
+ charger: rt9490@53 {
+ compatible = "richtek,rt9490";
+ status = "okay";
+ reg = <0x53>;
+ thermistor = <&thermistor_rt9490>;
+ };
+};
+
+&i2c2 {
+ bc12_port0: pi3usb9201@5f {
+ compatible = "pericom,pi3usb9201";
+ status = "okay";
+ reg = <0x5f>;
+ irq = <&int_usb_c0_bc12>;
+ };
+ ppc_port0: syv682x@40 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x40>;
+ frs_en_gpio = <&usb_c0_frs_en>;
+ };
+};
+
+&i2c4 {
+ ps8743_mux_1: ps8743-mux-1@10 {
+ compatible = "parade,ps8743";
+ reg = <0x10>;
+ board-init = "ps8743_eq_c1_setting";
+ };
+};
diff --git a/zephyr/projects/corsola/include/baseboard_usbc_config.h b/zephyr/projects/corsola/include/baseboard_usbc_config.h
new file mode 100644
index 0000000000..66610fec5e
--- /dev/null
+++ b/zephyr/projects/corsola/include/baseboard_usbc_config.h
@@ -0,0 +1,39 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Corsola daughter board detection */
+
+#ifndef __CROS_EC_BASEBOARD_USBC_CONFIG_H
+#define __CROS_EC_BASEBOARD_USBC_CONFIG_H
+
+#include "gpio.h"
+
+#ifdef CONFIG_PLATFORM_EC_USB_PD_TCPM_RT1718S
+#define GPIO_EN_USB_C1_SINK RT1718S_GPIO1
+#define GPIO_EN_USB_C1_SOURCE RT1718S_GPIO2
+#define GPIO_EN_USB_C1_FRS RT1718S_GPIO3
+#endif
+
+void ppc_interrupt(enum gpio_signal signal);
+void ccd_interrupt(enum gpio_signal signal);
+
+/* USB-A ports */
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_COUNT };
+
+/* USB-C ports */
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
+BUILD_ASSERT(USBC_PORT_COUNT == CONFIG_USB_PD_PORT_MAX_COUNT);
+
+/**
+ * Is the port fine to be muxed its DisplayPort lines?
+ *
+ * Only one port can be muxed to DisplayPort at a time.
+ *
+ * @param port Port number of TCPC.
+ * @return 1 is fine; 0 is bad as other port is already muxed;
+ */
+int corsola_is_dp_muxable(int port);
+
+#endif /* __CROS_EC_BASEBOARD_USBC_CONFIG_H */
diff --git a/zephyr/projects/corsola/include/variant_db_detection.h b/zephyr/projects/corsola/include/variant_db_detection.h
new file mode 100644
index 0000000000..285ff327f2
--- /dev/null
+++ b/zephyr/projects/corsola/include/variant_db_detection.h
@@ -0,0 +1,33 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Corsola daughter board detection */
+
+#ifndef __CROS_EC_CORSOLA_DB_DETECTION_H
+#define __CROS_EC_CORSOLA_DB_DETECTION_H
+
+enum corsola_db_type {
+ CORSOLA_DB_UNINIT = -1,
+ CORSOLA_DB_NONE,
+ CORSOLA_DB_TYPEC,
+ CORSOLA_DB_HDMI,
+ CORSOLA_DB_COUNT,
+};
+
+#ifdef CONFIG_VARIANT_CORSOLA_DB_DETECTION
+/*
+ * Get the connected daughterboard type.
+ *
+ * @return The daughterboard type.
+ */
+enum corsola_db_type corsola_get_db_type(void);
+#else
+inline enum corsola_db_type corsola_get_db_type(void)
+{
+ return CORSOLA_DB_NONE;
+};
+#endif /* CONFIG_VARIANT_CORSOLA_DB_DETECTION */
+
+#endif /* __CROS_EC_CORSOLA_DB_DETECTION_H */
diff --git a/zephyr/projects/corsola/interrupts_kingler.dts b/zephyr/projects/corsola/interrupts_kingler.dts
new file mode 100644
index 0000000000..f3da785a60
--- /dev/null
+++ b/zephyr/projects/corsola/interrupts_kingler.dts
@@ -0,0 +1,114 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Kingler and Steelix use the same dts, take care of this when modify it.
+ */
+
+/ {
+ aliases {
+ int-wp = &int_wp;
+ };
+
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_power_button: power_button {
+ irq-pin = <&gpio_gsc_ec_pwr_btn_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ int_volume_up: volume_up {
+ irq-pin = <&gpio_ec_volup_btn_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_volume_down: volume_down {
+ irq-pin = <&gpio_ec_voldn_btn_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-pin = <&gpio_lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_warm_rst: warm_rst {
+ irq-pin = <&ap_ec_warm_rst_req>;
+ flags = <GPIO_INT_EDGE_RISING>;
+ handler = "chipset_reset_request_interrupt";
+ };
+ int_ap_in_sleep: ap_in_sleep {
+ irq-pin = <&ap_in_sleep_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_in_rst: ap_in_rst {
+ irq-pin = <&ap_sysrst_odl_r>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_wdtrst: ap_wdtrst {
+ irq-pin = <&ap_ec_wdtrst_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "chipset_watchdog_interrupt";
+ };
+ int_ac_present: ac_present {
+ irq-pin = <&gpio_acok_od>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_usba: usba {
+ irq-pin = <&gpio_ap_xhci_init_done>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "usb_a0_interrupt";
+ };
+ int_wp: wp {
+ irq-pin = <&gpio_ec_wp_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "switch_interrupt";
+ };
+ int_usb_c0_tcpc: usb_c0_tcpc {
+ irq-pin = <&gpio_usb_c0_tcpc_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "tcpc_alert_event";
+ };
+ int_usb_c1_tcpc: usb_c1_tcpc {
+ irq-pin = <&gpio_usb_c1_tcpc_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "tcpc_alert_event";
+ };
+ int_usb_c0_ppc: usb_c0_ppc {
+ irq-pin = <&gpio_usb_c0_ppc_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ppc_interrupt";
+ };
+ int_usb_c0_bc12: usb_c0_bc12 {
+ irq-pin = <&gpio_usb_c0_bc12_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "bc12_interrupt";
+ };
+ int_x_ec_gpio2: x_ec_gpio2 {
+ irq-pin = <&gpio_x_ec_gpio2>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "x_ec_interrupt";
+ };
+ int_base_imu: base_imu {
+ irq-pin = <&base_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "bmi3xx_interrupt";
+ };
+ int_tablet_mode: tablet_mode {
+ irq-pin = <&gpio_tablet_mode_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "gmr_tablet_switch_isr";
+ };
+ int_ccd_mode_odl: ccd-mode-odl {
+ irq-pin = <&gpio_ccd_mode_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ccd_interrupt";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/interrupts_krabby.dts b/zephyr/projects/corsola/interrupts_krabby.dts
new file mode 100644
index 0000000000..3caf4660ae
--- /dev/null
+++ b/zephyr/projects/corsola/interrupts_krabby.dts
@@ -0,0 +1,110 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ int-wp = &int_wp;
+ };
+
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_power_button: power_button {
+ irq-pin = <&power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ int_volume_up: volume_up {
+ irq-pin = <&volume_up_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_volume_down: volume_down {
+ irq-pin = <&volume_down_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-pin = <&lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_warm_rst: warm_rst {
+ irq-pin = <&ap_ec_warm_rst_req>;
+ flags = <GPIO_INT_EDGE_RISING>;
+ handler = "chipset_reset_request_interrupt";
+ };
+ int_ap_in_sleep: ap_in_sleep {
+ irq-pin = <&ap_in_sleep_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_in_rst: ap_in_rst {
+ irq-pin = <&ap_sysrst_odl_r>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_wdtrst: ap_wdtrst {
+ irq-pin = <&ap_ec_wdtrst_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "chipset_watchdog_interrupt";
+ };
+ int_tablet_mode: tablet_mode {
+ irq-pin = <&tablet_mode_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "gmr_tablet_switch_isr";
+ };
+ int_base_imu: base_imu {
+ irq-pin = <&base_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "icm42607_interrupt";
+ };
+ int_lid_imu: lid_imu {
+ irq-pin = <&lid_accel_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "lis2dw12_interrupt";
+ };
+ int_ac_present: ac_present {
+ irq-pin = <&ac_present>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_usba: usba {
+ irq-pin = <&gpio_ap_xhci_init_done>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "usb_a0_interrupt";
+ };
+ int_wp: wp {
+ irq-pin = <&ec_flash_wp_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "switch_interrupt";
+ };
+ int_spi0_cs: spi0_cs {
+ irq-pin = <&spi0_cs>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "spi_event";
+ };
+ int_x_ec_gpio2: x_ec_gpio2 {
+ irq-pin = <&gpio_x_ec_gpio2>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "x_ec_interrupt";
+ };
+ int_usb_c0_ppc_bc12: usb_c0_ppc_bc12 {
+ irq-pin = <&usb_c0_ppc_bc12_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "c0_bc12_interrupt";
+ };
+ int_usb_c1_bc12_charger: usb_c1_bc12_charger {
+ irq-pin = <&usb_c1_bc12_charger_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "rt9490_bc12_dt_interrupt";
+ };
+ int_ccd_mode_odl: ccd-mode-odl {
+ irq-pin = <&gpio_ccd_mode_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ccd_interrupt";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/interrupts_magikarp.dts b/zephyr/projects/corsola/interrupts_magikarp.dts
new file mode 100644
index 0000000000..4f4e0ba100
--- /dev/null
+++ b/zephyr/projects/corsola/interrupts_magikarp.dts
@@ -0,0 +1,115 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ int-wp = &int_wp;
+ };
+
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_power_button: power_button {
+ irq-pin = <&power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ int_volume_up: volume_up {
+ irq-pin = <&volume_up_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_volume_down: volume_down {
+ irq-pin = <&volume_down_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-pin = <&lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_warm_rst: warm_rst {
+ irq-pin = <&ap_ec_warm_rst_req>;
+ flags = <GPIO_INT_EDGE_RISING>;
+ handler = "chipset_reset_request_interrupt";
+ };
+ int_ap_in_sleep: ap_in_sleep {
+ irq-pin = <&ap_in_sleep_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_in_rst: ap_in_rst {
+ irq-pin = <&ap_sysrst_odl_r>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_wdtrst: ap_wdtrst {
+ irq-pin = <&ap_ec_wdtrst_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "chipset_watchdog_interrupt";
+ };
+ int_tablet_mode: tablet_mode {
+ irq-pin = <&tablet_mode_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "gmr_tablet_switch_isr";
+ };
+ int_base_imu: base_imu {
+ irq-pin = <&base_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "motion_interrupt";
+ };
+ int_lid_imu: lid_imu {
+ irq-pin = <&lid_accel_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "lis2dw12_interrupt";
+ };
+ int_ac_present: ac_present {
+ irq-pin = <&ac_present>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_usba: usba {
+ irq-pin = <&gpio_ap_xhci_init_done>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "usb_a0_interrupt";
+ };
+ int_wp: wp {
+ irq-pin = <&ec_flash_wp_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "switch_interrupt";
+ };
+ int_spi0_cs: spi0_cs {
+ irq-pin = <&spi0_cs>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "spi_event";
+ };
+ int_x_ec_gpio2: x_ec_gpio2 {
+ irq-pin = <&gpio_x_ec_gpio2>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "x_ec_interrupt";
+ };
+ int_usb_c0_bc12: usb_c0_bc12 {
+ irq-pin = <&usb_c0_bc12_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "bc12_interrupt";
+ };
+ int_usb_c0_ppc: usb_c0_ppc {
+ irq-pin = <&usb_c0_ppc_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ppc_interrupt";
+ };
+ int_usb_c1_bc12_charger: usb_c1_bc12_charger {
+ irq-pin = <&usb_c1_bc12_charger_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "rt9490_bc12_dt_interrupt";
+ };
+ int_ccd_mode_odl: ccd-mode-odl {
+ irq-pin = <&gpio_ccd_mode_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ccd_interrupt";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/interrupts_steelix.dts b/zephyr/projects/corsola/interrupts_steelix.dts
new file mode 100644
index 0000000000..816beb95f4
--- /dev/null
+++ b/zephyr/projects/corsola/interrupts_steelix.dts
@@ -0,0 +1,10 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+&int_base_imu {
+ irq-pin = <&base_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "motion_interrupt";
+};
diff --git a/zephyr/projects/corsola/interrupts_tentacruel.dts b/zephyr/projects/corsola/interrupts_tentacruel.dts
new file mode 100644
index 0000000000..11229daf36
--- /dev/null
+++ b/zephyr/projects/corsola/interrupts_tentacruel.dts
@@ -0,0 +1,115 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ int-wp = &int_wp;
+ };
+
+ gpio-interrupts {
+ compatible = "cros-ec,gpio-interrupts";
+
+ int_power_button: power_button {
+ irq-pin = <&power_button_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_button_interrupt";
+ };
+ int_volume_up: volume_up {
+ irq-pin = <&volume_up_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_volume_down: volume_down {
+ irq-pin = <&volume_down_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "button_interrupt";
+ };
+ int_lid_open: lid_open {
+ irq-pin = <&lid_open>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "lid_interrupt";
+ };
+ int_warm_rst: warm_rst {
+ irq-pin = <&ap_ec_warm_rst_req>;
+ flags = <GPIO_INT_EDGE_RISING>;
+ handler = "chipset_reset_request_interrupt";
+ };
+ int_ap_in_sleep: ap_in_sleep {
+ irq-pin = <&ap_in_sleep_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_in_rst: ap_in_rst {
+ irq-pin = <&ap_sysrst_odl_r>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "power_signal_interrupt";
+ };
+ int_ap_wdtrst: ap_wdtrst {
+ irq-pin = <&ap_ec_wdtrst_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "chipset_watchdog_interrupt";
+ };
+ int_tablet_mode: tablet_mode {
+ irq-pin = <&tablet_mode_l>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "gmr_tablet_switch_isr";
+ };
+ int_base_imu: base_imu {
+ irq-pin = <&base_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "motion_interrupt";
+ };
+ int_lid_imu: lid_imu {
+ irq-pin = <&lid_accel_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "lis2dw12_interrupt";
+ };
+ int_ac_present: ac_present {
+ irq-pin = <&ac_present>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "extpower_interrupt";
+ };
+ int_usba: usba {
+ irq-pin = <&gpio_ap_xhci_init_done>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "usb_a0_interrupt";
+ };
+ int_wp: wp {
+ irq-pin = <&ec_flash_wp_odl>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "switch_interrupt";
+ };
+ int_spi0_cs: spi0_cs {
+ irq-pin = <&spi0_cs>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "spi_event";
+ };
+ int_x_ec_gpio2: x_ec_gpio2 {
+ irq-pin = <&gpio_x_ec_gpio2>;
+ flags = <GPIO_INT_EDGE_BOTH>;
+ handler = "x_ec_interrupt";
+ };
+ int_usb_c0_ppc: usb_c0_ppc {
+ irq-pin = <&usb_c0_ppc_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ppc_interrupt";
+ };
+ int_usb_c0_bc12: usb_c0_bc12 {
+ irq-pin = <&usb_c0_bc12_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "bc12_interrupt";
+ };
+ int_usb_c1_bc12_charger: usb_c1_bc12_charger {
+ irq-pin = <&usb_c1_bc12_charger_int_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "rt9490_bc12_dt_interrupt";
+ };
+ int_ccd_mode_odl: ccd-mode-odl {
+ irq-pin = <&gpio_ccd_mode_odl>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "ccd_interrupt";
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/keyboard_steelix.dts b/zephyr/projects/corsola/keyboard_steelix.dts
new file mode 100644
index 0000000000..9a0dca3e05
--- /dev/null
+++ b/zephyr/projects/corsola/keyboard_steelix.dts
@@ -0,0 +1,29 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ cros-keyscan {
+ compatible = "cros-keyscan";
+
+ debounce-down = <15000>;
+ debounce-up = <15000>;
+
+ actual-key-mask = <
+ 0x1c /* C0 */
+ 0xff /* C1 */
+ 0xff /* C2 */
+ 0xff /* C3 */
+ 0xff /* C4 */
+ 0xf5 /* C5 */
+ 0xff /* C6 */
+ 0xa4 /* C7 */
+ 0xff /* C8 */
+ 0xfe /* C9 */
+ 0x55 /* C10 */
+ 0xfa /* C11 */
+ 0xca /* C12 */
+ >;
+ };
+};
diff --git a/zephyr/projects/corsola/led_it81202_base.dtsi b/zephyr/projects/corsola/led_it81202_base.dtsi
new file mode 100644
index 0000000000..dce7bb4f95
--- /dev/null
+++ b/zephyr/projects/corsola/led_it81202_base.dtsi
@@ -0,0 +1,184 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include <dt-bindings/battery.h>
+
+/ {
+ led_colors: led-colors {
+ compatible = "cros-ec,led-policy";
+
+ bat-power-state-charge {
+ charge-state = "PWR_STATE_CHARGE";
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ };
+ };
+
+ bat-power-state-near-full {
+ charge-state = "PWR_STATE_CHARGE_NEAR_FULL";
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ };
+ };
+
+ bat-power-state-discharge {
+ charge-state = "PWR_STATE_DISCHARGE";
+
+ color-0 {
+ led-color = <&color_battery_off>;
+ };
+ };
+
+ bat-power-state-discharge-s0-bat-low {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S0";
+ batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>;
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-error {
+ charge-state = "PWR_STATE_ERROR";
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <1000>;
+ };
+ };
+
+ pwr-power-state-off {
+ color-0 {
+ led-color = <&color_power_off>;
+ };
+ };
+
+ pwr-power-state-on {
+ chipset-state = "POWER_S0";
+
+ color-0 {
+ led-color = <&color_power_white>;
+ };
+ };
+
+ pwr-power-state-s3 {
+ chipset-state = "POWER_S3";
+
+ color-0 {
+ led-color = <&color_power_white>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_power_off>;
+ period-ms = <3000>;
+ };
+ };
+ };
+
+ pwmleds {
+ compatible = "cros-ec,pwm-pin-config";
+
+ /* NOTE: &pwm number needs same with channel number */
+ led_power_white: ec_led1_odl {
+ #led-pin-cells = <1>;
+ pwms = <&pwm0
+ PWM_CHANNEL_0
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
+ };
+ led_battery_amber: ec_led2_odl {
+ #led-pin-cells = <1>;
+ pwms = <&pwm1
+ PWM_CHANNEL_1
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
+ };
+ led_battery_white: ec_led3_odl {
+ #led-pin-cells = <1>;
+ pwms = <&pwm2
+ PWM_CHANNEL_2
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
+ };
+ };
+
+ pwm-led-pins {
+ compatible = "cros-ec,pwm-led-pins";
+
+ color_power_off: color-power-off {
+ led-color = "LED_OFF";
+ led-id = "EC_LED_ID_POWER_LED";
+ led-pins = <&led_power_white 0>;
+ };
+
+ color_power_white: color-power-white {
+ led-color = "LED_WHITE";
+ br-color = "EC_LED_COLOR_WHITE";
+ led-id = "EC_LED_ID_POWER_LED";
+ led-pins = <&led_power_white 100>;
+ };
+
+ color_battery_off: color-battery-off {
+ led-color = "LED_OFF";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ led-pins = <&led_battery_amber 0>,
+ <&led_battery_white 0>;
+ };
+
+ color_battery_amber: color-battery-amber {
+ led-color = "LED_AMBER";
+ br-color = "EC_LED_COLOR_AMBER";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ led-pins = <&led_battery_amber 100>,
+ <&led_battery_white 0>;
+ };
+
+ color_battery_white: color-battery-white {
+ led-color = "LED_WHITE";
+ br-color = "EC_LED_COLOR_WHITE";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ led-pins = <&led_battery_amber 0>,
+ <&led_battery_white 100>;
+ };
+ };
+};
+
+/* LED1 */
+&pwm0 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm0_gpa0_default>;
+ pinctrl-names = "default";
+};
+
+/* LED2 */
+&pwm1 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm1_gpa1_default>;
+ pinctrl-names = "default";
+};
+
+/* LED3 */
+&pwm2 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C4>;
+ pinctrl-0 = <&pwm2_gpa2_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/led_kingler.dts b/zephyr/projects/corsola/led_kingler.dts
new file mode 100644
index 0000000000..92f6c4d4fe
--- /dev/null
+++ b/zephyr/projects/corsola/led_kingler.dts
@@ -0,0 +1,71 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ pwmleds {
+ compatible = "pwm-leds";
+ pwm_led0: pwm_led_0 {
+ pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED
+ &pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED
+ &pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ };
+
+ cros-pwmleds {
+ compatible = "cros-ec,pwm-leds";
+
+ leds = <&pwm_led0>;
+
+ color-map-red = <100 0 0>;
+ color-map-green = < 0 100 0>;
+ color-map-amber = <100 20 0>;
+
+ brightness-range = <255 255 0 0 0 255>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pwm_led_0@0 {
+ reg = <0>;
+ ec-led-name = "EC_LED_ID_BATTERY_LED";
+ };
+ };
+};
+
+/* Red LED */
+&pwm0_gpc3 {
+ drive-open-drain;
+};
+
+&pwm0 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm0_gpc3>;
+ pinctrl-names = "default";
+};
+
+/* Green LED */
+&pwm1_gpc2 {
+ drive-open-drain;
+};
+
+&pwm1 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm1_gpc2>;
+ pinctrl-names = "default";
+};
+
+/* Blue LED */
+&pwm2_gpc4 {
+ drive-open-drain;
+};
+
+&pwm2 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm2_gpc4>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/led_krabby.dts b/zephyr/projects/corsola/led_krabby.dts
new file mode 100644
index 0000000000..b16bff3cac
--- /dev/null
+++ b/zephyr/projects/corsola/led_krabby.dts
@@ -0,0 +1,5 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "led_it81202_base.dtsi"
diff --git a/zephyr/projects/corsola/led_magikarp.dts b/zephyr/projects/corsola/led_magikarp.dts
new file mode 100644
index 0000000000..0e2b0aca52
--- /dev/null
+++ b/zephyr/projects/corsola/led_magikarp.dts
@@ -0,0 +1,136 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "led_it81202_base.dtsi"
+
+/ {
+ led_colors: led-colors {
+ compatible = "cros-ec,led-policy";
+
+ /* Magikarp LED bat charge */
+ bat-power-state-charge {
+ charge-state = "PWR_STATE_CHARGE";
+ /* Battery percent range (>= Empty, <= 94%) */
+ batt-lvl = <BATTERY_LEVEL_EMPTY
+ (BATTERY_LEVEL_NEAR_FULL - 3)>;
+ color-0 {
+ led-color = <&color_battery_amber>;
+ };
+ };
+
+ bat-power-state-charge-near-full {
+ charge-state = "PWR_STATE_CHARGE";
+ /* Battery percent range (>= 95%, <= Full) */
+ batt-lvl = <(BATTERY_LEVEL_NEAR_FULL - 2)
+ BATTERY_LEVEL_FULL>;
+ color-0 {
+ led-color = <&color_battery_white>;
+ };
+ };
+
+ /* Magikarp LED bat discharge */
+ bat-power-state-discharge-s0 {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S0";
+ /* Battery percent range (>= 11%, <= Full) */
+ batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>;
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ };
+ };
+
+
+ bat-power-state-discharge-s0-bat-low {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S0";
+ /* Battery percent range (>= Empty, <= 10%) */
+ batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>;
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-discharge-s3 {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S3";
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-discharge-s5 {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S5";
+ color-0 {
+ led-color = <&color_battery_off>;
+ };
+ };
+
+ /* Magikarp LED bat error */
+ bat-power-state-error {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S0";
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <1000>;
+ };
+ };
+
+ bat-power-state-error-s3 {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S3";
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-error-s5 {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S5";
+
+ color-0 {
+ led-color = <&color_battery_off>;
+ };
+ };
+ };
+
+ pwm-led-pins {
+ compatible = "cros-ec,pwm-led-pins";
+
+ /* Overwrite Power LED white to off */
+ color_power_white: color-power-white {
+ led-color = "LED_WHITE";
+ led-id = "EC_LED_ID_POWER_LED";
+ led-pins = <&led_power_white 0>;
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/led_steelix.dts b/zephyr/projects/corsola/led_steelix.dts
new file mode 100644
index 0000000000..6a25929327
--- /dev/null
+++ b/zephyr/projects/corsola/led_steelix.dts
@@ -0,0 +1,55 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ pwmleds {
+ compatible = "pwm-leds";
+ led_battery_red: ec_led1_odl {
+ pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ led_battery_green: ec_led2_odl {
+ pwms = <&pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ led_power_white: ec_led3_odl {
+ pwms = <&pwm4 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ };
+};
+
+/* Red LED */
+&pwm0_gpc3 {
+ drive-open-drain;
+};
+
+&pwm0 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm0_gpc3>;
+ pinctrl-names = "default";
+};
+
+/* Green LED */
+&pwm1_gpc2 {
+ drive-open-drain;
+};
+
+&pwm1 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm1_gpc2>;
+ pinctrl-names = "default";
+};
+
+/* White LED */
+&pwm4_gpb6 {
+ drive-open-drain;
+};
+
+&pwm4 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm4_gpb6>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/led_tentacruel.dts b/zephyr/projects/corsola/led_tentacruel.dts
new file mode 100644
index 0000000000..5569a956f6
--- /dev/null
+++ b/zephyr/projects/corsola/led_tentacruel.dts
@@ -0,0 +1,118 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include "led_it81202_base.dtsi"
+
+/ {
+ led_colors: led-colors {
+ compatible = "cros-ec,led-policy";
+
+ /* Tentacruel LED bat charge */
+ bat-power-state-charge {
+ charge-state = "PWR_STATE_CHARGE";
+ /* Battery percent range (>= Empty, <= 94%) */
+ batt-lvl = <BATTERY_LEVEL_EMPTY
+ (BATTERY_LEVEL_NEAR_FULL - 3)>;
+ color-0 {
+ led-color = <&color_battery_amber>;
+ };
+ };
+
+ bat-power-state-charge-near-full {
+ charge-state = "PWR_STATE_CHARGE";
+ /* Battery percent range (>= 95%, <= Full) */
+ batt-lvl = <(BATTERY_LEVEL_NEAR_FULL - 2)
+ BATTERY_LEVEL_FULL>;
+ color-0 {
+ led-color = <&color_battery_white>;
+ };
+ };
+
+ /* Tentacruel LED bat discharge */
+ bat-power-state-discharge {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S0";
+ /* Battery percent range (>= 11%, <= Full) */
+ batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>;
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ };
+ };
+
+ bat-power-state-discharge-s3 {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S3";
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-discharge-s5 {
+ charge-state = "PWR_STATE_DISCHARGE";
+ chipset-state = "POWER_S5";
+ color-0 {
+ led-color = <&color_battery_off>;
+ };
+ };
+
+ /* Tentacruel LED bat error */
+ bat-power-state-error {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S0";
+
+ color-0 {
+ led-color = <&color_battery_amber>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <1000>;
+ };
+ };
+
+ bat-power-state-error-s3 {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S3";
+
+ color-0 {
+ led-color = <&color_battery_white>;
+ period-ms = <1000>;
+ };
+
+ color-1 {
+ led-color = <&color_battery_off>;
+ period-ms = <3000>;
+ };
+ };
+
+ bat-power-state-error-s5 {
+ charge-state = "PWR_STATE_ERROR";
+ chipset-state = "POWER_S5";
+
+ color-0 {
+ led-color = <&color_battery_off>;
+ };
+ };
+ };
+
+ pwm-led-pins {
+ compatible = "cros-ec,pwm-led-pins";
+
+ /* Overwrite Power LED white to off */
+ color_power_white: color-power-white {
+ led-color = "LED_WHITE";
+ led-id = "EC_LED_ID_POWER_LED";
+ led-pins = <&led_power_white 0>;
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/motionsense_kingler.dts b/zephyr/projects/corsola/motionsense_kingler.dts
new file mode 100644
index 0000000000..a7f674e01f
--- /dev/null
+++ b/zephyr/projects/corsola/motionsense_kingler.dts
@@ -0,0 +1,150 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Kingler and Steelix use the same dts, take care of this when modify it.
+ */
+
+#include <dt-bindings/motionsense/utils.h>
+
+/ {
+ aliases {
+ /*
+ * motion sense's <>_INT_EVENT is handled
+ * by alias. Using the alias, each driver creates
+ * its own <>_INT_EVENT.
+ */
+ bmi3xx-int = &base_accel;
+ };
+
+ /*
+ * Declare mutexes used by sensor drivers.
+ * A mutex node is used to create an instance of mutex_t.
+ * A mutex node is referenced by a sensor node if the
+ * corresponding sensor driver needs to use the
+ * instance of the mutex.
+ */
+ motionsense-mutex {
+ compatible = "cros-ec,motionsense-mutex";
+ lid_mutex: lid-mutex {
+ };
+ base_mutex: base-mutex {
+ };
+ };
+
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ lid_rot_ref: lid-rotation-ref {
+ mat33 = <0 (-1) 0
+ (-1) 0 0
+ 0 0 (-1)>;
+ };
+ base_rot_ref: base-rotation-ref {
+ mat33 = <0 (-1) 0
+ 1 0 0
+ 0 0 1>;
+ };
+ };
+
+ /*
+ * Driver specific data. A driver-specific data can be shared with
+ * different motion sensors while they are using the same driver.
+ *
+ * If a node's compatible starts with "cros-ec,accelgyro-", it is for
+ * a common structure defined in accelgyro.h.
+ * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
+ * "struct als_drv_data_t" in accelgyro.h
+ */
+ motionsense-sensor-data {
+ bma4xx_data: bma4xx-drv-data {
+ compatible = "cros-ec,drvdata-bma4xx";
+ status = "okay";
+ };
+ bmi3xx_data: bmi3xx-drv-data {
+ compatible = "cros-ec,drvdata-bmi3xx";
+ status = "okay";
+ };
+ };
+
+ /*
+ * List of motion sensors that creates motion_sensors array.
+ * The nodelabel "lid_accel" and "base_accel" are used to indicate
+ * motion sensor IDs for lid angle calculation.
+ */
+ motionsense-sensor {
+ lid_accel: lid-accel {
+ compatible = "cros-ec,bma4xx";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&lid_rot_ref>;
+ default-range = <2>;
+ drv-data = <&bma4xx_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_accel: base-accel {
+ compatible = "cros-ec,bmi3xx-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&bmi3xx_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ ec-rate = <(100 * USEC_PER_MSEC)>;
+ };
+ ec-s3 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ ec-rate = <0>;
+ };
+ };
+ };
+
+ base_gyro: base-gyro {
+ compatible = "cros-ec,bmi3xx-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&bmi3xx_data>;
+ };
+
+ };
+
+ motionsense-sensor-info {
+ compatible = "cros-ec,motionsense-sensor-info";
+
+ /*
+ * list of GPIO interrupts that have to
+ * be enabled at initial stage
+ */
+ sensor-irqs = <&int_base_imu>;
+ /* list of sensors in force mode */
+ accel-force-mode-sensors = <&lid_accel>;
+ };
+};
diff --git a/zephyr/projects/corsola/motionsense_krabby.dts b/zephyr/projects/corsola/motionsense_krabby.dts
new file mode 100644
index 0000000000..1c7d5b2df4
--- /dev/null
+++ b/zephyr/projects/corsola/motionsense_krabby.dts
@@ -0,0 +1,146 @@
+/* Copyright 2020 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/motionsense/utils.h>
+
+
+/ {
+ aliases {
+ /*
+ * motion sense's <>_INT_EVENT is handled
+ * by alias. Using the alias, each driver creates
+ * its own <>_INT_EVENT.
+ */
+ icm42607-int = &base_accel;
+ lis2dw12-int = &lid_accel;
+ };
+
+ /*
+ * Declare mutexes used by sensor drivers.
+ * A mutex node is used to create an instance of mutex_t.
+ * A mutex node is referenced by a sensor node if the
+ * corresponding sensor driver needs to use the
+ * instance of the mutex.
+ */
+ motionsense-mutex {
+ compatible = "cros-ec,motionsense-mutex";
+ lid_mutex: lid-mutex {
+ };
+
+ base_mutex: icm42607-mutex {
+ };
+ };
+
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ lid_rot_ref: lid-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+
+ base_rot_ref: base-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+ };
+
+ /*
+ * Driver specific data. A driver-specific data can be shared with
+ * different motion sensors while they are using the same driver.
+ *
+ * If a node's compatible starts with "cros-ec,accelgyro-", it is for
+ * a common structure defined in accelgyro.h.
+ * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
+ * "struct als_drv_data_t" in accelgyro.h
+ */
+ motionsense-sensor-data {
+ icm42607_data: icm42607-drv-data {
+ compatible = "cros-ec,drvdata-icm42607";
+ status = "okay";
+ };
+
+ lis2dw12_data: lis2dw12-drv-data {
+ compatible = "cros-ec,drvdata-lis2dw12";
+ status = "okay";
+ };
+ };
+
+ /*
+ * List of motion sensors that creates motion_sensors array.
+ * The nodelabel "lid_accel" and "base_accel" are used to indicate
+ * motion sensor IDs for lid angle calculation.
+ */
+ motionsense-sensor {
+ lid_accel: lid-accel {
+ compatible = "cros-ec,lis2dw12";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&lid_rot_ref>;
+ default-range = <2>;
+ drv-data = <&lis2dw12_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_accel: base-accel {
+ compatible = "cros-ec,icm42607-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_gyro: base-gyro {
+ compatible = "cros-ec,icm42607-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ };
+ };
+
+ motionsense-sensor-info {
+ compatible = "cros-ec,motionsense-sensor-info";
+
+ /*
+ * list of GPIO interrupts that have to
+ * be enabled at initial stage
+ */
+ sensor-irqs = <&int_base_imu &int_lid_imu>;
+ };
+};
diff --git a/zephyr/projects/corsola/motionsense_magikarp.dts b/zephyr/projects/corsola/motionsense_magikarp.dts
new file mode 100644
index 0000000000..92e73bd2c6
--- /dev/null
+++ b/zephyr/projects/corsola/motionsense_magikarp.dts
@@ -0,0 +1,199 @@
+/* Copyright 2020 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/motionsense/utils.h>
+
+
+/ {
+ aliases {
+ /*
+ * motion sense's <>_INT_EVENT is handled
+ * by alias. Using the alias, each driver creates
+ * its own <>_INT_EVENT.
+ */
+ icm42607-int = &base_accel;
+ lis2dw12-int = &lid_accel;
+ bmi3xx-int = &base_accel;
+ };
+
+ /*
+ * Declare mutexes used by sensor drivers.
+ * A mutex node is used to create an instance of mutex_t.
+ * A mutex node is referenced by a sensor node if the
+ * corresponding sensor driver needs to use the
+ * instance of the mutex.
+ */
+ motionsense-mutex {
+ compatible = "cros-ec,motionsense-mutex";
+ lid_mutex: lid-mutex {
+ };
+
+ base_mutex: icm42607-mutex {
+ };
+
+ base_mutex_bmi323: bmi323-mutex {
+ };
+ };
+
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ lid_rot_ref: lid-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 (-1)>;
+ };
+
+ base_rot_ref: base-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+
+ base_rot_ref_bmi: base-rotation-ref-bmi {
+ mat33 = <0 1 0
+ (-1) 0 0
+ 0 0 1>;
+ };
+ };
+
+ /*
+ * Driver specific data. A driver-specific data can be shared with
+ * different motion sensors while they are using the same driver.
+ *
+ * If a node's compatible starts with "cros-ec,accelgyro-", it is for
+ * a common structure defined in accelgyro.h.
+ * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
+ * "struct als_drv_data_t" in accelgyro.h
+ */
+ motionsense-sensor-data {
+ icm42607_data: icm42607-drv-data {
+ compatible = "cros-ec,drvdata-icm42607";
+ status = "okay";
+ };
+
+ lis2dw12_data: lis2dw12-drv-data {
+ compatible = "cros-ec,drvdata-lis2dw12";
+ status = "okay";
+ };
+
+ bmi323_data: bmi323-drv-data {
+ compatible = "cros-ec,drvdata-bmi3xx";
+ status = "okay";
+ };
+ };
+
+ /*
+ * List of motion sensors that creates motion_sensors array.
+ * The nodelabel "lid_accel" and "base_accel" are used to indicate
+ * motion sensor IDs for lid angle calculation.
+ */
+ motionsense-sensor {
+ lid_accel: lid-accel {
+ compatible = "cros-ec,lis2dw12";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&lid_rot_ref>;
+ default-range = <2>;
+ drv-data = <&lis2dw12_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_accel: base-accel {
+ compatible = "cros-ec,icm42607-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_gyro: base-gyro {
+ compatible = "cros-ec,icm42607-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ };
+ };
+
+ motionsense-sensor-alt {
+ alt_base_accel: alt-base-accel {
+ compatible = "cros-ec,bmi3xx-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex_bmi323>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_bmi>;
+ drv-data = <&bmi323_data>;
+ alternate-for = <&base_accel>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ alt_base_gyro: alt-base-gyro {
+ compatible = "cros-ec,bmi3xx-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex_bmi323>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_bmi>;
+ drv-data = <&bmi323_data>;
+ alternate-for = <&base_gyro>;
+ };
+ };
+
+ motionsense-sensor-info {
+ compatible = "cros-ec,motionsense-sensor-info";
+
+ /*
+ * list of GPIO interrupts that have to
+ * be enabled at initial stage
+ */
+ sensor-irqs = <&int_base_imu &int_lid_imu>;
+ };
+};
diff --git a/zephyr/projects/corsola/motionsense_steelix.dts b/zephyr/projects/corsola/motionsense_steelix.dts
new file mode 100644
index 0000000000..df96fc2e42
--- /dev/null
+++ b/zephyr/projects/corsola/motionsense_steelix.dts
@@ -0,0 +1,133 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/motionsense/utils.h>
+
+/* inherit the rot_ref from Kingler and overwrite it */
+&lid_rot_ref {
+ mat33 = <0 1 0
+ 1 0 0
+ 0 0 (-1)>;
+};
+
+&base_rot_ref {
+ mat33 = <1 0 0
+ 0 (-1) 0
+ 0 0 (-1)>;
+};
+
+/ {
+ aliases {
+ /*
+ * motion sense's <>_INT_EVENT is handled
+ * by alias. Using the alias, each driver creates
+ * its own <>_INT_EVENT.
+ */
+ lsm6dsm-int = &base_accel;
+ };
+
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ base_rot_ref_lsm6dsm: base-rotation-ref-lsm6dsm {
+ mat33 = <0 1 0
+ 1 0 0
+ 0 0 (-1)>;
+ };
+ };
+
+ /*
+ * Driver specific data. A driver-specific data can be shared with
+ * different motion sensors while they are using the same driver.
+ *
+ * If a node's compatible starts with "cros-ec,accelgyro-", it is for
+ * a common structure defined in accelgyro.h.
+ * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
+ * "struct als_drv_data_t" in accelgyro.h
+ */
+ motionsense-sensor-data {
+ lis2dw12_data: lis2dw12-drv-data {
+ compatible = "cros-ec,drvdata-lis2dw12";
+ status = "okay";
+ };
+ lsm6dsm_data_accel: lsm6dsm-accel-drv-data {
+ compatible = "cros-ec,drvdata-lsm6dsm";
+ status = "okay";
+ };
+ lsm6dsm_data_gyro: lsm6dsm-gyro-drv-data {
+ compatible = "cros-ec,drvdata-lsm6dsm";
+ status = "okay";
+ };
+ };
+
+ motionsense-sensor-alt {
+ alt_lid_accel: alt-lid-accel {
+ compatible = "cros-ec,lis2dw12";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&lid_rot_ref>;
+ default-range = <2>;
+ drv-data = <&lis2dw12_data>;
+ i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS";
+ alternate-for = <&lid_accel>;
+ alternate-ssfc-indicator = <&lid_sensor_1>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ alt_base_accel: alt-base-accel {
+ compatible = "cros-ec,lsm6dsm-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_lsm6dsm>;
+ drv-data = <&lsm6dsm_data_accel>;
+ alternate-for = <&base_accel>;
+ alternate-ssfc-indicator = <&base_sensor_1>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ ec-rate = <(100 * USEC_PER_MSEC)>;
+ };
+ ec-s3 {
+ odr = <(12500 | ROUND_UP_FLAG)>;
+ ec-rate = <0>;
+ };
+ };
+ };
+
+ alt_base_gyro: alt-base-gyro {
+ compatible = "cros-ec,lsm6dsm-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_lsm6dsm>;
+ default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */
+ drv-data = <&lsm6dsm_data_gyro>;
+ alternate-for = <&base_gyro>;
+ alternate-ssfc-indicator = <&base_sensor_1>;
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/motionsense_tentacruel.dts b/zephyr/projects/corsola/motionsense_tentacruel.dts
new file mode 100644
index 0000000000..68b2c023df
--- /dev/null
+++ b/zephyr/projects/corsola/motionsense_tentacruel.dts
@@ -0,0 +1,199 @@
+/* Copyright 2020 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/motionsense/utils.h>
+
+
+/ {
+ aliases {
+ /*
+ * motion sense's <>_INT_EVENT is handled
+ * by alias. Using the alias, each driver creates
+ * its own <>_INT_EVENT.
+ */
+ icm42607-int = &base_accel;
+ lis2dw12-int = &lid_accel;
+ bmi3xx-int = &base_accel;
+ };
+
+ /*
+ * Declare mutexes used by sensor drivers.
+ * A mutex node is used to create an instance of mutex_t.
+ * A mutex node is referenced by a sensor node if the
+ * corresponding sensor driver needs to use the
+ * instance of the mutex.
+ */
+ motionsense-mutex {
+ compatible = "cros-ec,motionsense-mutex";
+ lid_mutex: lid-mutex {
+ };
+
+ base_mutex: icm42607-mutex {
+ };
+
+ base_mutex_bmi323: bmi323-mutex {
+ };
+ };
+
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ lid_rot_ref: lid-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+
+ base_rot_ref: base-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+
+ base_rot_ref_bmi: base-rotation-ref-bmi {
+ mat33 = <0 1 0
+ (-1) 0 0
+ 0 0 1>;
+ };
+ };
+
+ /*
+ * Driver specific data. A driver-specific data can be shared with
+ * different motion sensors while they are using the same driver.
+ *
+ * If a node's compatible starts with "cros-ec,accelgyro-", it is for
+ * a common structure defined in accelgyro.h.
+ * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
+ * "struct als_drv_data_t" in accelgyro.h
+ */
+ motionsense-sensor-data {
+ icm42607_data: icm42607-drv-data {
+ compatible = "cros-ec,drvdata-icm42607";
+ status = "okay";
+ };
+
+ lis2dw12_data: lis2dw12-drv-data {
+ compatible = "cros-ec,drvdata-lis2dw12";
+ status = "okay";
+ };
+
+ bmi323_data: bmi323-drv-data {
+ compatible = "cros-ec,drvdata-bmi3xx";
+ status = "okay";
+ };
+ };
+
+ /*
+ * List of motion sensors that creates motion_sensors array.
+ * The nodelabel "lid_accel" and "base_accel" are used to indicate
+ * motion sensor IDs for lid angle calculation.
+ */
+ motionsense-sensor {
+ lid_accel: lid-accel {
+ compatible = "cros-ec,lis2dw12";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&lid_rot_ref>;
+ default-range = <2>;
+ drv-data = <&lis2dw12_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_accel: base-accel {
+ compatible = "cros-ec,icm42607-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ base_gyro: base-gyro {
+ compatible = "cros-ec,icm42607-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref>;
+ drv-data = <&icm42607_data>;
+ };
+ };
+
+ motionsense-sensor-alt {
+ alt_base_accel: alt-base-accel {
+ compatible = "cros-ec,bmi3xx-accel";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex_bmi323>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_bmi>;
+ drv-data = <&bmi323_data>;
+ alternate-for = <&base_accel>;
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ ec-s3 {
+ odr = <(10000 | ROUND_UP_FLAG)>;
+ };
+ };
+ };
+
+ alt_base_gyro: alt-base-gyro {
+ compatible = "cros-ec,bmi3xx-gyro";
+ status = "okay";
+
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex_bmi323>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_bmi>;
+ drv-data = <&bmi323_data>;
+ alternate-for = <&base_gyro>;
+ };
+ };
+
+ motionsense-sensor-info {
+ compatible = "cros-ec,motionsense-sensor-info";
+
+ /*
+ * list of GPIO interrupts that have to
+ * be enabled at initial stage
+ */
+ sensor-irqs = <&int_base_imu &int_lid_imu>;
+ };
+};
diff --git a/zephyr/projects/corsola/npcx_keyboard.dts b/zephyr/projects/corsola/npcx_keyboard.dts
new file mode 100644
index 0000000000..f9e46de1f2
--- /dev/null
+++ b/zephyr/projects/corsola/npcx_keyboard.dts
@@ -0,0 +1,32 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+&cros_kb_raw {
+ status = "okay";
+ /* No KSO2 (it's inverted and implemented by GPIO) */
+ pinctrl-0 = <
+ &ksi0_gp31
+ &ksi1_gp30
+ &ksi2_gp27
+ &ksi3_gp26
+ &ksi4_gp25
+ &ksi5_gp24
+ &ksi6_gp23
+ &ksi7_gp22
+ &kso00_gp21
+ &kso01_gp20
+ &kso03_gp16
+ &kso04_gp15
+ &kso05_gp14
+ &kso06_gp13
+ &kso07_gp12
+ &kso08_gp11
+ &kso09_gp10
+ &kso10_gp07
+ &kso11_gp06
+ &kso12_gp05
+ >;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/projects/corsola/power_signal.dts b/zephyr/projects/corsola/power_signal.dts
new file mode 100644
index 0000000000..181d7cf96e
--- /dev/null
+++ b/zephyr/projects/corsola/power_signal.dts
@@ -0,0 +1,26 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ power_signal_list: power-signal-list {
+ compatible = "mt8186,power-signal-list";
+ ap_in_rst {
+ power-enum-name = "AP_IN_RST";
+ power-gpio-pin = <&ap_sysrst_odl_r>;
+ };
+ ap_in_s3 {
+ power-enum-name = "AP_IN_S3";
+ power-gpio-pin = <&ap_in_sleep_l>;
+ };
+ ap_wdt_asserted {
+ power-enum-name = "AP_WDT_ASSERTED";
+ power-gpio-pin = <&ap_ec_wdtrst_l>;
+ };
+ ap_warm_rst_req {
+ power-enum-name = "AP_WARM_RST_REQ";
+ power-gpio-pin = <&ap_ec_warm_rst_req>;
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/prj.conf b/zephyr/projects/corsola/prj.conf
new file mode 100644
index 0000000000..110b91bbbb
--- /dev/null
+++ b/zephyr/projects/corsola/prj.conf
@@ -0,0 +1,101 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+
+# http://google3/hardware/standards/usb/
+CONFIG_PLATFORM_EC_USB_PID=0x505C
+
+# CROS EC
+CONFIG_CROS_EC=y
+CONFIG_PLATFORM_EC=y
+CONFIG_PLATFORM_EC_SWITCH=y
+CONFIG_SHIMMED_TASKS=y
+
+# AP SoC configuration
+CONFIG_AP=y
+CONFIG_AP_ARM_MTK_MT8186=y
+
+# Variant config
+CONFIG_VARIANT_CORSOLA_DB_DETECTION=y
+
+# Shell features
+CONFIG_KERNEL_SHELL=y
+CONFIG_SHELL_HELP=y
+CONFIG_SHELL_HISTORY=y
+CONFIG_SHELL_TAB=y
+CONFIG_SHELL_TAB_AUTOCOMPLETION=y
+
+# CBI
+CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
+
+# I2C
+CONFIG_I2C=y
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
+CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
+CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
+
+# MKBP
+CONFIG_PLATFORM_EC_MKBP_EVENT=y
+CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y
+CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y
+
+# EFS2
+CONFIG_PLATFORM_EC_VBOOT_EFS2=y
+
+# USB
+CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n
+CONFIG_PLATFORM_EC_USB_PD_USB32_DRD=n
+CONFIG_PLATFORM_EC_USB_PD_USB4=n
+CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB_CUSTOM_HOOK=y
+
+# USB-C
+CONFIG_PLATFORM_EC_USBC=y
+CONFIG_PLATFORM_EC_USBC_SS_MUX_DFP_ONLY=y
+CONFIG_PLATFORM_EC_USB_PD_DPS=y
+CONFIG_PLATFORM_EC_USB_PD_DP_HPD_GPIO=y
+CONFIG_PLATFORM_EC_USB_PD_DP_HPD_GPIO_CUSTOM=y
+CONFIG_PLATFORM_EC_USB_PD_FRS=y
+
+# Power Seq
+CONFIG_PLATFORM_EC_CHIPSET_RESUME_INIT_HOOK=y
+CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
+CONFIG_PLATFORM_EC_POWERSEQ=y
+CONFIG_PLATFORM_EC_POWERSEQ_HOST_SLEEP=y
+CONFIG_PLATFORM_EC_POWERSEQ_PP5000_CONTROL=n
+CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y
+
+# Optional features
+CONFIG_FLASH_SHELL=n
+
+# EEPROM
+CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
+
+# Host Commands
+CONFIG_PLATFORM_EC_HOSTCMD=y
+
+# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
+CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
+CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
+CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
+CONFIG_PLATFORM_EC_BATTERY_SMART=y
+CONFIG_PLATFORM_EC_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV=9000
+CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
+CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY=y
+
+# Charger
+CONFIG_PLATFORM_EC_BC12_CLIENT_MODE_ONLY_PI3USB9201=y
+CONFIG_PLATFORM_EC_CHARGER=y
+CONFIG_PLATFORM_EC_CHARGE_MANAGER=y
+
+# Button
+CONFIG_PLATFORM_EC_CMD_BUTTON=y
+CONFIG_PLATFORM_EC_POWER_BUTTON=y
+CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
diff --git a/zephyr/projects/corsola/prj_it81202_base.conf b/zephyr/projects/corsola/prj_it81202_base.conf
new file mode 100644
index 0000000000..04283bcf5c
--- /dev/null
+++ b/zephyr/projects/corsola/prj_it81202_base.conf
@@ -0,0 +1,93 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Bring up options
+CONFIG_SHELL_HISTORY_BUFFER=256
+CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
+CONFIG_PLATFORM_EC_BRINGUP=y
+
+# Power Sequencing
+CONFIG_PLATFORM_EC_CHIPSET_RESET_HOOK=y
+
+# Lid Switch
+CONFIG_PLATFORM_EC_LID_SWITCH=y
+
+# Charger
+CONFIG_PLATFORM_EC_CHARGE_RAMP_HW=y
+CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
+CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
+CONFIG_PLATFORM_EC_CHARGER_RT9490=y
+CONFIG_PLATFORM_EC_CHARGER_MAINTAIN_VBAT=y
+CONFIG_PLATFORM_EC_CHARGER_PSYS=y
+CONFIG_PLATFORM_EC_CHARGER_PSYS_READ=y
+# BOARD_RS2
+CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
+# BOARD_RS1
+CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
+CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP=y
+
+# Host Commands
+CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCEL_INFO=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_SYSINFO=y
+CONFIG_PLATFORM_EC_HOST_COMMAND_STATUS=y
+
+# LED
+CONFIG_PLATFORM_EC_LED_DT=y
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
+# Sensors
+CONFIG_PLATFORM_EC_MOTIONSENSE=y
+CONFIG_PLATFORM_EC_ACCEL_FIFO=y
+CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y
+CONFIG_PLATFORM_EC_LID_ANGLE=y
+CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
+CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y
+CONFIG_PLATFORM_EC_TABLET_MODE=y
+CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=y
+CONFIG_PLATFORM_EC_MAX_SENSOR_FREQ_MILLIHZ=100000
+
+# Sensor Drivers
+CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y
+CONFIG_PLATFORM_EC_ACCELGYRO_ICM42607=y
+CONFIG_PLATFORM_EC_ACCELGYRO_ICM_COMM_I2C=y
+
+# Tasks
+CONFIG_TASK_CHARGER_STACK_SIZE=1024
+CONFIG_TASK_CHIPSET_STACK_SIZE=1440
+CONFIG_TASK_MOTIONSENSE_STACK_SIZE=1024
+CONFIG_TASK_PD_STACK_SIZE=1280
+
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
+
+# USB-C
+CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
+CONFIG_PLATFORM_EC_USBC_PPC_RT1739=y
+CONFIG_PLATFORM_EC_USBC_PPC_SYV682C=y
+CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y
+CONFIG_PLATFORM_EC_USB_MUX_IT5205=y
+CONFIG_PLATFORM_EC_USB_MUX_TUSB546=y
+CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
+CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y
+CONFIG_PLATFORM_EC_USB_PD_FRS_PPC=y
+CONFIG_PLATFORM_EC_USB_PD_LOGGING=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_DRIVER_IT8XXX2=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_ITE_ON_CHIP=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_TCPCI=y
+CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_PPC=y
+CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_ADC_EACH_PORT=y
+CONFIG_PLATFORM_EC_USB_PD_DUAL_ROLE_AUTO_TOGGLE=n
+CONFIG_PLATFORM_EC_CONFIG_USB_PD_3A_PORTS=0
+CONFIG_PLATFORM_EC_USB_PD_PULLUP=1
+
+CONFIG_PLATFORM_EC_SHA256_UNROLLED=y
+
+# TODO(b/180980668): bring these features up
+CONFIG_LTO=n
+CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
diff --git a/zephyr/projects/corsola/prj_kingler.conf b/zephyr/projects/corsola/prj_kingler.conf
new file mode 100644
index 0000000000..d7de991e93
--- /dev/null
+++ b/zephyr/projects/corsola/prj_kingler.conf
@@ -0,0 +1,12 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Variant config
+CONFIG_BOARD_KINGLER=y
+
+# LED
+CONFIG_PLATFORM_EC_LED_PWM=y
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI2=y
diff --git a/zephyr/projects/corsola/prj_krabby.conf b/zephyr/projects/corsola/prj_krabby.conf
new file mode 100644
index 0000000000..c4cde05c16
--- /dev/null
+++ b/zephyr/projects/corsola/prj_krabby.conf
@@ -0,0 +1,9 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Variant config
+CONFIG_BOARD_KRABBY=y
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI2=y
diff --git a/zephyr/projects/corsola/prj_magikarp.conf b/zephyr/projects/corsola/prj_magikarp.conf
new file mode 100644
index 0000000000..a5ec9ede3b
--- /dev/null
+++ b/zephyr/projects/corsola/prj_magikarp.conf
@@ -0,0 +1,27 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Variant config
+CONFIG_BOARD_MAGIKARP=y
+
+# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
+CONFIG_PLATFORM_EC_USB_MUX_TUSB546=n
+CONFIG_PLATFORM_EC_USB_MUX_PS8743=y
+CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
+CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
+
+# Sensor
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+
+# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
+
+# Battery
+CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y
diff --git a/zephyr/projects/corsola/prj_npcx993_base.conf b/zephyr/projects/corsola/prj_npcx993_base.conf
new file mode 100644
index 0000000000..0642bcd331
--- /dev/null
+++ b/zephyr/projects/corsola/prj_npcx993_base.conf
@@ -0,0 +1,95 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+# Bring up options
+CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
+
+# Debug options and features; can be disabled to save memory or once bringup
+# is complete.
+CONFIG_SHELL_MINIMAL=n
+CONFIG_LOG=y
+CONFIG_LOG_MODE_MINIMAL=y
+
+# ADC
+CONFIG_ADC=y
+
+# Charger
+CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
+CONFIG_PLATFORM_EC_CHARGER_ISL9238C=y
+CONFIG_PLATFORM_EC_CHARGER_PSYS=y
+CONFIG_PLATFORM_EC_CHARGER_PSYS_READ=y
+CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
+CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
+CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
+# LED
+CONFIG_PLATFORM_EC_LED_COMMON=y
+CONFIG_PLATFORM_EC_LED_ONOFF_STATES=y
+
+# Math
+CONFIG_PLATFORM_EC_MATH_UTIL=y
+
+# Power sequencing
+CONFIG_PLATFORM_EC_POWERSEQ_MT8186=y
+CONFIG_PLATFORM_EC_POWERSEQ_S4=n
+
+# Button
+CONFIG_PLATFORM_EC_BUTTONS_RUNTIME_CONFIG=y
+
+# Sensors
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y
+CONFIG_PLATFORM_EC_ACCEL_FIFO=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCEL_INFO=y
+CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y
+CONFIG_PLATFORM_EC_LID_ANGLE=y
+CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
+CONFIG_PLATFORM_EC_LID_SWITCH=y
+CONFIG_PLATFORM_EC_MOTIONSENSE=y
+CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y
+CONFIG_PLATFORM_EC_TABLET_MODE=y
+CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=y
+
+# USBA
+CONFIG_PLATFORM_EC_USBA=y
+
+# USBC
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
+CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
+CONFIG_PLATFORM_EC_PD_POWER_SUPPLY_TURN_OFF_DELAY=15000
+CONFIG_PLATFORM_EC_PD_POWER_SUPPLY_TURN_ON_DELAY=15000
+CONFIG_PLATFORM_EC_USBC_PPC=y
+CONFIG_PLATFORM_EC_USBC_PPC_NX20P3483=y
+CONFIG_PLATFORM_EC_USBC_PPC_RT1718S=y
+CONFIG_PLATFORM_EC_USB_MUX_PS8743=y
+CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
+CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y
+CONFIG_PLATFORM_EC_USB_PD_FRS_TCPC=y
+CONFIG_PLATFORM_EC_USB_PD_LOGGING=y
+CONFIG_PLATFORM_EC_USB_PD_DEBUG_FIXED_LEVEL=y
+CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL=2
+CONFIG_PLATFORM_EC_USB_PD_TCPM_ANX7447=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_ANX7447_AUX_PU_PD=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_RT1718S=y
+CONFIG_PLATFORM_EC_USB_PD_TCPM_SBU=y
+CONFIG_PLATFORM_EC_USB_PD_VBUS_DETECT_TCPC=y
+CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_BY_BOARD=y
+
+# External power
+CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+
+# Keyboard
+CONFIG_CROS_KB_RAW_NPCX=y
+CONFIG_CROS_KB_RAW_NPCX_KSO_HIGH_DRIVE=y
+
+CONFIG_SYSCON=y
+
+CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n
diff --git a/zephyr/projects/corsola/prj_steelix.conf b/zephyr/projects/corsola/prj_steelix.conf
new file mode 100644
index 0000000000..7a854b1313
--- /dev/null
+++ b/zephyr/projects/corsola/prj_steelix.conf
@@ -0,0 +1,32 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Variant config
+CONFIG_BOARD_STEELIX=y
+
+# steelix only use D2, drop the workaround config for H1
+CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=n
+
+# Motion sensor
+CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y
+CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSM=y
+CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
+CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
+CONFIG_PLATFORM_EC_KEYBOARD_STRICT_DEBOUNCE=y
+
+# USBC
+CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=3250
+CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=65000
+
+# Remove bring up options for FW QUAL
+CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=n
+
+# Remove debug options and features for FW QUAL
+CONFIG_LOG=n
+CONFIG_LOG_MODE_MINIMAL=n
+CONFIG_SHELL_MINIMAL=y
+CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL=0
diff --git a/zephyr/projects/corsola/prj_tentacruel.conf b/zephyr/projects/corsola/prj_tentacruel.conf
new file mode 100644
index 0000000000..71cc9d9694
--- /dev/null
+++ b/zephyr/projects/corsola/prj_tentacruel.conf
@@ -0,0 +1,26 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Variant config
+CONFIG_BOARD_TENTACRUEL=y
+
+# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
+CONFIG_PLATFORM_EC_USB_MUX_TUSB546=n
+CONFIG_PLATFORM_EC_USB_MUX_PS8743=y
+
+# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
+CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
+
+# Sensor
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
+CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+
+# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
+
+# Battery
+CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
diff --git a/zephyr/projects/corsola/src/board.c b/zephyr/projects/corsola/src/board.c
new file mode 100644
index 0000000000..93a2443191
--- /dev/null
+++ b/zephyr/projects/corsola/src/board.c
@@ -0,0 +1,37 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "console.h"
+#include "hooks.h"
+#include "typec_control.h"
+#include "usb_dp_alt_mode.h"
+#include "usb_mux.h"
+#include "usb_pd.h"
+#include "usbc_ppc.h"
+
+#include "baseboard_usbc_config.h"
+
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
+
+static void ccd_interrupt_deferred(void)
+{
+ /*
+ * If CCD_MODE_ODL asserts, it means there's a debug accessory connected
+ * and we should enable the SBU FETs.
+ */
+ typec_set_sbu(CONFIG_CCD_USBC_PORT_NUMBER, 1);
+
+ /* Mux DP AUX away when CCD enabled to prevent the AUX channel
+ * interferes the SBU pins.
+ */
+ CPRINTS("CCD Enabled, mux DP_AUX_PATH_SEL to 1");
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(dp_aux_path_sel), 1);
+}
+DECLARE_DEFERRED(ccd_interrupt_deferred);
+
+void ccd_interrupt(enum gpio_signal signal)
+{
+ hook_call_deferred(&ccd_interrupt_deferred_data, 0);
+}
diff --git a/zephyr/projects/corsola/src/board_chipset.c b/zephyr/projects/corsola/src/board_chipset.c
new file mode 100644
index 0000000000..54e96bc631
--- /dev/null
+++ b/zephyr/projects/corsola/src/board_chipset.c
@@ -0,0 +1,49 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Corsola baseboard-chipset specific configuration */
+
+#include <zephyr/init.h>
+#include <ap_power/ap_power.h>
+#include <zephyr/drivers/gpio.h>
+#include "gpio.h"
+
+static void board_backlight_handler(struct ap_power_ev_callback *cb,
+ struct ap_power_ev_data data)
+{
+ int value;
+
+ switch (data.event) {
+ default:
+ return;
+
+ case AP_POWER_RESUME:
+ /* Called on AP S3 -> S0 transition */
+ value = 1;
+ break;
+
+ case AP_POWER_SUSPEND:
+ /* Called on AP S0 -> S3 transition */
+ value = 0;
+ break;
+ }
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_bl_en_od), value);
+}
+
+static int install_backlight_handler(const struct device *unused)
+{
+ static struct ap_power_ev_callback cb;
+
+ /*
+ * Add a callback for suspend/resume to
+ * control the keyboard backlight.
+ */
+ ap_power_ev_init_callback(&cb, board_backlight_handler,
+ AP_POWER_RESUME | AP_POWER_SUSPEND);
+ ap_power_ev_add_callback(&cb);
+ return 0;
+}
+
+SYS_INIT(install_backlight_handler, APPLICATION, 1);
diff --git a/zephyr/projects/corsola/src/hibernate.c b/zephyr/projects/corsola/src/hibernate.c
new file mode 100644
index 0000000000..56c085e077
--- /dev/null
+++ b/zephyr/projects/corsola/src/hibernate.c
@@ -0,0 +1,22 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include <zephyr/drivers/gpio.h>
+
+#include "charger.h"
+#include "driver/charger/isl923x_public.h"
+#include "system.h"
+
+/* Corsola board specific hibernate implementation */
+__override void board_hibernate(void)
+{
+#ifdef CONFIG_CHARGER_ISL9238C
+ isl9238c_hibernate(CHARGER_SOLO);
+#endif
+}
+
+__override void board_hibernate_late(void)
+{
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_ulp), 1);
+}
diff --git a/zephyr/projects/corsola/src/kingler/board_steelix.c b/zephyr/projects/corsola/src/kingler/board_steelix.c
new file mode 100644
index 0000000000..8b88a6d7c7
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/board_steelix.c
@@ -0,0 +1,76 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Board re-init for Rusty board
+ * Rusty shares the firmware with Steelix.
+ * Steelix is convertible but Rusty is clamshell
+ * so some functions should be disabled for clamshell.
+ */
+#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio.h>
+
+#include "accelgyro.h"
+#include "common.h"
+#include "cros_cbi.h"
+#include "driver/accelgyro_bmi3xx.h"
+#include "driver/accelgyro_lsm6dsm.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+#include "motion_sense.h"
+#include "motionsense_sensors.h"
+#include "tablet_mode.h"
+
+LOG_MODULE_REGISTER(board_init, LOG_LEVEL_ERR);
+
+static bool board_is_clamshell;
+
+static void board_setup_init(void)
+{
+ int ret;
+ uint32_t val;
+
+ ret = cros_cbi_get_fw_config(FORM_FACTOR, &val);
+ if (ret != 0) {
+ LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FORM_FACTOR);
+ return;
+ }
+ if (val == CLAMSHELL) {
+ board_is_clamshell = true;
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_setup_init, HOOK_PRIO_PRE_DEFAULT);
+
+static void disable_base_imu_irq(void)
+{
+ if (board_is_clamshell) {
+ gpio_disable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_base_imu));
+ gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(base_imu_int_l),
+ GPIO_INPUT | GPIO_PULL_UP);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, disable_base_imu_irq, HOOK_PRIO_POST_DEFAULT);
+
+static bool base_use_alt_sensor;
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ if (base_use_alt_sensor) {
+ lsm6dsm_interrupt(signal);
+ } else {
+ bmi3xx_interrupt(signal);
+ }
+}
+
+static void alt_sensor_init(void)
+{
+ base_use_alt_sensor = cros_cbi_ssfc_check_match(
+ CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_1)));
+
+ motion_sensors_check_ssfc();
+}
+DECLARE_HOOK(HOOK_INIT, alt_sensor_init, HOOK_PRIO_POST_I2C);
diff --git a/zephyr/projects/corsola/src/kingler/button.c b/zephyr/projects/corsola/src/kingler/button.c
new file mode 100644
index 0000000000..920069bef6
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/button.c
@@ -0,0 +1,35 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* kingler button */
+
+#include "button.h"
+#include "cros_board_info.h"
+#include "gpio.h"
+#include "hooks.h"
+
+static void buttons_hook(void)
+{
+ int version;
+
+ if (cbi_get_board_version(&version)) {
+ return;
+ }
+
+ /* b:219891339: drop this workaround when we deprecate rev0 */
+ if (version == 0) {
+ /* swap VOLUP/VOLDN */
+ button_reassign_gpio(BUTTON_VOLUME_DOWN, GPIO_VOLUME_UP_L);
+ button_reassign_gpio(BUTTON_VOLUME_UP, GPIO_VOLUME_DOWN_L);
+ /*
+ * button_reassign_gpio will disable the old button interrupt
+ * and then enable the new button interrupt which cause the
+ * GPIO_VOLUME_UP_L interrupt disabled after we reassign
+ * BUTTON_VOLUME_UP, so we need to re-enable it here.
+ */
+ gpio_enable_interrupt(GPIO_VOLUME_UP_L);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, buttons_hook, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/kingler/i2c.c b/zephyr/projects/corsola/src/kingler/i2c.c
new file mode 100644
index 0000000000..f2bbff3749
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/i2c.c
@@ -0,0 +1,21 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c/i2c.h"
+#include "i2c.h"
+
+/* Kingler and Steelix board specific i2c implementation */
+
+#ifdef CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED
+int board_allow_i2c_passthru(const struct i2c_cmd_desc_t *cmd_desc)
+{
+ return (i2c_get_device_for_port(cmd_desc->port) ==
+ i2c_get_device_for_port(I2C_PORT_VIRTUAL_BATTERY) ||
+ i2c_get_device_for_port(cmd_desc->port) ==
+ i2c_get_device_for_port(I2C_PORT_EEPROM) ||
+ i2c_get_device_for_port(cmd_desc->port) ==
+ i2c_get_device_for_port(I2C_PORT_USB_C0));
+}
+#endif
diff --git a/zephyr/projects/corsola/src/kingler/led.c b/zephyr/projects/corsola/src/kingler/led.c
new file mode 100644
index 0000000000..4e2c5b12fb
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/led.c
@@ -0,0 +1,52 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Battery LED control for Kingler
+ */
+#include "common.h"
+#include "ec_commands.h"
+#include "led_common.h"
+#include "led_onoff_states.h"
+#include "led_pwm.h"
+
+__override const int led_charge_lvl_1 = 5;
+__override const int led_charge_lvl_2 = 97;
+__override struct led_descriptor
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
+
+__override void led_set_color_battery(enum ec_led_colors color)
+{
+ switch (color) {
+ case EC_LED_COLOR_RED:
+ set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_RED);
+ break;
+ case EC_LED_COLOR_GREEN:
+ set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_GREEN);
+ break;
+ case EC_LED_COLOR_AMBER:
+ set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_AMBER);
+ break;
+ default: /* LED_OFF and other unsupported colors */
+ set_pwm_led_color(EC_LED_ID_BATTERY_LED, -1);
+ break;
+ }
+}
diff --git a/zephyr/projects/corsola/src/kingler/led_steelix.c b/zephyr/projects/corsola/src/kingler/led_steelix.c
new file mode 100644
index 0000000000..87b76128e8
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/led_steelix.c
@@ -0,0 +1,181 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Battery LED control for Steelix
+ */
+
+#include <zephyr/drivers/pwm.h>
+#include <zephyr/logging/log.h>
+
+#include "board_led.h"
+#include "common.h"
+#include "cros_cbi.h"
+#include "led_common.h"
+#include "led_onoff_states.h"
+#include "util.h"
+
+LOG_MODULE_REGISTER(board_led, LOG_LEVEL_ERR);
+
+#define BOARD_LED_PWM_PERIOD_NS BOARD_LED_HZ_TO_PERIOD_NS(100)
+
+static const struct board_led_pwm_dt_channel board_led_battery_red =
+ BOARD_LED_PWM_DT_CHANNEL_INITIALIZER(DT_NODELABEL(led_battery_red));
+static const struct board_led_pwm_dt_channel board_led_battery_green =
+ BOARD_LED_PWM_DT_CHANNEL_INITIALIZER(DT_NODELABEL(led_battery_green));
+static const struct board_led_pwm_dt_channel board_led_power_white =
+ BOARD_LED_PWM_DT_CHANNEL_INITIALIZER(DT_NODELABEL(led_power_white));
+
+__override const int led_charge_lvl_1 = 5;
+__override const int led_charge_lvl_2 = 97;
+__override struct led_descriptor
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
+
+__override const struct led_descriptor
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF,
+ 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = {
+ EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED,
+};
+
+const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
+
+static void board_led_pwm_set_duty(const struct board_led_pwm_dt_channel *ch,
+ int percent)
+{
+ uint32_t pulse_ns;
+ int rv;
+
+ if (!device_is_ready(ch->dev)) {
+ LOG_ERR("PWM device %s not ready", ch->dev->name);
+ return;
+ }
+
+ pulse_ns = DIV_ROUND_NEAREST(BOARD_LED_PWM_PERIOD_NS * percent, 100);
+
+ LOG_DBG("Board LED PWM %s set percent (%d), pulse %d", ch->dev->name,
+ percent, pulse_ns);
+
+ rv = pwm_set(ch->dev, ch->channel, BOARD_LED_PWM_PERIOD_NS, pulse_ns,
+ ch->flags);
+ if (rv) {
+ LOG_ERR("pwm_set() failed %s (%d)", ch->dev->name, rv);
+ }
+}
+
+static bool device_is_clamshell(void)
+{
+ int ret;
+ uint32_t val;
+
+ ret = cros_cbi_get_fw_config(FORM_FACTOR, &val);
+ if (ret != 0) {
+ LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FORM_FACTOR);
+ return false;
+ }
+
+ return val == CLAMSHELL;
+}
+
+__override void led_set_color_battery(enum ec_led_colors color)
+{
+ switch (color) {
+ case EC_LED_COLOR_RED:
+ board_led_pwm_set_duty(&board_led_battery_red, 100);
+ board_led_pwm_set_duty(&board_led_battery_green, 0);
+ break;
+ case EC_LED_COLOR_GREEN:
+ board_led_pwm_set_duty(&board_led_battery_red, 0);
+ board_led_pwm_set_duty(&board_led_battery_green, 100);
+ break;
+ case EC_LED_COLOR_AMBER:
+ board_led_pwm_set_duty(&board_led_battery_red, 100);
+ board_led_pwm_set_duty(&board_led_battery_green, 20);
+ break;
+ default: /* LED_OFF and other unsupported colors */
+ board_led_pwm_set_duty(&board_led_battery_red, 0);
+ board_led_pwm_set_duty(&board_led_battery_green, 0);
+ break;
+ }
+}
+
+__override void led_set_color_power(enum ec_led_colors color)
+{
+ if (device_is_clamshell()) {
+ board_led_pwm_set_duty(&board_led_power_white, 0);
+ } else {
+ switch (color) {
+ case EC_LED_COLOR_WHITE:
+ board_led_pwm_set_duty(&board_led_power_white, 100);
+ break;
+ default:
+ board_led_pwm_set_duty(&board_led_power_white, 0);
+ break;
+ }
+ }
+}
+
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
+{
+ if (led_id == EC_LED_ID_BATTERY_LED) {
+ brightness_range[EC_LED_COLOR_RED] = 1;
+ brightness_range[EC_LED_COLOR_GREEN] = 1;
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ } else if (led_id == EC_LED_ID_POWER_LED) {
+ if (device_is_clamshell()) {
+ brightness_range[EC_LED_COLOR_WHITE] = 0;
+ } else {
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
+ }
+ }
+}
+
+int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
+{
+ if (led_id == EC_LED_ID_BATTERY_LED) {
+ if (brightness[EC_LED_COLOR_RED] != 0) {
+ led_set_color_battery(EC_LED_COLOR_RED);
+ } else if (brightness[EC_LED_COLOR_GREEN] != 0) {
+ led_set_color_battery(EC_LED_COLOR_GREEN);
+ } else if (brightness[EC_LED_COLOR_AMBER] != 0) {
+ led_set_color_battery(EC_LED_COLOR_AMBER);
+ } else {
+ led_set_color_battery(LED_OFF);
+ }
+ } else if (led_id == EC_LED_ID_POWER_LED) {
+ if (brightness[EC_LED_COLOR_WHITE] != 0) {
+ led_set_color_power(EC_LED_COLOR_WHITE);
+ } else {
+ led_set_color_power(LED_OFF);
+ }
+ }
+
+ return EC_SUCCESS;
+}
diff --git a/zephyr/projects/corsola/src/kingler/usb_pd_policy.c b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
new file mode 100644
index 0000000000..3de2857ad1
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
@@ -0,0 +1,74 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "charge_manager.h"
+#include "console.h"
+#include "driver/ppc/rt1718s.h"
+#include "system.h"
+#include "usb_mux.h"
+#include "usb_pd.h"
+#include "usbc_ppc.h"
+#include "util.h"
+
+#include "baseboard_usbc_config.h"
+
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+void pd_power_supply_reset(int port)
+{
+ int prev_en;
+
+ prev_en = ppc_is_sourcing_vbus(port);
+
+ if (port == USBC_PORT_C1) {
+ rt1718s_gpio_set_level(port, GPIO_EN_USB_C1_SOURCE, 0);
+ }
+
+ /* Disable VBUS. */
+ ppc_vbus_source_enable(port, 0);
+
+ /* Enable discharge if we were previously sourcing 5V */
+ if (prev_en) {
+ pd_set_vbus_discharge(port, 1);
+ }
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+}
+
+int pd_set_power_supply_ready(int port)
+{
+ int rv;
+
+ /* Disable charging. */
+ rv = ppc_vbus_sink_enable(port, 0);
+ if (rv) {
+ return rv;
+ }
+
+ pd_set_vbus_discharge(port, 0);
+
+ /* Provide Vbus. */
+ if (port == USBC_PORT_C1) {
+ rt1718s_gpio_set_level(port, GPIO_EN_USB_C1_SOURCE, 1);
+ }
+
+ rv = ppc_vbus_source_enable(port, 1);
+ if (rv) {
+ return rv;
+ }
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
+ return EC_SUCCESS;
+}
+
+int pd_snk_is_vbus_provided(int port)
+{
+ /* TODO: use ADC? */
+ return tcpm_check_vbus_level(port, VBUS_PRESENT);
+}
diff --git a/zephyr/projects/corsola/src/kingler/usbc_config.c b/zephyr/projects/corsola/src/kingler/usbc_config.c
new file mode 100644
index 0000000000..8c0ca86454
--- /dev/null
+++ b/zephyr/projects/corsola/src/kingler/usbc_config.c
@@ -0,0 +1,317 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Kingler board-specific USB-C configuration */
+
+#include "charger.h"
+#include "console.h"
+#include "driver/bc12/pi3usb9201_public.h"
+#include "driver/charger/isl923x_public.h"
+#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/rt1718s.h"
+#include "driver/tcpm/anx7447.h"
+#include "driver/tcpm/rt1718s.h"
+#include "driver/usb_mux/ps8743.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+#include "timer.h"
+#include "usb_charge.h"
+#include "usb_mux.h"
+#include "usb_pd_tcpm.h"
+#include "usbc_ppc.h"
+
+#include "baseboard_usbc_config.h"
+#include "variant_db_detection.h"
+
+/* TODO(b/220196310): Create GPIO driver for RT17181S TCPC */
+#ifdef __REQUIRE_ZEPHYR_GPIOS__
+#undef __REQUIRE_ZEPHYR_GPIOS__
+#endif
+#include "gpio.h"
+
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+
+/* USB Mux */
+
+/* USB Mux C1 : board_init of PS8743 */
+int ps8743_mux_1_board_init(const struct usb_mux *me)
+{
+ ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB,
+ PS8743_USB_EQ_RX_16_0_DB);
+
+ return EC_SUCCESS;
+}
+
+void board_usb_mux_init(void)
+{
+ if (corsola_get_db_type() == CORSOLA_DB_TYPEC) {
+ /* Disable DCI function. This is not needed for ARM. */
+ ps8743_field_update(usb_muxes[1].mux, PS8743_REG_DCI_CONFIG_2,
+ PS8743_AUTO_DCI_MODE_MASK,
+ PS8743_AUTO_DCI_MODE_FORCE_USB);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
+
+void board_tcpc_init(void)
+{
+ /* Only reset TCPC if not sysjump */
+ if (!system_jumped_late()) {
+ /* TODO(crosbug.com/p/61098): How long do we need to wait? */
+ board_reset_pd_mcu();
+ }
+
+ /* Enable TCPC interrupts */
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_tcpc));
+ if (corsola_get_db_type() == CORSOLA_DB_TYPEC) {
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_usb_c1_tcpc));
+ }
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_bc12));
+
+ /*
+ * Initialize HPD to low; after sysjump SOC needs to see
+ * HPD pulse to enable video path
+ */
+ for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port) {
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_POST_I2C);
+
+__override int board_rt1718s_init(int port)
+{
+ static bool gpio_initialized;
+
+ if (!system_jumped_late() && !gpio_initialized) {
+ /* set GPIO 1~3 as push pull, as output, output low. */
+ rt1718s_gpio_set_flags(port, RT1718S_GPIO1, GPIO_OUT_LOW);
+ rt1718s_gpio_set_flags(port, RT1718S_GPIO2, GPIO_OUT_LOW);
+ rt1718s_gpio_set_flags(port, RT1718S_GPIO3, GPIO_OUT_LOW);
+ gpio_initialized = true;
+ }
+
+ /* gpio1 low, gpio2 output high when receiving frs signal */
+ RETURN_ERROR(rt1718s_update_bits8(port, RT1718S_GPIO1_VBUS_CTRL,
+ RT1718S_GPIO1_VBUS_CTRL_FRS_RX_VBUS,
+ 0));
+ RETURN_ERROR(rt1718s_update_bits8(port, RT1718S_GPIO2_VBUS_CTRL,
+ RT1718S_GPIO2_VBUS_CTRL_FRS_RX_VBUS,
+ 0xFF));
+
+ /* Trigger GPIO 1/2 change when FRS signal received */
+ RETURN_ERROR(rt1718s_update_bits8(
+ port, RT1718S_FRS_CTRL3,
+ RT1718S_FRS_CTRL3_FRS_RX_WAIT_GPIO2 |
+ RT1718S_FRS_CTRL3_FRS_RX_WAIT_GPIO1,
+ RT1718S_FRS_CTRL3_FRS_RX_WAIT_GPIO2 |
+ RT1718S_FRS_CTRL3_FRS_RX_WAIT_GPIO1));
+ /* Set FRS signal detect time to 46.875us */
+ RETURN_ERROR(rt1718s_update_bits8(port, RT1718S_FRS_CTRL1,
+ RT1718S_FRS_CTRL1_FRSWAPRX_MASK,
+ 0xFF));
+
+ /* Disable BC1.2 SRC mode */
+ RETURN_ERROR(rt1718s_update_bits8(port, RT1718S_RT2_BC12_SRC_FUNC,
+ RT1718S_RT2_BC12_SRC_FUNC_BC12_SRC_EN,
+ 0));
+
+ return EC_SUCCESS;
+}
+
+__override int board_rt1718s_set_frs_enable(int port, int enable)
+{
+ if (port == USBC_PORT_C1)
+ /*
+ * Use set_flags (implemented by a single i2c write) instead
+ * of set_level (= i2c_update) to save one read operation in
+ * FRS path.
+ */
+ rt1718s_gpio_set_flags(port, GPIO_EN_USB_C1_FRS,
+ enable ? GPIO_OUT_HIGH : GPIO_OUT_LOW);
+ return EC_SUCCESS;
+}
+
+void board_reset_pd_mcu(void)
+{
+ CPRINTS("Resetting TCPCs...");
+ /* reset C0 ANX3447 */
+ /* Assert reset */
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_rst), 1);
+ msleep(1);
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_rst), 0);
+ /* After TEST_R release, anx7447/3447 needs 2ms to finish eFuse
+ * loading.
+ */
+ msleep(2);
+
+ /* reset C1 RT1718s */
+ rt1718s_sw_reset(USBC_PORT_C1);
+}
+
+/* Used by Vbus discharge common code with CONFIG_USB_PD_DISCHARGE */
+int board_vbus_source_enabled(int port)
+{
+ return ppc_is_sourcing_vbus(port);
+}
+
+__override int board_rt1718s_set_snk_enable(int port, int enable)
+{
+ if (port == USBC_PORT_C1) {
+ rt1718s_gpio_set_level(port, GPIO_EN_USB_C1_SINK, enable);
+ }
+
+ return EC_SUCCESS;
+}
+
+int board_set_active_charge_port(int port)
+{
+ int i;
+ bool is_valid_port =
+ (port >= 0 && port < board_get_usb_pd_port_count());
+
+ if (!is_valid_port && port != CHARGE_PORT_NONE) {
+ return EC_ERROR_INVAL;
+ }
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTS("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0)) {
+ CPRINTS("Disabling C%d as sink failed.", i);
+ }
+ }
+
+ return EC_SUCCESS;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTS("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTS("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ if (i == port) {
+ continue;
+ }
+
+ if (ppc_vbus_sink_enable(i, 0)) {
+ CPRINTS("C%d: sink path disable failed.", i);
+ }
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTS("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+uint16_t tcpc_get_alert_status(void)
+{
+ uint16_t status = 0;
+
+ if (!gpio_pin_get_dt(
+ GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_int_odl))) {
+ if (!gpio_pin_get_dt(
+ GPIO_DT_FROM_NODELABEL(gpio_usb_c0_tcpc_rst))) {
+ status |= PD_STATUS_TCPC_ALERT_0;
+ }
+ }
+
+ if (!gpio_pin_get_dt(
+ GPIO_DT_FROM_NODELABEL(gpio_usb_c1_tcpc_int_odl))) {
+ return status |= PD_STATUS_TCPC_ALERT_1;
+ }
+ return status;
+}
+
+void tcpc_alert_event(enum gpio_signal signal)
+{
+ int port;
+
+ switch (signal) {
+ case GPIO_SIGNAL(DT_NODELABEL(gpio_usb_c0_tcpc_int_odl)):
+ port = 0;
+ break;
+ case GPIO_SIGNAL(DT_NODELABEL(gpio_usb_c1_tcpc_int_odl)):
+ port = 1;
+ break;
+ default:
+ return;
+ }
+
+ schedule_deferred_pd_interrupt(port);
+}
+
+void ppc_interrupt(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_SIGNAL(DT_NODELABEL(gpio_usb_c0_ppc_int_odl)):
+ ppc_chips[0].drv->interrupt(0);
+ break;
+ case GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_ppc_int_odl)):
+ ppc_chips[1].drv->interrupt(1);
+ break;
+ default:
+ break;
+ }
+}
+
+void bc12_interrupt(enum gpio_signal signal)
+{
+ usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
+}
+
+__override int board_get_vbus_voltage(int port)
+{
+ int voltage = 0;
+ int rv;
+
+ switch (port) {
+ case USBC_PORT_C0:
+ rv = tcpc_config[USBC_PORT_C0].drv->get_vbus_voltage(port,
+ &voltage);
+ if (rv)
+ return 0;
+ break;
+ case USBC_PORT_C1:
+ rt1718s_get_adc(port, RT1718S_ADC_VBUS1, &voltage);
+ break;
+ default:
+ return 0;
+ }
+ return voltage;
+}
+
+__override int board_nx20p348x_init(int port)
+{
+ int rv;
+
+ rv = i2c_update8(ppc_chips[port].i2c_port,
+ ppc_chips[port].i2c_addr_flags,
+ NX20P348X_DEVICE_CONTROL_REG, NX20P348X_CTRL_LDO_SD,
+ MASK_SET);
+ return rv;
+}
diff --git a/zephyr/projects/corsola/src/krabby/charger_workaround.c b/zephyr/projects/corsola/src/krabby/charger_workaround.c
new file mode 100644
index 0000000000..d7fd05cc00
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/charger_workaround.c
@@ -0,0 +1,93 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <zephyr/sys/util.h>
+
+#include "charger.h"
+#include "driver/charger/rt9490.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "system.h"
+
+/*
+ * This workaround and the board id checks only apply to krabby and early
+ * tentacruel devices.
+ * Newer project should have all of these fixed.
+ */
+BUILD_ASSERT(IS_ENABLED(CONFIG_BOARD_KRABBY) ||
+ IS_ENABLED(CONFIG_BOARD_TENTACRUEL) || IS_ENABLED(CONFIG_TEST));
+
+/* b/194967754#comment5: work around for IBUS ADC unstable issue */
+static void ibus_adc_workaround(void)
+{
+ if (system_get_board_version() != 0) {
+ return;
+ }
+
+ i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags,
+ RT9490_REG_ADC_CHANNEL0, RT9490_VSYS_ADC_DIS, MASK_SET);
+
+ rt9490_enable_hidden_mode(CHARGER_SOLO, true);
+ /* undocumented registers... */
+ i2c_write8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, 0x52, 0xC4);
+
+ i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags,
+ RT9490_REG_ADC_CHANNEL0, RT9490_VSYS_ADC_DIS, MASK_CLR);
+ rt9490_enable_hidden_mode(CHARGER_SOLO, false);
+}
+
+/* b/214880220#comment44: lock i2c at 400khz */
+static void i2c_speed_workaround(void)
+{
+ if (system_get_board_version() >= 3) {
+ return;
+ }
+
+ rt9490_enable_hidden_mode(CHARGER_SOLO, true);
+ /* Set to Auto mode, default run at 400kHz */
+ i2c_write8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, 0x71, 0x22);
+ /* Manually select for 400kHz, valid only when 0x71[7] == 1 */
+ i2c_write8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, 0xF7, 0x14);
+ rt9490_enable_hidden_mode(CHARGER_SOLO, false);
+}
+
+static void eoc_deglitch_workaround(void)
+{
+ if (system_get_board_version() != 1) {
+ return;
+ }
+
+ /* set end-of-charge deglitch time to 2ms */
+ i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags,
+ RT9490_REG_ADD_CTRL0, RT9490_TD_EOC, MASK_CLR);
+}
+
+static void disable_safety_timer(void)
+{
+ if (system_get_board_version() >= 2) {
+ return;
+ }
+ /* Disable charge timer */
+ i2c_write8(chg_chips[CHARGER_SOLO].i2c_port,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags,
+ RT9490_REG_SAFETY_TMR_CTRL,
+ RT9490_EN_TRICHG_TMR | RT9490_EN_PRECHG_TMR |
+ RT9490_EN_FASTCHG_TMR);
+}
+
+static void board_rt9490_workaround(void)
+{
+ ibus_adc_workaround();
+ i2c_speed_workaround();
+ eoc_deglitch_workaround();
+ disable_safety_timer();
+}
+DECLARE_HOOK(HOOK_INIT, board_rt9490_workaround, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/krabby/hooks.c b/zephyr/projects/corsola/src/krabby/hooks.c
new file mode 100644
index 0000000000..1eb4f600f2
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/hooks.c
@@ -0,0 +1,90 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <zephyr/init.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/pinctrl.h>
+
+#include <ap_power/ap_power.h>
+#include "charger.h"
+#include "driver/charger/rt9490.h"
+#include "extpower.h"
+#include "gpio.h"
+#include "hooks.h"
+
+#define I2C3_NODE DT_NODELABEL(i2c3)
+PINCTRL_DT_DEFINE(I2C3_NODE);
+
+static void board_i2c3_ctrl(bool enable)
+{
+ if (DEVICE_DT_GET(
+ DT_GPIO_CTLR_BY_IDX(DT_NODELABEL(i2c3), scl_gpios, 0)) ==
+ DEVICE_DT_GET(DT_NODELABEL(gpiof))) {
+ const struct pinctrl_dev_config *pcfg =
+ PINCTRL_DT_DEV_CONFIG_GET(I2C3_NODE);
+
+ if (enable) {
+ pinctrl_apply_state(pcfg, PINCTRL_STATE_DEFAULT);
+ } else {
+ pinctrl_apply_state(pcfg, PINCTRL_STATE_SLEEP);
+ }
+ }
+}
+
+static void board_enable_i2c3(void)
+{
+ board_i2c3_ctrl(1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, board_enable_i2c3, HOOK_PRIO_FIRST);
+
+static void board_disable_i2c3(void)
+{
+ board_i2c3_ctrl(0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_HARD_OFF, board_disable_i2c3, HOOK_PRIO_LAST);
+
+static void board_suspend_handler(struct ap_power_ev_callback *cb,
+ struct ap_power_ev_data data)
+{
+ int value;
+
+ switch (data.event) {
+ default:
+ return;
+
+ case AP_POWER_RESUME:
+ value = 1;
+ break;
+
+ case AP_POWER_SUSPEND:
+ value = 0;
+ break;
+ }
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_5v_usm), value);
+}
+
+static int install_suspend_handler(const struct device *unused)
+{
+ static struct ap_power_ev_callback cb;
+
+ /*
+ * Add a callback for suspend/resume.
+ */
+ ap_power_ev_init_callback(&cb, board_suspend_handler,
+ AP_POWER_RESUME | AP_POWER_SUSPEND);
+ ap_power_ev_add_callback(&cb);
+ return 0;
+}
+
+SYS_INIT(install_suspend_handler, APPLICATION, 1);
+
+static void board_hook_ac_change(void)
+{
+ if (system_get_board_version() >= 1) {
+ rt9490_enable_adc(CHARGER_SOLO, extpower_is_present());
+ }
+}
+DECLARE_HOOK(HOOK_AC_CHANGE, board_hook_ac_change, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, board_hook_ac_change, HOOK_PRIO_LAST);
diff --git a/zephyr/projects/corsola/src/krabby/i2c.c b/zephyr/projects/corsola/src/krabby/i2c.c
new file mode 100644
index 0000000000..a83af77dbd
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/i2c.c
@@ -0,0 +1,19 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c/i2c.h"
+#include "i2c.h"
+
+/* Krabby board specific i2c implementation */
+
+#ifdef CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED
+int board_allow_i2c_passthru(const struct i2c_cmd_desc_t *cmd_desc)
+{
+ return (i2c_get_device_for_port(cmd_desc->port) ==
+ i2c_get_device_for_port(I2C_PORT_VIRTUAL_BATTERY) ||
+ i2c_get_device_for_port(cmd_desc->port) ==
+ i2c_get_device_for_port(I2C_PORT_EEPROM));
+}
+#endif
diff --git a/zephyr/projects/corsola/src/krabby/keyboard_magikarp.c b/zephyr/projects/corsola/src/krabby/keyboard_magikarp.c
new file mode 100644
index 0000000000..bcb706bba3
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/keyboard_magikarp.c
@@ -0,0 +1,29 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "ec_commands.h"
+
+static const struct ec_response_keybd_config magikarp_kb_legacy = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
+{
+ return &magikarp_kb_legacy;
+}
diff --git a/zephyr/projects/corsola/src/krabby/ppc_krabby.c b/zephyr/projects/corsola/src/krabby/ppc_krabby.c
new file mode 100644
index 0000000000..d4f574a725
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/ppc_krabby.c
@@ -0,0 +1,31 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Krabby PPC/BC12 (RT1739) configuration */
+
+#include "baseboard_usbc_config.h"
+#include "gpio/gpio_int.h"
+#include "driver/ppc/rt1739.h"
+#include "driver/ppc/syv682x.h"
+#include "hooks.h"
+#include "variant_db_detection.h"
+
+void c0_bc12_interrupt(enum gpio_signal signal)
+{
+ rt1739_interrupt(0);
+}
+
+static void board_usbc_init(void)
+{
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_ppc_bc12));
+}
+DECLARE_HOOK(HOOK_INIT, board_usbc_init, HOOK_PRIO_POST_DEFAULT);
+
+void ppc_interrupt(enum gpio_signal signal)
+{
+ if (signal == GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_ppc_int_odl))) {
+ syv682x_interrupt(1);
+ }
+}
diff --git a/zephyr/projects/corsola/src/krabby/ppc_magikarp.c b/zephyr/projects/corsola/src/krabby/ppc_magikarp.c
new file mode 100644
index 0000000000..41cce3f73d
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/ppc_magikarp.c
@@ -0,0 +1,44 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Tentacruel PPC/BC12 (mixed RT1739 or PI3USB9201+SYV682X) configuration */
+
+#include "baseboard_usbc_config.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+#include "usbc/ppc.h"
+#include "variant_db_detection.h"
+
+#include <zephyr/logging/log.h>
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+
+void bc12_interrupt(enum gpio_signal signal)
+{
+ usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
+}
+
+static void board_usbc_init(void)
+{
+ /* Enable PPC interrupts. */
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_ppc));
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_bc12));
+}
+DECLARE_HOOK(HOOK_INIT, board_usbc_init, HOOK_PRIO_POST_DEFAULT);
+
+void ppc_interrupt(enum gpio_signal signal)
+{
+ if (signal == GPIO_SIGNAL(DT_NODELABEL(usb_c0_ppc_int_odl))) {
+ syv682x_interrupt(0);
+ } else if (signal == GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_ppc_int_odl))) {
+ syv682x_interrupt(1);
+ }
+}
diff --git a/zephyr/projects/corsola/src/krabby/ppc_tentacruel.c b/zephyr/projects/corsola/src/krabby/ppc_tentacruel.c
new file mode 100644
index 0000000000..877b9940b4
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/ppc_tentacruel.c
@@ -0,0 +1,89 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Tentacruel PPC/BC12 (mixed RT1739 or PI3USB9201+SYV682X) configuration */
+
+#include "baseboard_usbc_config.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "driver/usb_mux/ps8743.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "usbc/ppc.h"
+#include "variant_db_detection.h"
+
+#include <zephyr/logging/log.h>
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+
+LOG_MODULE_REGISTER(alt_dev_replacement);
+
+#define BOARD_VERSION_UNKNOWN 0xffffffff
+
+/* Check board version to decide which ppc/bc12 is used. */
+static bool board_has_syv_ppc(void)
+{
+ static uint32_t board_version = BOARD_VERSION_UNKNOWN;
+
+ if (board_version == BOARD_VERSION_UNKNOWN) {
+ if (cbi_get_board_version(&board_version) != EC_SUCCESS) {
+ LOG_ERR("Failed to get board version.");
+ board_version = 0;
+ }
+ }
+
+ return (board_version >= 3);
+}
+
+static void check_alternate_devices(void)
+{
+ /* Configure the PPC driver */
+ if (board_has_syv_ppc())
+ /* Arg is the USB port number */
+ PPC_ENABLE_ALTERNATE(0);
+}
+DECLARE_HOOK(HOOK_INIT, check_alternate_devices, HOOK_PRIO_DEFAULT);
+
+void bc12_interrupt(enum gpio_signal signal)
+{
+ usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
+}
+
+/* USB Mux C1 : board_init of PS8743 */
+int ps8743_eq_c1_setting(void)
+{
+ ps8743_write(usb_muxes[1].mux, PS8743_REG_USB_EQ_RX, 0x90);
+ return EC_SUCCESS;
+}
+
+static void board_usbc_init(void)
+{
+ if (board_has_syv_ppc()) {
+ /* Enable PPC interrupts. */
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_usb_c0_ppc));
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_usb_c0_bc12));
+ } else {
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_usb_c0_ppc));
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_usbc_init, HOOK_PRIO_POST_DEFAULT);
+
+void ppc_interrupt(enum gpio_signal signal)
+{
+ if (signal == GPIO_SIGNAL(DT_NODELABEL(usb_c0_ppc_int_odl))) {
+ ppc_chips[0].drv->interrupt(0);
+ }
+ if (signal == GPIO_SIGNAL(DT_ALIAS(gpio_usb_c1_ppc_int_odl))) {
+ ppc_chips[1].drv->interrupt(1);
+ }
+}
diff --git a/zephyr/projects/corsola/src/krabby/sensor_magikarp.c b/zephyr/projects/corsola/src/krabby/sensor_magikarp.c
new file mode 100644
index 0000000000..269bc26fae
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/sensor_magikarp.c
@@ -0,0 +1,41 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "accelgyro.h"
+#include "cros_cbi.h"
+#include "driver/accelgyro_bmi323.h"
+#include "driver/accelgyro_icm42607.h"
+#include "hooks.h"
+#include "motionsense_sensors.h"
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ uint32_t val;
+
+ cros_cbi_get_fw_config(FW_BASE_GYRO, &val);
+ if (val == FW_BASE_ICM42607) {
+ icm42607_interrupt(signal);
+ } else if (val == FW_BASE_BMI323) {
+ bmi3xx_interrupt(signal);
+ }
+}
+
+static void motionsense_init(void)
+{
+ uint32_t val;
+
+ cros_cbi_get_fw_config(FW_BASE_GYRO, &val);
+ if (val == FW_BASE_ICM42607) {
+ ccprints("BASE ACCEL is ICM42607");
+ } else if (val == FW_BASE_BMI323) {
+ MOTIONSENSE_ENABLE_ALTERNATE(alt_base_accel);
+ MOTIONSENSE_ENABLE_ALTERNATE(alt_base_gyro);
+ ccprints("BASE ACCEL IS BMI323");
+ } else {
+ ccprints("no motionsense");
+ }
+}
+DECLARE_HOOK(HOOK_INIT, motionsense_init, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/krabby/sensor_tentacruel.c b/zephyr/projects/corsola/src/krabby/sensor_tentacruel.c
new file mode 100644
index 0000000000..269bc26fae
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/sensor_tentacruel.c
@@ -0,0 +1,41 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "accelgyro.h"
+#include "cros_cbi.h"
+#include "driver/accelgyro_bmi323.h"
+#include "driver/accelgyro_icm42607.h"
+#include "hooks.h"
+#include "motionsense_sensors.h"
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ uint32_t val;
+
+ cros_cbi_get_fw_config(FW_BASE_GYRO, &val);
+ if (val == FW_BASE_ICM42607) {
+ icm42607_interrupt(signal);
+ } else if (val == FW_BASE_BMI323) {
+ bmi3xx_interrupt(signal);
+ }
+}
+
+static void motionsense_init(void)
+{
+ uint32_t val;
+
+ cros_cbi_get_fw_config(FW_BASE_GYRO, &val);
+ if (val == FW_BASE_ICM42607) {
+ ccprints("BASE ACCEL is ICM42607");
+ } else if (val == FW_BASE_BMI323) {
+ MOTIONSENSE_ENABLE_ALTERNATE(alt_base_accel);
+ MOTIONSENSE_ENABLE_ALTERNATE(alt_base_gyro);
+ ccprints("BASE ACCEL IS BMI323");
+ } else {
+ ccprints("no motionsense");
+ }
+}
+DECLARE_HOOK(HOOK_INIT, motionsense_init, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/krabby/temp_tentacruel.c b/zephyr/projects/corsola/src/krabby/temp_tentacruel.c
new file mode 100644
index 0000000000..59c5a989aa
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/temp_tentacruel.c
@@ -0,0 +1,129 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "charger.h"
+#include "charge_state.h"
+#include "common.h"
+#include "config.h"
+#include "console.h"
+#include "driver/charger/rt9490.h"
+#include "hooks.h"
+#include "temp_sensor/temp_sensor.h"
+#include "thermal.h"
+#include "util.h"
+
+#define NUM_CURRENT_LEVELS ARRAY_SIZE(current_table)
+#define TEMP_THRESHOLD 55
+#define TEMP_BUFF_SIZE 60
+#define KEEP_TIME 5
+
+BUILD_ASSERT(IS_ENABLED(CONFIG_BOARD_TENTACRUEL) || IS_ENABLED(CONFIG_TEST));
+/* calculate current average temperature */
+static int average_tempature(void)
+{
+ static int temp_history_buffer[TEMP_BUFF_SIZE];
+ static int buff_ptr;
+ static int temp_sum;
+ static int past_temp;
+ static int avg_temp;
+ int cur_temp, t;
+
+ temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(temp_charger)), &t);
+ cur_temp = K_TO_C(t);
+ past_temp = temp_history_buffer[buff_ptr];
+ temp_history_buffer[buff_ptr] = cur_temp;
+ temp_sum = temp_sum + temp_history_buffer[buff_ptr] - past_temp;
+ buff_ptr++;
+ if (buff_ptr >= TEMP_BUFF_SIZE) {
+ buff_ptr = 0;
+ }
+ /* Calculate per minute temperature.
+ * It's expected low temperature when the first 60 seconds.
+ */
+ avg_temp = temp_sum / TEMP_BUFF_SIZE;
+ return avg_temp;
+}
+
+static int current_level;
+
+/* Limit charging current table : 3600/3000/2400/1800
+ * note this should be in descending order.
+ */
+static uint16_t current_table[] = {
+ 3600,
+ 3000,
+ 2400,
+ 1800,
+};
+
+/* Called by hook task every hook second (1 sec) */
+static void current_update(void)
+{
+ int temp;
+ static uint8_t uptime;
+ static uint8_t dntime;
+
+ temp = average_tempature();
+#ifndef CONFIG_TEST
+ if (charge_get_state() == PWR_STATE_DISCHARGE) {
+ current_level = 0;
+ uptime = 0;
+ dntime = 0;
+ return;
+ }
+#endif
+ if (temp >= TEMP_THRESHOLD) {
+ dntime = 0;
+ if (uptime < KEEP_TIME) {
+ uptime++;
+ } else {
+ uptime = 0;
+ current_level++;
+ }
+ } else if (current_level != 0 && temp < TEMP_THRESHOLD) {
+ uptime = 0;
+ if (dntime < KEEP_TIME) {
+ dntime++;
+ } else {
+ dntime = 0;
+ current_level--;
+ }
+ } else {
+ uptime = 0;
+ dntime = 0;
+ }
+ if (current_level > NUM_CURRENT_LEVELS) {
+ current_level = NUM_CURRENT_LEVELS;
+ }
+}
+DECLARE_HOOK(HOOK_SECOND, current_update, HOOK_PRIO_DEFAULT);
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ /*
+ * Precharge must be executed when communication is failed on
+ * dead battery.
+ */
+ if (!(curr->batt.flags & BATT_FLAG_RESPONSIVE))
+ return 0;
+ if (current_level != 0) {
+ if (curr->requested_current > current_table[current_level - 1])
+ curr->requested_current =
+ current_table[current_level - 1];
+ }
+ return 0;
+}
+
+enum ec_status charger_profile_override_get_param(uint32_t param,
+ uint32_t *value)
+{
+ return EC_RES_INVALID_PARAM;
+}
+
+enum ec_status charger_profile_override_set_param(uint32_t param,
+ uint32_t value)
+{
+ return EC_RES_INVALID_PARAM;
+}
diff --git a/zephyr/projects/corsola/src/krabby/usb_pd_policy.c b/zephyr/projects/corsola/src/krabby/usb_pd_policy.c
new file mode 100644
index 0000000000..8f2a2c3515
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/usb_pd_policy.c
@@ -0,0 +1,88 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "adc.h"
+#include "charge_manager.h"
+#include "chipset.h"
+#include "usb_charge.h"
+#include "usb_pd.h"
+#include "usbc_ppc.h"
+
+int pd_snk_is_vbus_provided(int port)
+{
+ static atomic_t vbus_prev[CONFIG_USB_PD_PORT_MAX_COUNT];
+ int vbus;
+
+ /*
+ * (b:181203590#comment20) TODO(yllin): use
+ * PD_VSINK_DISCONNECT_PD for non-5V case.
+ */
+ vbus = adc_read_channel(board_get_vbus_adc(port)) >=
+ PD_V_SINK_DISCONNECT_MAX;
+
+#ifdef CONFIG_USB_CHARGER
+ /*
+ * There's no PPC to inform VBUS change for usb_charger, so inform
+ * the usb_charger now.
+ */
+ if (!!(vbus_prev[port] != vbus)) {
+ usb_charger_vbus_change(port, vbus);
+ }
+
+ if (vbus) {
+ atomic_or(&vbus_prev[port], 1);
+ } else {
+ atomic_clear(&vbus_prev[port]);
+ }
+#endif
+ return vbus;
+}
+
+void pd_power_supply_reset(int port)
+{
+ int prev_en;
+
+ prev_en = ppc_is_sourcing_vbus(port);
+
+ /* Disable VBUS. */
+ ppc_vbus_source_enable(port, 0);
+
+ /* Enable discharge if we were previously sourcing 5V */
+ if (prev_en) {
+ pd_set_vbus_discharge(port, 1);
+ }
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+}
+
+int pd_set_power_supply_ready(int port)
+{
+ int rv;
+
+ /* Disable charging. */
+ rv = ppc_vbus_sink_enable(port, 0);
+ if (rv) {
+ return rv;
+ }
+
+ pd_set_vbus_discharge(port, 0);
+
+ /* Provide Vbus. */
+ rv = ppc_vbus_source_enable(port, 1);
+ if (rv) {
+ return rv;
+ }
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
+ return EC_SUCCESS;
+}
+
+int board_vbus_source_enabled(int port)
+{
+ return ppc_is_sourcing_vbus(port);
+}
diff --git a/zephyr/projects/corsola/src/krabby/usbc_config.c b/zephyr/projects/corsola/src/krabby/usbc_config.c
new file mode 100644
index 0000000000..7a7f710804
--- /dev/null
+++ b/zephyr/projects/corsola/src/krabby/usbc_config.c
@@ -0,0 +1,141 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Krabby board-specific USB-C configuration */
+
+#include "adc.h"
+#include "baseboard_usbc_config.h"
+#include "charge_manager.h"
+#include "console.h"
+#include "driver/tcpm/it83xx_pd.h"
+#include "driver/usb_mux/tusb1064.h"
+#include "i2c.h"
+#include "usb_pd.h"
+#include "usbc_ppc.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+
+int tusb1064_mux_1_board_init(const struct usb_mux *me)
+{
+ int rv;
+
+ rv = i2c_write8(me->i2c_port, me->i2c_addr_flags,
+ TUSB1064_REG_DP1DP3EQ_SEL,
+ TUSB1064_DP1EQ(TUSB1064_DP_EQ_RX_8_9_DB) |
+ TUSB1064_DP3EQ(TUSB1064_DP_EQ_RX_5_4_DB));
+ if (rv)
+ return rv;
+
+ /* Enable EQ_OVERRIDE so the gain registers are used */
+ return i2c_update8(me->i2c_port, me->i2c_addr_flags,
+ TUSB1064_REG_GENERAL, REG_GENERAL_EQ_OVERRIDE,
+ MASK_SET);
+}
+
+#ifdef CONFIG_USB_PD_TCPM_ITE_ON_CHIP
+const struct cc_para_t *board_get_cc_tuning_parameter(enum usbpd_port port)
+{
+ const static struct cc_para_t
+ cc_parameter[CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT] = {
+ {
+ .rising_time =
+ IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
+ .falling_time =
+ IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
+ },
+ {
+ .rising_time =
+ IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
+ .falling_time =
+ IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
+ },
+ };
+
+ return &cc_parameter[port];
+}
+#endif
+
+void board_reset_pd_mcu(void)
+{
+ /*
+ * C0 & C1: TCPC is embedded in the EC and processes interrupts in the
+ * chip code (it83xx/intc.c)
+ */
+}
+
+#ifndef CONFIG_TEST
+int board_set_active_charge_port(int port)
+{
+ int i;
+ int is_valid_port = (port >= 0 && port < board_get_usb_pd_port_count());
+
+ if (!is_valid_port && port != CHARGE_PORT_NONE) {
+ return EC_ERROR_INVAL;
+ }
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTS("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0)) {
+ CPRINTS("Disabling C%d as sink failed.", i);
+ }
+ }
+
+ return EC_SUCCESS;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTS("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTS("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port) {
+ continue;
+ }
+
+ if (ppc_vbus_sink_enable(i, 0)) {
+ CPRINTS("C%d: sink path disable failed.", i);
+ }
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTS("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+#endif
+
+#ifdef CONFIG_USB_PD_VBUS_MEASURE_ADC_EACH_PORT
+enum adc_channel board_get_vbus_adc(int port)
+{
+ if (port == 0) {
+ return ADC_VBUS_C0;
+ }
+ if (port == 1) {
+ return ADC_VBUS_C1;
+ }
+ CPRINTSUSB("Unknown vbus adc port id: %d", port);
+ return ADC_VBUS_C0;
+}
+#endif /* CONFIG_USB_PD_VBUS_MEASURE_ADC_EACH_PORT */
diff --git a/zephyr/projects/corsola/src/usb_pd_policy.c b/zephyr/projects/corsola/src/usb_pd_policy.c
new file mode 100644
index 0000000000..a885362c61
--- /dev/null
+++ b/zephyr/projects/corsola/src/usb_pd_policy.c
@@ -0,0 +1,226 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "atomic.h"
+#include "console.h"
+#include "chipset.h"
+#include "hooks.h"
+#include "timer.h"
+#include "typec_control.h"
+#include "usb_dp_alt_mode.h"
+#include "usb_mux.h"
+#include "usb_pd.h"
+#include "usbc_ppc.h"
+
+#include "baseboard_usbc_config.h"
+
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+
+static int active_aux_port = -1;
+
+int pd_check_vconn_swap(int port)
+{
+ /* Allow Vconn swap if AP is on. */
+ return chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_ON);
+}
+
+static void set_dp_aux_path_sel(int port)
+{
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(dp_aux_path_sel), port);
+ CPRINTS("Set DP_AUX_PATH_SEL: %d", port);
+}
+
+int svdm_get_hpd_gpio(int port)
+{
+ /* HPD is low active, inverse the result */
+ return !gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(ec_ap_dp_hpd_odl));
+}
+
+static void reset_aux_deferred(void)
+{
+ if (active_aux_port == -1)
+ /* reset to 1 for lower power consumption. */
+ set_dp_aux_path_sel(1);
+}
+DECLARE_DEFERRED(reset_aux_deferred);
+
+void svdm_set_hpd_gpio(int port, int en)
+{
+ /*
+ * HPD is low active, inverse the en.
+ *
+ * Implement FCFS policy:
+ * 1) Enable hpd if no active port.
+ * 2) Disable hpd if active port is the given port.
+ */
+ if (en && active_aux_port < 0) {
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ec_ap_dp_hpd_odl), 0);
+ active_aux_port = port;
+ hook_call_deferred(&reset_aux_deferred_data, -1);
+ }
+
+ if (!en && active_aux_port == port) {
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ec_ap_dp_hpd_odl), 1);
+ active_aux_port = -1;
+ /*
+ * This might be a HPD debounce to send a HPD IRQ (500us), so
+ * do not reset the aux path immediately. Defer this call and
+ * re-check if this is a real disable.
+ */
+ hook_call_deferred(&reset_aux_deferred_data, 1 * MSEC);
+ }
+}
+
+__override int svdm_dp_config(int port, uint32_t *payload)
+{
+ int opos = pd_alt_mode(port, TCPCI_MSG_SOP, USB_SID_DISPLAYPORT);
+ uint8_t pin_mode = get_dp_pin_mode(port);
+ mux_state_t mux_mode = svdm_dp_get_mux_mode(port);
+ int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
+
+ if (!pin_mode) {
+ return 0;
+ }
+
+ CPRINTS("pin_mode: %x, mf: %d, mux: %d", pin_mode, mf_pref, mux_mode);
+ /*
+ * Defer setting the usb_mux until HPD goes high, svdm_dp_attention().
+ * The AP only supports one DP phy. An external DP mux switches between
+ * the two ports. Should switch those muxes when it is really used,
+ * i.e. HPD high; otherwise, the real use case is preempted, like:
+ * (1) plug a dongle without monitor connected to port-0,
+ * (2) plug a dongle without monitor connected to port-1,
+ * (3) plug a monitor to the port-1 dongle.
+ */
+
+ payload[0] =
+ VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos));
+ payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
+ 1, /* DPv1.3 signaling */
+ 2); /* UFP connected */
+ return 2;
+};
+
+__override void svdm_dp_post_config(int port)
+{
+ mux_state_t mux_mode = svdm_dp_get_mux_mode(port);
+
+ typec_set_sbu(port, true);
+
+ /*
+ * Prior to post-config, the mux will be reset to safe mode, and this
+ * will break mux config and aux path config we did in the first DP
+ * status command. Only enable this if the port is the current aux-port.
+ */
+ if (port == active_aux_port) {
+ usb_mux_set(port, mux_mode, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ }
+
+ dp_flags[port] |= DP_FLAGS_DP_ON;
+}
+
+int corsola_is_dp_muxable(int port)
+{
+ int i;
+
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ if (i != port) {
+ if (usb_mux_get(i) & USB_PD_MUX_DP_ENABLED) {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+__override int svdm_dp_attention(int port, uint32_t *payload)
+{
+ int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
+ int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
+#ifdef CONFIG_USB_PD_DP_HPD_GPIO
+ int cur_lvl = svdm_get_hpd_gpio(port);
+#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
+ mux_state_t mux_state;
+
+ dp_status[port] = payload[1];
+
+ if (!corsola_is_dp_muxable(port)) {
+ /* TODO(waihong): Info user? */
+ CPRINTS("p%d: The other port is already muxed.", port);
+ return 0; /* nak */
+ }
+
+ if (lvl) {
+ set_dp_aux_path_sel(port);
+
+ usb_mux_set(port, USB_PD_MUX_DOCK, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
+ } else {
+ usb_mux_set(port, USB_PD_MUX_USB_ENABLED, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
+ }
+
+ if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) && (irq || lvl)) {
+ /*
+ * Wake up the AP. IRQ or level high indicates a DP sink is now
+ * present.
+ */
+ if (IS_ENABLED(CONFIG_MKBP_EVENT)) {
+ pd_notify_dp_alt_mode_entry(port);
+ }
+ }
+
+#ifdef CONFIG_USB_PD_DP_HPD_GPIO
+ if (irq && !lvl) {
+ /*
+ * IRQ can only be generated when the level is high, because
+ * the IRQ is signaled by a short low pulse from the high level.
+ */
+ CPRINTF("ERR:HPD:IRQ&LOW\n");
+ return 0; /* nak */
+ }
+
+ if (irq && cur_lvl) {
+ uint64_t now = get_time().val;
+ /* wait for the minimum spacing between IRQ_HPD if needed */
+ if (now < svdm_hpd_deadline[port]) {
+ usleep(svdm_hpd_deadline[port] - now);
+ }
+
+ /* generate IRQ_HPD pulse */
+ svdm_set_hpd_gpio(port, 0);
+ /*
+ * b/171172053#comment14: since the HPD_DSTREAM_DEBOUNCE_IRQ is
+ * very short (500us), we can use udelay instead of usleep for
+ * more stable pulse period.
+ */
+ udelay(HPD_DSTREAM_DEBOUNCE_IRQ);
+ svdm_set_hpd_gpio(port, 1);
+ } else {
+ svdm_set_hpd_gpio(port, lvl);
+ }
+
+ /* set the minimum time delay (2ms) for the next HPD IRQ */
+ svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
+#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
+
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
+
+#ifdef USB_PD_PORT_TCPC_MST
+ if (port == USB_PD_PORT_TCPC_MST) {
+ baseboard_mst_enable_control(port, lvl);
+ }
+#endif
+
+ /* ack */
+ return 1;
+}
diff --git a/zephyr/projects/corsola/src/usbc_config.c b/zephyr/projects/corsola/src/usbc_config.c
new file mode 100644
index 0000000000..e3a2796de5
--- /dev/null
+++ b/zephyr/projects/corsola/src/usbc_config.c
@@ -0,0 +1,319 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Corsola baseboard-specific USB-C configuration */
+
+#include <zephyr/drivers/gpio.h>
+#include <ap_power/ap_power.h>
+
+#include "adc.h"
+#include "baseboard_usbc_config.h"
+#include "button.h"
+#include "charger.h"
+#include "charge_state_v2.h"
+#include "console.h"
+#include "ec_commands.h"
+#include "extpower.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "lid_switch.h"
+#include "task.h"
+#include "ppc/syv682x_public.h"
+#include "power.h"
+#include "power_button.h"
+#include "spi.h"
+#include "switch.h"
+#include "tablet_mode.h"
+#include "uart.h"
+#include "usb_charge.h"
+#include "usb_mux.h"
+#include "usb_pd_tcpm.h"
+#include "usb_tc_sm.h"
+#include "usbc/usb_muxes.h"
+#include "usbc_ppc.h"
+
+#include "variant_db_detection.h"
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+
+/* a flag for indicating the tasks are inited. */
+static bool tasks_inited;
+
+/* Baseboard */
+static void baseboard_init(void)
+{
+#ifdef CONFIG_VARIANT_CORSOLA_USBA
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usba));
+#endif
+ /* If CCD mode has enabled before init, force the ccd_interrupt. */
+ if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_ccd_mode_odl))) {
+ ccd_interrupt(GPIO_CCD_MODE_ODL);
+ }
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_ccd_mode_odl));
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_PRE_DEFAULT);
+
+__override uint8_t board_get_usb_pd_port_count(void)
+{
+ if (corsola_get_db_type() == CORSOLA_DB_HDMI) {
+ if (tasks_inited) {
+ return CONFIG_USB_PD_PORT_MAX_COUNT;
+ } else {
+ return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
+ }
+ } else if (corsola_get_db_type() == CORSOLA_DB_NONE) {
+ return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
+ }
+
+ return CONFIG_USB_PD_PORT_MAX_COUNT;
+}
+
+/* USB-A */
+void usb_a0_interrupt(enum gpio_signal signal)
+{
+ enum usb_charge_mode mode = gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(
+ gpio_ap_xhci_init_done)) ?
+ USB_CHARGE_MODE_ENABLED :
+ USB_CHARGE_MODE_DISABLED;
+
+ const int xhci_stat = gpio_get_level(signal);
+
+ for (int i = 0; i < USB_PORT_COUNT; i++) {
+ usb_charge_set_mode(i, mode, USB_ALLOW_SUSPEND_CHARGE);
+ }
+
+ for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
+ /*
+ * Enable DRP toggle after XHCI inited. This is used to follow
+ * USB 3.2 spec 10.3.1.1.
+ */
+ if (xhci_stat) {
+ pd_set_dual_role(i, PD_DRP_TOGGLE_ON);
+ } else if (tc_is_attached_src(i)) {
+ /*
+ * This is a AP reset S0->S0 transition.
+ * We should set the role back to sink.
+ */
+ pd_set_dual_role(i, PD_DRP_FORCE_SINK);
+ }
+ }
+}
+
+__override enum pd_dual_role_states pd_get_drp_state_in_s0(void)
+{
+ if (gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_ap_xhci_init_done))) {
+ return PD_DRP_TOGGLE_ON;
+ } else {
+ return PD_DRP_FORCE_SINK;
+ }
+}
+
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
+void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
+{
+ /*
+ * We ignore the cc_pin and PPC vconn because polarity and PPC vconn
+ * should already be set correctly in the PPC driver via the pd
+ * state machine.
+ */
+}
+
+/**
+ * Handle PS185 HPD changing state.
+ */
+int debounced_hpd;
+
+static void ps185_hdmi_hpd_deferred(void)
+{
+ const int new_hpd =
+ gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
+
+ /* HPD status not changed, probably a glitch, just return. */
+ if (debounced_hpd == new_hpd) {
+ return;
+ }
+
+ debounced_hpd = new_hpd;
+
+ if (!corsola_is_dp_muxable(USBC_PORT_C1)) {
+ if (debounced_hpd) {
+ CPRINTS("C0 port is already muxed.");
+ }
+ return;
+ }
+
+ if (debounced_hpd) {
+ dp_status[USBC_PORT_C1] =
+ VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
+ 0, /* HPD level ... not applicable */
+ 0, /* exit DP? ... no */
+ 0, /* usb mode? ... no */
+ 0, /* multi-function ... no */
+ 1, /* DP enabled ... yes */
+ 0, /* power low? ... no */
+ (!!DP_FLAGS_DP_ON));
+ /* update C1 virtual mux */
+ usb_mux_set(USBC_PORT_C1, USB_PD_MUX_DP_ENABLED,
+ USB_SWITCH_DISCONNECT,
+ 0 /* polarity, don't care */);
+
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(dp_aux_path_sel),
+ debounced_hpd);
+ CPRINTS("Set DP_AUX_PATH_SEL: %d", 1);
+ }
+ svdm_set_hpd_gpio(USBC_PORT_C1, debounced_hpd);
+ CPRINTS(debounced_hpd ? "HDMI plug" : "HDMI unplug");
+}
+DECLARE_DEFERRED(ps185_hdmi_hpd_deferred);
+
+static void ps185_hdmi_hpd_disconnect_deferred(void)
+{
+ const int new_hpd =
+ gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
+
+ if (debounced_hpd == new_hpd && !new_hpd) {
+ dp_status[USBC_PORT_C1] =
+ VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
+ 0, /* HPD level ... not applicable */
+ 0, /* exit DP? ... no */
+ 0, /* usb mode? ... no */
+ 0, /* multi-function ... no */
+ 0, /* DP enabled ... no */
+ 0, /* power low? ... no */
+ (!DP_FLAGS_DP_ON));
+ usb_mux_set(USBC_PORT_C1, USB_PD_MUX_NONE,
+ USB_SWITCH_DISCONNECT,
+ 0 /* polarity, don't care */);
+ }
+}
+DECLARE_DEFERRED(ps185_hdmi_hpd_disconnect_deferred);
+
+#define PS185_HPD_DEBOUCE 250
+#define HPD_SINK_ABSENCE_DEBOUNCE (2 * MSEC)
+
+static void hdmi_hpd_interrupt(enum gpio_signal signal)
+{
+ hook_call_deferred(&ps185_hdmi_hpd_deferred_data, PS185_HPD_DEBOUCE);
+
+ if (!gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd))) {
+ hook_call_deferred(&ps185_hdmi_hpd_disconnect_deferred_data,
+ HPD_SINK_ABSENCE_DEBOUNCE);
+ } else {
+ hook_call_deferred(&ps185_hdmi_hpd_disconnect_deferred_data,
+ -1);
+ }
+}
+
+/* HDMI/TYPE-C function shared subboard interrupt */
+void x_ec_interrupt(enum gpio_signal signal)
+{
+ int sub = corsola_get_db_type();
+
+ if (sub == CORSOLA_DB_TYPEC) {
+ /* C1: PPC interrupt */
+ ppc_interrupt(signal);
+ } else if (sub == CORSOLA_DB_HDMI) {
+ hdmi_hpd_interrupt(signal);
+ } else {
+ CPRINTS("Undetected subboard interrupt.");
+ }
+}
+
+static void board_hdmi_handler(struct ap_power_ev_callback *cb,
+ struct ap_power_ev_data data)
+{
+ int value;
+
+ switch (data.event) {
+ default:
+ return;
+
+ case AP_POWER_RESUME:
+ value = 1;
+ break;
+
+ case AP_POWER_SUSPEND:
+ value = 0;
+ break;
+ }
+ gpio_pin_set_dt(GPIO_DT_FROM_ALIAS(gpio_en_hdmi_pwr), value);
+ gpio_pin_set_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_pwrdn_odl), value);
+}
+
+static void tasks_init_deferred(void)
+{
+ tasks_inited = true;
+}
+DECLARE_DEFERRED(tasks_init_deferred);
+
+static void baseboard_x_ec_gpio2_init(void)
+{
+ static struct ppc_drv virtual_ppc_drv = { 0 };
+ static struct tcpm_drv virtual_tcpc_drv = { 0 };
+ static struct bc12_drv virtual_bc12_drv = { 0 };
+
+ /* no sub board */
+ if (corsola_get_db_type() == CORSOLA_DB_NONE) {
+ return;
+ }
+
+ /* type-c: USB_C1_PPC_INT_ODL / hdmi: PS185_EC_DP_HPD */
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_x_ec_gpio2));
+
+ if (corsola_get_db_type() == CORSOLA_DB_TYPEC) {
+ gpio_pin_interrupt_configure_dt(
+ GPIO_DT_FROM_ALIAS(gpio_usb_c1_ppc_int_odl),
+ GPIO_INT_EDGE_FALLING);
+ return;
+ }
+ if (corsola_get_db_type() == CORSOLA_DB_HDMI) {
+ static struct ap_power_ev_callback cb;
+
+ ap_power_ev_init_callback(&cb, board_hdmi_handler,
+ AP_POWER_RESUME | AP_POWER_SUSPEND);
+ ap_power_ev_add_callback(&cb);
+ }
+
+ /* drop related C1 port drivers when it's a HDMI DB. */
+ ppc_chips[USBC_PORT_C1] =
+ (const struct ppc_config_t){ .drv = &virtual_ppc_drv };
+ tcpc_config[USBC_PORT_C1] =
+ (const struct tcpc_config_t){ .drv = &virtual_tcpc_drv };
+ bc12_ports[USBC_PORT_C1] =
+ (const struct bc12_config){ .drv = &virtual_bc12_drv };
+ /* Use virtual mux to notify AP the mainlink direction. */
+ USB_MUX_ENABLE_ALTERNATIVE(usb_mux_chain_1_hdmi_db);
+
+ /*
+ * If a HDMI DB is attached, C1 port tasks will be exiting in that
+ * the port number is larger than board_get_usb_pd_port_count().
+ * After C1 port tasks finished, we intentionally increase the port
+ * count by 1 for usb_mux to access the C1 virtual mux for notifying
+ * mainlink direction.
+ */
+ hook_call_deferred(&tasks_init_deferred_data, 2 * SECOND);
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_x_ec_gpio2_init, HOOK_PRIO_DEFAULT);
+
+__override uint8_t get_dp_pin_mode(int port)
+{
+ if (corsola_get_db_type() == CORSOLA_DB_HDMI && port == USBC_PORT_C1) {
+ if (usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED) {
+ return MODE_DP_PIN_E;
+ } else {
+ return 0;
+ }
+ }
+
+ return pd_dfp_dp_get_pin_mode(port, dp_status[port]);
+}
diff --git a/zephyr/projects/corsola/src/variant_db_detection.c b/zephyr/projects/corsola/src/variant_db_detection.c
new file mode 100644
index 0000000000..6099d86bdd
--- /dev/null
+++ b/zephyr/projects/corsola/src/variant_db_detection.c
@@ -0,0 +1,115 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Corsola daughter board detection */
+#include <zephyr/drivers/gpio.h>
+
+#include "console.h"
+#include "cros_cbi.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+
+#include "variant_db_detection.h"
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+
+static void corsola_db_config(enum corsola_db_type type)
+{
+ switch (type) {
+ case CORSOLA_DB_HDMI:
+ /* EC_X_GPIO1 */
+ gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_en_hdmi_pwr),
+ GPIO_OUTPUT_HIGH);
+ /* X_EC_GPIO2 */
+ gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd),
+ GPIO_INPUT);
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_x_ec_gpio2));
+ /* EC_X_GPIO3 */
+ gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_pwrdn_odl),
+ GPIO_OUTPUT_HIGH | GPIO_OPEN_DRAIN);
+ return;
+ case CORSOLA_DB_TYPEC:
+ /* EC_X_GPIO1 */
+ gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_usb_c1_frs_en),
+ GPIO_OUTPUT_LOW);
+ /* X_EC_GPIO2 */
+ gpio_pin_configure_dt(
+ GPIO_DT_FROM_ALIAS(gpio_usb_c1_ppc_int_odl),
+ GPIO_INPUT | GPIO_PULL_UP);
+ gpio_enable_dt_interrupt(
+ GPIO_INT_FROM_NODELABEL(int_x_ec_gpio2));
+ /* EC_X_GPIO3 */
+ gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_usb_c1_dp_in_hpd),
+ GPIO_OUTPUT_LOW);
+ return;
+ case CORSOLA_DB_NONE:
+ /* Set floating pins as input with PU to prevent leakage */
+ gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_x_gpio1),
+ GPIO_INPUT | GPIO_PULL_UP);
+ gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_x_ec_gpio2),
+ GPIO_INPUT | GPIO_PULL_UP);
+ gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_x_gpio3),
+ GPIO_INPUT | GPIO_PULL_UP);
+ return;
+ default:
+ break;
+ }
+}
+
+enum corsola_db_type corsola_get_db_type(void)
+{
+#if DT_NODE_EXISTS(DT_NODELABEL(db_config))
+ int ret;
+ uint32_t val;
+#endif
+ static enum corsola_db_type db = CORSOLA_DB_UNINIT;
+
+ if (db != CORSOLA_DB_UNINIT) {
+ return db;
+ }
+
+ if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_hdmi_prsnt_odl))) {
+ db = CORSOLA_DB_HDMI;
+ } else {
+ db = CORSOLA_DB_TYPEC;
+ }
+
+/* Detect for no sub board case by FW_CONFIG */
+#if DT_NODE_EXISTS(DT_NODELABEL(db_config))
+ ret = cros_cbi_get_fw_config(DB, &val);
+ if (ret != 0) {
+ CPRINTS("Error retrieving CBI FW_CONFIG field %d", DB);
+ } else if (val == DB_NONE) {
+ db = CORSOLA_DB_NONE;
+ }
+#endif
+
+ corsola_db_config(db);
+
+ switch (db) {
+ case CORSOLA_DB_NONE:
+ CPRINTS("Detect %s DB", "NONE");
+ break;
+ case CORSOLA_DB_TYPEC:
+ CPRINTS("Detect %s DB", "TYPEC");
+ break;
+ case CORSOLA_DB_HDMI:
+ CPRINTS("Detect %s DB", "HDMI");
+ break;
+ default:
+ CPRINTS("DB UNINIT");
+ break;
+ }
+
+ return db;
+}
+
+static void corsola_db_init(void)
+{
+ corsola_get_db_type();
+}
+DECLARE_HOOK(HOOK_INIT, corsola_db_init, HOOK_PRIO_PRE_I2C);
diff --git a/zephyr/projects/corsola/thermistor_tentacruel.dts b/zephyr/projects/corsola/thermistor_tentacruel.dts
new file mode 100644
index 0000000000..f9e5306f24
--- /dev/null
+++ b/zephyr/projects/corsola/thermistor_tentacruel.dts
@@ -0,0 +1,140 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ thermistor_rt9490: thermistor-rt9490 {
+ status = "okay";
+ compatible = "cros-ec,thermistor";
+ scaling-factor = <3>;
+ num-pairs = <21>;
+ steinhart-reference-mv = <4900>;
+ steinhart-reference-res = <10000>;
+
+ sample-datum-0 {
+ milivolt = <(731 / 3)>;
+ temp = <0>;
+ sample-index = <0>;
+ };
+
+ sample-datum-1 {
+ milivolt = <(708 / 3)>;
+ temp = <5>;
+ sample-index = <1>;
+ };
+
+ sample-datum-2 {
+ milivolt = <(682 / 3)>;
+ temp = <10>;
+ sample-index = <2>;
+ };
+
+ sample-datum-3 {
+ milivolt = <(653 / 3)>;
+ temp = <15>;
+ sample-index = <3>;
+ };
+
+ sample-datum-4 {
+ milivolt = <(622 / 3)>;
+ temp = <20>;
+ sample-index = <4>;
+ };
+
+ sample-datum-5 {
+ milivolt = <(589 / 3)>;
+ temp = <25>;
+ sample-index = <5>;
+ };
+
+ sample-datum-6 {
+ milivolt = <(554 / 3)>;
+ temp = <30>;
+ sample-index = <6>;
+ };
+
+ sample-datum-7 {
+ milivolt = <(519 / 3)>;
+ temp = <35>;
+ sample-index = <7>;
+ };
+
+ sample-datum-8 {
+ milivolt = <(483 / 3)>;
+ temp = <40>;
+ sample-index = <8>;
+ };
+
+ sample-datum-9 {
+ milivolt = <(446 / 3)>;
+ temp = <45>;
+ sample-index = <9>;
+ };
+
+ sample-datum-10 {
+ milivolt = <(411 / 3)>;
+ temp = <50>;
+ sample-index = <10>;
+ };
+ sample-datum-11 {
+ milivolt = <(376 / 3)>;
+ temp = <55>;
+ sample-index = <11>;
+ };
+
+ sample-datum-12 {
+ milivolt = <(343 / 3)>;
+ temp = <60>;
+ sample-index = <12>;
+ };
+
+ sample-datum-13 {
+ milivolt = <(312 / 3)>;
+ temp = <65>;
+ sample-index = <13>;
+ };
+
+ sample-datum-14 {
+ milivolt = <(284 / 3)>;
+ temp = <70>;
+ sample-index = <14>;
+ };
+
+ sample-datum-15 {
+ milivolt = <(257 / 3)>;
+ temp = <75>;
+ sample-index = <15>;
+ };
+
+ sample-datum-16 {
+ milivolt = <(232 / 3)>;
+ temp = <80>;
+ sample-index = <16>;
+ };
+
+ sample-datum-17 {
+ milivolt = <(209 / 3)>;
+ temp = <85>;
+ sample-index = <17>;
+ };
+
+ sample-datum-18 {
+ milivolt = <(188 / 3)>;
+ temp = <90>;
+ sample-index = <18>;
+ };
+
+ sample-datum-19 {
+ milivolt = <(169 / 3)>;
+ temp = <95>;
+ sample-index = <19>;
+ };
+
+ sample-datum-20 {
+ milivolt = <(152 / 3)>;
+ temp = <100>;
+ sample-index = <20>;
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/usba.dts b/zephyr/projects/corsola/usba.dts
new file mode 100644
index 0000000000..2ecb3b7d5a
--- /dev/null
+++ b/zephyr/projects/corsola/usba.dts
@@ -0,0 +1,11 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usba_port_enable_list: usba-port-enable-list {
+ compatible = "cros-ec,usba-port-enable-pins";
+ enable-pins = <&en_pp5000_usb_a0_vbus>;
+ };
+};
diff --git a/zephyr/projects/corsola/usba_steelix.dts b/zephyr/projects/corsola/usba_steelix.dts
new file mode 100644
index 0000000000..0ddd67f664
--- /dev/null
+++ b/zephyr/projects/corsola/usba_steelix.dts
@@ -0,0 +1,10 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* steelix usba port enable config */
+&usba_port_enable_list {
+ enable-pins = <&en_pp5000_usb_a0_vbus
+ &en_pp5000_usb_a1_vbus>;
+};
diff --git a/zephyr/projects/corsola/usbc_kingler.dts b/zephyr/projects/corsola/usbc_kingler.dts
new file mode 100644
index 0000000000..18bc6ce303
--- /dev/null
+++ b/zephyr/projects/corsola/usbc_kingler.dts
@@ -0,0 +1,56 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ tcpc = <&tcpc_port0>;
+ ppc = <&ppc_port0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&anx7447_mux_0 &virtual_mux_0>;
+ };
+ };
+
+ port0-muxes {
+ anx7447_mux_0: anx7447-mux-0 {
+ compatible = "analogix,usbc-mux-anx7447";
+ };
+ virtual_mux_0: virtual-mux-0 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ tcpc = <&tcpc_port1>;
+ ppc = <&ppc_port1>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&ps8743_mux_1 &virtual_mux_1>;
+ };
+ usb_mux_chain_1_hdmi_db: usb-mux-chain-1-hdmi-db {
+ compatible = "cros-ec,usb-mux-chain";
+ alternative-chain;
+ usb-muxes = <&virtual_mux_1>;
+ };
+ };
+
+ port1-muxes {
+ virtual_mux_1: virtual-mux-1 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+ };
+};
diff --git a/zephyr/projects/corsola/usbc_krabby.dts b/zephyr/projects/corsola/usbc_krabby.dts
new file mode 100644
index 0000000000..a72864da35
--- /dev/null
+++ b/zephyr/projects/corsola/usbc_krabby.dts
@@ -0,0 +1,59 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_ppc_port0>;
+ ppc = <&bc12_ppc_port0>;
+ tcpc = <&usbpd0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
+ };
+ };
+ port0-muxes {
+ virtual_mux_0: virtual-mux-0 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&usbpd1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&tusb1064_mux_1 &virtual_mux_1>;
+ };
+ usb_mux_chain_1_hdmi_db: usb-mux-chain-1-hdmi-db {
+ compatible = "cros-ec,usb-mux-chain";
+ alternative-chain;
+ usb-muxes = <&virtual_mux_1>;
+ };
+ };
+ port1-muxes {
+ virtual_mux_1: virtual-mux-1 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+ };
+};
+
+&usbpd0 {
+ status = "okay";
+};
+
+&usbpd1 {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/usbc_magikarp.dts b/zephyr/projects/corsola/usbc_magikarp.dts
new file mode 100644
index 0000000000..c94db15b3a
--- /dev/null
+++ b/zephyr/projects/corsola/usbc_magikarp.dts
@@ -0,0 +1,59 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&ppc_port0>;
+ tcpc = <&usbpd0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
+ };
+ };
+ port0-muxes {
+ virtual_mux_0: virtual-mux-0 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&usbpd1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&ps8743_mux_1 &virtual_mux_1>;
+ };
+ usb_mux_chain_1_hdmi_db: usb-mux-chain-1-hdmi-db {
+ compatible = "cros-ec,usb-mux-chain";
+ alternative-chain;
+ usb-muxes = <&virtual_mux_1>;
+ };
+ };
+ port1-muxes {
+ virtual_mux_1: virtual-mux-1 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+ };
+};
+
+&usbpd0 {
+ status = "okay";
+};
+
+&usbpd1 {
+ status = "okay";
+};
diff --git a/zephyr/projects/corsola/usbc_tentacruel.dts b/zephyr/projects/corsola/usbc_tentacruel.dts
new file mode 100644
index 0000000000..bb105a8e08
--- /dev/null
+++ b/zephyr/projects/corsola/usbc_tentacruel.dts
@@ -0,0 +1,60 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&bc12_ppc_port0>;
+ ppc_alt = <&ppc_port0>;
+ tcpc = <&usbpd0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
+ };
+ };
+ port0-muxes {
+ virtual_mux_0: virtual-mux-0 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&usbpd1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&ps8743_mux_1 &virtual_mux_1>;
+ };
+ usb_mux_chain_1_hdmi_db: usb-mux-chain-1-hdmi-db {
+ compatible = "cros-ec,usb-mux-chain";
+ alternative-chain;
+ usb-muxes = <&virtual_mux_1>;
+ };
+ };
+ port1-muxes {
+ virtual_mux_1: virtual-mux-1 {
+ compatible = "cros-ec,usbc-mux-virtual";
+ };
+ };
+ };
+};
+
+&usbpd0 {
+ status = "okay";
+};
+
+&usbpd1 {
+ status = "okay";
+};