HARSHAPRIYA N has uploaded this change for review. ( https://review.coreboot.org/25334
Change subject: Eve: NHLT changes to enable Windows use audio codecs ......................................................................
Eve: NHLT changes to enable Windows use audio codecs
This patch adds changes to nhlt to enable windows use audio codecs and enable audio functionality
Change-Id: Ib13110f4d42e140aa1356ed0b6a6127943b6e800 --- M src/include/nhlt.h M src/lib/nhlt.c M src/mainboard/google/eve/mainboard.c M src/soc/intel/skylake/include/soc/nhlt.h M src/soc/intel/skylake/nhlt/max98927.c M src/soc/intel/skylake/nhlt/rt5514.c M src/soc/intel/skylake/nhlt/rt5663.c 7 files changed, 58 insertions(+), 17 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/25334/1
diff --git a/src/include/nhlt.h b/src/include/nhlt.h index 5b72320..ddebd5f 100644 --- a/src/include/nhlt.h +++ b/src/include/nhlt.h @@ -207,6 +207,7 @@ NHLT_DIR_RENDER, NHLT_DIR_CAPTURE, NHLT_DIR_BIDIRECTIONAL, + NHLT_DIR_FEEDBACK, };
/* Channel Mask for an endpoint. While they are prefixed with 'SPEAKER' the @@ -301,6 +302,7 @@ uint8_t num_endpoints; struct nhlt_endpoint endpoints[MAX_ENDPOINTS]; uint8_t current_instance_id[NHLT_MAX_LINK_TYPES]; + uint32_t buffer_size; };
struct nhlt_tdm_config { @@ -313,6 +315,13 @@ NHLT_TDM_MIC_ARRAY, };
+struct maxm_array_config { + struct nhlt_tdm_config tdm_config1; + uint8_t feedback_virtual_slot; + uint16_t feedback_channels; + uint16_t feedback_valid_bits_per_sample; +}; + struct nhlt_dmic_array_config { struct nhlt_tdm_config tdm_config; uint8_t array_type; diff --git a/src/lib/nhlt.c b/src/lib/nhlt.c index da94415..723123c 100644 --- a/src/lib/nhlt.c +++ b/src/lib/nhlt.c @@ -275,7 +275,7 @@
size_t nhlt_current_size(struct nhlt *nhlt) { - return calc_size(nhlt) + sizeof(acpi_header_t); + return calc_size(nhlt) + sizeof(acpi_header_t) + sizeof(uint32_t); }
static void nhlt_free_resources(struct nhlt *nhlt) @@ -386,6 +386,7 @@
for (i = 0; i < nhlt->num_endpoints; i++) serialize_endpoint(&nhlt->endpoints[i], cur); + ser32(cur, nhlt->buffer_size); }
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr) diff --git a/src/mainboard/google/eve/mainboard.c b/src/mainboard/google/eve/mainboard.c index d30eff2..f8e3126 100644 --- a/src/mainboard/google/eve/mainboard.c +++ b/src/mainboard/google/eve/mainboard.c @@ -45,14 +45,26 @@ /* 4 Channel DMIC array */ if (nhlt_soc_add_rt5514(nhlt, AUDIO_LINK_SSP0, 4)) printk(BIOS_ERR, "Couldn't add rt5514.\n"); + nhlt->endpoints[nhlt->num_endpoints-1].instance_id = 0; + nhlt->endpoints[nhlt->num_endpoints-1].subsystem_id = 0x006B;
/* RT5663 Headset codec */ if (nhlt_soc_add_rt5663(nhlt, AUDIO_LINK_SSP1)) printk(BIOS_ERR, "Couldn't add headset codec.\n"); + nhlt->endpoints[nhlt->num_endpoints-1].instance_id = 0; + nhlt->endpoints[nhlt->num_endpoints-1].subsystem_id = 0x006B; + nhlt->endpoints[nhlt->num_endpoints-2].instance_id = 0; + nhlt->endpoints[nhlt->num_endpoints-2].subsystem_id = 0x006B;
/* MAXIM98927 Smart Amps for left and right channel */ if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0)) printk(BIOS_ERR, "Couldn't add max98927\n"); + nhlt->endpoints[nhlt->num_endpoints-1].instance_id = 0; + nhlt->endpoints[nhlt->num_endpoints-1].subsystem_id = 0x006B; + nhlt->endpoints[nhlt->num_endpoints-2].instance_id = 0; + nhlt->endpoints[nhlt->num_endpoints-2].subsystem_id = 0x006B; + + nhlt->buffer_size = 0;
end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr, oem_id_maxim, oem_table_id_maxim, 0); diff --git a/src/soc/intel/skylake/include/soc/nhlt.h b/src/soc/intel/skylake/include/soc/nhlt.h index 1af27e8..b74d2e2 100644 --- a/src/soc/intel/skylake/include/soc/nhlt.h +++ b/src/soc/intel/skylake/include/soc/nhlt.h @@ -19,6 +19,7 @@ #include <nhlt.h>
#define NHLT_VID 0x8086 +#define NHLT_GOOGLE_VID 0x1ae0 #define NHLT_DID_DMIC 0xae20 #define NHLT_DID_BT 0xae30 #define NHLT_DID_SSP 0xae34 diff --git a/src/soc/intel/skylake/nhlt/max98927.c b/src/soc/intel/skylake/nhlt/max98927.c index bbaf15d..060657a 100644 --- a/src/soc/intel/skylake/nhlt/max98927.c +++ b/src/soc/intel/skylake/nhlt/max98927.c @@ -16,15 +16,6 @@ #include <soc/nhlt.h>
static const struct nhlt_format_config max98927_render_formats[] = { - /* 48 KHz 24-bits per sample. */ - { - .num_channels = 2, - .sample_freq_khz = 48, - .container_bits_per_sample = 32, - .valid_bits_per_sample = 24, - .speaker_mask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT, - .settings_file = "max98927-render-2ch-48khz-24b.bin", - }, /* 48 KHz 16-bits per sample. */ { .num_channels = 2, @@ -41,29 +32,55 @@ { .num_channels = 4, .sample_freq_khz = 48, - .container_bits_per_sample = 32, + .container_bits_per_sample = 16, .valid_bits_per_sample = 16, .speaker_mask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT, .settings_file = "max98927-render-2ch-48khz-16b.bin", }, }; + +static const struct maxm_array_config render_config = { + .tdm_config1 = { + .virtual_slot = 0x0, + .config_type = 0x3, + }, + .feedback_virtual_slot = 2, + .feedback_channels = 4, + .feedback_valid_bits_per_sample = 16, +}; + +static const struct maxm_array_config capture_config = { + .tdm_config1 = { + .virtual_slot = 0x2, + .config_type = 0x3, + }, + .feedback_virtual_slot = 0, + .feedback_channels = 2, + .feedback_valid_bits_per_sample = 16, +}; + + static const struct nhlt_endp_descriptor max98927_descriptors[] = { { .link = NHLT_LINK_SSP, .device = NHLT_SSP_DEV_I2S, .direction = NHLT_DIR_RENDER, - .vid = NHLT_VID, + .vid = NHLT_GOOGLE_VID, .did = NHLT_DID_SSP, + .cfg = &render_config, + .cfg_size = sizeof(render_config), .formats = max98927_render_formats, .num_formats = ARRAY_SIZE(max98927_render_formats), }, { .link = NHLT_LINK_SSP, .device = NHLT_SSP_DEV_I2S, - .direction = NHLT_DIR_CAPTURE, - .vid = NHLT_VID, + .direction = NHLT_DIR_FEEDBACK, + .vid = NHLT_GOOGLE_VID, .did = NHLT_DID_SSP, + .cfg = &capture_config, + .cfg_size = sizeof(capture_config), .formats = max98927_capture_formats, .num_formats = ARRAY_SIZE(max98927_capture_formats), }, diff --git a/src/soc/intel/skylake/nhlt/rt5514.c b/src/soc/intel/skylake/nhlt/rt5514.c index 9c48c7b..686f3a4 100644 --- a/src/soc/intel/skylake/nhlt/rt5514.c +++ b/src/soc/intel/skylake/nhlt/rt5514.c @@ -30,6 +30,7 @@
static const struct nhlt_dmic_array_config rt5514_4ch_mic_config = { .tdm_config = { + .virtual_slot = 0x1, .config_type = NHLT_TDM_MIC_ARRAY, }, .array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED, @@ -40,7 +41,7 @@ .link = NHLT_LINK_SSP, .device = NHLT_SSP_DEV_I2S, .direction = NHLT_DIR_CAPTURE, - .vid = NHLT_VID, + .vid = NHLT_GOOGLE_VID, .did = NHLT_DID_SSP, .cfg = &rt5514_4ch_mic_config, .cfg_size = sizeof(rt5514_4ch_mic_config), diff --git a/src/soc/intel/skylake/nhlt/rt5663.c b/src/soc/intel/skylake/nhlt/rt5663.c index c5a3f53..d602425 100644 --- a/src/soc/intel/skylake/nhlt/rt5663.c +++ b/src/soc/intel/skylake/nhlt/rt5663.c @@ -46,7 +46,7 @@ .link = NHLT_LINK_SSP, .device = NHLT_SSP_DEV_I2S, .direction = NHLT_DIR_RENDER, - .vid = NHLT_VID, + .vid = NHLT_GOOGLE_VID, .did = NHLT_DID_SSP, .cfg = &tdm_config, .cfg_size = sizeof(tdm_config), @@ -58,7 +58,7 @@ .link = NHLT_LINK_SSP, .device = NHLT_SSP_DEV_I2S, .direction = NHLT_DIR_CAPTURE, - .vid = NHLT_VID, + .vid = NHLT_GOOGLE_VID, .did = NHLT_DID_SSP, .cfg = &tdm_config, .cfg_size = sizeof(tdm_config),