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 <ravishankar.sarawadi@intel.com>
Change-Id: I46e9702add37464122ffc78826ebf8a6c5b5b07c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72881
Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Ravi Sarawadi 2023-02-07 09:33:46 -08:00 committed by Martin L Roth
parent 6eec8beb1b
commit 9afa18f0e9
2 changed files with 49 additions and 0 deletions

View File

@ -34,12 +34,51 @@ static const struct pad_config i2s_disable_pads[] = {
PAD_NC(GPP_D17, NONE), 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) void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
{ {
if (!fw_config_is_provisioned()) { if (!fw_config_is_provisioned()) {
GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads);
GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads);
GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads);
GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads);
return; 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, i2s_disable_pads);
GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads);
GPIO_PADBASED_OVERRIDE(padbased_table, sndw_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))) { } else if (fw_config_probe(FW_CONFIG(AUDIO, MAX98363_CS42L42_SNDW))) {
printk(BIOS_INFO, "Configure GPIOs for SoundWire audio.\n"); printk(BIOS_INFO, "Configure GPIOs for SoundWire audio.\n");
GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); 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))) { } else if (fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_I2S))) {
printk(BIOS_INFO, "Configure GPIOs for I2S audio.\n"); printk(BIOS_INFO, "Configure GPIOs for I2S audio.\n");
GPIO_PADBASED_OVERRIDE(padbased_table, sndw_disable_pads); 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);
} }
} }

View File

@ -21,3 +21,9 @@ void variant_generate_s0ix_hook(enum s0ix_entry entry)
acpigen_soc_set_tx_gpio(GPP_B09); 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));
}