mb/google/brya: Enable BT offload conditionally

Currently, BT offload is disabled/enabled unconditionally based on the
devicetree settings. BT offload uses I2S lines and cannot be enabled
when a I2S based audio daughter card is active. So we need to enable
BT offload only while using soundwire based audio daugther card.

BUG=b:175701262
TEST=Verified BT offload on brya with soundwire audio daughter card
BT offload enabled

Change-Id: I6a9ad463e13e2cfcfc3b7de5a61a25cdef0641f7
Signed-off-by: Sugnan Prabhu S <sugnan.prabhu.s@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55180
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Sugnan Prabhu S 2021-06-04 12:57:30 +05:30 committed by Werner Zeh
parent b3af9f8d2e
commit 22618d9f07
3 changed files with 39 additions and 0 deletions

View File

@ -1,3 +1,4 @@
bootblock-y += gpio.c bootblock-y += gpio.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-y += gpio.c ramstage-y += gpio.c

View File

@ -55,6 +55,28 @@ static const struct pad_config i2s_disable_pads[] = {
PAD_NC(GPP_R7, NONE), PAD_NC(GPP_R7, NONE),
}; };
static const struct pad_config bt_i2s_enable_pads[] = {
PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), /* BT_I2S_BCLK */
PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), /* BT_I2S_SYNC */
PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), /* BT_I2S_SDO */
PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), /* BT_I2S_SDI */
PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), /* SSP2_SCLK */
PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), /* SSP2_SFRM */
PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), /* SSP_TXD */
PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), /* SSP_RXD */
};
static const struct pad_config bt_i2s_disable_pads[] = {
PAD_NC(GPP_VGPIO_30, NONE),
PAD_NC(GPP_VGPIO_31, NONE),
PAD_NC(GPP_VGPIO_32, NONE),
PAD_NC(GPP_VGPIO_33, NONE),
PAD_NC(GPP_VGPIO_34, NONE),
PAD_NC(GPP_VGPIO_35, NONE),
PAD_NC(GPP_VGPIO_36, NONE),
PAD_NC(GPP_VGPIO_37, NONE),
};
static void fw_config_handle(void *unused) static void fw_config_handle(void *unused)
{ {
if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO, AUDIO_UNKNOWN))) { if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO, AUDIO_UNKNOWN))) {
@ -69,7 +91,13 @@ static void fw_config_handle(void *unused)
printk(BIOS_INFO, "Configure audio over SoundWire with MAX98373 ALC5682.\n"); printk(BIOS_INFO, "Configure audio over SoundWire with MAX98373 ALC5682.\n");
gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads)); gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads));
gpio_configure_pads(sndw_enable_pads, ARRAY_SIZE(sndw_enable_pads)); gpio_configure_pads(sndw_enable_pads, ARRAY_SIZE(sndw_enable_pads));
printk(BIOS_INFO, "BT offload enabled\n");
gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads));
gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads));
} else {
printk(BIOS_INFO, "BT offload disabled\n");
gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads)); gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads));
gpio_configure_pads(bt_i2s_disable_pads, ARRAY_SIZE(bt_i2s_disable_pads));
} }
if (fw_config_probe(FW_CONFIG(AUDIO, MAX98357_ALC5682I_I2S))) { if (fw_config_probe(FW_CONFIG(AUDIO, MAX98357_ALC5682I_I2S))) {

View File

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <chip.h>
#include <fw_config.h>
#include <baseboard/variants.h>
void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config)
{
config->CnviBtAudioOffload = fw_config_probe(FW_CONFIG(AUDIO, MAX98373_ALC5682_SNDW));
}