Commit e17527e1 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: avs: Add probe machine board

Stub machine board driver with no custom DAPM routes and single FE DAI
link for userspace to interact with.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221202152841.672536-13-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ed914a2a
......@@ -291,6 +291,33 @@ static void board_pdev_unregister(void *data)
platform_device_unregister(data);
}
static int __maybe_unused avs_register_probe_board(struct avs_dev *adev)
{
struct platform_device *board;
struct snd_soc_acpi_mach mach = {{0}};
int ret;
ret = avs_probe_platform_register(adev, "probe-platform");
if (ret < 0)
return ret;
mach.mach_params.platform = "probe-platform";
board = platform_device_register_data(NULL, "avs_probe_mb", PLATFORM_DEVID_NONE,
(const void *)&mach, sizeof(mach));
if (IS_ERR(board)) {
dev_err(adev->dev, "probe board register failed\n");
return PTR_ERR(board);
}
ret = devm_add_action(adev->dev, board_pdev_unregister, board);
if (ret < 0) {
platform_device_unregister(board);
return ret;
}
return 0;
}
static int avs_register_dmic_board(struct avs_dev *adev)
{
struct platform_device *codec, *board;
......@@ -500,6 +527,12 @@ int avs_register_all_boards(struct avs_dev *adev)
{
int ret;
#ifdef CONFIG_DEBUG_FS
ret = avs_register_probe_board(adev);
if (ret < 0)
dev_warn(adev->dev, "enumerate PROBE endpoints failed: %d\n", ret);
#endif
ret = avs_register_dmic_board(adev);
if (ret < 0)
dev_warn(adev->dev, "enumerate DMIC endpoints failed: %d\n",
......
......@@ -77,6 +77,14 @@ config SND_SOC_INTEL_AVS_MACH_NAU8825
Say Y or m if you have such a device. This is a recommended option.
If unsure select "N".
config SND_SOC_INTEL_AVS_MACH_PROBE
tristate "Probing (data) board"
depends on DEBUG_FS
select SND_HWDEP
help
This adds support for data probing board which can be used to
gather data from runtime stream over compress operations.
config SND_SOC_INTEL_AVS_MACH_RT274
tristate "rt274 in I2S mode"
depends on I2C
......
......@@ -8,6 +8,7 @@ snd-soc-avs-max98927-objs := max98927.o
snd-soc-avs-max98357a-objs := max98357a.o
snd-soc-avs-max98373-objs := max98373.o
snd-soc-avs-nau8825-objs := nau8825.o
snd-soc-avs-probe-objs := probe.o
snd-soc-avs-rt274-objs := rt274.o
snd-soc-avs-rt286-objs := rt286.o
snd-soc-avs-rt298-objs := rt298.o
......@@ -22,6 +23,7 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98927) += snd-soc-avs-max98927.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98373) += snd-soc-avs-max98373.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_PROBE) += snd-soc-avs-probe.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT298) += snd-soc-avs-rt298.o
......
// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
//
// Authors: Cezary Rojewski <cezary.rojewski@intel.com>
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//
#include <linux/device.h>
#include <linux/module.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
SND_SOC_DAILINK_DEF(probe_cp, DAILINK_COMP_ARRAY(COMP_CPU("Probe Extraction CPU DAI")));
SND_SOC_DAILINK_DEF(platform, DAILINK_COMP_ARRAY(COMP_PLATFORM("probe-platform")));
static struct snd_soc_dai_link probe_mb_dai_links[] = {
{
.name = "Compress Probe Capture",
.nonatomic = 1,
SND_SOC_DAILINK_REG(probe_cp, dummy, platform),
},
};
static int avs_probe_mb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct snd_soc_acpi_mach *mach;
struct snd_soc_card *card;
int ret;
mach = dev_get_platdata(dev);
card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
card->name = "avs_probe_mb";
card->dev = dev;
card->owner = THIS_MODULE;
card->dai_link = probe_mb_dai_links;
card->num_links = ARRAY_SIZE(probe_mb_dai_links);
card->fully_routed = true;
ret = snd_soc_fixup_dai_links_platform_name(card, mach->mach_params.platform);
if (ret)
return ret;
return devm_snd_soc_register_card(dev, card);
}
static struct platform_driver avs_probe_mb_driver = {
.probe = avs_probe_mb_probe,
.driver = {
.name = "avs_probe_mb",
.pm = &snd_soc_pm_ops,
},
};
module_platform_driver(avs_probe_mb_driver);
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:avs_probe_mb");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment