diff --git a/src/mainboard/google/fatcat/Kconfig b/src/mainboard/google/fatcat/Kconfig index c1e19b8b34..f78f5e2c11 100644 --- a/src/mainboard/google/fatcat/Kconfig +++ b/src/mainboard/google/fatcat/Kconfig @@ -155,6 +155,7 @@ config BOARD_GOOGLE_MOONSTONE config BOARD_GOOGLE_MODEL_RUBY def_bool n select BOARD_GOOGLE_BASEBOARD_FATCAT + select DRIVERS_I2C_TAS2563 select HAVE_SLP_S0_GATE select MAINBOARD_HAS_GOOGLE_STRAUSS_KEYBOARD diff --git a/src/mainboard/google/fatcat/variants/ruby/fw_config.c b/src/mainboard/google/fatcat/variants/ruby/fw_config.c index 8c207ed5e2..d02976e026 100644 --- a/src/mainboard/google/fatcat/variants/ruby/fw_config.c +++ b/src/mainboard/google/fatcat/variants/ruby/fw_config.c @@ -11,6 +11,93 @@ /* t: table */ #define GPIO_CONFIGURE_PADS(t) gpio_configure_pads(t, ARRAY_SIZE(t)) +static const struct pad_config i2s_enable_pads[] = { + /* I2S_MCLK1_OUT */ + PAD_CFG_NF(GPP_D09, NONE, DEEP, NF2), + /* I2S0_SCLK_HDR */ + PAD_CFG_NF(GPP_D10, NONE, DEEP, NF2), + /* I2S0_SFRM_HDR */ + PAD_CFG_NF(GPP_D11, NONE, DEEP, NF2), + /* I2S0_TXD_HDR */ + PAD_CFG_NF(GPP_D12, NONE, DEEP, NF2), + /* I2S0_RXD_HDR */ + PAD_CFG_NF(GPP_D13, NONE, DEEP, NF2), + + /* I2S1_TXD_HDR */ + PAD_CFG_NF(GPP_S00, NONE, DEEP, NF6), + /* I2S1_RXD_HDR */ + PAD_CFG_NF(GPP_S01, NONE, DEEP, NF6), + /* I2S1_SCLK_HDR */ + PAD_CFG_NF(GPP_S02, NONE, DEEP, NF6), + /* I2S1_SFRM_HDR */ + PAD_CFG_NF(GPP_S03, NONE, DEEP, NF6), + + /* DMIC_CLK_A0 */ + PAD_CFG_NF(GPP_S04, NONE, DEEP, NF5), + /* DMIC_CLK_A0 */ + PAD_CFG_NF(GPP_S05, NONE, DEEP, NF5), + /* DMIC_CLK_A1 */ + PAD_CFG_NF(GPP_D16, NONE, DEEP, NF3), + /* DMIC_DATA_A1 */ + PAD_CFG_NF(GPP_D17, NONE, DEEP, NF3), +}; + +static const struct pad_config bt_i2s_enable_pads[] = { + /* GPP_V30 : [] ==> BT_I2S_BCLK - SSP2 */ + PAD_CFG_NF(GPP_VGPIO30, NONE, DEEP, NF3), + /* GPP_V31 : [] ==> BT_I2S_SYNC - SSP2 */ + PAD_CFG_NF(GPP_VGPIO31, NONE, DEEP, NF3), + /* GPP_V32 : [] ==> BT_I2S_SDO - SSP2 */ + PAD_CFG_NF(GPP_VGPIO32, NONE, DEEP, NF3), + /* GPP_V33 : [] ==> BT_I2S_SDI - SSP2 */ + PAD_CFG_NF(GPP_VGPIO33, NONE, DEEP, NF3), + /* GPP_V34 : [] ==> SSP_SCLK */ + PAD_CFG_NF(GPP_VGPIO34, NONE, DEEP, NF1), + /* GPP_V35 : [] ==> SSP_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), +}; + +static const struct pad_config audio_disable_pads[] = { + PAD_NC(GPP_S00, NONE), + PAD_NC(GPP_S01, NONE), + PAD_NC(GPP_S02, NONE), + PAD_NC(GPP_S03, NONE), + PAD_NC(GPP_S04, NONE), + PAD_NC(GPP_S05, NONE), + PAD_NC(GPP_S06, NONE), + PAD_NC(GPP_S07, NONE), + PAD_NC(GPP_D09, NONE), + PAD_NC(GPP_D10, NONE), + PAD_NC(GPP_D11, NONE), + PAD_NC(GPP_D12, NONE), + PAD_NC(GPP_D13, NONE), + PAD_NC(GPP_D16, NONE), + PAD_NC(GPP_D17, NONE), +}; + void fw_config_configure_pre_mem_gpio(void) { if (!fw_config_is_provisioned()) { @@ -25,4 +112,14 @@ void fw_config_gpio_padbased_override(struct pad_config *padbased_table) printk(BIOS_WARNING, "FW_CONFIG is not provisioned, Exiting\n"); return; } + + if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_NONE))) { + GPIO_PADBASED_OVERRIDE(padbased_table, audio_disable_pads); + GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_disable_pads); + } else if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_TAS2563_ALC5682I_I2S))) { + printk(BIOS_INFO, "Configure GPIOs for I2S TAS2563 ALC5682 audio.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, i2s_enable_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/fatcat/variants/ruby/overridetree.cb b/src/mainboard/google/fatcat/variants/ruby/overridetree.cb index d9552f834b..a7f37a8840 100644 --- a/src/mainboard/google/fatcat/variants/ruby/overridetree.cb +++ b/src/mainboard/google/fatcat/variants/ruby/overridetree.cb @@ -1,3 +1,10 @@ +fw_config + field AUDIO 0 1 + option AUDIO_NONE 0 + option AUDIO_TAS2563_ALC5682I_I2S 1 + end +end + chip soc/intel/pantherlake # The initial version temporarily uses the PTL-H, @@ -242,7 +249,18 @@ chip soc/intel/pantherlake register "property_list[0].name" = ""realtek,jd-src"" register "property_list[0].integer" = "1" device i2c 1a on - #probe AUDIO ALC5682I_I2S + probe AUDIO AUDIO_TAS2563_ALC5682I_I2S + end + end + chip drivers/i2c/tas2563 + register "irq_gpio" = "ACPI_GPIO_IRQ_LEVEL_LOW(GPP_H03)" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_D01)" + register "audio_slots[0]" = "0x4e" + register "audio_slots[1]" = "0x4f" + register "audio_slots[2]" = "0x4c" + register "audio_slots[3]" = "0x4d" + device i2c 4a on + probe AUDIO AUDIO_TAS2563_ALC5682I_I2S end end end @@ -288,5 +306,12 @@ chip soc/intel/pantherlake end # I2C5 device ref gspi0 on end device ref smbus on end + device ref hda on + chip drivers/sof + register "spkr_tplg" = "tas2563" + register "jack_tplg" = "rt5682" + device generic 0 on end + end + end end end