1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
3 // This file is provided under a dual BSD/GPLv2 license. When using or
4 // redistributing this file, you may do so under either license.
6 // Copyright(c) 2021 Advanced Micro Devices, Inc. All rights reserved.
8 // Authors: Vishnuvardhanrao Ravuapati <vishnuvardhanrao.ravulapati@amd.com>
9 // V Sujith Kumar Reddy <Vsujithkumar.Reddy@amd.com>
11 /*This file support Host TRACE Logger driver callback for SOF FW */
15 #define ACP_LOGGER_STREAM 8
18 int acp_sof_trace_release(struct snd_sof_dev
*sdev
)
20 struct acp_dsp_stream
*stream
;
21 struct acp_dev_data
*adata
;
24 adata
= sdev
->pdata
->hw_pdata
;
25 stream
= adata
->dtrace_stream
;
26 ret
= acp_dsp_stream_put(sdev
, stream
);
28 dev_err(sdev
->dev
, "Failed to release trace stream\n");
32 adata
->dtrace_stream
= NULL
;
35 EXPORT_SYMBOL_NS(acp_sof_trace_release
, "SND_SOC_SOF_AMD_COMMON");
37 int acp_sof_trace_init(struct snd_sof_dev
*sdev
, struct snd_dma_buffer
*dmab
,
38 struct sof_ipc_dma_trace_params_ext
*dtrace_params
)
40 struct acp_dsp_stream
*stream
;
41 struct acp_dev_data
*adata
;
44 adata
= sdev
->pdata
->hw_pdata
;
45 stream
= acp_dsp_stream_get(sdev
, ACP_LOGGER_STREAM
);
50 stream
->num_pages
= NUM_PAGES
;
52 ret
= acp_dsp_stream_config(sdev
, stream
);
54 acp_dsp_stream_put(sdev
, stream
);
58 adata
->dtrace_stream
= stream
;
59 dtrace_params
->stream_tag
= stream
->stream_tag
;
60 dtrace_params
->buffer
.phy_addr
= stream
->reg_offset
;
64 EXPORT_SYMBOL_NS(acp_sof_trace_init
, "SND_SOC_SOF_AMD_COMMON");