From 0b192d3238728bb71192bc518982ea2e02cc1e2c Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Mon, 20 Mar 2023 17:40:31 +0800 Subject: mb/google/geralt: Read LCM ID from ADC channels 4 and 5 The SKU ID is not really used on Geralt. Both ADC channels 4 and 5 will be used for LCM ID on derived projects. For Geralt reference board, only PANEL_ID_LOW_CHANNEL is valid. BRANCH=none BUG=b:247415660 TEST=boot Geralt proto0 and see FW screen in DEV mode. Change-Id: I77a3caadc1b0be5bf39dd2cf73ea1df88f9a09ea Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/73874 Reviewed-by: Rex-BC Chen Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/mainboard/google/geralt/boardid.c | 19 +++++++++---------- src/mainboard/google/geralt/panel_geralt.c | 7 +++++-- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/mainboard/google/geralt') diff --git a/src/mainboard/google/geralt/boardid.c b/src/mainboard/google/geralt/boardid.c index 7a627416be..3a08c6d5cb 100644 --- a/src/mainboard/google/geralt/boardid.c +++ b/src/mainboard/google/geralt/boardid.c @@ -15,10 +15,9 @@ enum { /* RAM IDs */ RAM_ID_LOW_CHANNEL = 2, RAM_ID_HIGH_CHANNEL = 3, - /* SKU ID */ - SKU_ID_CHANNEL = 4, - /* PANEL ID */ - PANEL_ID_CHANNEL = 5, + /* PANEL IDs */ + PANEL_ID_HIGH_CHANNEL = 4, + PANEL_ID_LOW_CHANNEL = 5, }; static const unsigned int ram_voltages[ADC_LEVELS] = { @@ -56,8 +55,8 @@ static const unsigned int panel_voltages[ADC_LEVELS] = { static const unsigned int *adc_voltages[] = { [RAM_ID_LOW_CHANNEL] = ram_voltages, [RAM_ID_HIGH_CHANNEL] = ram_voltages, - [SKU_ID_CHANNEL] = ram_voltages, - [PANEL_ID_CHANNEL] = panel_voltages, + [PANEL_ID_HIGH_CHANNEL] = panel_voltages, + [PANEL_ID_LOW_CHANNEL] = panel_voltages, }; static uint32_t get_adc_index(unsigned int channel) @@ -84,7 +83,8 @@ uint32_t panel_id(void) static uint32_t cached_panel_id = BOARD_ID_INIT; if (cached_panel_id == BOARD_ID_INIT) - cached_panel_id = get_adc_index(PANEL_ID_CHANNEL); + cached_panel_id = get_adc_index(PANEL_ID_HIGH_CHANNEL) << 4 | + get_adc_index(PANEL_ID_LOW_CHANNEL); return cached_panel_id; } @@ -101,9 +101,8 @@ uint32_t sku_id(void) printk(BIOS_WARNING, "SKU code from EC: %s\n", (cached_sku_code == CROS_SKU_UNKNOWN) ? "CROS_SKU_UNKNOWN" : "CROS_SKU_UNPROVISIONED"); - /* Reserve last 8 bits to report SKU_ID and PANEL_ID */ - cached_sku_code = 0x7FFFFF00UL | get_adc_index(SKU_ID_CHANNEL) << 4 | - panel_id(); + /* Reserve last 8 bits to report PANEL_IDs */ + cached_sku_code = 0x7FFFFF00UL | panel_id(); } printk(BIOS_DEBUG, "SKU Code: %#02x\n", cached_sku_code); } diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c index 7828651397..1cb8e47d2a 100644 --- a/src/mainboard/google/geralt/panel_geralt.c +++ b/src/mainboard/google/geralt/panel_geralt.c @@ -72,10 +72,13 @@ static struct panel_description panels[] = { struct panel_description *get_panel_description(uint32_t panel_id) { - if (panel_id >= ARRAY_SIZE(panels)) + /* Only PANEL_ID_LOW_CHANNEL value is valid for the reference board. */ + uint32_t id = panel_id & 0xF; + + if (id >= ARRAY_SIZE(panels)) return NULL; - return &panels[panel_id]; + return &panels[id]; } void fill_lp_backlight_gpios(struct lb_gpios *gpios) -- cgit v1.2.3