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 <[email protected]>
Reviewed-on: https://gerrit.mot.com/2774476
Reviewed-by: Wanlong Zhou <[email protected]>
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <[email protected]>
Submit-Approved: Jira Key
This commit is contained in:
liaohj 2023-10-23 18:10:21 +08:00 • committed by Hujun Liao
commit 7bd15a4f60

View file

@ -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);