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>
diff --git a/src/mainboard/google/rex/variants/rex0/fw_config.c b/src/mainboard/google/rex/variants/rex0/fw_config.c
index 7d7c901..11014b5 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 @@
 	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 @@
 		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 3aec24b..b259636 100644
--- a/src/mainboard/google/rex/variants/rex0/variant.c
+++ b/src/mainboard/google/rex/variants/rex0/variant.c
@@ -21,3 +21,9 @@
 			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));
+}