2 #include <console/console.h>
7 static const struct pad_config i2s_enable_pads
[] = {
9 PAD_CFG_NF(GPP_D09
, NONE
, DEEP
, NF2
), /* I2S_MCLK1_OUT */
10 PAD_CFG_NF(GPP_D10
, NONE
, DEEP
, NF2
), /* I2S0_SCLK_HDR */
11 PAD_CFG_NF(GPP_D11
, NONE
, DEEP
, NF2
), /* I2S0_SFRM_HDR */
12 PAD_CFG_NF(GPP_D12
, NONE
, DEEP
, NF2
), /* I2S0_TXD_HDR */
13 PAD_CFG_NF(GPP_D13
, NONE
, DEEP
, NF2
), /* I2S0_RXD_HDR */
15 PAD_CFG_NF(GPP_S00
, NONE
, DEEP
, NF6
), /* I2S1_SCLK_HDR */
16 PAD_CFG_NF(GPP_S01
, NONE
, DEEP
, NF6
), /* I2S1_SFRM_HDR */
17 PAD_CFG_NF(GPP_S02
, NONE
, DEEP
, NF6
), /* I2S1_TXD_HDR */
18 PAD_CFG_NF(GPP_S03
, NONE
, DEEP
, NF6
), /* I2S1_RXD_HDR */
19 PAD_CFG_NF(GPP_S06
, NONE
, DEEP
, NF3
), /* DMIC_CLK_A1 */
20 PAD_CFG_NF(GPP_S07
, NONE
, DEEP
, NF3
), /* DMIC_DATA1 */
23 static const struct pad_config sndw_enable_pads
[] = {
24 /* Soundwire GPIO Config */
25 /* DMIC config pads */
26 PAD_CFG_NF(GPP_D09
, NONE
, DEEP
, NF2
),
27 PAD_CFG_NF(GPP_D10
, NONE
, DEEP
, NF2
),
28 PAD_CFG_NF(GPP_D11
, NONE
, DEEP
, NF2
),
29 PAD_CFG_NF(GPP_D12
, NONE
, DEEP
, NF2
),
30 PAD_CFG_NF(GPP_D13
, NONE
, DEEP
, NF2
),
31 /* Soundwire - External codec - JE Header */
32 PAD_CFG_NF(GPP_S00
, NONE
, DEEP
, NF1
),
33 PAD_CFG_NF(GPP_S01
, NONE
, DEEP
, NF1
),
34 PAD_CFG_NF(GPP_S04
, NONE
, DEEP
, NF1
),
35 PAD_CFG_NF(GPP_S05
, NONE
, DEEP
, NF1
),
36 /* DMIC - JD Header */
37 PAD_CFG_NF(GPP_S02
, NONE
, DEEP
, NF3
),
38 PAD_CFG_NF(GPP_S03
, NONE
, DEEP
, NF3
),
39 PAD_CFG_NF(GPP_S06
, NONE
, DEEP
, NF3
),
40 PAD_CFG_NF(GPP_S07
, NONE
, DEEP
, NF3
),
43 static const struct pad_config sndw_alc711_enable_pads
[] = {
44 /* DMIC config pads */
45 PAD_CFG_NF(GPP_D09
, NONE
, DEEP
, NF2
),
46 PAD_CFG_NF(GPP_D10
, NONE
, DEEP
, NF2
),
47 PAD_CFG_NF(GPP_D11
, NONE
, DEEP
, NF2
),
48 PAD_CFG_NF(GPP_D12
, NONE
, DEEP
, NF2
),
49 PAD_CFG_NF(GPP_D13
, NONE
, DEEP
, NF2
),
50 /* Soundwire GPIO Config */
51 PAD_CFG_NF(GPP_S00
, NONE
, DEEP
, NF1
),
52 PAD_CFG_NF(GPP_S01
, NONE
, DEEP
, NF1
),
53 /* DMIC - JD Header */
54 PAD_CFG_NF(GPP_S02
, NONE
, DEEP
, NF3
),
55 PAD_CFG_NF(GPP_S03
, NONE
, DEEP
, NF3
),
56 PAD_CFG_NF(GPP_S06
, NONE
, DEEP
, NF3
),
57 PAD_CFG_NF(GPP_S07
, NONE
, DEEP
, NF3
),
60 static const struct pad_config audio_disable_pads
[] = {
61 PAD_NC(GPP_S00
, NONE
),
62 PAD_NC(GPP_S01
, NONE
),
63 PAD_NC(GPP_S02
, NONE
),
64 PAD_NC(GPP_S03
, NONE
),
65 PAD_NC(GPP_S04
, NONE
),
66 PAD_NC(GPP_S05
, NONE
),
67 PAD_NC(GPP_S06
, NONE
),
68 PAD_NC(GPP_S07
, NONE
),
69 PAD_NC(GPP_D09
, NONE
),
70 PAD_NC(GPP_D10
, NONE
),
71 PAD_NC(GPP_D11
, NONE
),
72 PAD_NC(GPP_D12
, NONE
),
73 PAD_NC(GPP_D13
, NONE
),
76 static void fw_config_handle(void *unused
)
78 printk(BIOS_INFO
, "FW config 0x%" PRIx64
"\n", fw_config_get());
79 if (fw_config_probe(FW_CONFIG(AUDIO
, NONE
))) {
80 printk(BIOS_INFO
, "Configure GPIOs for no audio.\n");
81 gpio_configure_pads(audio_disable_pads
, ARRAY_SIZE(audio_disable_pads
));
84 if (fw_config_probe(FW_CONFIG(AUDIO
, MTL_ALC1019_ALC5682I_I2S
)) ||
85 fw_config_probe(FW_CONFIG(AUDIO
, MTL_ALC5682I_MAX9857A_I2S
))) {
86 printk(BIOS_INFO
, "Configure GPIOs for I2S audio.\n");
87 gpio_configure_pads(i2s_enable_pads
, ARRAY_SIZE(i2s_enable_pads
));
90 if (fw_config_probe(FW_CONFIG(AUDIO
, MTL_MAX98373_ALC5682_SNDW
))) {
91 printk(BIOS_INFO
, "Configure GPIOs for SoundWire audio (ext codec).\n");
92 gpio_configure_pads(sndw_enable_pads
, ARRAY_SIZE(i2s_enable_pads
));
95 if (fw_config_probe(FW_CONFIG(AUDIO
, MTL_ALC711_SNDW
))) {
96 printk(BIOS_INFO
, "Configure GPIOs for SoundWire audio (onboard codec).\n");
97 gpio_configure_pads(sndw_alc711_enable_pads
, ARRAY_SIZE(i2s_enable_pads
));
100 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_ENTRY
, fw_config_handle
, NULL
);