1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <console/console.h>
8 static const struct pad_config dmic_enable_pads
[] = {
9 PAD_CFG_NF(GPP_R4
, NONE
, DEEP
, NF3
), /* DMIC_CLK0 */
10 PAD_CFG_NF(GPP_R5
, NONE
, DEEP
, NF3
), /* DMIC_DATA0 */
14 static const struct pad_config dmic_disable_pads
[] = {
19 static const struct pad_config i2s_enable_pads
[] = {
20 PAD_CFG_NF(GPP_R0
, NONE
, DEEP
, NF2
), /* I2S_HP_SCLK */
21 PAD_CFG_NF(GPP_R1
, NONE
, DEEP
, NF2
), /* I2S_HP_SFRM */
22 PAD_CFG_NF(GPP_R2
, DN_20K
, DEEP
, NF2
), /* I2S_PCH_TX_HP_RX_STRAP */
23 PAD_CFG_NF(GPP_R3
, NONE
, DEEP
, NF2
), /* I2S_PCH_RX_HP_TX */
24 PAD_CFG_NF(GPP_S0
, NONE
, DEEP
, NF4
), /* I2S_SPKR_SCLK */
25 PAD_CFG_NF(GPP_S1
, NONE
, DEEP
, NF4
), /* I2S_SPKR_SFRM */
26 PAD_CFG_NF(GPP_S2
, NONE
, DEEP
, NF4
), /* I2S_PCH_TX_SPKR_RX */
27 PAD_CFG_NF(GPP_S3
, NONE
, DEEP
, NF4
), /* I2S_PCH_RX_SPKR_TX */
30 static const struct pad_config i2s_disable_pads
[] = {
41 static void fw_config_handle(void *unused
)
43 if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO
, AUDIO_UNKNOWN
))) {
44 printk(BIOS_INFO
, "Disable audio related GPIO pins.\n");
45 gpio_configure_pads(i2s_disable_pads
, ARRAY_SIZE(i2s_disable_pads
));
46 gpio_configure_pads(dmic_disable_pads
, ARRAY_SIZE(dmic_disable_pads
));
50 if (fw_config_probe(FW_CONFIG(AUDIO
, MAX98360_ALC5682I_I2S
)) ||
51 fw_config_probe(FW_CONFIG(AUDIO
, MAX98360_ALC5682IVS_I2S
))) {
52 printk(BIOS_INFO
, "Configure audio over I2S with MAX98390 ALC5682I.\n");
53 gpio_configure_pads(dmic_enable_pads
, ARRAY_SIZE(dmic_enable_pads
));
54 gpio_configure_pads(i2s_enable_pads
, ARRAY_SIZE(i2s_enable_pads
));
57 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_ENTRY
, fw_config_handle
, NULL
);