aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorBo-Chen Chen <rex-bc.chen@mediatek.com>2022-12-01 16:35:48 +0800
committerYu-Ping Wu <yupingso@google.com>2022-12-12 08:26:58 +0000
commitc5d0c94868ded8999b0ad6447b315e0d6283a421 (patch)
treec47533ab106c883b98e3055a045dd290d0222619 /src/mainboard/google
parent7e11dcb5107982e1c596d0291f25eb01507c8d5c (diff)
mb/google/geralt: Add support for getting panel id
According to ID table(go/geralt-id), we add panel_id() to read the panel id from auxadc channel 5. BUG=b:244208960 TEST=emerge-geralt coreboot Change-Id: I2c0f4ee5a642c41dda9594fbaf2c63f2b2ebac6e Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70402 Reviewed-by: Yidi Lin <yidilin@google.com> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/geralt/boardid.c31
-rw-r--r--src/mainboard/google/geralt/panel.h8
2 files changed, 39 insertions, 0 deletions
diff --git a/src/mainboard/google/geralt/boardid.c b/src/mainboard/google/geralt/boardid.c
index 24ea438e40..19d25c4a10 100644
--- a/src/mainboard/google/geralt/boardid.c
+++ b/src/mainboard/google/geralt/boardid.c
@@ -5,6 +5,7 @@
#include <console/console.h>
#include <ec/google/chromeec/ec.h>
#include <soc/auxadc.h>
+#include "panel.h"
/* board_id is provided by ec/google/chromeec/ec_boardid.c */
@@ -16,6 +17,8 @@ enum {
RAM_ID_HIGH_CHANNEL = 3,
/* SKU ID */
SKU_ID_CHANNEL = 4,
+ /* PANEL ID */
+ PANEL_ID_CHANNEL = 5,
};
static const unsigned int ram_voltages[ADC_LEVELS] = {
@@ -34,10 +37,27 @@ static const unsigned int ram_voltages[ADC_LEVELS] = {
[11] = 1342600,
};
+static const unsigned int panel_voltages[ADC_LEVELS] = {
+ /* ID : Voltage (unit: uV) */
+ [0] = 0,
+ [1] = 283000,
+ [2] = 394000,
+ [3] = 503000,
+ [4] = 608000,
+ [5] = 712000,
+ [6] = 823000,
+ [7] = 937000,
+ [8] = 1046000,
+ [9] = 1155000,
+ [10] = 1277000,
+ [11] = 1434000,
+};
+
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,
};
static uint32_t get_adc_index(unsigned int channel)
@@ -58,6 +78,17 @@ static uint32_t get_adc_index(unsigned int channel)
return id;
}
+/* Returns the ID for LCD module (type of panel). */
+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);
+
+ return cached_panel_id;
+}
+
uint32_t sku_id(void)
{
static uint32_t cached_sku_code = BOARD_ID_INIT;
diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h
new file mode 100644
index 0000000000..e940094da0
--- /dev/null
+++ b/src/mainboard/google/geralt/panel.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __MAINBOARD_GOOGLE_GERALT_PANEL_H__
+#define __MAINBOARD_GOOGLE_GERALT_PANEL_H__
+
+uint32_t panel_id(void);
+
+#endif