1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
6 #include <console/console.h>
9 static const struct pad_config wfc_disable_pads
[] = {
11 PAD_NC_LOCK(GPP_D3
, NONE
, LOCK_CONFIG
),
12 /* D15 : EN_PP2800_WCAM_X */
13 PAD_NC_LOCK(GPP_D15
, NONE
, LOCK_CONFIG
),
14 /* D16 : EN_PP1800_PP1200_WCAM_X */
15 PAD_NC_LOCK(GPP_D16
, NONE
, LOCK_CONFIG
),
16 /* H22 : WCAM_MCLK_R */
17 PAD_NC(GPP_H22
, NONE
),
18 /* R6 : DMIC_WCAM_CLK_R */
20 /* R7 : DMIC_WCAM_DATA */
24 static const struct pad_config emmc_disable_pads
[] = {
32 PAD_NC(GPP_I10
, NONE
),
34 PAD_NC(GPP_I11
, NONE
),
36 PAD_NC(GPP_I12
, NONE
),
38 PAD_NC(GPP_I13
, NONE
),
40 PAD_NC(GPP_I14
, NONE
),
42 PAD_NC(GPP_I15
, NONE
),
44 PAD_NC(GPP_I16
, NONE
),
46 PAD_NC(GPP_I17
, NONE
),
47 /* I18 : EMMC_RST_L */
48 PAD_NC(GPP_I18
, NONE
),
51 static const struct pad_config stylus_disable_pads
[] = {
52 /* F13 : SOC_PEN_DETECT_R_ODL */
53 PAD_NC_LOCK(GPP_F13
, NONE
, LOCK_CONFIG
),
54 /* F15 : SOC_PEN_DETECT_ODL */
55 PAD_NC_LOCK(GPP_F15
, NONE
, LOCK_CONFIG
),
58 void fw_config_gpio_padbased_override(struct pad_config
*padbased_table
)
60 // Skip checking FW config if board ID in CBI is not verified.
61 if (board_id() == BOARD_ID_UNKNOWN
)
64 if (fw_config_probe(FW_CONFIG(WFC
, WFC_ABSENT
))) {
65 printk(BIOS_INFO
, "Disable MIPI WFC GPIO pins.\n");
66 gpio_padbased_override(padbased_table
, wfc_disable_pads
,
67 ARRAY_SIZE(wfc_disable_pads
));
70 if (!fw_config_probe(FW_CONFIG(STORAGE
, STORAGE_EMMC
))) {
71 printk(BIOS_INFO
, "Disable eMMC SSD GPIO pins.\n");
72 gpio_padbased_override(padbased_table
, emmc_disable_pads
,
73 ARRAY_SIZE(emmc_disable_pads
));
76 if (fw_config_probe(FW_CONFIG(STYLUS
, STYLUS_ABSENT
))) {
77 printk(BIOS_INFO
, "Disable Stylus GPIO pins.\n");
78 gpio_padbased_override(padbased_table
, stylus_disable_pads
,
79 ARRAY_SIZE(stylus_disable_pads
));