Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Modify the host trace_init parameter list to include dmab

Stop host code (AMD, Intel) to access sdev->dmatb directly.
Modify the trace_init prototype to include the pointer to a
struct snd_dma_buffer. The ipc3-dtrace passes for now the pointer to
sdev->dmatb, but the aim is to move all tracing related runtime information
local to a trace implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
4b49cbd1 b69979a1

+11 -9
+2 -2
sound/soc/sof/amd/acp-trace.c
··· 34 34 } 35 35 EXPORT_SYMBOL_NS(acp_sof_trace_release, SND_SOC_SOF_AMD_COMMON); 36 36 37 - int acp_sof_trace_init(struct snd_sof_dev *sdev, 37 + int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, 38 38 struct sof_ipc_dma_trace_params_ext *dtrace_params) 39 39 { 40 40 struct acp_dsp_stream *stream; ··· 46 46 if (!stream) 47 47 return -ENODEV; 48 48 49 - stream->dmab = &sdev->dmatb; 49 + stream->dmab = dmab; 50 50 stream->num_pages = NUM_PAGES; 51 51 52 52 ret = acp_dsp_stream_config(sdev, stream);
+1 -1
sound/soc/sof/amd/acp.h
··· 212 212 int snd_amd_acp_find_config(struct pci_dev *pci); 213 213 214 214 /* Trace */ 215 - int acp_sof_trace_init(struct snd_sof_dev *sdev, 215 + int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, 216 216 struct sof_ipc_dma_trace_params_ext *dtrace_params); 217 217 int acp_sof_trace_release(struct snd_sof_dev *sdev); 218 218
+2 -2
sound/soc/sof/intel/hda-trace.c
··· 36 36 return ret; 37 37 } 38 38 39 - int hda_dsp_trace_init(struct snd_sof_dev *sdev, 39 + int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, 40 40 struct sof_ipc_dma_trace_params_ext *dtrace_params) 41 41 { 42 42 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; ··· 57 57 * initialize capture stream, set BDL address and return corresponding 58 58 * stream tag which will be sent to the firmware by IPC message. 59 59 */ 60 - ret = hda_dsp_trace_prepare(sdev, &sdev->dmatb); 60 + ret = hda_dsp_trace_prepare(sdev, dmab); 61 61 if (ret < 0) { 62 62 dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret); 63 63 hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE,
+1 -1
sound/soc/sof/intel/hda.h
··· 658 658 /* 659 659 * Trace Control. 660 660 */ 661 - int hda_dsp_trace_init(struct snd_sof_dev *sdev, 661 + int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, 662 662 struct sof_ipc_dma_trace_params_ext *dtrace_params); 663 663 int hda_dsp_trace_release(struct snd_sof_dev *sdev); 664 664 int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);
+1 -1
sound/soc/sof/ipc3-dtrace.c
··· 412 412 sdev->host_offset = 0; 413 413 sdev->dtrace_draining = false; 414 414 415 - ret = sof_dtrace_host_init(sdev, &params); 415 + ret = sof_dtrace_host_init(sdev, &sdev->dmatb, &params); 416 416 if (ret < 0) { 417 417 dev_err(sdev->dev, "Host dtrace init failed: %d\n", ret); 418 418 return ret;
+2 -1
sound/soc/sof/ipc3-priv.h
··· 31 31 32 32 /* dtrace platform callback wrappers */ 33 33 static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev, 34 + struct snd_dma_buffer *dmatb, 34 35 struct sof_ipc_dma_trace_params_ext *dtrace_params) 35 36 { 36 37 struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops; 37 38 38 39 if (dsp_ops->trace_init) 39 - return dsp_ops->trace_init(sdev, dtrace_params); 40 + return dsp_ops->trace_init(sdev, dmatb, dtrace_params); 40 41 41 42 return 0; 42 43 }
+2 -1
sound/soc/sof/sof-priv.h
··· 254 254 size_t size, const char *name, 255 255 enum sof_debugfs_access_type access_type); /* optional */ 256 256 257 - /* host DMA trace initialization */ 257 + /* host DMA trace (IPC3) */ 258 258 int (*trace_init)(struct snd_sof_dev *sdev, 259 + struct snd_dma_buffer *dmatb, 259 260 struct sof_ipc_dma_trace_params_ext *dtrace_params); /* optional */ 260 261 int (*trace_release)(struct snd_sof_dev *sdev); /* optional */ 261 262 int (*trace_trigger)(struct snd_sof_dev *sdev,