From 9afa18f0e936e07c51298c0376c23f3af8aaa65e Mon Sep 17 00:00:00 2001 From: Ravi Sarawadi Date: Tue, 7 Feb 2023 09:33:46 -0800 Subject: [PATCH] mb/google/rex: Enable audio BT offload This patch enables BT offload feature on Rex over SSP1. BT mode is selected via FW_CONFIG and corresponding VGPIOs are programmed. BUG=b:275538390 TEST=Verified audio playback using BT speaker/headset in I2S mode on google/rex. Signed-off-by: Ravi Sarawadi Change-Id: I46e9702add37464122ffc78826ebf8a6c5b5b07c Reviewed-on: https://review.coreboot.org/c/coreboot/+/72881 Reviewed-by: Wonkyu Kim Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) --- .../google/rex/variants/rex0/fw_config.c | 43 +++++++++++++++++++ .../google/rex/variants/rex0/variant.c | 6 +++ 2 files changed, 49 insertions(+) diff --git a/src/mainboard/google/rex/variants/rex0/fw_config.c b/src/mainboard/google/rex/variants/rex0/fw_config.c index 7d7c901270..11014b5325 100644 --- a/src/mainboard/google/rex/variants/rex0/fw_config.c +++ b/src/mainboard/google/rex/variants/rex0/fw_config.c @@ -34,12 +34,51 @@ static const struct pad_config i2s_disable_pads[] = { PAD_NC(GPP_D17, NONE), }; +static const struct pad_config bt_i2s_enable_pads[] = { + /* GPP_V30 : [] ==> BT_I2S_BCLK */ + PAD_CFG_NF(GPP_VGPIO30, NONE, DEEP, NF2), + /* GPP_V31 : [] ==> BT_I2S_SYNC */ + PAD_CFG_NF(GPP_VGPIO31, NONE, DEEP, NF2), + /* GPP_V32 : [] ==> BT_I2S_SDO */ + PAD_CFG_NF(GPP_VGPIO32, NONE, DEEP, NF2), + /* GPP_V33 : [] ==> BT_I2S_SDI */ + PAD_CFG_NF(GPP_VGPIO33, NONE, DEEP, NF2), + /* GPP_V34 : [] ==> SSP2_SCLK */ + PAD_CFG_NF(GPP_VGPIO34, NONE, DEEP, NF1), + /* GPP_V35 : [] ==> SSP2_SFRM */ + PAD_CFG_NF(GPP_VGPIO35, NONE, DEEP, NF1), + /* GPP_V36 : [] ==> SSP_TXD */ + PAD_CFG_NF(GPP_VGPIO36, NONE, DEEP, NF1), + /* GPP_V37 : [] ==> SSP_RXD */ + PAD_CFG_NF(GPP_VGPIO37, NONE, DEEP, NF1), +}; + +static const struct pad_config bt_i2s_disable_pads[] = { + /* GPP_V30 : [] ==> BT_I2S_BCLK */ + PAD_NC(GPP_VGPIO30, NONE), + /* GPP_V31 : [] ==> BT_I2S_SYNC */ + PAD_NC(GPP_VGPIO31, NONE), + /* GPP_V32 : [] ==> BT_I2S_SDO */ + PAD_NC(GPP_VGPIO32, NONE), + /* GPP_V33 : [] ==> BT_I2S_SDI */ + PAD_NC(GPP_VGPIO33, NONE), + /* GPP_V34 : [] ==> SSP2_SCLK */ + PAD_NC(GPP_VGPIO34, NONE), + /* GPP_V35 : [] ==> SSP2_SFRM */ + PAD_NC(GPP_VGPIO35, NONE), + /* GPP_V36 : [] ==> SSP_TXD */ + PAD_NC(GPP_VGPIO36, NONE), + /* GPP_V37 : [] ==> SSP_RXD */ + PAD_NC(GPP_VGPIO37, NONE), +}; + void fw_config_gpio_padbased_override(struct pad_config *padbased_table) { if (!fw_config_is_provisioned()) { GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); return; } @@ -48,11 +87,15 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); } else if (fw_config_probe(FW_CONFIG(AUDIO, MAX98363_CS42L42_SNDW))) { printk(BIOS_INFO, "Configure GPIOs for SoundWire audio.\n"); GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); } else if (fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_I2S))) { printk(BIOS_INFO, "Configure GPIOs for I2S audio.\n"); GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads); + printk(BIOS_INFO, "Configure GPIOs for BT offload mode.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_enable_pads); } } diff --git a/src/mainboard/google/rex/variants/rex0/variant.c b/src/mainboard/google/rex/variants/rex0/variant.c index 3aec24b165..b259636d66 100644 --- a/src/mainboard/google/rex/variants/rex0/variant.c +++ b/src/mainboard/google/rex/variants/rex0/variant.c @@ -21,3 +21,9 @@ void variant_generate_s0ix_hook(enum s0ix_entry entry) acpigen_soc_set_tx_gpio(GPP_B09); } } + +void variant_update_soc_chip_config(struct soc_intel_meteorlake_config *config) +{ + config->cnvi_bt_audio_offload = fw_config_probe(FW_CONFIG(AUDIO, + MAX98360_ALC5682I_I2S)); +}