Weimin Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85571?usp=email )
Change subject: drivers/soundwire: Support Realtek ALC712 codec ......................................................................
drivers/soundwire: Support Realtek ALC712 codec
Update SoundWire driver to support ALC712 audio codec.
reference datasheet: Realtek ALC712-VB-CG Rev. 0.24
BUG=b:378629979 TEST=TBD
Change-Id: Ib79896a9fe23f2f66d6ee3a24f5a62bfa0f7a649 Signed-off-by: Weimin Wu wuweimin@huaqin.corp-partner.google.com --- M src/drivers/soundwire/alc711/alc711.c M src/drivers/soundwire/alc711/chip.h M src/include/mipi/ids.h 3 files changed, 24 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/85571/1
diff --git a/src/drivers/soundwire/alc711/alc711.c b/src/drivers/soundwire/alc711/alc711.c index 83552c4..67941b9 100644 --- a/src/drivers/soundwire/alc711/alc711.c +++ b/src/drivers/soundwire/alc711/alc711.c @@ -10,6 +10,9 @@
#include "chip.h"
+static struct soundwire_multilane alc711_multilane = { +}; + static struct soundwire_slave alc711_slave = { .wake_up_unavailable = false, .test_mode_supported = false, @@ -87,7 +90,8 @@ .port = 2, .source = &alc711_dp } - } + }, + .multilane = &alc711_multilane
};
@@ -96,6 +100,7 @@ struct drivers_soundwire_alc711_config *config = dev->chip_info; const char *scope = acpi_device_scope(dev); struct acpi_dp *dsd; + size_t lane_mapping_count, audio_mode_count;
if (!scope) return; @@ -112,6 +117,21 @@ acpigen_write_name_string("_DDN", config->desc ? : dev->chip_ops->name); acpigen_write_STA(acpi_device_status(dev));
+ /* Overlay multilane config, if provided. */ + lane_mapping_count = MIN(ARRAY_SIZE(config->multilane.lane_mapping), SOUNDWIRE_MAX_LANE); + if (lane_mapping_count > 0) { + alc711_multilane.lane_mapping_count = lane_mapping_count; + memcpy(&alc711_multilane.lane_mapping, &config->multilane.lane_mapping, + sizeof(struct soundwire_multilane_map) * lane_mapping_count); + } + + /* Overlay Audio Mode config, if provided. */ + audio_mode_count = MIN(ARRAY_SIZE(config->audio_mode), SOUNDWIRE_MAX_MODE); + if (audio_mode_count > 0) { + /* Currently only 1 audio mode is supported. */ + memcpy(&alc711_audio_mode, &config->audio_mode, sizeof(struct soundwire_audio_mode)); + } + dsd = acpi_dp_new_table("_DSD"); soundwire_gen_codec(dsd, &alc711_codec, NULL); acpi_dp_write(dsd); diff --git a/src/drivers/soundwire/alc711/chip.h b/src/drivers/soundwire/alc711/chip.h index c628209..8b0230e 100644 --- a/src/drivers/soundwire/alc711/chip.h +++ b/src/drivers/soundwire/alc711/chip.h @@ -10,6 +10,8 @@ const char *name; const char *desc; struct soundwire_address alc711_address; + struct soundwire_audio_mode audio_mode[SOUNDWIRE_MAX_MODE]; + struct soundwire_multilane multilane; };
#endif /* __DRIVERS_SOUNDWIRE_ALC711_CHIP_H__ */ diff --git a/src/include/mipi/ids.h b/src/include/mipi/ids.h index a194de1..fdd2d6a 100644 --- a/src/include/mipi/ids.h +++ b/src/include/mipi/ids.h @@ -21,6 +21,7 @@ #define MIPI_MFG_ID_REALTEK 0x025d #define MIPI_DEV_ID_REALTEK_ALC5682 0x5682 #define MIPI_DEV_ID_REALTEK_ALC711 0x0711 +#define MIPI_DEV_ID_REALTEK_ALC712 0x0712 #define MIPI_DEV_ID_REALTEK_ALC721 0x0721 #define MIPI_DEV_ID_REALTEK_ALC722 0x0722 #define MIPI_DEV_ID_REALTEK_ALC1308 0x1308