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 <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73874
Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Yidi Lin 2023-03-20 17:40:31 +08:00 committed by Rex-BC Chen
parent 23725958b4
commit 0b192d3238
2 changed files with 14 additions and 12 deletions

View File

@ -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);
}

View File

@ -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)