ASoC: SOF: Clean up the probe support
Subsystems (3)
Peter Ujfalusi
maintainercover ASoC: SOF: Clean up the probe support
Hi,
The probe debug feature of SOF can be used to extract streams of data from a given point of a pipeline for analysis.
The support is implemented by using the ALSA/ASoC compress support for the capture stream, but the code can not be used by/for a normal compressed data stream. It is a debug feature.
Merge the probe implementation in the core (compress.c/h and probe.c/h) into one file: sof-probes.c/h
Rename the Intel HDA specific probe implementation from hda-compressc.c to hda-probes.c
We also need to add IPC logging support for the probes messages and drop the unused references to SOF compress to have reasonably clean code.
Regards,
Peter
---
Peter Ujfalusi (5):
ASoC: SOF: ipc: Add probe message logging to ipc_log_header()
ASoC: SOF: pcm: Remove non existent CONFIG_SND_SOC_SOF_COMPRESS
reference
ASoC: SOF: probe: Merge and clean up the probe and compress files
ASoC: SOF: Intel: Rename hda-compress.c to hda-probes.c
ASoC: SOF: sof-probes: Correct the function names used for
snd_soc_cdai_ops
Ranjani Sridharan (1):
ASoC: SOF: compress: move and export sof_probe_compr_ops
sound/soc/sof/Makefile | 3 +-
sound/soc/sof/compress.c | 147 ---------
sound/soc/sof/compress.h | 32 --
sound/soc/sof/core.c | 2 +-
sound/soc/sof/debug.c | 2 +-
sound/soc/sof/intel/Makefile | 2 +-
sound/soc/sof/intel/hda-dai.c | 16 +-
.../intel/{hda-compress.c => hda-probes.c} | 0
sound/soc/sof/ipc.c | 23 ++
sound/soc/sof/pcm.c | 6 +-
sound/soc/sof/probe.h | 85 ------
sound/soc/sof/sof-priv.h | 5 -
sound/soc/sof/{probe.c => sof-probes.c} | 280 +++++++++++-------
sound/soc/sof/sof-probes.h | 38 +++
14 files changed, 248 insertions(+), 393 deletions(-)
delete mode 100644 sound/soc/sof/compress.c
delete mode 100644 sound/soc/sof/compress.h
rename sound/soc/sof/intel/{hda-compress.c => hda-probes.c} (100%)
delete mode 100644 sound/soc/sof/probe.h
rename sound/soc/sof/{probe.c => sof-probes.c} (52%)
create mode 100644 sound/soc/sof/sof-probes.hSignature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 1/6 ASoC: SOF: ipc: Add probe message logging to ipc_log_header()
Probe related messages are missing from the logging, for example the PROBE_INIT would show up as:
ipc tx: 0xc0010000: unknown GLB command
ipc tx succeeded: 0xc0010000: unknown GLB command
Add code to handle the probe messages to have human readable output
--- sound/soc/sof/ipc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
sound/soc/sof/ipc.c +23 -0
@@ -192,6 +192,29 @@ static void ipc_log_header(struct device *dev, u8 *text, u32 cmd) str2 ="unknown type" ;break ; }break ; +case SOF_IPC_GLB_PROBE : + str ="GLB_PROBE" ; +switch (type) { +case SOF_IPC_PROBE_INIT : + str2 ="INIT" ;break ; +case SOF_IPC_PROBE_DEINIT : + str2 ="DEINIT" ;break ; +case SOF_IPC_PROBE_DMA_ADD : + str2 ="DMA_ADD" ;break ; +case SOF_IPC_PROBE_DMA_INFO : + str2 ="DMA_INFO" ;break ; +case SOF_IPC_PROBE_DMA_REMOVE : + str2 ="DMA_REMOVE" ;break ; +case SOF_IPC_PROBE_POINT_ADD : + str2 ="POINT_ADD" ;break ; +case SOF_IPC_PROBE_POINT_INFO : + str2 ="POINT_INFO" ;break ; +case SOF_IPC_PROBE_POINT_REMOVE : + str2 ="POINT_REMOVE" ;break ; +default : + str2 ="unknown type" ;break ; + } +break ;default : str ="unknown GLB command" ;break ; }
Signature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 2/6 ASoC: SOF: pcm: Remove non existent CONFIG_SND_SOC_SOF_COMPRESS reference
In reply to Peter UjfalusiThe SND_SOC_SOF_COMPRESS is not valid Kconfig option, remove it.
At the same time remove the also the declaration of the non existent sof_compressed_ops.
--- sound/soc/sof/pcm.c | 4 ---- sound/soc/sof/sof-priv.h | 5 ----- 2 files changed, 9 deletions(-)
sound/soc/sof/pcm.c +0 -4
@@ -829,11 +829,7 @@ void snd_sof_new_platform_drv(struct snd_sof_dev *sdev) pd->trigger = sof_pcm_trigger; pd->pointer = sof_pcm_pointer; -#if IS_ENABLED (CONFIG_SND_SOC_SOF_COMPRESS ) - pd->compress_ops = &sof_compressed_ops; -#endif #if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES ) -/* override cops when probe support is enabled */ pd->compress_ops = &sof_probe_compressed_ops;#endif pd->pcm_construct = sof_pcm_new;
sound/soc/sof/sof-priv.h +0 -5
@@ -540,11 +540,6 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev);void snd_sof_handle_fw_exception (struct snd_sof_dev *sdev);int snd_sof_dbg_memory_info_init (struct snd_sof_dev *sdev); -/* -* Platform specific ops. -*/ -extern struct snd_compress_ops sof_compressed_ops; -/* * DSP Architectures. */
Signature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 3/6 ASoC: SOF: compress: move and export sof_probe_compr_ops
In reply to Peter UjfalusiFrom: Ranjani Sridharan <[email protected]>
sof_probe_compr_ops are not platform-specific. So move it to common compress code and export the symbol. The compilation of the common compress code is already dependent on the selection of CONFIG_SND_SOC_SOF_DEBUG_PROBES, so no need to check the Kconfig section for defining sof_probe_compr_ops again.
--- sound/soc/sof/compress.c | 53 +++++++++++++++++++---------------- sound/soc/sof/compress.h | 15 +--------- sound/soc/sof/intel/hda-dai.c | 16 +++-------- 3 files changed, 34 insertions(+), 50 deletions(-)
sound/soc/sof/compress.c +29 -24
@@ -13,13 +13,8 @@#include "ops.h" #include "probe.h" -const struct snd_compress_ops sof_probe_compressed_ops = { - .copy = sof_probe_compr_copy, -}; -EXPORT_SYMBOL (sof_probe_compressed_ops); - -int sof_probe_compr_open (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai) +static int sof_probe_compr_open (struct snd_compr_stream *cstream, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);
@@ -34,10 +29,9 @@ int sof_probe_compr_open(struct snd_compr_stream *cstream, sdev->extractor_stream_tag = ret;return 0 ; } -EXPORT_SYMBOL (sof_probe_compr_open); -int sof_probe_compr_free (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai) +static int sof_probe_compr_free (struct snd_compr_stream *cstream, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);
@@ -66,10 +60,10 @@ int sof_probe_compr_free(struct snd_compr_stream *cstream,return snd_sof_probe_compr_free (sdev, cstream, dai); } -EXPORT_SYMBOL (sof_probe_compr_free); -int sof_probe_compr_set_params (struct snd_compr_stream *cstream, -struct snd_compr_params *params,struct snd_soc_dai *dai) +static int sof_probe_compr_set_params (struct snd_compr_stream *cstream, +struct snd_compr_params *params, +struct snd_soc_dai *dai) {struct snd_compr_runtime *rtd = cstream->runtime; struct snd_sof_dev *sdev =
@@ -95,31 +89,38 @@ int sof_probe_compr_set_params(struct snd_compr_stream *cstream,return 0 ; } -EXPORT_SYMBOL (sof_probe_compr_set_params); -int sof_probe_compr_trigger (struct snd_compr_stream *cstream,int cmd, -struct snd_soc_dai *dai) +static int sof_probe_compr_trigger (struct snd_compr_stream *cstream,int cmd, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);return snd_sof_probe_compr_trigger (sdev, cstream, cmd, dai); } -EXPORT_SYMBOL (sof_probe_compr_trigger); -int sof_probe_compr_pointer (struct snd_compr_stream *cstream, -struct snd_compr_tstamp *tstamp,struct snd_soc_dai *dai) +static int sof_probe_compr_pointer (struct snd_compr_stream *cstream, +struct snd_compr_tstamp *tstamp, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);return snd_sof_probe_compr_pointer (sdev, cstream, tstamp, dai); } -EXPORT_SYMBOL (sof_probe_compr_pointer); -int sof_probe_compr_copy (struct snd_soc_component *component, -struct snd_compr_stream *cstream, -char __user *buf,size_t count) +struct snd_soc_cdai_ops sof_probe_compr_ops = { + .startup = sof_probe_compr_open, + .shutdown = sof_probe_compr_free, + .set_params = sof_probe_compr_set_params, + .trigger = sof_probe_compr_trigger, + .pointer = sof_probe_compr_pointer, +}; +EXPORT_SYMBOL (sof_probe_compr_ops); + +static int sof_probe_compr_copy (struct snd_soc_component *component, +struct snd_compr_stream *cstream, +char __user *buf,size_t count) {struct snd_compr_runtime *rtd = cstream->runtime;unsigned int offset, n;
@@ -144,4 +145,8 @@ int sof_probe_compr_copy(struct snd_soc_component *component,return count - ret;return count; } -EXPORT_SYMBOL (sof_probe_compr_copy); + +const struct snd_compress_ops sof_probe_compressed_ops = { + .copy = sof_probe_compr_copy, +}; +EXPORT_SYMBOL (sof_probe_compressed_ops);
sound/soc/sof/compress.h +1 -14
@@ -13,20 +13,7 @@#include <sound/compress_driver.h> +extern struct snd_soc_cdai_ops sof_probe_compr_ops;extern const struct snd_compress_ops sof_probe_compressed_ops; -int sof_probe_compr_open (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai); -int sof_probe_compr_free (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai); -int sof_probe_compr_set_params (struct snd_compr_stream *cstream, -struct snd_compr_params *params,struct snd_soc_dai *dai); -int sof_probe_compr_trigger (struct snd_compr_stream *cstream,int cmd, -struct snd_soc_dai *dai); -int sof_probe_compr_pointer (struct snd_compr_stream *cstream, -struct snd_compr_tstamp *tstamp,struct snd_soc_dai *dai); -int sof_probe_compr_copy (struct snd_soc_component *component, -struct snd_compr_stream *cstream, -char __user *buf,size_t count); -#endif
sound/soc/sof/intel/hda-dai.c +4 -12
@@ -16,6 +16,10 @@ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) +#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES) +#include "../compress.h" +#endif + struct hda_pipe_params { u8 host_dma_id; u8 link_dma_id;
@@ -400,18 +404,6 @@ static const struct snd_soc_dai_ops hda_link_dai_ops = { .prepare = hda_link_pcm_prepare, }; -#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA_PROBES ) -#include "../compress.h" - -static struct snd_soc_cdai_ops sof_probe_compr_ops = { - .startup = sof_probe_compr_open, - .shutdown = sof_probe_compr_free, - .set_params = sof_probe_compr_set_params, - .trigger = sof_probe_compr_trigger, - .pointer = sof_probe_compr_pointer, -}; - -#endif #endif static int ssp_dai_hw_params(struct snd_pcm_substream *substream,
Signature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 4/6 ASoC: SOF: probe: Merge and clean up the probe and compress files
In reply to Peter UjfalusiThe probe debug functionality is implemented via compress support and it was spread across two set of files:
probe.c/h
compress.c/h
Merge the two files into sof-probes.s/h and clean them up by removing unused struct definitions, functions. We can also move most of the functions static as they are only used internally.
---
sound/soc/sof/Makefile | 3 +-
sound/soc/sof/compress.c | 152 -------------
sound/soc/sof/compress.h | 19 --
sound/soc/sof/core.c | 2 +-
sound/soc/sof/debug.c | 2 +-
sound/soc/sof/intel/hda-dai.c | 2 +-
sound/soc/sof/pcm.c | 2 +-
sound/soc/sof/probe.h | 85 -------
sound/soc/sof/{probe.c => sof-probes.c} | 280 +++++++++++++++---------
sound/soc/sof/sof-probes.h | 38 ++++
10 files changed, 221 insertions(+), 364 deletions(-)
delete mode 100644 sound/soc/sof/compress.c
delete mode 100644 sound/soc/sof/compress.h
delete mode 100644 sound/soc/sof/probe.h
rename sound/soc/sof/{probe.c => sof-probes.c} (52%)
create mode 100644 sound/soc/sof/sof-probes.hsound/soc/sof/Makefile +2 -1
@@ -2,7 +2,8 @@ snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ control.o trace.o utils.o sof-audio.o -snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += probe.o compress.o + +snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += sof-probes.o snd-sof-pci-objs := sof-pci-dev.o snd-sof-acpi-objs := sof-acpi-dev.o
sound/soc/sof/compress.c deleted +0 -152
152 lines not on this page · raw message
sound/soc/sof/compress.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ -/* -* This file is provided under a dual BSD/GPLv2 license. When using or -* redistributing this file, you may do so under either license. -* -* Copyright(c) 2019-2020 Intel Corporation. All rights reserved. -* -* Author: Cezary Rojewski <[email protected]> -*/ - -#ifndef __SOF_COMPRESS_H -#define __SOF_COMPRESS_H - -#include <sound/compress_driver.h> - -extern struct snd_soc_cdai_ops sof_probe_compr_ops; -extern const struct snd_compress_ops sof_probe_compressed_ops; - -#endif
sound/soc/sof/core.c +1 -1
@@ -15,7 +15,7 @@#include "sof-priv.h" #include "ops.h" #if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES ) -#include "probe.h" +#include "sof-probes.h" #endif /* see SOF_DBG_ flags */
sound/soc/sof/debug.c +1 -1
@@ -20,7 +20,7 @@#include "ops.h" #if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES ) -#include "probe.h" +#include "sof-probes.h" /** * strsplit_u32 - Split string into sequence of u32 tokens
sound/soc/sof/intel/hda-dai.c +1 -1
@@ -17,7 +17,7 @@#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )#if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES ) -#include "../compress.h" +#include "../sof-probes.h" #endif struct hda_pipe_params {
sound/soc/sof/pcm.c +1 -1
@@ -17,7 +17,7 @@#include "sof-audio.h" #include "ops.h" #if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES ) -#include "compress.h" +#include "sof-probes.h" #endif /* Create DMA buffer page table for DSP */
sound/soc/sof/probe.h deleted +0 -85
85 lines not on this page · raw message
sound/soc/sof/sof-probes.c renamed from sound/soc/sof/probe.c +177 -103
343 lines not on this page · raw message
sound/soc/sof/sof-probes.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2019-2021 Intel Corporation. All rights reserved. +* Author: Cezary Rojewski <[email protected]> +*/ + +#ifndef __SOF_PROBES_H +#define __SOF_PROBES_H + +#include <sound/compress_driver.h> +#include <sound/sof/header.h> + +struct snd_sof_dev ; + +#define SOF_PROBE_INVALID_NODE_ID UINT_MAX + +struct sof_probe_point_desc { +unsigned int buffer_id; +unsigned int purpose; +unsigned int stream_tag; +} __packed; + +int sof_ipc_probe_points_info (struct snd_sof_dev *sdev, +struct sof_probe_point_desc **desc, +size_t *num_desc); +int sof_ipc_probe_points_add (struct snd_sof_dev *sdev, +struct sof_probe_point_desc *desc, +size_t num_desc); +int sof_ipc_probe_points_remove (struct snd_sof_dev *sdev, +unsigned int *buffer_id,size_t num_buffer_id); + +extern struct snd_soc_cdai_ops sof_probe_compr_ops; +extern const struct snd_compress_ops sof_probe_compressed_ops; + +#endif
Signature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 5/6 ASoC: SOF: Intel: Rename hda-compress.c to hda-probes.c
In reply to Peter UjfalusiThe hda-compress.c is implementing the SOF probe support for intel HDA platforms using compress API.
To avoid the confusion, rename it to reflect this.
---
sound/soc/sof/intel/Makefile | 2 +-
sound/soc/sof/intel/{hda-compress.c => hda-probes.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename sound/soc/sof/intel/{hda-compress.c => hda-probes.c} (100%)sound/soc/sof/intel/Makefile +1 -1
@@ -9,7 +9,7 @@ snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \ hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \ hda-dai.o hda-bus.o \ apl.o cnl.o tgl.o icl.o -snd-sof-intel-hda-common-$(CONFIG_SND_SOC_SOF_HDA_PROBES) += hda-compress.o +snd-sof-intel-hda-common-$(CONFIG_SND_SOC_SOF_HDA_PROBES) += hda-probes.o snd-sof-intel-hda-objs := hda-codec.o
sound/soc/sof/intel/hda-probes.c renamed from sound/soc/sof/intel/hda-compress.c +0 -0
Signature · 1 line
2.33.0
Peter Ujfalusi
maintainerPATCH 6/6 ASoC: SOF: sof-probes: Correct the function names used for snd_soc_cdai_ops
In reply to Peter UjfalusiThe snd_soc_cdai_ops have startup and shutdown callbacks defined unlike the component callbacks where open and free is used.
--- sound/soc/sof/sof-probes.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/sof/sof-probes.c +6 -6
@@ -230,8 +230,8 @@ int sof_ipc_probe_points_remove(struct snd_sof_dev *sdev, }EXPORT_SYMBOL (sof_ipc_probe_points_remove); -static int sof_probe_compr_open (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai) +static int sof_probe_compr_startup (struct snd_compr_stream *cstream, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);int ret;
@@ -246,8 +246,8 @@ static int sof_probe_compr_open(struct snd_compr_stream *cstream,return 0 ; } -static int sof_probe_compr_free (struct snd_compr_stream *cstream, -struct snd_soc_dai *dai) +static int sof_probe_compr_shutdown (struct snd_compr_stream *cstream, +struct snd_soc_dai *dai) {struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (dai->component);struct sof_probe_point_desc *desc;
@@ -322,8 +322,8 @@ static int sof_probe_compr_pointer(struct snd_compr_stream *cstream, }struct snd_soc_cdai_ops sof_probe_compr_ops = { - .startup = sof_probe_compr_open, - .shutdown = sof_probe_compr_free, + .startup = sof_probe_compr_startup, + .shutdown = sof_probe_compr_shutdown, .set_params = sof_probe_compr_set_params, .trigger = sof_probe_compr_trigger, .pointer = sof_probe_compr_pointer,
Signature · 1 line
2.33.0
Mark Brown
maintainerQuoted 8 lines · Peter Ujfalusi
The probe debug feature of SOF can be used to extract streams of data from a given point of a pipeline for analysis.
The support is implemented by using the ALSA/ASoC compress support for the capture stream, but the code can not be used by/for a normal compressed data stream. It is a debug feature.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: SOF: ipc: Add probe message logging to ipc_log_header()
commit: 4ba344dc792fc665c6e95d08ac13ba30f908bbf7
[2/6] ASoC: SOF: pcm: Remove non existent CONFIG_SND_SOC_SOF_COMPRESS reference
commit: 8a720724589e8d782ad3ad4e0f08977de00bea5f
[3/6] ASoC: SOF: compress: move and export sof_probe_compr_ops
commit: 2dc51106ccc6c64b9ea68ddd9ec533f7e67e081d
[4/6] ASoC: SOF: probe: Merge and clean up the probe and compress files
commit: 7bbdda8009001d66611314e67a3f498d4b412c64
[5/6] ASoC: SOF: Intel: Rename hda-compress.c to hda-probes.c
commit: f95b4152ad75274734ed23d0546d24f5e7fc9c3c
[6/6] ASoC: SOF: sof-probes: Correct the function names used for snd_soc_cdai_ops
commit: 49efed50588547b0f13897b6fc69f155c2e2af50All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark