mb/google/rauru: Report panel ID for sapphire

The panel id is sampled with AUXADC_VIN3 (PANEL_ID_HIGH_CHANNEL)
and AUXADC_VIN4 (PANEL_ID_LOW_CHANNEL).

    [DEBUG]  ADC[2]: Raw value=1744 ID=7
    [DEBUG]  ADC[3]: Raw value=283 ID=1
    [DEBUG]  Panel ID: 0x9

BUG=b:448281461
TEST=build and check the CBFS include the panel ID
BRANCH=none

Change-Id: I3b010162bb5b892d528c74e2d38e624465fa90dc
Signed-off-by: Wentao Qin <qinwentao@huaqin.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90190
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@google.com>
This commit is contained in:
Wentao Qin 2025-11-24 23:25:01 +08:00 committed by Yidi Lin
commit 5807b59fc5
2 changed files with 29 additions and 2 deletions

View file

@ -7,6 +7,7 @@
#include <ec/google/chromeec/ec.h>
#include <soc/mt6363_sdmadc.h>
#include "panel.h"
#include "storage.h"
#define ADC_LEVELS 8
@ -18,9 +19,12 @@ DEFINE_BITFIELD(PANEL_TYPE, 7, 0);
enum {
/* Storage IDs */
STORAGE_ID_LOW_CHANNEL = AUXADC_CHAN_VIN1,
/* Panel IDS */
PANEL_ID0_CHANNEL = AUXADC_CHAN_VIN3,
PANEL_ID1_CHANNEL = AUXADC_CHAN_VIN4,
};
static const unsigned int storageid_voltages[ADC_LEVELS] = {
static const unsigned int id_voltages[ADC_LEVELS] = {
/* ID : Voltage (unit: mV) */
[0] = 50,
[1] = 210,
@ -33,7 +37,9 @@ static const unsigned int storageid_voltages[ADC_LEVELS] = {
};
static const unsigned int *adc_voltages[] = {
[STORAGE_ID_LOW_CHANNEL] = storageid_voltages,
[STORAGE_ID_LOW_CHANNEL] = id_voltages,
[PANEL_ID0_CHANNEL] = id_voltages,
[PANEL_ID1_CHANNEL] = id_voltages,
};
static uint32_t get_adc_index(unsigned int channel)
@ -55,6 +61,25 @@ static uint32_t get_adc_index(unsigned int channel)
return id;
}
uint32_t panel_id(void)
{
static uint32_t cached_panel_id = BOARD_ID_INIT;
if (cached_panel_id != BOARD_ID_INIT)
return cached_panel_id;
uint32_t id0 = get_adc_index(PANEL_ID0_CHANNEL);
uint32_t id1 = get_adc_index(PANEL_ID1_CHANNEL);
if (id0 && id0 != 0x7)
printk(BIOS_ERR, "Invalid Panel ID0: %#02x\n", id0);
cached_panel_id = (!!id0) << 3 | (id1 & 0x7);
printk(BIOS_DEBUG, "Panel ID: %#02x\n", cached_panel_id);
return cached_panel_id;
}
uint32_t storage_id(void)
{
static uint32_t cached_storage_id = BOARD_ID_INIT;

View file

@ -5,4 +5,6 @@
#include <soc/display.h>
uint32_t panel_id(void);
#endif /* __MAINBOARD_GOOGLE_RAURU_PANEL_H__ */