summaryrefslogtreecommitdiff
path: root/zephyr/program/skyrim/crystaldrift/src/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/program/skyrim/crystaldrift/src/board.c')
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/board.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/zephyr/program/skyrim/crystaldrift/src/board.c b/zephyr/program/skyrim/crystaldrift/src/board.c
new file mode 100644
index 0000000000..a6ce70585a
--- /dev/null
+++ b/zephyr/program/skyrim/crystaldrift/src/board.c
@@ -0,0 +1,24 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "chipset.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "hooks.h"
+
+#include <zephyr/drivers/gpio.h>
+
+static void check_usbhub_en(void)
+{
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_usbhub_en))) {
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_usbhub_en), 0);
+ } else if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !gpio_pin_get_dt(
+ GPIO_DT_FROM_NODELABEL(gpio_ec_usbhub_en))) {
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_ec_usbhub_en), 1);
+ }
+}
+DECLARE_HOOK(HOOK_SECOND, check_usbhub_en, HOOK_PRIO_DEFAULT);