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_R */
10 PAD_CFG_NF(GPP_R5
, NONE
, DEEP
, NF3
), /* DMIC_DATA0_R */
11 PAD_CFG_NF(GPP_R6
, NONE
, DEEP
, NF3
), /* DMIC_CLK1_R */
12 PAD_CFG_NF(GPP_R7
, NONE
, DEEP
, NF3
), /* DMIC_DATA1_R */
15 static const struct pad_config dmic_disable_pads
[] = {
22 static const struct pad_config i2s_enable_pads
[] = {
23 PAD_CFG_NF(GPP_R0
, NONE
, DEEP
, NF2
), /* I2S_HP_SCLK_R */
24 PAD_CFG_NF(GPP_R1
, NONE
, DEEP
, NF2
), /* I2S_HP_SFRM_R */
25 PAD_CFG_NF(GPP_R2
, DN_20K
, DEEP
, NF2
), /* I2S_PCH_TX_HP_RX_STRAP */
26 PAD_CFG_NF(GPP_R3
, NONE
, DEEP
, NF2
), /* I2S_PCH_RX_HP_TX */
27 PAD_CFG_NF(GPP_S0
, NONE
, DEEP
, NF4
), /* I2S_SPKR_SCLK_R */
28 PAD_CFG_NF(GPP_S1
, NONE
, DEEP
, NF4
), /* I2S_SPKR_SFRM_R */
29 PAD_CFG_NF(GPP_S2
, NONE
, DEEP
, NF4
), /* I2S_PCH_TX_SPKR_RX_R */
30 PAD_CFG_NF(GPP_S3
, NONE
, DEEP
, NF4
), /* I2S_PCH_RX_SPKR_TX */
33 static const struct pad_config i2s_disable_pads
[] = {
44 static const struct pad_config bt_i2s_enable_pads
[] = {
45 PAD_CFG_NF(GPP_VGPIO_30
, NONE
, DEEP
, NF3
), /* BT_I2S_BCLK */
46 PAD_CFG_NF(GPP_VGPIO_31
, NONE
, DEEP
, NF3
), /* BT_I2S_SYNC */
47 PAD_CFG_NF(GPP_VGPIO_32
, NONE
, DEEP
, NF3
), /* BT_I2S_SDO */
48 PAD_CFG_NF(GPP_VGPIO_33
, NONE
, DEEP
, NF3
), /* BT_I2S_SDI */
49 PAD_CFG_NF(GPP_VGPIO_34
, NONE
, DEEP
, NF1
), /* SSP2_SCLK */
50 PAD_CFG_NF(GPP_VGPIO_35
, NONE
, DEEP
, NF1
), /* SSP2_SFRM */
51 PAD_CFG_NF(GPP_VGPIO_36
, NONE
, DEEP
, NF1
), /* SSP_TXD */
52 PAD_CFG_NF(GPP_VGPIO_37
, NONE
, DEEP
, NF1
), /* SSP_RXD */
55 static const struct pad_config bt_i2s_disable_pads
[] = {
56 PAD_NC(GPP_VGPIO_30
, NONE
),
57 PAD_NC(GPP_VGPIO_31
, NONE
),
58 PAD_NC(GPP_VGPIO_32
, NONE
),
59 PAD_NC(GPP_VGPIO_33
, NONE
),
60 PAD_NC(GPP_VGPIO_34
, NONE
),
61 PAD_NC(GPP_VGPIO_35
, NONE
),
62 PAD_NC(GPP_VGPIO_36
, NONE
),
63 PAD_NC(GPP_VGPIO_37
, NONE
),
66 static const struct pad_config fp_disable_pads
[] = {
67 PAD_NC(GPP_D0
, NONE
), /* D0 : ISH_GP0 ==> PCH_FP_BOOT0 */
68 PAD_NC(GPP_D1
, NONE
), /* D1 : ISH_GP1 ==> FP_RST_ODL */
69 PAD_NC(GPP_D2
, NONE
), /* D2 : ISH_GP2 ==> EN_FP_PWR */
72 static void fw_config_handle(void *unused
)
74 if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO
, AUDIO_UNKNOWN
))) {
75 printk(BIOS_INFO
, "Disable audio related GPIO pins.\n");
76 gpio_configure_pads(i2s_disable_pads
, ARRAY_SIZE(i2s_disable_pads
));
77 gpio_configure_pads(dmic_disable_pads
, ARRAY_SIZE(dmic_disable_pads
));
78 gpio_configure_pads(bt_i2s_disable_pads
, ARRAY_SIZE(bt_i2s_disable_pads
));
82 if (fw_config_probe(FW_CONFIG(AUDIO
, MAX98373_NAU88L25B_I2S
))) {
83 printk(BIOS_INFO
, "Configure audio over I2S with MAX98373 NAU88L25B.\n");
84 gpio_configure_pads(dmic_enable_pads
, ARRAY_SIZE(dmic_enable_pads
));
85 gpio_configure_pads(i2s_enable_pads
, ARRAY_SIZE(i2s_enable_pads
));
86 printk(BIOS_INFO
, "Enabling BT offload\n");
87 gpio_configure_pads(bt_i2s_enable_pads
, ARRAY_SIZE(bt_i2s_enable_pads
));
89 printk(BIOS_INFO
, "Disabling BT offload\n");
90 gpio_configure_pads(bt_i2s_disable_pads
, ARRAY_SIZE(bt_i2s_disable_pads
));
93 if (fw_config_probe(FW_CONFIG(FPMCU_MASK
, FPMCU_DISABLED
))) {
94 printk(BIOS_INFO
, "Disabling FP pads\n");
95 gpio_configure_pads(fp_disable_pads
, ARRAY_SIZE(fp_disable_pads
));
98 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_ENTRY
, fw_config_handle
, NULL
);