1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
8 /* Pad configuration in ramstage */
9 static const struct pad_config gpio_table
[] = {
10 /* D5 : TOUCH_RESET_L */
12 /* D6 : EN_PP3300_TOUCH_S0 */
14 /* D15 : EN_PP3300_CAMERA */
15 PAD_CFG_GPO(GPP_D15
, 1, PLTRST
),
16 /* H16 : AP_SUB_IO_L ==> HP_RST_ODL */
17 PAD_CFG_GPO(GPP_H16
, 1, PWROK
),
20 const struct pad_config
*variant_override_gpio_table(size_t *num
)
22 *num
= ARRAY_SIZE(gpio_table
);
26 static const struct pad_config codec_rt5682_pads
[] = {
27 PAD_NC(GPP_H16
, NONE
),
30 static const struct pad_config codec_cs42l42_pads
[] = {
31 PAD_NC(GPP_D18
, NONE
),
34 static const struct pad_config romstage_gpio_table
[] = {
35 /* no touchscreen present */
36 /* D5 : TOUCH_RESET_L */
38 /* D6 : EN_PP3300_TOUCH_S0 */
42 const struct pad_config
*__weak
variant_romstage_gpio_table(size_t *num
)
44 *num
= ARRAY_SIZE(romstage_gpio_table
);
45 return romstage_gpio_table
;
48 static void fw_config_handle(void *unused
)
50 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE
, AUDIO_CODEC_ALC5682
)))
51 gpio_configure_pads(codec_rt5682_pads
, ARRAY_SIZE(codec_rt5682_pads
));
52 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE
, AUDIO_CODEC_CS42l42
)))
53 gpio_configure_pads(codec_cs42l42_pads
, ARRAY_SIZE(codec_cs42l42_pads
));
56 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_ENTRY
, fw_config_handle
, NULL
);