3f2c656491
"struct snd_soc_dapm_widget" and "struct snd_kcontrol_new" are used in most of these .c files. Adding the header files to prevent from depending on <sound/soc.h> Reported-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200821195603.215535-17-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
44 lines
1004 B
C
44 lines
1004 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
// Copyright (c) 2020 Intel Corporation
|
|
|
|
/*
|
|
* sof_sdw_dmic - Helpers to handle dmic from generic machine driver
|
|
*/
|
|
|
|
#include <sound/soc.h>
|
|
#include <sound/soc-acpi.h>
|
|
#include <sound/soc-dapm.h>
|
|
#include "sof_sdw_common.h"
|
|
|
|
static const struct snd_soc_dapm_widget dmic_widgets[] = {
|
|
SND_SOC_DAPM_MIC("SoC DMIC", NULL),
|
|
};
|
|
|
|
static const struct snd_soc_dapm_route dmic_map[] = {
|
|
/* digital mics */
|
|
{"DMic", NULL, "SoC DMIC"},
|
|
};
|
|
|
|
int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd)
|
|
{
|
|
struct snd_soc_card *card = rtd->card;
|
|
int ret;
|
|
|
|
ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
|
|
ARRAY_SIZE(dmic_widgets));
|
|
if (ret) {
|
|
dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
|
|
/* Don't need to add routes if widget addition failed */
|
|
return ret;
|
|
}
|
|
|
|
ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
|
|
ARRAY_SIZE(dmic_map));
|
|
|
|
if (ret)
|
|
dev_err(card->dev, "DMic map addition failed: %d\n", ret);
|
|
|
|
return ret;
|
|
}
|
|
|