1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /*
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.
5  *
6  * Copyright(c) 2021 Intel Corporation. All rights reserved.
7  */
8 
9 #ifndef __SOUND_SOC_SOF_IPC3_PRIV_H
10 #define __SOUND_SOC_SOF_IPC3_PRIV_H
11 
12 #include "sof-priv.h"
13 
14 /* IPC3 specific ops */
15 extern const struct sof_ipc_pcm_ops ipc3_pcm_ops;
16 extern const struct sof_ipc_tplg_ops ipc3_tplg_ops;
17 extern const struct sof_ipc_tplg_control_ops tplg_ipc3_control_ops;
18 extern const struct sof_ipc_fw_loader_ops ipc3_loader_ops;
19 extern const struct sof_ipc_fw_tracing_ops ipc3_dtrace_ops;
20 
21 /* helpers for fw_ready and ext_manifest parsing */
22 int sof_ipc3_get_ext_windows(struct snd_sof_dev *sdev,
23 			     const struct sof_ipc_ext_data_hdr *ext_hdr);
24 int sof_ipc3_get_cc_info(struct snd_sof_dev *sdev,
25 			 const struct sof_ipc_ext_data_hdr *ext_hdr);
26 int sof_ipc3_validate_fw_version(struct snd_sof_dev *sdev);
27 
28 /* dtrace position update */
29 int ipc3_dtrace_posn_update(struct snd_sof_dev *sdev,
30 			    struct sof_ipc_dma_trace_posn *posn);
31 
32 /* dtrace platform callback wrappers */
sof_dtrace_host_init(struct snd_sof_dev * sdev,struct snd_dma_buffer * dmatb,struct sof_ipc_dma_trace_params_ext * dtrace_params)33 static inline int sof_dtrace_host_init(struct snd_sof_dev *sdev,
34 				       struct snd_dma_buffer *dmatb,
35 				       struct sof_ipc_dma_trace_params_ext *dtrace_params)
36 {
37 	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
38 
39 	if (dsp_ops->trace_init)
40 		return dsp_ops->trace_init(sdev, dmatb, dtrace_params);
41 
42 	return 0;
43 }
44 
sof_dtrace_host_release(struct snd_sof_dev * sdev)45 static inline int sof_dtrace_host_release(struct snd_sof_dev *sdev)
46 {
47 	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
48 
49 	if (dsp_ops->trace_release)
50 		return dsp_ops->trace_release(sdev);
51 
52 	return 0;
53 }
54 
sof_dtrace_host_trigger(struct snd_sof_dev * sdev,int cmd)55 static inline int sof_dtrace_host_trigger(struct snd_sof_dev *sdev, int cmd)
56 {
57 	struct snd_sof_dsp_ops *dsp_ops = sdev->pdata->desc->ops;
58 
59 	if (dsp_ops->trace_trigger)
60 		return dsp_ops->trace_trigger(sdev, cmd);
61 
62 	return 0;
63 }
64 
65 #endif
66