From 7bd15a4f608d69a4ce76254176ab77fa054b67c7 Mon Sep 17 00:00:00 2001 From: liaohj Date: Mon, 23 Oct 2023 18:10:21 +0800 Subject: [PATCH] audio:add lock for aw dynamics set dailink for aw driver, we use dynamics set dailink. and for fogo5gna ,there are aw8838 also use the interface. but aw8838 & aw882xx are different ko. so add lock for awinic_set_dai_name function to avoid rewrite ,and lost one dailink. Change-Id: Ie1dca1fb38b4cb9764a62884adc433422d4b80bb Signed-off-by: liaohj Reviewed-on: https://gerrit.mot.com/2774476 Reviewed-by: Wanlong Zhou SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- asoc/holi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/asoc/holi.c b/asoc/holi.c index 01b668ff7157..7df117af25cf 100644 --- a/asoc/holi.c +++ b/asoc/holi.c @@ -6250,15 +6250,20 @@ static const struct of_device_id holi_asoc_machine_of_match[] = { #ifdef CONFIG_AW882XX_STEREO_SMARTPA struct snd_soc_dai_link_component aw_codecs[4]; static unsigned int aw_codecs_num; +static DEFINE_MUTEX(aw_dailink_mutex); void awinic_set_dai_name(const char* drvdainame, const char*drvname) { + mutex_lock(&aw_dailink_mutex); if (aw_codecs_num < ARRAY_SIZE(aw_codecs)) { aw_codecs[aw_codecs_num].dai_name = drvdainame; aw_codecs[aw_codecs_num].name = drvname; aw_codecs[aw_codecs_num].of_node = NULL; + pr_info("aw_codecs_num[%d] codec name %s dai name %s\n", + aw_codecs_num, aw_codecs[aw_codecs_num].name, aw_codecs[aw_codecs_num].dai_name); aw_codecs_num++; } + mutex_unlock(&aw_dailink_mutex); } EXPORT_SYMBOL(awinic_set_dai_name);