Tyler Wang | 77d8e0b | 2023-09-05 14:21:19 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <baseboard/variants.h> |
| 4 | #include <bootstate.h> |
| 5 | #include <console/console.h> |
| 6 | #include <fw_config.h> |
| 7 | #include <gpio.h> |
| 8 | |
| 9 | #define GPIO_PADBASED_OVERRIDE(b, a) gpio_padbased_override(b, a, ARRAY_SIZE(a)) |
| 10 | |
| 11 | static const struct pad_config fp_disable_pads[] = { |
| 12 | /* GPP_B11 : [] ==> EN_FP_PWR */ |
| 13 | PAD_NC(GPP_B11, NONE), |
| 14 | /* GPP_C22 : [] ==> SOC_FP_BOOT0 */ |
| 15 | PAD_NC(GPP_C22, NONE), |
| 16 | /* GPP_C23 : [] ==> FP_RST_ODL */ |
| 17 | PAD_NC(GPP_C23, NONE), |
| 18 | /* GPP_E10 : [] ==> SOC_FPMCU_INT_L */ |
| 19 | PAD_NC(GPP_E10, NONE), |
| 20 | /* GPP_F11 : GSP1_SOC_CLK_R */ |
| 21 | PAD_NC(GPP_F11, NONE), |
| 22 | /* GPP_F12 : GSPI1_SOC_DO_FPMCU_DI_R */ |
| 23 | PAD_NC(GPP_F12, NONE), |
| 24 | /* GPP_F13 : GSPI1_SOC_DI_FPMCU_DO_LS_R */ |
| 25 | PAD_NC(GPP_F13, NONE), |
| 26 | /* GPP_F17 : [] ==> GSPI1_SOC_CS_L */ |
| 27 | PAD_NC(GPP_F17, NONE), |
| 28 | }; |
| 29 | |
| 30 | static const struct pad_config stylus_disable_pads[] = { |
| 31 | /* GPP_E04 : SOC_PEN_DETECT */ |
| 32 | PAD_NC(GPP_E04, NONE), |
Tyler Wang | b1be5c2 | 2023-11-21 19:47:26 +0800 | [diff] [blame^] | 33 | /* GPP_E09 : SOC_PEN_DETECT */ |
| 34 | PAD_NC(GPP_E09, NONE), |
Tyler Wang | 77d8e0b | 2023-09-05 14:21:19 +0800 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | void fw_config_gpio_padbased_override(struct pad_config *padbased_table) |
| 38 | { |
| 39 | if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_ABSENT))) { |
| 40 | printk(BIOS_INFO, "Configure GPIOs for no stylus.\n"); |
| 41 | GPIO_PADBASED_OVERRIDE(padbased_table, stylus_disable_pads); |
| 42 | } |
| 43 | if (fw_config_probe(FW_CONFIG(FP_MCU, FP_ABSENT))) { |
| 44 | printk(BIOS_INFO, "Configure GPIOs for no FP module.\n"); |
| 45 | GPIO_PADBASED_OVERRIDE(padbased_table, fp_disable_pads); |
| 46 | } |
| 47 | } |