lib/nhlt, soc/intel/skl: Update NHLT to program feedback config
Adapted from WIP (and abandoned) patch CB:25334, this patch: 1. Ensures SSP endpoint InstanceId is 0 2. Adds capability_size parameter at the end of the nhlt 3. Adsd more config_type enum values to accommodate feedback stream 4. Programs virtual_slot values for max98373, max98927, and rt5514 nhlt files 5. Adds NHLT feedback_config parameters Default feedback configs are added here to the max98373, max98927, and rt5514 codecs; in a follow-on patch, these will be overridden at the board level. TEST=tested with subsequent patch Change-Id: I59285e332de09bb448b0d67ad56c72a208588d47 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70393 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: CoolStar <coolstarorganization@gmail.com>
This commit is contained in:
parent
343644006f
commit
ca342e1082
|
@ -299,6 +299,17 @@ struct nhlt_tdm_config {
|
||||||
enum {
|
enum {
|
||||||
NHLT_TDM_BASIC,
|
NHLT_TDM_BASIC,
|
||||||
NHLT_TDM_MIC_ARRAY,
|
NHLT_TDM_MIC_ARRAY,
|
||||||
|
NHLT_TDM_RENDER_WITH_LOOPBACK,
|
||||||
|
NHLT_TDM_RENDER_FEEDBACK,
|
||||||
|
NHLT_TDM_MULTI_MODE,
|
||||||
|
NHLT_TDM_MULTI_MODE_MIC_ARRAY = NHLT_TDM_MULTI_MODE | NHLT_TDM_MIC_ARRAY
|
||||||
|
};
|
||||||
|
|
||||||
|
struct nhlt_feedback_config {
|
||||||
|
struct nhlt_tdm_config tdm_config;
|
||||||
|
uint8_t feedback_virtual_slot;
|
||||||
|
uint16_t feedback_channels;
|
||||||
|
uint16_t feedback_valid_bits_per_sample;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nhlt_dmic_array_config {
|
struct nhlt_dmic_array_config {
|
||||||
|
|
|
@ -181,14 +181,6 @@ int nhlt_endpoint_add_formats(struct nhlt_endpoint *endp,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nhlt_next_instance(struct nhlt *nhlt, int link_type)
|
|
||||||
{
|
|
||||||
if (link_type < NHLT_LINK_HDA || link_type >= NHLT_MAX_LINK_TYPES)
|
|
||||||
return;
|
|
||||||
|
|
||||||
nhlt->current_instance_id[link_type]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t calc_specific_config_size(struct nhlt_specific_config *cfg)
|
static size_t calc_specific_config_size(struct nhlt_specific_config *cfg)
|
||||||
{
|
{
|
||||||
return sizeof(cfg->size) + cfg->size;
|
return sizeof(cfg->size) + cfg->size;
|
||||||
|
@ -255,7 +247,7 @@ static size_t calc_size(struct nhlt *nhlt)
|
||||||
|
|
||||||
size_t nhlt_current_size(struct nhlt *nhlt)
|
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)
|
static void nhlt_free_resources(struct nhlt *nhlt)
|
||||||
|
@ -360,12 +352,13 @@ static void serialize_endpoint(struct nhlt_endpoint *endp, struct cursor *cur)
|
||||||
|
|
||||||
static void nhlt_serialize_endpoints(struct nhlt *nhlt, struct cursor *cur)
|
static void nhlt_serialize_endpoints(struct nhlt *nhlt, struct cursor *cur)
|
||||||
{
|
{
|
||||||
int i;
|
int i, capabilities_size = 0;
|
||||||
|
|
||||||
ser8(cur, nhlt->num_endpoints);
|
ser8(cur, nhlt->num_endpoints);
|
||||||
|
|
||||||
for (i = 0; i < nhlt->num_endpoints; i++)
|
for (i = 0; i < nhlt->num_endpoints; i++)
|
||||||
serialize_endpoint(&nhlt->endpoints[i], cur);
|
serialize_endpoint(&nhlt->endpoints[i], cur);
|
||||||
|
ser32(cur, capabilities_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
uintptr_t nhlt_serialize(struct nhlt *nhlt, uintptr_t acpi_addr)
|
||||||
|
@ -468,12 +461,5 @@ int nhlt_add_endpoints(struct nhlt *nhlt,
|
||||||
int nhlt_add_ssp_endpoints(struct nhlt *nhlt, int virtual_bus_id,
|
int nhlt_add_ssp_endpoints(struct nhlt *nhlt, int virtual_bus_id,
|
||||||
const struct nhlt_endp_descriptor *epds, size_t num_epds)
|
const struct nhlt_endp_descriptor *epds, size_t num_epds)
|
||||||
{
|
{
|
||||||
int ret;
|
return _nhlt_add_endpoints(nhlt, virtual_bus_id, epds, num_epds);
|
||||||
|
|
||||||
ret = _nhlt_add_endpoints(nhlt, virtual_bus_id, epds, num_epds);
|
|
||||||
|
|
||||||
if (!ret)
|
|
||||||
nhlt_next_instance(nhlt, NHLT_LINK_SSP);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,6 @@
|
||||||
#include <soc/nhlt.h>
|
#include <soc/nhlt.h>
|
||||||
|
|
||||||
static const struct nhlt_format_config max98373_render_formats[] = {
|
static const struct nhlt_format_config max98373_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 = "max98373-render-2ch-48khz-24b.bin",
|
|
||||||
},
|
|
||||||
/* 48 KHz 16-bits per sample. */
|
/* 48 KHz 16-bits per sample. */
|
||||||
{
|
{
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
@ -45,6 +36,26 @@ static const struct nhlt_format_config max98373_capture_formats[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct nhlt_feedback_config render_config = {
|
||||||
|
.tdm_config = {
|
||||||
|
.virtual_slot = 0x0,
|
||||||
|
.config_type = NHLT_TDM_RENDER_FEEDBACK,
|
||||||
|
},
|
||||||
|
.feedback_virtual_slot = 2,
|
||||||
|
.feedback_channels = 4,
|
||||||
|
.feedback_valid_bits_per_sample = 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct nhlt_feedback_config capture_config = {
|
||||||
|
.tdm_config = {
|
||||||
|
.virtual_slot = 0x2,
|
||||||
|
.config_type = NHLT_TDM_RENDER_FEEDBACK,
|
||||||
|
},
|
||||||
|
.feedback_virtual_slot = 0,
|
||||||
|
.feedback_channels = 2,
|
||||||
|
.feedback_valid_bits_per_sample = 16,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct nhlt_endp_descriptor max98373_descriptors[] = {
|
static const struct nhlt_endp_descriptor max98373_descriptors[] = {
|
||||||
{
|
{
|
||||||
.link = NHLT_LINK_SSP,
|
.link = NHLT_LINK_SSP,
|
||||||
|
@ -52,6 +63,8 @@ static const struct nhlt_endp_descriptor max98373_descriptors[] = {
|
||||||
.direction = NHLT_DIR_RENDER,
|
.direction = NHLT_DIR_RENDER,
|
||||||
.vid = NHLT_VID,
|
.vid = NHLT_VID,
|
||||||
.did = NHLT_DID_SSP,
|
.did = NHLT_DID_SSP,
|
||||||
|
.cfg = &render_config,
|
||||||
|
.cfg_size = sizeof(render_config),
|
||||||
.formats = max98373_render_formats,
|
.formats = max98373_render_formats,
|
||||||
.num_formats = ARRAY_SIZE(max98373_render_formats),
|
.num_formats = ARRAY_SIZE(max98373_render_formats),
|
||||||
},
|
},
|
||||||
|
@ -61,6 +74,8 @@ static const struct nhlt_endp_descriptor max98373_descriptors[] = {
|
||||||
.direction = NHLT_DIR_CAPTURE,
|
.direction = NHLT_DIR_CAPTURE,
|
||||||
.vid = NHLT_VID,
|
.vid = NHLT_VID,
|
||||||
.did = NHLT_DID_SSP,
|
.did = NHLT_DID_SSP,
|
||||||
|
.cfg = &capture_config,
|
||||||
|
.cfg_size = sizeof(capture_config),
|
||||||
.formats = max98373_capture_formats,
|
.formats = max98373_capture_formats,
|
||||||
.num_formats = ARRAY_SIZE(max98373_capture_formats),
|
.num_formats = ARRAY_SIZE(max98373_capture_formats),
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,15 +4,6 @@
|
||||||
#include <soc/nhlt.h>
|
#include <soc/nhlt.h>
|
||||||
|
|
||||||
static const struct nhlt_format_config max98927_render_formats[] = {
|
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. */
|
/* 48 KHz 16-bits per sample. */
|
||||||
{
|
{
|
||||||
.num_channels = 2,
|
.num_channels = 2,
|
||||||
|
@ -36,13 +27,37 @@ static const struct nhlt_format_config max98927_capture_formats[] = {
|
||||||
.settings_file = "max98927-render-2ch-48khz-16b.bin",
|
.settings_file = "max98927-render-2ch-48khz-16b.bin",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
static const struct nhlt_endp_descriptor max98927_descriptors[] = {
|
|
||||||
|
static struct nhlt_feedback_config render_config = {
|
||||||
|
.tdm_config = {
|
||||||
|
.virtual_slot = 0x0,
|
||||||
|
.config_type = NHLT_TDM_RENDER_FEEDBACK,
|
||||||
|
},
|
||||||
|
.feedback_virtual_slot = 2,
|
||||||
|
.feedback_channels = 4,
|
||||||
|
.feedback_valid_bits_per_sample = 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct nhlt_feedback_config capture_config = {
|
||||||
|
.tdm_config = {
|
||||||
|
.virtual_slot = 0x2,
|
||||||
|
.config_type = NHLT_TDM_RENDER_FEEDBACK,
|
||||||
|
},
|
||||||
|
.feedback_virtual_slot = 0,
|
||||||
|
.feedback_channels = 2,
|
||||||
|
.feedback_valid_bits_per_sample = 16,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static struct nhlt_endp_descriptor max98927_descriptors[] = {
|
||||||
{
|
{
|
||||||
.link = NHLT_LINK_SSP,
|
.link = NHLT_LINK_SSP,
|
||||||
.device = NHLT_SSP_DEV_I2S,
|
.device = NHLT_SSP_DEV_I2S,
|
||||||
.direction = NHLT_DIR_RENDER,
|
.direction = NHLT_DIR_RENDER,
|
||||||
.vid = NHLT_VID,
|
.vid = NHLT_VID,
|
||||||
.did = NHLT_DID_SSP,
|
.did = NHLT_DID_SSP,
|
||||||
|
.cfg = &render_config,
|
||||||
|
.cfg_size = sizeof(render_config),
|
||||||
.formats = max98927_render_formats,
|
.formats = max98927_render_formats,
|
||||||
.num_formats = ARRAY_SIZE(max98927_render_formats),
|
.num_formats = ARRAY_SIZE(max98927_render_formats),
|
||||||
},
|
},
|
||||||
|
@ -52,6 +67,8 @@ static const struct nhlt_endp_descriptor max98927_descriptors[] = {
|
||||||
.direction = NHLT_DIR_CAPTURE,
|
.direction = NHLT_DIR_CAPTURE,
|
||||||
.vid = NHLT_VID,
|
.vid = NHLT_VID,
|
||||||
.did = NHLT_DID_SSP,
|
.did = NHLT_DID_SSP,
|
||||||
|
.cfg = &capture_config,
|
||||||
|
.cfg_size = sizeof(capture_config),
|
||||||
.formats = max98927_capture_formats,
|
.formats = max98927_capture_formats,
|
||||||
.num_formats = ARRAY_SIZE(max98927_capture_formats),
|
.num_formats = ARRAY_SIZE(max98927_capture_formats),
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,6 +18,7 @@ static const struct nhlt_format_config rt5514_4ch_formats[] = {
|
||||||
|
|
||||||
static const struct nhlt_dmic_array_config rt5514_4ch_mic_config = {
|
static const struct nhlt_dmic_array_config rt5514_4ch_mic_config = {
|
||||||
.tdm_config = {
|
.tdm_config = {
|
||||||
|
.virtual_slot = 0x1,
|
||||||
.config_type = NHLT_TDM_MIC_ARRAY,
|
.config_type = NHLT_TDM_MIC_ARRAY,
|
||||||
},
|
},
|
||||||
.array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED,
|
.array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED,
|
||||||
|
|
Loading…
Reference in New Issue