| 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 bt_i2s_enable_pads[] = { |
| 9 |
PAD_CFG_NF(GPP_VGPIO_30, NONE, DEEP, NF3), |
| 10 |
PAD_CFG_NF(GPP_VGPIO_31, NONE, DEEP, NF3), |
| 11 |
PAD_CFG_NF(GPP_VGPIO_32, NONE, DEEP, NF3), |
| 12 |
PAD_CFG_NF(GPP_VGPIO_33, NONE, DEEP, NF3), |
| 13 |
PAD_CFG_NF(GPP_VGPIO_34, NONE, DEEP, NF1), |
| 14 |
PAD_CFG_NF(GPP_VGPIO_35, NONE, DEEP, NF1), |
| 15 |
PAD_CFG_NF(GPP_VGPIO_36, NONE, DEEP, NF1), |
| 16 |
PAD_CFG_NF(GPP_VGPIO_37, NONE, DEEP, NF1), |
| 17 |
}; |
| 18 |
|
| 19 |
static const struct pad_config bt_i2s_disable_pads[] = { |
| 20 |
PAD_NC(GPP_VGPIO_30, NONE), |
| 21 |
PAD_NC(GPP_VGPIO_31, NONE), |
| 22 |
PAD_NC(GPP_VGPIO_32, NONE), |
| 23 |
PAD_NC(GPP_VGPIO_33, NONE), |
| 24 |
PAD_NC(GPP_VGPIO_34, NONE), |
| 25 |
PAD_NC(GPP_VGPIO_35, NONE), |
| 26 |
PAD_NC(GPP_VGPIO_36, NONE), |
| 27 |
PAD_NC(GPP_VGPIO_37, NONE), |
| 28 |
}; |
| 29 |
|
| 30 |
static void fw_config_handle(void *unused) |
| 31 |
{ |
| 32 |
if (!fw_config_is_provisioned() || |
| 33 |
fw_config_probe(FW_CONFIG(AUDIO_AMP, UNPROVISIONED))) { |
| 34 |
printk(BIOS_INFO, "Disable BT offload audio related GPIO pins.\n"); |
| 35 |
gpio_configure_pads(bt_i2s_disable_pads, ARRAY_SIZE(bt_i2s_disable_pads)); |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
if (fw_config_probe(FW_CONFIG(AUDIO_AMP, MAX98360_ALC5682VS_I2S_2WAY))) { |
| 40 |
printk(BIOS_INFO, "BT offload enabled over I2S with MAX98360+RT5682VS\n"); |
| 41 |
gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads)); |
| 42 |
} |
| 43 |
} |
| 44 |
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); |