Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
// This file incorporates work covered by the following copyright notice:
|
|
// Copyright (c) 2020 Intel Corporation
|
|
// Copyright (c) 2024 Advanced Micro Devices, Inc.
|
|
|
|
/*
|
|
* soc_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 <sound/soc_sdw_utils.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 asoc_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd)
|
|
{
|
|
struct snd_soc_card *card = rtd->card;
|
|
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
|
|
int ret;
|
|
|
|
ret = snd_soc_dapm_new_controls(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(dapm, dmic_map,
|
|
ARRAY_SIZE(dmic_map));
|
|
|
|
if (ret)
|
|
dev_err(card->dev, "DMic map addition failed: %d\n", ret);
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_NS(asoc_sdw_dmic_init, "SND_SOC_SDW_UTILS");
|