| 1 |
|
| 2 |
|
| 3 |
#include <bootstate.h> |
| 4 |
#include <console/console.h> |
| 5 |
#include <fw_config.h> |
| 6 |
#include <gpio.h> |
| 7 |
|
| 8 |
static const struct pad_config dmic_enable_pads[] = { |
| 9 |
PAD_CFG_NF(GPP_R4, NONE, DEEP, NF3), |
| 10 |
PAD_CFG_NF(GPP_R5, NONE, DEEP, NF3), |
| 11 |
|
| 12 |
}; |
| 13 |
|
| 14 |
static const struct pad_config dmic_disable_pads[] = { |
| 15 |
PAD_NC(GPP_R4, NONE), |
| 16 |
PAD_NC(GPP_R5, NONE), |
| 17 |
}; |
| 18 |
|
| 19 |
static const struct pad_config i2s_enable_pads[] = { |
| 20 |
PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2), |
| 21 |
PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2), |
| 22 |
PAD_CFG_NF(GPP_R2, DN_20K, DEEP, NF2), |
| 23 |
PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2), |
| 24 |
PAD_CFG_NF(GPP_S0, NONE, DEEP, NF4), |
| 25 |
PAD_CFG_NF(GPP_S1, NONE, DEEP, NF4), |
| 26 |
PAD_CFG_NF(GPP_S2, NONE, DEEP, NF4), |
| 27 |
PAD_CFG_NF(GPP_S3, NONE, DEEP, NF4), |
| 28 |
}; |
| 29 |
|
| 30 |
static const struct pad_config i2s_disable_pads[] = { |
| 31 |
PAD_NC(GPP_R0, NONE), |
| 32 |
PAD_NC(GPP_R1, NONE), |
| 33 |
PAD_NC(GPP_R2, NONE), |
| 34 |
PAD_NC(GPP_R3, NONE), |
| 35 |
PAD_NC(GPP_S0, NONE), |
| 36 |
PAD_NC(GPP_S1, NONE), |
| 37 |
PAD_NC(GPP_S2, NONE), |
| 38 |
PAD_NC(GPP_S3, NONE), |
| 39 |
}; |
| 40 |
|
| 41 |
static const struct pad_config bt_i2s_enable_pads[] = { |
| 42 |
PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), |
| 43 |
PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), |
| 44 |
PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), |
| 45 |
PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), |
| 46 |
PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), |
| 47 |
PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), |
| 48 |
PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), |
| 49 |
PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), |
| 50 |
}; |
| 51 |
|
| 52 |
static void fw_config_handle(void *unused) |
| 53 |
{ |
| 54 |
if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(AUDIO, AUDIO_UNKNOWN))) { |
| 55 |
printk(BIOS_INFO, "Disable audio related GPIO pins.\n"); |
| 56 |
gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads)); |
| 57 |
gpio_configure_pads(dmic_disable_pads, ARRAY_SIZE(dmic_disable_pads)); |
| 58 |
return; |
| 59 |
} |
| 60 |
|
| 61 |
if (fw_config_probe(FW_CONFIG(AUDIO, MAX98390_ALC5682I_I2S_4SPK))) { |
| 62 |
printk(BIOS_INFO, "Configure audio over I2S with MAX98390 ALC5682I.\n"); |
| 63 |
gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads)); |
| 64 |
gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads)); |
| 65 |
printk(BIOS_INFO, "BT offload enabled\n"); |
| 66 |
gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads)); |
| 67 |
} |
| 68 |
} |
| 69 |
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); |