From 454f4b32f8b010b9267d6c47f81502dfdffc6a24 Mon Sep 17 00:00:00 2001 From: mick_hsiao Date: Thu, 11 May 2023 16:43:13 +0800 Subject: Uldren: update fw config Update cbi config to let DB works, Also remove fan code, because uldren doesn't have fan design BUG=b:273159459 TEST=DB can charge and read usb Change-Id: I9da2c3fd7eedc44cfcaad89d32c393cc528feff2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4522690 Commit-Queue: Shou-Chieh Hsu Reviewed-by: Elthan Huang Tested-by: Mick Hsiao Reviewed-by: Shou-Chieh Hsu --- zephyr/program/nissa/CMakeLists.txt | 1 - zephyr/program/nissa/uldren/cbi.dtsi | 46 +++++++++++++++++++---------------- zephyr/program/nissa/uldren/src/fan.c | 41 ------------------------------- 3 files changed, 25 insertions(+), 63 deletions(-) delete mode 100644 zephyr/program/nissa/uldren/src/fan.c diff --git a/zephyr/program/nissa/CMakeLists.txt b/zephyr/program/nissa/CMakeLists.txt index e2f85139bf..cd45f00a3a 100644 --- a/zephyr/program/nissa/CMakeLists.txt +++ b/zephyr/program/nissa/CMakeLists.txt @@ -118,7 +118,6 @@ if(DEFINED CONFIG_BOARD_ULDREN) "uldren/src/kb_backlight.c" "uldren/src/keyboard.c" ) - zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "uldren/src/fan.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "uldren/src/usbc.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER "uldren/src/charger.c") endif() diff --git a/zephyr/program/nissa/uldren/cbi.dtsi b/zephyr/program/nissa/uldren/cbi.dtsi index 9d865a38bb..02aa0607f9 100644 --- a/zephyr/program/nissa/uldren/cbi.dtsi +++ b/zephyr/program/nissa/uldren/cbi.dtsi @@ -7,44 +7,47 @@ /* Uldren-specific fw_config fields. */ nissa-fw-config { /* - * FW_CONFIG field to enable KB back light or not. + * FW_CONFIG field to enable USB DB. */ - kb-bl { - enum-name = "FW_KB_BL"; - start = <4>; - size = <1>; + sub-board { + enum-name = "FW_SUB_BOARD"; + start = <1>; + size = <2>; - no-kb-bl { + sub-board-1 { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_KB_BL_NOT_PRESENT"; + enum-name = "FW_SUB_BOARD_1"; value = <0>; - default; }; - kb-bl-present { + sub-board-2 { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_KB_BL_PRESENT"; - value = <1>; + enum-name = "FW_SUB_BOARD_2"; + value = <3>; + }; + sub-board-3 { + compatible = "cros-ec,cbi-fw-config-value"; + enum-name = "FW_SUB_BOARD_3"; + value = <2>; }; }; - /* - * FW_CONFIG field to enable USB DB. + * FW_CONFIG field to enable KB back light or not. */ - db-usb { - enum-name = "FW_DB_USB"; - start = <6>; + kb-bl { + enum-name = "FW_KB_BL"; + start = <5>; size = <1>; - no-db-usb { + no-kb-bl { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_DB_USB_NOT_PRESENT"; + enum-name = "FW_KB_BL_NOT_PRESENT"; value = <0>; + default; }; - db-usb-present { + kb-bl-present { compatible = "cros-ec,cbi-fw-config-value"; - enum-name = "FW_DB_USB_PRESENT"; + enum-name = "FW_KB_BL_PRESENT"; value = <1>; - default; }; }; @@ -67,5 +70,6 @@ value = <1>; }; }; +/delete-node/ fan; }; }; diff --git a/zephyr/program/nissa/uldren/src/fan.c b/zephyr/program/nissa/uldren/src/fan.c deleted file mode 100644 index 32f9d3c65e..0000000000 --- a/zephyr/program/nissa/uldren/src/fan.c +++ /dev/null @@ -1,41 +0,0 @@ -/* 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 "cros_cbi.h" -#include "fan.h" -#include "gpio/gpio.h" -#include "hooks.h" - -#include -#include -#include - -LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL); - -/* - * Nirwen fan support - */ -static void fan_init(void) -{ - int ret; - uint32_t val; - /* - * Retrieve the fan config. - */ - ret = cros_cbi_get_fw_config(FW_FAN, &val); - if (ret != 0) { - LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN); - return; - } - if (val != FW_FAN_PRESENT) { - /* Disable the fan */ - fan_set_count(0); - } else { - /* Configure the fan enable GPIO */ - gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_fan_enable), - GPIO_OUTPUT); - } -} -DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST); -- cgit v1.2.1