mb/google/octopus: add ALC5682I-VS to be supported in the SSFC

Add ALC5682I-VS codec support. ALC5682I-VD/ALC5682I-VS load different
hid name depending on SSFC.

BUG=b:198722640
BRANCH=octopus
TEST=Set CBI SSFC BIT9-11 to select codec, and test audio works

Change-Id: I80be12d88e100ce8586371fc49b36447859e24f8
Signed-off-by: Paul Huang <paul2_huang@pegatron.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59856
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marco Chen <marcochen@google.com>
This commit is contained in:
Paul Huang 2021-12-03 10:17:15 +08:00 committed by Felix Held
parent c71e320bae
commit 0f0edeed2e
3 changed files with 24 additions and 6 deletions

View File

@ -62,6 +62,7 @@ static void gpio_modification_by_ssfc(struct pad_config *table, size_t num)
/* For RT5682, GPIO 137 should be set as EDGE_BOTH. */ /* For RT5682, GPIO 137 should be set as EDGE_BOTH. */
const struct pad_config rt5682_gpio_137 = PAD_CFG_GPI_APIC_IOS(GPIO_137, const struct pad_config rt5682_gpio_137 = PAD_CFG_GPI_APIC_IOS(GPIO_137,
NONE, DEEP, EDGE_BOTH, INVERT, HIZCRx1, DISPUPD); NONE, DEEP, EDGE_BOTH, INVERT, HIZCRx1, DISPUPD);
enum ssfc_audio_codec codec = ssfc_get_audio_codec();
if (table == NULL || num == 0) if (table == NULL || num == 0)
return; return;
@ -72,7 +73,8 @@ static void gpio_modification_by_ssfc(struct pad_config *table, size_t num)
* provide override_table right now so it will be returned earlier since * provide override_table right now so it will be returned earlier since
* table above is NULL. * table above is NULL.
*/ */
if (ssfc_get_audio_codec() != SSFC_AUDIO_CODEC_RT5682) if ((codec != SSFC_AUDIO_CODEC_RT5682) &&
(codec != SSFC_AUDIO_CODEC_RT5682_VS))
return; return;
while (num--) { while (num--) {
@ -192,13 +194,26 @@ static void audio_codec_device_update(void)
continue; continue;
} }
if ((audio_dev->chip_ops == &drivers_i2c_generic_ops) && if (audio_dev->chip_ops == &drivers_i2c_generic_ops) {
(codec == SSFC_AUDIO_CODEC_RT5682)) {
struct drivers_i2c_generic_config *cfg = struct drivers_i2c_generic_config *cfg =
audio_dev->chip_info; audio_dev->chip_info;
if (cfg != NULL && !strcmp(cfg->hid, "10EC5682")) { if ((cfg != NULL && !strcmp(cfg->hid, "10EC5682")) &&
printk(BIOS_INFO, "enable RT5682.\n"); (codec == SSFC_AUDIO_CODEC_RT5682)) {
printk(BIOS_INFO, "enable RT5682 VD.\n");
continue;
}
if ((cfg != NULL && !strcmp(cfg->hid, "10EC5682")) &&
(codec == SSFC_AUDIO_CODEC_RT5682_VS)) {
cfg->hid = "RTL5682";
printk(BIOS_INFO, "enable RT5682 VS.\n");
continue;
}
if ((cfg != NULL && !strcmp(cfg->hid, "RTL5682")) &&
(codec == SSFC_AUDIO_CODEC_RT5682_VS)) {
printk(BIOS_INFO, "enable RT5682 VS.\n");
continue; continue;
} }
} }

View File

@ -30,6 +30,7 @@ enum ssfc_audio_codec {
SSFC_AUDIO_CODEC_DA7219, SSFC_AUDIO_CODEC_DA7219,
SSFC_AUDIO_CODEC_RT5682, SSFC_AUDIO_CODEC_RT5682,
SSFC_AUDIO_CODEC_CS42L42, SSFC_AUDIO_CODEC_CS42L42,
SSFC_AUDIO_CODEC_RT5682_VS,
}; };
#define SSFC_AUDIO_CODEC_OFFSET 9 #define SSFC_AUDIO_CODEC_OFFSET 9
#define SSFC_AUDIO_CODEC_MASK 0x7 #define SSFC_AUDIO_CODEC_MASK 0x7

View File

@ -28,7 +28,9 @@ void __weak variant_nhlt_init(struct nhlt *nhlt)
printk(BIOS_ERR, "Added Dialog_7219 codec.\n"); printk(BIOS_ERR, "Added Dialog_7219 codec.\n");
} }
if (CONFIG(NHLT_RT5682) && codec == SSFC_AUDIO_CODEC_RT5682) { if (CONFIG(NHLT_RT5682) &&
(codec == SSFC_AUDIO_CODEC_RT5682 ||
codec == SSFC_AUDIO_CODEC_RT5682_VS)) {
/* Realtek for Headset codec */ /* Realtek for Headset codec */
if (!nhlt_soc_add_rt5682(nhlt, AUDIO_LINK_SSP2)) if (!nhlt_soc_add_rt5682(nhlt, AUDIO_LINK_SSP2))
printk(BIOS_ERR, "Added ALC5682 codec.\n"); printk(BIOS_ERR, "Added ALC5682 codec.\n");