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>
This commit is contained in:
Peter Ujfalusi 2022-05-16 13:47:09 +03:00 коммит произвёл Mark Brown
Родитель b69979a1ec
Коммит 4b49cbd1e7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
7 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -34,7 +34,7 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev)
} }
EXPORT_SYMBOL_NS(acp_sof_trace_release, SND_SOC_SOF_AMD_COMMON); EXPORT_SYMBOL_NS(acp_sof_trace_release, SND_SOC_SOF_AMD_COMMON);
int acp_sof_trace_init(struct snd_sof_dev *sdev, int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params) struct sof_ipc_dma_trace_params_ext *dtrace_params)
{ {
struct acp_dsp_stream *stream; struct acp_dsp_stream *stream;
@ -46,7 +46,7 @@ int acp_sof_trace_init(struct snd_sof_dev *sdev,
if (!stream) if (!stream)
return -ENODEV; return -ENODEV;
stream->dmab = &sdev->dmatb; stream->dmab = dmab;
stream->num_pages = NUM_PAGES; stream->num_pages = NUM_PAGES;
ret = acp_dsp_stream_config(sdev, stream); ret = acp_dsp_stream_config(sdev, stream);

Просмотреть файл

@ -212,7 +212,7 @@ extern struct snd_sof_dsp_ops sof_renoir_ops;
int snd_amd_acp_find_config(struct pci_dev *pci); int snd_amd_acp_find_config(struct pci_dev *pci);
/* Trace */ /* Trace */
int acp_sof_trace_init(struct snd_sof_dev *sdev, int acp_sof_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params); struct sof_ipc_dma_trace_params_ext *dtrace_params);
int acp_sof_trace_release(struct snd_sof_dev *sdev); int acp_sof_trace_release(struct snd_sof_dev *sdev);

Просмотреть файл

@ -36,7 +36,7 @@ static int hda_dsp_trace_prepare(struct snd_sof_dev *sdev, struct snd_dma_buffer
return ret; return ret;
} }
int hda_dsp_trace_init(struct snd_sof_dev *sdev, int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params) struct sof_ipc_dma_trace_params_ext *dtrace_params)
{ {
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
@ -57,7 +57,7 @@ int hda_dsp_trace_init(struct snd_sof_dev *sdev,
* initialize capture stream, set BDL address and return corresponding * initialize capture stream, set BDL address and return corresponding
* stream tag which will be sent to the firmware by IPC message. * stream tag which will be sent to the firmware by IPC message.
*/ */
ret = hda_dsp_trace_prepare(sdev, &sdev->dmatb); ret = hda_dsp_trace_prepare(sdev, dmab);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret); dev_err(sdev->dev, "error: hdac trace init failed: %d\n", ret);
hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE, hda_dsp_stream_put(sdev, SNDRV_PCM_STREAM_CAPTURE,

Просмотреть файл

@ -658,7 +658,7 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; }
/* /*
* Trace Control. * Trace Control.
*/ */
int hda_dsp_trace_init(struct snd_sof_dev *sdev, int hda_dsp_trace_init(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab,
struct sof_ipc_dma_trace_params_ext *dtrace_params); struct sof_ipc_dma_trace_params_ext *dtrace_params);
int hda_dsp_trace_release(struct snd_sof_dev *sdev); int hda_dsp_trace_release(struct snd_sof_dev *sdev);
int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd); int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);

Просмотреть файл

@ -412,7 +412,7 @@ static int ipc3_dtrace_enable(struct snd_sof_dev *sdev)
sdev->host_offset = 0; sdev->host_offset = 0;
sdev->dtrace_draining = false; sdev->dtrace_draining = false;
ret = sof_dtrace_host_init(sdev, &params); ret = sof_dtrace_host_init(sdev, &sdev->dmatb, &params);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "Host dtrace init failed: %d\n", ret); dev_err(sdev->dev, "Host dtrace init failed: %d\n", ret);
return ret; return ret;

Просмотреть файл

@ -31,12 +31,13 @@ int ipc3_dtrace_posn_update(struct snd_sof_dev *sdev,
/* dtrace platform callback wrappers */ /* dtrace platform callback wrappers */
static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev, static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev,
struct snd_dma_buffer *dmatb,
struct sof_ipc_dma_trace_params_ext *dtrace_params) struct sof_ipc_dma_trace_params_ext *dtrace_params)
{ {
struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops; struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
if (dsp_ops->trace_init) if (dsp_ops->trace_init)
return dsp_ops->trace_init(sdev, dtrace_params); return dsp_ops->trace_init(sdev, dmatb, dtrace_params);
return 0; return 0;
} }

Просмотреть файл

@ -254,8 +254,9 @@ struct snd_sof_dsp_ops {
size_t size, const char *name, size_t size, const char *name,
enum sof_debugfs_access_type access_type); /* optional */ enum sof_debugfs_access_type access_type); /* optional */
/* host DMA trace initialization */ /* host DMA trace (IPC3) */
int (*trace_init)(struct snd_sof_dev *sdev, int (*trace_init)(struct snd_sof_dev *sdev,
struct snd_dma_buffer *dmatb,
struct sof_ipc_dma_trace_params_ext *dtrace_params); /* optional */ struct sof_ipc_dma_trace_params_ext *dtrace_params); /* optional */
int (*trace_release)(struct snd_sof_dev *sdev); /* optional */ int (*trace_release)(struct snd_sof_dev *sdev); /* optional */
int (*trace_trigger)(struct snd_sof_dev *sdev, int (*trace_trigger)(struct snd_sof_dev *sdev,