1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <console/console.h>
8 static const struct pad_config lte_disable_pads
[] = {
9 /* A8 : WWAN_RF_DISABLE_ODL */
11 /* A12 : WWAN_PCIE_WAKE_ODL */
12 PAD_NC(GPP_A12
, NONE
),
13 /* D5 : SRCCLKREQ0# ==> WWAN_CLKREQ_ODL */
17 /* D15 : EN_PP2800_WCAM_X ==> WWAN_SAR_DETECT_2_ODL */
18 PAD_NC(GPP_D15
, NONE
),
19 /* F12 : WWAN_RST_L */
20 PAD_NC_LOCK(GPP_F12
, NONE
, LOCK_CONFIG
),
21 /* H19 : SOC_I2C_SUB_INT_ODL */
22 PAD_NC(GPP_H19
, NONE
),
23 /* H21 : WCAM_MCLK_R ==> WWAN_PERST_L */
24 PAD_NC_LOCK(GPP_H21
, NONE
, LOCK_CONFIG
),
25 /* H23 : WWAN_SAR_DETECT_ODL */
26 PAD_NC(GPP_H23
, NONE
),
29 static const struct pad_config sd_disable_pads
[] = {
30 /* D8 : SD_CLKREQ_ODL */
32 /* H12 : SD_PERST_L */
33 PAD_NC_LOCK(GPP_H12
, NONE
, LOCK_CONFIG
),
34 /* H13 : EN_PP3300_SD_X */
35 PAD_NC_LOCK(GPP_H13
, NONE
, LOCK_CONFIG
),
38 static const struct pad_config stylus_disable_pads
[] = {
39 /* F13 : SOC_PEN_DETECT_R_ODL */
40 PAD_NC_LOCK(GPP_F13
, NONE
, LOCK_CONFIG
),
41 /* F15 : SOC_PEN_DETECT_ODL */
42 PAD_NC_LOCK(GPP_F15
, NONE
, LOCK_CONFIG
),
45 void fw_config_gpio_padbased_override(struct pad_config
*padbased_table
)
47 if (fw_config_probe(FW_CONFIG(LTE
, LTE_ABSENT
)) && fw_config_probe(FW_CONFIG(WWAN_5G
, WWAN_5G_ABSENT
))
48 && fw_config_probe(FW_CONFIG(LTE_EM060
, LTE_EM060_ABSENT
))) {
49 printk(BIOS_INFO
, "Disable LTE-related GPIO pins.\n");
50 gpio_padbased_override(padbased_table
, lte_disable_pads
,
51 ARRAY_SIZE(lte_disable_pads
));
54 if (fw_config_probe(FW_CONFIG(SD_CARD
, SD_ABSENT
))) {
55 printk(BIOS_INFO
, "Disable SD card GPIO pins.\n");
56 gpio_padbased_override(padbased_table
, sd_disable_pads
,
57 ARRAY_SIZE(sd_disable_pads
));
60 if (fw_config_probe(FW_CONFIG(STYLUS
, STYLUS_ABSENT
))) {
61 printk(BIOS_INFO
, "Disable Stylus GPIO pins.\n");
62 gpio_padbased_override(padbased_table
, stylus_disable_pads
,
63 ARRAY_SIZE(stylus_disable_pads
));