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 override_gpio_table
[] = {
11 PAD_CFG_GPO(GPP_A10
, 1, PWROK
),
12 /* C12 : AP_PEN_DET_ODL ==> NC */
13 PAD_NC(GPP_C12
, UP_20K
),
14 /* C18 : AP_I2C_EMR_SDA */
15 PAD_NC(GPP_C18
, NONE
),
16 /* C19 : AP_I2C_EMR_SCL */
17 PAD_NC(GPP_C19
, NONE
),
18 /* C22 : UART2_RTS_N ==> NC */
19 PAD_NC(GPP_C22
, UP_20K
),
20 /* D0 : WWAN_HOST_WAKE ==> WWAN_WDISABLE_L */
21 PAD_CFG_GPO(GPP_D0
, 1, DEEP
),
22 /* D12 : WCAM_RST_L ==> NC */
23 PAD_NC(GPP_D12
, NONE
),
24 /* D14 : EN_PP1200_CAMERA ==> NC */
25 PAD_NC(GPP_D14
, NONE
),
26 /* D15 : UCAM_RST_L ==> NC */
27 PAD_NC(GPP_D15
, NONE
),
28 /* D19 : WWAN_WLAN_COEX1 ==> NC */
29 PAD_NC(GPP_D19
, NONE
),
30 /* D20 : WWAN_WLAN_COEX2 ==> NC */
31 PAD_NC(GPP_D20
, NONE
),
32 /* D21 : WWAN_WLAN_COEX3 ==> NC */
33 PAD_NC(GPP_D21
, NONE
),
34 /* E0 : CLK_24M_UCAM ==> NC */
36 /* E2 : CLK_24M_WCAM ==> NC */
38 /* H1 : EN_PP3300_SD_U ==> NC */
40 /* H6 : AP_I2C_CAM_SDA ==> NC */
42 /* H7 : AP_I2C_CAM_SCL ==> NC */
44 /* H16 : AP_SUB_IO_L ==> HP_RST_ODL */
45 PAD_CFG_GPO(GPP_H16
, 1, PWROK
),
46 /* H17 : WWAN_RST_L */
47 PAD_CFG_GPO(GPP_H17
, 1, PLTRST
),
48 /* G0 : SD_CMD ==> NC */
50 /* G1 : SD_DATA0 ==> NC */
52 /* G2 : SD_DATA1 ==> NC */
54 /* G3 : SD_DATA2 ==> NC */
56 /* G4 : SD_DATA3 ==> NC */
58 /* G5 : SD_CD_ODL ==> NC */
59 PAD_NC(GPP_G5
, UP_20K
),
60 /* G6 : SD_CLK ==> NC */
62 /* G7 : SD_SDIO_WP ==> NC */
66 static const struct pad_config lte_disable_pads
[] = {
67 PAD_NC(GPP_A10
, NONE
),
69 PAD_NC(GPP_H17
, NONE
),
72 static const struct pad_config codec_da7219_pads
[] = {
73 PAD_NC(GPP_H16
, NONE
),
76 static const struct pad_config codec_cs42l42_pads
[] = {
77 PAD_NC(GPP_D18
, NONE
),
80 const struct pad_config
*variant_override_gpio_table(size_t *num
)
82 *num
= ARRAY_SIZE(override_gpio_table
);
83 return override_gpio_table
;
86 static void fw_config_handle(void *unused
)
88 if (!fw_config_probe(FW_CONFIG(LTE
, LTE_PRESENT
)))
89 gpio_configure_pads(lte_disable_pads
, ARRAY_SIZE(lte_disable_pads
));
90 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE
, AUDIO_CODEC_DA7219
)))
91 gpio_configure_pads(codec_da7219_pads
, ARRAY_SIZE(codec_da7219_pads
));
92 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE
, AUDIO_CODEC_CS42l42
)))
93 gpio_configure_pads(codec_cs42l42_pads
, ARRAY_SIZE(codec_cs42l42_pads
));
95 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE
, BS_ON_ENTRY
, fw_config_handle
, NULL
);