| 1 |
|
| 2 |
|
| 3 |
#include <baseboard/variants.h> |
| 4 |
#include <console/console.h> |
| 5 |
#include <fw_config.h> |
| 6 |
#include <gpio.h> |
| 7 |
|
| 8 |
#define GPIO_PADBASED_OVERRIDE(b, a) gpio_padbased_override(b, a, ARRAY_SIZE(a)) |
| 9 |
|
| 10 |
static const struct pad_config fp_disable_pads[] = { |
| 11 |
|
| 12 |
PAD_NC(GPP_B11, NONE), |
| 13 |
|
| 14 |
PAD_NC(GPP_C22, NONE), |
| 15 |
|
| 16 |
PAD_NC(GPP_C23, NONE), |
| 17 |
|
| 18 |
PAD_NC(GPP_E10, NONE), |
| 19 |
|
| 20 |
PAD_NC(GPP_F11, NONE), |
| 21 |
|
| 22 |
PAD_NC(GPP_F12, NONE), |
| 23 |
|
| 24 |
PAD_NC(GPP_F13, NONE), |
| 25 |
|
| 26 |
PAD_NC(GPP_F17, NONE), |
| 27 |
}; |
| 28 |
|
| 29 |
static const struct pad_config stylus_disable_pads[] = { |
| 30 |
|
| 31 |
PAD_NC(GPP_E04, NONE), |
| 32 |
|
| 33 |
PAD_NC(GPP_E09, NONE), |
| 34 |
}; |
| 35 |
|
| 36 |
static const struct pad_config cnvi_bt_disable_pads[] = { |
| 37 |
|
| 38 |
PAD_NC(GPP_F04, NONE), |
| 39 |
|
| 40 |
PAD_NC(GPP_F05, NONE), |
| 41 |
}; |
| 42 |
|
| 43 |
static const struct pad_config discrete_bt_disable_pads[] = { |
| 44 |
|
| 45 |
PAD_NC(GPP_S01, NONE), |
| 46 |
|
| 47 |
PAD_NC(GPP_S02, NONE), |
| 48 |
}; |
| 49 |
|
| 50 |
static const struct pad_config bt_i2s_enable_pads[] = { |
| 51 |
|
| 52 |
PAD_CFG_NF(GPP_VGPIO30, NONE, DEEP, NF2), |
| 53 |
|
| 54 |
PAD_CFG_NF(GPP_VGPIO31, NONE, DEEP, NF2), |
| 55 |
|
| 56 |
PAD_CFG_NF(GPP_VGPIO32, NONE, DEEP, NF2), |
| 57 |
|
| 58 |
PAD_CFG_NF(GPP_VGPIO33, NONE, DEEP, NF2), |
| 59 |
|
| 60 |
PAD_CFG_NF(GPP_VGPIO34, NONE, DEEP, NF1), |
| 61 |
|
| 62 |
PAD_CFG_NF(GPP_VGPIO35, NONE, DEEP, NF1), |
| 63 |
|
| 64 |
PAD_CFG_NF(GPP_VGPIO36, NONE, DEEP, NF1), |
| 65 |
|
| 66 |
PAD_CFG_NF(GPP_VGPIO37, NONE, DEEP, NF1), |
| 67 |
}; |
| 68 |
|
| 69 |
static const struct pad_config discrete_bt_i2s_enable_pads[] = { |
| 70 |
|
| 71 |
PAD_CFG_NF(GPP_S00, NONE, DEEP, NF6), |
| 72 |
|
| 73 |
PAD_CFG_NF(GPP_S01, NONE, DEEP, NF6), |
| 74 |
|
| 75 |
PAD_CFG_NF(GPP_S02, NONE, DEEP, NF6), |
| 76 |
|
| 77 |
PAD_CFG_NF(GPP_S03, NONE, DEEP, NF6), |
| 78 |
}; |
| 79 |
|
| 80 |
void fw_config_gpio_padbased_override(struct pad_config *padbased_table) |
| 81 |
{ |
| 82 |
if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_ABSENT))) { |
| 83 |
printk(BIOS_INFO, "Configure GPIOs for no stylus.\n"); |
| 84 |
GPIO_PADBASED_OVERRIDE(padbased_table, stylus_disable_pads); |
| 85 |
} |
| 86 |
if (fw_config_probe(FW_CONFIG(FP_MCU, FP_ABSENT))) { |
| 87 |
printk(BIOS_INFO, "Configure GPIOs for no FP module.\n"); |
| 88 |
GPIO_PADBASED_OVERRIDE(padbased_table, fp_disable_pads); |
| 89 |
} |
| 90 |
if (fw_config_probe(FW_CONFIG(WIFI_TYPE, WIFI_CNVI))) { |
| 91 |
printk(BIOS_INFO, "Configure GPIOs for CNVi WIFI/BT module.\n"); |
| 92 |
GPIO_PADBASED_OVERRIDE(padbased_table, bt_i2s_enable_pads); |
| 93 |
printk(BIOS_INFO, "Disable GPIOs for PCIe WIFI/BT module.\n"); |
| 94 |
GPIO_PADBASED_OVERRIDE(padbased_table, discrete_bt_disable_pads); |
| 95 |
} |
| 96 |
if (fw_config_probe(FW_CONFIG(WIFI_TYPE, WIFI_PCIE))) { |
| 97 |
printk(BIOS_INFO, "Configure GPIOs for discrete WIFI/BT module.\n"); |
| 98 |
GPIO_PADBASED_OVERRIDE(padbased_table, discrete_bt_i2s_enable_pads); |
| 99 |
printk(BIOS_INFO, "Configure GPIOs for discrete PCM BT path.\n"); |
| 100 |
GPIO_PADBASED_OVERRIDE(padbased_table, cnvi_bt_disable_pads); |
| 101 |
} |
| 102 |
} |