summaryrefslogtreecommitdiff
path: root/board/kinox/pwm.c
diff options
context:
space:
mode:
authorDtrain Hsu <dtrain_hsu@compal.corp-partner.google.com>2022-02-10 10:33:08 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-17 11:20:41 +0000
commit55680f70d2a1e61c193fc78ff1d51c7437803683 (patch)
treee12ef58e7b092b03ac8925f2656acd612fec4239 /board/kinox/pwm.c
parent7e464f4acaef417e315c1d48779c2ea67b14993d (diff)
downloadchrome-ec-55680f70d2a1e61c193fc78ff1d51c7437803683.tar.gz
Create the initial EC image for the kinox variant by copying the brask reference board EC files into a new directory named for the variant. (Auto-Generated by create_initial_ec_image.sh version 1.5.0). BUG=b:215049181 BRANCH=None TEST=make BOARD=kinox Signed-off-by: Dtrain Hsu <dtrain_hsu@compal.corp-partner.google.com> Change-Id: I604216664a0efc690ba9cd2c0c071a0e4650b228 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3448054 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Commit-Queue: Zhuohao Lee <zhuohao@chromium.org>
Diffstat (limited to 'board/kinox/pwm.c')
-rw-r--r--board/kinox/pwm.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/board/kinox/pwm.c b/board/kinox/pwm.c
new file mode 100644
index 0000000000..125d507a82
--- /dev/null
+++ b/board/kinox/pwm.c
@@ -0,0 +1,45 @@
+/* Copyright 2022 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 "common.h"
+
+#include "compile_time_macros.h"
+#include "hooks.h"
+#include "pwm.h"
+#include "pwm_chip.h"
+
+const struct pwm_t pwm_channels[] = {
+ [PWM_CH_LED_GREEN] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000
+ },
+ [PWM_CH_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000
+ },
+ [PWM_CH_LED_RED] = {
+ .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+static void board_pwm_init(void)
+{
+ /*
+ * TODO(b/197478860): Turn on the fan at 100% by default
+ * We need to find tune the fan speed according to the
+ * thermal sensor value.
+ */
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, 100);
+
+ pwm_enable(PWM_CH_LED_RED, 1);
+ pwm_enable(PWM_CH_LED_GREEN, 1);
+}
+DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT);