1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (c) 2020 Intel Corporation
5 * sof_sdw_dmic - Helpers to handle dmic from generic machine driver
9 #include <sound/soc-acpi.h>
10 #include <sound/soc-dapm.h>
11 #include "sof_sdw_common.h"
13 static const struct snd_soc_dapm_widget dmic_widgets
[] = {
14 SND_SOC_DAPM_MIC("SoC DMIC", NULL
),
17 static const struct snd_soc_dapm_route dmic_map
[] = {
19 {"DMic", NULL
, "SoC DMIC"},
22 int sof_sdw_dmic_init(struct snd_soc_pcm_runtime
*rtd
)
24 struct snd_soc_card
*card
= rtd
->card
;
27 ret
= snd_soc_dapm_new_controls(&card
->dapm
, dmic_widgets
,
28 ARRAY_SIZE(dmic_widgets
));
30 dev_err(card
->dev
, "DMic widget addition failed: %d\n", ret
);
31 /* Don't need to add routes if widget addition failed */
35 ret
= snd_soc_dapm_add_routes(&card
->dapm
, dmic_map
,
36 ARRAY_SIZE(dmic_map
));
39 dev_err(card
->dev
, "DMic map addition failed: %d\n", ret
);