From d99640ffe586fe018d35e3636d63538c26d07f6c Mon Sep 17 00:00:00 2001 From: zengqinghong Date: Fri, 25 Oct 2024 22:19:11 +0800 Subject: mb/google/nissa/var/teliks: Match VBT with SSFC We want to configure different VBT timings for panels of different sizes and distinguish them through SSFC. We select the reserved bit 6 of SSFC as the flag bit. When using a 12-inch panel, set this bit to 0; when using an 11-inch panel, set this bit to 1. Without splitting, the platform_BootPerf test will fail. BUG=b:374428465 TEST= 1. can match VBT with SSFC -When SSFC is set to 0x40: $ cat /sys/firmware/log | grep vbt Bit 6 of SSFC is 1, use vbt-teliks_panel_11_inch.bin CBFS: Found 'vbt-teliks_panel_11_inch.bin' @0x1c6140 size 0x50f in mcache @0x76adda14 -When SSFC is set to 0x0: $ cat /sys/firmware/log | grep vbt Bit 6 of SSFC is 0, use vbt-teliks.bin CBFS: Found 'vbt-teliks.bin' @0x1c5bc0 size 0x50e in mcache @0x76add9b0 2. can pass platform_BootPerf test The platform_BootPerf time measured for all SKUs is less than 1.55s. Change-Id: Ia8fb45aede5ead4826d983760506c366a70643ee Signed-off-by: Qinghong Zeng Reviewed-on: https://review.coreboot.org/c/coreboot/+/84871 Reviewed-by: Paul Menzel Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Jianeng Ceng Reviewed-by: Subrata Banik --- .../google/brya/variants/teliks/variant.c | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/mainboard/google/brya/variants') diff --git a/src/mainboard/google/brya/variants/teliks/variant.c b/src/mainboard/google/brya/variants/teliks/variant.c index 7e0f02dead..7da0043cae 100644 --- a/src/mainboard/google/brya/variants/teliks/variant.c +++ b/src/mainboard/google/brya/variants/teliks/variant.c @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include /* Per-pipe DDI Function Control 2 */ #define TRANS_DDI_FUNC_CTL2_A 0x60404 @@ -55,3 +58,58 @@ void variant_finalize(void) graphics_gtt_rmw(TRANS_DDI_FUNC_CTL2_A, ~TRANS_DDI_AUDIO_MUTE_OVERRIDE_BITS_FIELDS, TRANS_DDI_AUDIO_MUTE_OVERRIDE_BITS_FIELDS); } + +static int get_ssfc(uint32_t *val) +{ + static uint32_t known_value; + static enum { + SSFC_NOT_READ, + SSFC_AVAILABLE, + } ssfc_state = SSFC_NOT_READ; + + if (ssfc_state == SSFC_AVAILABLE) { + *val = known_value; + return 0; + } + + /* + * If SSFC field is not in the CBI then the value of SSFC will be 0 for + * further processing later since 0 of each bits group means default + * component in a variant. For more detail, please refer to cbi_ssfc.h. + */ + if (google_chromeec_cbi_get_ssfc(&known_value) != 0) { + printk(BIOS_DEBUG, "SSFC not set in CBI\n"); + return -1; + } + + ssfc_state = SSFC_AVAILABLE; + *val = known_value; + printk(BIOS_INFO, "SSFC 0x%x.\n", known_value); + return 0; +} + +const char *mainboard_vbt_filename(void) +{ + uint32_t ssfc; + if (get_ssfc(&ssfc)) { + printk(BIOS_INFO, "Failed to read SSFC, using default vbt-teliks.bin\n"); + return "vbt-teliks.bin"; + } + + /* + * Determine if the panel is 11 inches based on the SSFC register. + * + * Bit 6 of the SSFC register indicates the panel size: + * 0: 12.2 inch panel + * 1: 11.6 inch panel + */ + bool is_panel_11_inch = (ssfc >> 6) & 0x1; + + if (is_panel_11_inch) { + printk(BIOS_INFO, "Bit 6 of SSFC is 1, use vbt-teliks_panel_11_inch.bin\n"); + return "vbt-teliks_panel_11_inch.bin"; + } + + printk(BIOS_INFO, "Bit 6 of SSFC is 0, use vbt-teliks.bin\n"); + return "vbt-teliks.bin"; +} -- cgit v1.2.3