diff options
author | Josh Tsai <josh_tsai@compal.corp-partner.google.com> | 2022-09-13 13:52:33 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-26 17:45:35 +0000 |
commit | d5f41cd622bca61d06b896f3ecce63a5109ae651 (patch) | |
tree | bfcbabac746c1d5bb6108ab042e7a8e307c21481 | |
parent | 72074080bee85c7b1fd23cfed1f339be62fa7222 (diff) | |
download | chrome-ec-d5f41cd622bca61d06b896f3ecce63a5109ae651.tar.gz |
winterhold: modified fw config structure
winterhold only need to implement keyboard backlight fw config in
cbi. Remove unused fw config and add the override ec feature function
BRANCH=none
BUG=b:242241410
TEST=zmake build --coverage winterhold
TEST=when cbi fw_config set to 0x02, the ec feature EC_FEATURE_PWM_KEYB
is set to 1
LOW_COVERAGE_REASON=no unit tests for skyrim yet
Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com>
Change-Id: I349b64b72bb7bff9f07cab3d3feeb0a50b893aa9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891566
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Code-Coverage: Diana Z <dzigterman@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | zephyr/projects/skyrim/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zephyr/projects/skyrim/src/winterhold/kb_backlight.c | 34 | ||||
-rw-r--r-- | zephyr/projects/skyrim/src/winterhold/usb_mux_config.c | 32 | ||||
-rw-r--r-- | zephyr/projects/skyrim/winterhold.dts | 67 |
4 files changed, 43 insertions, 91 deletions
diff --git a/zephyr/projects/skyrim/CMakeLists.txt b/zephyr/projects/skyrim/CMakeLists.txt index 5c466e87e8..30817348ed 100644 --- a/zephyr/projects/skyrim/CMakeLists.txt +++ b/zephyr/projects/skyrim/CMakeLists.txt @@ -42,5 +42,6 @@ if(DEFINED CONFIG_BOARD_WINTERHOLD) zephyr_library_sources( "src/winterhold/usb_mux_config.c" "src/winterhold/ppc_config.c" + "src/winterhold/kb_backlight.c" ) endif() 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; +} diff --git a/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c b/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c index ca7b604d10..d2ee4a6606 100644 --- a/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c +++ b/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c @@ -108,35 +108,3 @@ int board_anx7483_c1_mux_set(const struct usb_mux *me, mux_state_t mux_state) return EC_SUCCESS; } - -int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state) -{ - CPRINTSUSB("C1: PS8818 mux using default tuning"); - - /* Once a DP connection is established, we need to set IN_HPD */ - if (mux_state & USB_PD_MUX_DP_ENABLED) - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); - else - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); - - return 0; -} - -static void setup_mux(void) -{ - uint32_t val; - - if (cros_cbi_get_fw_config(FW_IO_DB, &val) != 0) - CPRINTSUSB("Error finding FW_DB_IO in CBI FW_CONFIG"); - /* Val will have our dts default on error, so continue setup */ - - if (val == FW_IO_DB_PS8811_PS8818) { - CPRINTSUSB("C1: Setting PS8818 mux"); - USB_MUX_ENABLE_ALTERNATIVE(usb_mux_chain_ps8818_port1); - } else if (val == FW_IO_DB_NONE_ANX7483) { - CPRINTSUSB("C1: Setting ANX7483 mux"); - } else { - CPRINTSUSB("Unexpected DB_IO board: %d", val); - } -} -DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_INIT_I2C); diff --git a/zephyr/projects/skyrim/winterhold.dts b/zephyr/projects/skyrim/winterhold.dts index 1b2a89999f..aba1054d81 100644 --- a/zephyr/projects/skyrim/winterhold.dts +++ b/zephyr/projects/skyrim/winterhold.dts @@ -37,63 +37,23 @@ Winterhold-fw-config { compatible = "cros-ec,cbi-fw-config"; - form-factor { - enum-name = "FW_FORM_FACTOR"; - start = <0>; - size = <1>; - - ff-clamshell { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FF_CLAMSHELL"; - value = <0>; - }; - ff-convertible { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FF_CONVERTIBLE"; - value = <1>; - default; - }; - }; - io-db { - enum-name = "FW_IO_DB"; - start = <6>; - size = <2>; - - io-db-ps8811-ps8818 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_IO_DB_PS8811_PS8818"; - value = <0>; - }; - io-db-none-anx7483 { - compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_IO_DB_NONE_ANX7483"; - value = <1>; - default; - }; - }; - /* - * FW_CONFIG field to enable fan or not. + * FW_CONFIG field to enable KB back light or not. */ - fan { - enum-name = "FW_FAN"; - start = <10>; + kb-bl { + enum-name = "FW_KB_BL"; + start = <1>; size = <1>; - no-fan { + no-kb-bl { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FAN_NOT_PRESENT"; + enum-name = "FW_KB_BL_NOT_PRESENT"; value = <0>; }; - fan-present { + kb-bl-present { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_FAN_PRESENT"; + enum-name = "FW_KB_BL_PRESENT"; value = <1>; - /* - * Set as default so that unprovisioned - * configs will run the fan regardless. - */ - default; }; }; }; @@ -139,12 +99,6 @@ status = "okay"; reg = <0x71>; }; - ps8818_port1: ps8818@28 { - compatible = "parade,ps8818"; - reg = <0x28>; - flags = <(USB_MUX_FLAG_RESETS_IN_G3)>; - board-set = "board_c1_ps8818_mux_set"; - }; }; &usbc_port0 { @@ -161,9 +115,4 @@ compatible = "cros-ec,usb-mux-chain"; usb-muxes = <&amd_fp6_port1 &anx7483_port1>; }; - usb_mux_chain_ps8818_port1: usb-mux-chain-1-ps { - compatible = "cros-ec,usb-mux-chain"; - usb-muxes = <&amd_fp6_port1 &ps8818_port1>; - alternative-chain; - }; }; |