summaryrefslogtreecommitdiff
path: root/zephyr/projects/skyrim/src/winterhold/kb_backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/projects/skyrim/src/winterhold/kb_backlight.c')
-rw-r--r--zephyr/projects/skyrim/src/winterhold/kb_backlight.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/zephyr/projects/skyrim/src/winterhold/kb_backlight.c b/zephyr/projects/skyrim/src/winterhold/kb_backlight.c
new file mode 100644
index 0000000000..049b99e3a1
--- /dev/null
+++ b/zephyr/projects/skyrim/src/winterhold/kb_backlight.c
@@ -0,0 +1,34 @@
+/* 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/devicetree.h>
+#include <zephyr/logging/log.h>
+
+#include "board_config.h"
+#include "common.h"
+#include "cros_board_info.h"
+#include "cros_cbi.h"
+
+LOG_MODULE_DECLARE(skyrim, CONFIG_SKYRIM_LOG_LEVEL);
+
+__override uint32_t board_override_feature_flags0(uint32_t flags0)
+{
+ int ret;
+ uint32_t val;
+
+ /*
+ * Remove keyboard backlight feature for devices that don't support it.
+ */
+ ret = cros_cbi_get_fw_config(FW_KB_BL, &val);
+ if (ret != 0) {
+ LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_KB_BL);
+ return flags0;
+ }
+
+ if (val == FW_KB_BL_NOT_PRESENT)
+ return (flags0 & ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB));
+ else
+ return flags0;
+}