soc/intel/skl; mb/google/eve,poppy: Update NHLT methods

Adapted from WIP (and now abandoned) patches CB:25334, 26308, 26309.

Update the nhlt_soc_add_*() methods for max98373, max98927, and rt5514
codecs to program the render and feedback slot numbers as appropriate.

TEST=boot Windows on google/eve, atlas, nocturne, and rammus. Verify
audio functional with both Google project campfire drivers as well as
coolstar's AVS audio drivers.

Change-Id: Ib8c6e24ba539e205bd5bbd856ecff43b2c016c2e
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70394
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: CoolStar <coolstarorganization@gmail.com>
This commit is contained in:
Matt DeVillier 2022-12-06 21:05:16 -06:00 committed by Felix Held
parent ca342e1082
commit bf3c648fa7
9 changed files with 36 additions and 14 deletions

View File

@ -34,7 +34,7 @@ static unsigned long mainboard_write_acpi_tables(
nhlt->subsystem_id = SUBSYSTEM_ID; nhlt->subsystem_id = SUBSYSTEM_ID;
/* 4 Channel DMIC array */ /* 4 Channel DMIC array */
if (nhlt_soc_add_rt5514(nhlt, AUDIO_LINK_SSP0, 4)) if (nhlt_soc_add_rt5514(nhlt, AUDIO_LINK_SSP0, 4, 1))
printk(BIOS_ERR, "Couldn't add rt5514.\n"); printk(BIOS_ERR, "Couldn't add rt5514.\n");
/* RT5663 Headset codec */ /* RT5663 Headset codec */
@ -42,7 +42,8 @@ static unsigned long mainboard_write_acpi_tables(
printk(BIOS_ERR, "Couldn't add headset codec.\n"); printk(BIOS_ERR, "Couldn't add headset codec.\n");
/* MAXIM98927 Smart Amps for left and right channel */ /* MAXIM98927 Smart Amps for left and right channel */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0)) /* Render time_slot is 0 and feedback time_slot is 2 */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0, 0, 2))
printk(BIOS_ERR, "Couldn't add max98927\n"); printk(BIOS_ERR, "Couldn't add max98927\n");
end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr, end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr,

View File

@ -16,7 +16,8 @@ void variant_nhlt_init(struct nhlt *nhlt)
printk(BIOS_ERR, "Couldn't add Dialog DA7219 codec.\n"); printk(BIOS_ERR, "Couldn't add Dialog DA7219 codec.\n");
/* MAXIM Smart Amps for left and right speakers. */ /* MAXIM Smart Amps for left and right speakers. */
if (nhlt_soc_add_max98373(nhlt, AUDIO_LINK_SSP0)) /* Render time_slot is 0 and feedback time_slot is 2 */
if (nhlt_soc_add_max98373(nhlt, AUDIO_LINK_SSP0, 0, 2))
printk(BIOS_ERR, "Couldn't add Maxim 98373 codec.\n"); printk(BIOS_ERR, "Couldn't add Maxim 98373 codec.\n");
} }

View File

@ -16,7 +16,8 @@ void __weak variant_nhlt_init(struct nhlt *nhlt)
printk(BIOS_ERR, "Couldn't add 4CH DMIC arrays.\n"); printk(BIOS_ERR, "Couldn't add 4CH DMIC arrays.\n");
/* Maxim MAX98927 Smart Amps for left and right channel */ /* Maxim MAX98927 Smart Amps for left and right channel */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0)) /* Render time_slot is 0 and feedback time_slot is 2 */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0, 0, 2))
printk(BIOS_ERR, "Couldn't add Maxim MAX98927\n"); printk(BIOS_ERR, "Couldn't add Maxim MAX98927\n");
/* Realtek RT5663 Headset codec. */ /* Realtek RT5663 Headset codec. */

View File

@ -12,7 +12,8 @@ void variant_nhlt_init(struct nhlt *nhlt)
printk(BIOS_ERR, "Couldn't add 4CH DMIC array.\n"); printk(BIOS_ERR, "Couldn't add 4CH DMIC array.\n");
/* MAXIM Smart Amps for left and right speakers. */ /* MAXIM Smart Amps for left and right speakers. */
if (nhlt_soc_add_max98373(nhlt, AUDIO_LINK_SSP0)) /* Render time_slot is 0 and feedback time_slot is 2 */
if (nhlt_soc_add_max98373(nhlt, AUDIO_LINK_SSP0, 0, 2))
printk(BIOS_ERR, "Couldn't add Maxim 98373 codec.\n"); printk(BIOS_ERR, "Couldn't add Maxim 98373 codec.\n");
} }

View File

@ -16,7 +16,8 @@ void variant_nhlt_init(struct nhlt *nhlt)
printk(BIOS_ERR, "Couldn't add Dialog DA7219.\n"); printk(BIOS_ERR, "Couldn't add Dialog DA7219.\n");
/* Maxim MAX98927 Smart Amps for left and right channel */ /* Maxim MAX98927 Smart Amps for left and right channel */
if (nhlt_soc_add_max98927(nhlt, AUDIO_LINK_SSP0)) /* Render time_slot is 0 and feedback time_slot is 2 */
if (nhlt_soc_add_max98373(nhlt, AUDIO_LINK_SSP0, 0, 2))
printk(BIOS_ERR, "Couldn't add Maxim MAX98927\n"); printk(BIOS_ERR, "Couldn't add Maxim MAX98927\n");
} }

View File

@ -51,12 +51,14 @@ int nhlt_soc_add_max98357(struct nhlt *nhlt, int hwlink);
* Add max98373 amplifier in stereo configuration on provided SSP link. * Add max98373 amplifier in stereo configuration on provided SSP link.
* Return 0 on success, < 0 on error. * Return 0 on success, < 0 on error.
*/ */
int nhlt_soc_add_max98373(struct nhlt *nhlt, int hwlink); int nhlt_soc_add_max98373(struct nhlt *nhlt, int hwlink, int render_slot,
int feedback_slot);
/* /*
* Add rt5514 DSP on provided SSP link. Return 0 on success, < 0 on error. * Add rt5514 DSP on provided SSP link. Return 0 on success, < 0 on error.
*/ */
int nhlt_soc_add_rt5514(struct nhlt *nhlt, int hwlink, int num_channels); int nhlt_soc_add_rt5514(struct nhlt *nhlt, int hwlink, int num_channels,
int virtual_slot);
/* /*
* Add rt5663 headset codec on provided SSP link. Return 0 on success, < 0 * Add rt5663 headset codec on provided SSP link. Return 0 on success, < 0
@ -68,7 +70,8 @@ int nhlt_soc_add_rt5663(struct nhlt *nhlt, int hwlink);
* Add max98927 amplifier in stereo configuration on provided SSP link. * Add max98927 amplifier in stereo configuration on provided SSP link.
* Return 0 on success, < 0 on error. * Return 0 on success, < 0 on error.
*/ */
int nhlt_soc_add_max98927(struct nhlt *nhlt, int hwlink); int nhlt_soc_add_max98927(struct nhlt *nhlt, int hwlink, int render_slot,
int feedback_slot);
/* /*
* Add da7219 headset codec on provided SSP link. Return 0 on success, < 0 * Add da7219 headset codec on provided SSP link. Return 0 on success, < 0

View File

@ -81,8 +81,14 @@ static const struct nhlt_endp_descriptor max98373_descriptors[] = {
}, },
}; };
int nhlt_soc_add_max98373(struct nhlt *nhlt, int hwlink) int nhlt_soc_add_max98373(struct nhlt *nhlt, int hwlink, int render_slot,
int feedback_slot)
{ {
render_config.tdm_config.virtual_slot = render_slot;
render_config.feedback_virtual_slot = feedback_slot;
capture_config.tdm_config.virtual_slot = feedback_slot;
capture_config.feedback_virtual_slot = render_slot;
/* Virtual bus id of SSP links are the hardware port ids proper. */ /* Virtual bus id of SSP links are the hardware port ids proper. */
return nhlt_add_ssp_endpoints(nhlt, hwlink, max98373_descriptors, return nhlt_add_ssp_endpoints(nhlt, hwlink, max98373_descriptors,
ARRAY_SIZE(max98373_descriptors)); ARRAY_SIZE(max98373_descriptors));

View File

@ -74,8 +74,14 @@ static struct nhlt_endp_descriptor max98927_descriptors[] = {
}, },
}; };
int nhlt_soc_add_max98927(struct nhlt *nhlt, int hwlink) int nhlt_soc_add_max98927(struct nhlt *nhlt, int hwlink, int render_slot,
int feedback_slot)
{ {
render_config.tdm_config.virtual_slot = render_slot;
render_config.feedback_virtual_slot = feedback_slot;
capture_config.tdm_config.virtual_slot = feedback_slot;
capture_config.feedback_virtual_slot = render_slot;
/* Virtual bus id of SSP links are the hardware port ids proper. */ /* Virtual bus id of SSP links are the hardware port ids proper. */
return nhlt_add_ssp_endpoints(nhlt, hwlink, max98927_descriptors, return nhlt_add_ssp_endpoints(nhlt, hwlink, max98927_descriptors,
ARRAY_SIZE(max98927_descriptors)); ARRAY_SIZE(max98927_descriptors));

View File

@ -16,7 +16,7 @@ static const struct nhlt_format_config rt5514_4ch_formats[] = {
}, },
}; };
static const struct nhlt_dmic_array_config rt5514_4ch_mic_config = { static struct nhlt_dmic_array_config rt5514_4ch_mic_config = {
.tdm_config = { .tdm_config = {
.virtual_slot = 0x1, .virtual_slot = 0x1,
.config_type = NHLT_TDM_MIC_ARRAY, .config_type = NHLT_TDM_MIC_ARRAY,
@ -24,7 +24,7 @@ static const struct nhlt_dmic_array_config rt5514_4ch_mic_config = {
.array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED, .array_type = NHLT_MIC_ARRAY_4CH_L_SHAPED,
}; };
static const struct nhlt_endp_descriptor rt5514_4ch_descriptors[] = { static struct nhlt_endp_descriptor rt5514_4ch_descriptors[] = {
{ {
.link = NHLT_LINK_SSP, .link = NHLT_LINK_SSP,
.device = NHLT_SSP_DEV_I2S, .device = NHLT_SSP_DEV_I2S,
@ -38,8 +38,10 @@ static const struct nhlt_endp_descriptor rt5514_4ch_descriptors[] = {
}, },
}; };
int nhlt_soc_add_rt5514(struct nhlt *nhlt, int hwlink, int num_channels) int nhlt_soc_add_rt5514(struct nhlt *nhlt, int hwlink, int num_channels, int virtual_slot)
{ {
rt5514_4ch_mic_config.tdm_config.virtual_slot = virtual_slot;
switch (num_channels) { switch (num_channels) {
case 4: case 4:
return nhlt_add_ssp_endpoints(nhlt, hwlink, return nhlt_add_ssp_endpoints(nhlt, hwlink,