mb/google/rauru: Add variant-specific firmware config

This change introduces support for variant-specific firmware
configurations (fw_config) for the Rauru mainboard, specifically adding
initial support for the Sapphire variant.

The fw_config fields for Sapphire are defined in b:458266555.

All fw_config fields are now defined in variant-specific overridetree.cb
files (hylia, navi, rauru, sapphire). Consequently, access to these
fw_config values has been refactored to be encapsulated within
variant-specific fw_config.c files. This approach ensures that common
mainboard code does not need direct knowledge of variant-specific
fw_config definitions.

This is demonstrated by the audio amplifier initialization, which
now uses a variant-specific get_audio_amp_id() function to determine
the hardware present, rather than directly probing fw_config in the
common code.

BRANCH=None
BUG=b:458266555, b:448281461, b:461594346
TEST=emerge-tanjiro coreboot && emerge-rauru coreboot && test on navi

Change-Id: Iecca5820421f250e1a22cec110b36fb578edd9e7
Signed-off-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Signed-off-by: Wentao Qin <qinwentao@huaqin.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90330
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Chen-Tsung Hsieh 2025-12-01 17:29:32 +08:00 committed by Yidi Lin
commit 459cdd09f4
16 changed files with 175 additions and 19 deletions

View file

@ -29,6 +29,7 @@ config BOARD_SPECIFIC_OPTIONS
select CHROMEOS_USE_EC_WATCHDOG_FLAG if CHROMEOS
select EC_GOOGLE_CHROMEEC
select EC_GOOGLE_CHROMEEC_BOARDID
select EC_GOOGLE_CHROMEEC_FW_CONFIG_FROM_UFSC if BOARD_GOOGLE_SAPPHIRE
select EC_GOOGLE_CHROMEEC_SPI
select I2C_TPM if VBOOT
select MAINBOARD_HAS_TPM2 if VBOOT
@ -52,10 +53,13 @@ config MAINBOARD_PART_NUMBER
default "Sapphire" if BOARD_GOOGLE_SAPPHIRE
config VARIANT_DIR
default "hylia" if BOARD_GOOGLE_HYLIA
default "navi" if BOARD_GOOGLE_NAVI
default "rauru" if BOARD_GOOGLE_RAURU
default "sapphire" if BOARD_GOOGLE_SAPPHIRE
config OVERRIDE_DEVICETREE
default "variants/\$(CONFIG_VARIANT_DIR)/overridetree.cb" if BOARD_GOOGLE_NAVI
default "variants/\$(CONFIG_VARIANT_DIR)/overridetree.cb"
config BOOT_DEVICE_SPI_FLASH_BUS
int

View file

@ -2,8 +2,8 @@
#include <boot/coreboot_tables.h>
#include <drivers/tpm/cr50.h>
#include <fw_config.h>
#include <gpio.h>
#include <variants.h>
#include "gpio.h"
@ -79,12 +79,20 @@ void fill_lb_gpios(struct lb_gpios *gpios)
{GPIO_EN_SPKR.id, ACTIVE_HIGH, -1, "speaker enable"},
};
if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_TAS2563)))
lb_add_gpios(gpios, smartamp_gpios, ARRAY_SIZE(smartamp_gpios));
else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645)))
lb_add_gpios(gpios, alc5645_gpios, ARRAY_SIZE(alc5645_gpios));
else
switch (get_audio_amp_id()) {
case AUD_AMP_ID_NAU8318:
lb_add_gpios(gpios, nau8318_gpios, ARRAY_SIZE(nau8318_gpios));
break;
case AUD_AMP_ID_TAS2563:
lb_add_gpios(gpios, smartamp_gpios, ARRAY_SIZE(smartamp_gpios));
break;
case AUD_AMP_ID_ALC5645:
lb_add_gpios(gpios, alc5645_gpios, ARRAY_SIZE(alc5645_gpios));
break;
case AUD_AMP_ID_UNKNOWN:
default:
break;
}
struct lb_gpio edp_pwm_backlight_gpios[] = {
{GPIO_BL_PWM_1V8.id, ACTIVE_HIGH, -1, "PWM control"},

View file

@ -1,13 +1,5 @@
## SPDX-License-Identifier: GPL-2.0-only
fw_config
field AUDIO_AMP 28 29
option AMP_NAU8318 0
option AMP_TAS2563 1
option AMP_ALC5645 2
end
end
chip soc/mediatek/mt8196
device cpu_cluster 0 on end

View file

@ -5,6 +5,15 @@
#include <soc/display.h>
enum audio_amplifier_id {
AUD_AMP_ID_UNKNOWN,
AUD_AMP_ID_NAU8318,
AUD_AMP_ID_TAS2563,
AUD_AMP_ID_ALC5645,
};
enum audio_amplifier_id get_audio_amp_id(void);
void fw_config_panel_override(struct panel_description *panel);
#endif /* __MAINBOARD_GOOGLE_RAURU_VARIANTS_H__ */

View file

@ -3,7 +3,6 @@
#include <bootmode.h>
#include <console/console.h>
#include <device/device.h>
#include <fw_config.h>
#include <gpio.h>
#include <soc/addressmap.h>
#include <soc/bl31.h>
@ -17,6 +16,7 @@
#include <soc/spm_common.h>
#include <soc/storage.h>
#include <soc/usb.h>
#include <variants.h>
#include "gpio.h"
#include "storage.h"
@ -52,15 +52,22 @@ static void configure_alc5645(void)
printk(BIOS_INFO, "%s: done\n", __func__);
}
static void configure_audio(void)
{
if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_TAS2563))) {
switch (get_audio_amp_id()) {
case AUD_AMP_ID_TAS2563:
mtk_i2c_bus_init(I2C3, I2C_SPEED_FAST);
configure_tas2563();
} else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645))) {
break;
case AUD_AMP_ID_ALC5645:
configure_alc5645();
} else {
printk(BIOS_INFO, "Audio configure default amps NAU8318\n");
break;
case AUD_AMP_ID_NAU8318:
case AUD_AMP_ID_UNKNOWN:
default:
/* No configuration needed for NAU8318 or UNKNOWN */
break;
}
printk(BIOS_INFO, "%s: done\n", __func__);

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-y += fw_config.c

View file

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
#include <fw_config.h>
#include <variants.h>
enum audio_amplifier_id get_audio_amp_id(void)
{
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_TAS2563)))
return AUD_AMP_ID_TAS2563;
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_ALC5645)))
return AUD_AMP_ID_ALC5645;
return AUD_AMP_ID_NAU8318;
}

View file

@ -0,0 +1,14 @@
## SPDX-License-Identifier: GPL-2.0-only
fw_config
field AUDIO_AMPLIFIER 28 29
option AUDIO_AMPLIFIER_NAU8318 0
option AUDIO_AMPLIFIER_TAS2563 1
option AUDIO_AMPLIFIER_ALC5645 2
end
end
chip soc/mediatek/mt8196
device domain 0 on
end
end

View file

@ -9,3 +9,14 @@ void fw_config_panel_override(struct panel_description *panel)
if (fw_config_probe(FW_CONFIG(OLED_WQXGA_PLUS, PRESENT)))
panel->quirks |= PANEL_QUIRK_FORCE_MAX_SWING;
}
enum audio_amplifier_id get_audio_amp_id(void)
{
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_TAS2563)))
return AUD_AMP_ID_TAS2563;
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_ALC5645)))
return AUD_AMP_ID_ALC5645;
return AUD_AMP_ID_NAU8318;
}

View file

@ -5,6 +5,11 @@ fw_config
option PRESENT 1
option ABSENT 0
end
field AUDIO_AMPLIFIER 28 29
option AUDIO_AMPLIFIER_NAU8318 0
option AUDIO_AMPLIFIER_TAS2563 1
option AUDIO_AMPLIFIER_ALC5645 2
end
end
chip soc/mediatek/mt8196

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-y += fw_config.c

View file

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
#include <fw_config.h>
#include <variants.h>
enum audio_amplifier_id get_audio_amp_id(void)
{
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_TAS2563)))
return AUD_AMP_ID_TAS2563;
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_ALC5645)))
return AUD_AMP_ID_ALC5645;
return AUD_AMP_ID_NAU8318;
}

View file

@ -0,0 +1,14 @@
## SPDX-License-Identifier: GPL-2.0-only
fw_config
field AUDIO_AMPLIFIER 28 29
option AUDIO_AMPLIFIER_NAU8318 0
option AUDIO_AMPLIFIER_TAS2563 1
option AUDIO_AMPLIFIER_ALC5645 2
end
end
chip soc/mediatek/mt8196
device domain 0 on
end
end

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
ramstage-y += fw_config.c

View file

@ -0,0 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
#include <fw_config.h>
#include <variants.h>
enum audio_amplifier_id get_audio_amp_id(void)
{
if (fw_config_probe(FW_CONFIG(AUDIO_AMPLIFIER, AUDIO_AMPLIFIER_TAS2563)))
return AUD_AMP_ID_TAS2563;
return AUD_AMP_ID_UNKNOWN;
}

View file

@ -0,0 +1,41 @@
## SPDX-License-Identifier: GPL-2.0-only
fw_config
field AUDIO_CODEC 0 2
option AUDIO_CODEC_UNKNOWN 0
option AUDIO_CODEC_ALC5682IVS 1
end
field AUDIO_AMPLIFIER 3 5
option AUDIO_AMPLIFIER_UNKNOWN 0
option AUDIO_AMPLIFIER_TAS2563 1
end
field STORAGE_TYPE 12 14
option STORAGE_TYPE_UNKNOWN 0
option STORAGE_TYPE_UFS_40 1
end
field FINGERPRINT_INTERFACE 24 25
option FINGERPRINT_INTERFACE_UNKNOWN 0
option FINGERPRINT_INTERFACE_USB 1
end
field WIFI_INTERFACE 26 27
option WIFI_INTERFACE_UNKNOWN 0
option WIFI_INTERFACE_PCIE 1
end
field FORM_FACTOR 30 31
option FORM_FACTOR_UNKNOWN 0
option FORM_FACTOR_DETACHABLE 1
end
field PANEL_ID 39 42
option PANEL_ID_NS130070_M00 9
option PANEL_ID_UNKNOWN 15
end
field STYLUS 48 48
option STYLUS_PRESENT_ABSENT 0
option STYLUS_PRESENT_PRESENT 1
end
end
chip soc/mediatek/mt8196
device domain 0 on
end
end