1 // SPDX-License-Identifier: GPL-2.0-only
2 // This file incorporates work covered by the following copyright notice:
3 // Copyright (c) 2024 Intel Corporation
4 // Copyright (c) 2024 Advanced Micro Devices, Inc.
7 * soc_sdw_rt_dmic - Helpers to handle Realtek SDW DMIC from generic machine driver
10 #include <linux/device.h>
11 #include <linux/errno.h>
12 #include <sound/soc.h>
13 #include <sound/soc-acpi.h>
14 #include <sound/soc_sdw_utils.h>
16 int asoc_sdw_rt_dmic_rtd_init(struct snd_soc_pcm_runtime
*rtd
, struct snd_soc_dai
*dai
)
18 struct snd_soc_card
*card
= rtd
->card
;
19 struct snd_soc_component
*component
;
22 component
= dai
->component
;
25 * rt715-sdca (aka rt714) is a special case that uses different name in card->components
26 * and component->name_prefix.
28 if (!strcmp(component
->name_prefix
, "rt714"))
29 mic_name
= devm_kasprintf(card
->dev
, GFP_KERNEL
, "rt715-sdca");
31 mic_name
= devm_kasprintf(card
->dev
, GFP_KERNEL
, "%s", component
->name_prefix
);
33 card
->components
= devm_kasprintf(card
->dev
, GFP_KERNEL
,
34 "%s mic:%s", card
->components
,
36 if (!card
->components
)
39 dev_dbg(card
->dev
, "card->components: %s\n", card
->components
);
43 EXPORT_SYMBOL_NS(asoc_sdw_rt_dmic_rtd_init
, "SND_SOC_SDW_UTILS");