Debian Codegraph @

src/mainboard/google/dedede/variants/cappy2/gpio.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <bootstate.h>
6 #include <fw_config.h>
7
8 /* Pad configuration in ramstage */
9 static const struct pad_config gpio_table[] = {
10 /* D5 : TOUCH_RESET_L */
11 PAD_NC(GPP_D5, NONE),
12 /* D6 : EN_PP3300_TOUCH_S0 */
13 PAD_NC(GPP_D6, NONE),
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),
18 };
19
20 const struct pad_config *variant_override_gpio_table(size_t *num)
21 {
22 *num = ARRAY_SIZE(gpio_table);
23 return gpio_table;
24 }
25
26 static const struct pad_config codec_rt5682_pads[] = {
27 PAD_NC(GPP_H16, NONE),
28 };
29
30 static const struct pad_config codec_cs42l42_pads[] = {
31 PAD_NC(GPP_D18, NONE),
32 };
33
34 static const struct pad_config romstage_gpio_table[] = {
35 /* no touchscreen present */
36 /* D5 : TOUCH_RESET_L */
37 PAD_NC(GPP_D5, NONE),
38 /* D6 : EN_PP3300_TOUCH_S0 */
39 PAD_NC(GPP_D6, NONE),
40 };
41
42 const struct pad_config *__weak variant_romstage_gpio_table(size_t *num)
43 {
44 *num = ARRAY_SIZE(romstage_gpio_table);
45 return romstage_gpio_table;
46 }
47
48 static void fw_config_handle(void *unused)
49 {
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));
54 }
55
56 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);