diff options
author | Rob Barnes <robbarnes@google.com> | 2021-02-26 08:16:25 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-08 01:13:30 +0000 |
commit | 974b3d7e4621a449672df5267007c7aeb2d7af68 (patch) | |
tree | dd27510aa5367e653ce04550a21e3543eb7b3c02 /board/guybrush | |
parent | 51cf9f6619f2979a43e7ef5c6e9824b4bd715966 (diff) | |
download | chrome-ec-974b3d7e4621a449672df5267007c7aeb2d7af68.tar.gz |
guybrush: Add guybrush fw_configstabilize-glibc-13901.B-main
Each guybrush variant may have a different fw_config schema. Defining a
schema agnostic fw_config interface at baseboard. Each guybrush variant
must implement the interface. Fields that are not applicable outside a
specific variant do not need to be exposed in the baseboard interface.
BUG=b:178215011
TEST=Build and run on Guybrush B2
BRANCH=None
Change-Id: I41d24ffddfc41d3148ba6d3685f728f6ec962919
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2722982
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/guybrush')
-rw-r--r-- | board/guybrush/board_fw_config.c | 35 | ||||
-rw-r--r-- | board/guybrush/board_fw_config.h | 38 | ||||
-rw-r--r-- | board/guybrush/build.mk | 1 |
3 files changed, 74 insertions, 0 deletions
diff --git a/board/guybrush/board_fw_config.c b/board/guybrush/board_fw_config.c new file mode 100644 index 0000000000..b971ad7301 --- /dev/null +++ b/board/guybrush/board_fw_config.c @@ -0,0 +1,35 @@ +/* Copyright 2021 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 "base_fw_config.h" +#include "board_fw_config.h" + +bool board_has_kblight(void) +{ + return (get_fw_config_field(FW_CONFIG_KBLIGHT_OFFSET, + FW_CONFIG_KBLIGHT_WIDTH) == FW_CONFIG_KBLIGHT_YES); +} + +enum board_usb_c1_mux board_get_usb_c1_mux(void) +{ + int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET, + FW_CONFIG_USB_DB_WIDTH); + if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818) + return USB_C1_MUX_PS8818; + if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451) + return USB_C1_MUX_ANX7451; + return USB_C1_MUX_UNKNOWN; +}; + +enum board_usb_a1_retimer board_get_usb_a1_retimer(void) +{ + int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET, + FW_CONFIG_USB_DB_WIDTH); + if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818) + return USB_A1_RETIMER_PS8811; + if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451) + return USB_A1_RETIMER_ANX7491; + return USB_A1_RETIMER_UNKNOWN; +}; diff --git a/board/guybrush/board_fw_config.h b/board/guybrush/board_fw_config.h new file mode 100644 index 0000000000..80098d8eff --- /dev/null +++ b/board/guybrush/board_fw_config.h @@ -0,0 +1,38 @@ +/* Copyright 2021 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. + */ + +#ifndef _GUYBRUSH_BOARD_FW_CONFIG__H_ +#define _GUYBRUSH_BOARD_FW_CONFIG__H_ + +/**************************************************************************** + * Guybrush CBI FW Configuration + */ + +/* + * USB Daughter Board (2 bits) + */ +#define FW_CONFIG_USB_DB_OFFSET 0 +#define FW_CONFIG_USB_DB_WIDTH 2 +#define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0 +#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1 + +/* + * Form Factor (1 bits) + */ +#define FW_CONFIG_FORM_FACTOR_OFFSET 2 +#define FW_CONFIG_FORM_FACTOR_WIDTH 1 +#define FW_CONFIG_FORM_FACTOR_CLAMSHELL 0 +#define FW_CONFIG_FORM_FACTOR_CONVERTIABLE 1 + +/* + * Keyboard Backlight (1 bit) + */ +#define FW_CONFIG_KBLIGHT_OFFSET 3 +#define FW_CONFIG_KBLIGHT_WIDTH 1 +#define FW_CONFIG_KBLIGHT_NO 0 +#define FW_CONFIG_KBLIGHT_YES 1 + + +#endif /* _GUYBRUSH_CBI_FW_CONFIG__H_ */ diff --git a/board/guybrush/build.mk b/board/guybrush/build.mk index c76e04a0b7..1e79b1895e 100644 --- a/board/guybrush/build.mk +++ b/board/guybrush/build.mk @@ -9,3 +9,4 @@ BASEBOARD:=guybrush board-y=board.o +board-y+=board_fw_config.o |