summaryrefslogtreecommitdiff
path: root/src/mainboard/google/rex
diff options
context:
space:
mode:
authorTerry Cheong <htcheong@chromium.org>2023-12-07 19:39:41 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-12-08 12:56:21 +0000
commit03807acfa968da58d3596a5b23e2aeabbb984fa8 (patch)
tree382a41c9c5c49e837f847e00e61c54ff958106bb /src/mainboard/google/rex
parentc6fd32d131927930738bbdf2b3562863135bdda8 (diff)
mb/google/rex/var/screebo: set audio GPIO pins based on fw_config
Enable BT offload when I2S option is selected for screebo. BUG=b:275538390 TEST=Verified audio playback using BT speaker/headset in I2S mode on google/screebo. Fixes: https://review.coreboot.org/c/coreboot/+/77755 Change-Id: I7ebe8e28d35428ce2fb8129dc145fec9ac60f9da Signed-off-by: Terry Cheong <htcheong@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79378 Reviewed-by: Subrata Banik <subratabanik@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google/rex')
-rw-r--r--src/mainboard/google/rex/variants/screebo/Makefile.inc1
-rw-r--r--src/mainboard/google/rex/variants/screebo/fw_config.c87
2 files changed, 88 insertions, 0 deletions
diff --git a/src/mainboard/google/rex/variants/screebo/Makefile.inc b/src/mainboard/google/rex/variants/screebo/Makefile.inc
index 8bea0ff390..7bc4fba5a0 100644
--- a/src/mainboard/google/rex/variants/screebo/Makefile.inc
+++ b/src/mainboard/google/rex/variants/screebo/Makefile.inc
@@ -6,3 +6,4 @@ romstage-y += gpio.c
romstage-y += memory.c
ramstage-y += gpio.c
ramstage-y += variant.c
+ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
diff --git a/src/mainboard/google/rex/variants/screebo/fw_config.c b/src/mainboard/google/rex/variants/screebo/fw_config.c
new file mode 100644
index 0000000000..18b1089dbf
--- /dev/null
+++ b/src/mainboard/google/rex/variants/screebo/fw_config.c
@@ -0,0 +1,87 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <baseboard/variants.h>
+#include <bootstate.h>
+#include <console/console.h>
+#include <fw_config.h>
+#include <gpio.h>
+
+#define GPIO_PADBASED_OVERRIDE(b, a) gpio_padbased_override(b, a, ARRAY_SIZE(a))
+
+static const struct pad_config dmic_disable_pads[] = {
+ PAD_NC(GPP_S02, NONE),
+ PAD_NC(GPP_S03, NONE),
+ PAD_NC(GPP_S06, NONE),
+ PAD_NC(GPP_S07, NONE),
+};
+
+static const struct pad_config i2s_disable_pads[] = {
+ PAD_NC(GPP_D09, NONE),
+ PAD_NC(GPP_D10, NONE),
+ PAD_NC(GPP_D11, NONE),
+ PAD_NC(GPP_D12, DN_20K),
+ PAD_NC(GPP_D13, NONE),
+ PAD_NC(GPP_D14, NONE),
+ PAD_NC(GPP_D15, NONE),
+ PAD_NC(GPP_D16, 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)
+{
+ 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, bt_i2s_disable_pads);
+ return;
+ }
+
+ if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_UNKNOWN))) {
+ printk(BIOS_INFO, "Configure GPIOs for no audio.\n");
+ GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads);
+ GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads);
+ GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads);
+ } else if (fw_config_probe(FW_CONFIG(AUDIO, ALC1019_ALC5682I_I2S))) {
+ printk(BIOS_INFO, "Configure GPIOs for BT offload mode.\n");
+ GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_enable_pads);
+ }
+}