summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt3
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/gpio.dts4
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/prj.conf3
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/src/switchcap.c22
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/switchcap.dts12
-rw-r--r--zephyr/projects/herobrine/herobrine_npcx9/zmake.yaml1
6 files changed, 19 insertions, 26 deletions
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt b/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt
index 23b3a2c245..e6ac68192b 100644
--- a/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt
+++ b/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt
@@ -19,5 +19,4 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C
"src/i2c.c")
zephyr_library_sources(
- "src/battery.c"
- "src/switchcap.c")
+ "src/battery.c")
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/gpio.dts b/zephyr/projects/herobrine/herobrine_npcx9/gpio.dts
index fb8c0d8778..aa023e9110 100644
--- a/zephyr/projects/herobrine/herobrine_npcx9/gpio.dts
+++ b/zephyr/projects/herobrine/herobrine_npcx9/gpio.dts
@@ -151,7 +151,7 @@
enum-name = "GPIO_EC_INT_L";
label = "AP_EC_INT_L";
};
- switchcap_on {
+ gpio_switchcap_on: switchcap_on {
gpios = <&gpiod 5 GPIO_OUT_LOW>;
enum-name = "GPIO_SWITCHCAP_ON";
label = "SWITCHCAP_ON";
@@ -272,7 +272,7 @@
enum-name = "GPIO_SKU_ID2";
label = "SKU_ID2";
};
- src_vph_pwr_pg {
+ gpio_switchcap_pg: src_vph_pwr_pg {
gpios = <&gpioe 2 (GPIO_INPUT | GPIO_PULL_DOWN)>;
enum-name = "GPIO_SWITCHCAP_PG";
label = "SRC_VPH_PWR_PG";
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/prj.conf b/zephyr/projects/herobrine/herobrine_npcx9/prj.conf
index 03dbb23338..055ec976dd 100644
--- a/zephyr/projects/herobrine/herobrine_npcx9/prj.conf
+++ b/zephyr/projects/herobrine/herobrine_npcx9/prj.conf
@@ -31,6 +31,9 @@ CONFIG_PLATFORM_EC_PWM_KBLIGHT=y
# Application Processor is Qualcomm SC7280
CONFIG_AP_ARM_QUALCOMM_SC7280=y
+# GPIO Switchcap
+CONFIG_PLATFORM_EC_SWITCHCAP_GPIO=y
+
# Board version is selected over GPIO board ID pins.
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/src/switchcap.c b/zephyr/projects/herobrine/herobrine_npcx9/src/switchcap.c
deleted file mode 100644
index 16b0db6ef6..0000000000
--- a/zephyr/projects/herobrine/herobrine_npcx9/src/switchcap.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gpio.h"
-#include "power/qcom.h"
-
-void board_set_switchcap_power(int enable)
-{
- gpio_set_level(GPIO_SWITCHCAP_ON, enable);
-}
-
-int board_is_switchcap_enabled(void)
-{
- return gpio_get_level(GPIO_SWITCHCAP_ON);
-}
-
-int board_is_switchcap_power_good(void)
-{
- return gpio_get_level(GPIO_SWITCHCAP_PG);
-}
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/switchcap.dts b/zephyr/projects/herobrine/herobrine_npcx9/switchcap.dts
new file mode 100644
index 0000000000..b246274a7a
--- /dev/null
+++ b/zephyr/projects/herobrine/herobrine_npcx9/switchcap.dts
@@ -0,0 +1,12 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ switchcap {
+ compatible = "switchcap-gpio";
+ enable-pin = <&gpio_switchcap_on>;
+ power-good-pin = <&gpio_switchcap_pg>;
+ };
+};
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/zmake.yaml b/zephyr/projects/herobrine/herobrine_npcx9/zmake.yaml
index 5f93cd9f45..530278c5e7 100644
--- a/zephyr/projects/herobrine/herobrine_npcx9/zmake.yaml
+++ b/zephyr/projects/herobrine/herobrine_npcx9/zmake.yaml
@@ -8,6 +8,7 @@ dts-overlays:
- battery.dts
- i2c.dts
- motionsense.dts
+ - switchcap.dts
supported-zephyr-versions:
- v2.6
toolchain: coreboot-sdk