xref: /linux/sound/soc/sof/sof-client-probes.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __SOF_CLIENT_PROBES_H
4 #define __SOF_CLIENT_PROBES_H
5 
6 struct snd_compr_stream;
7 struct snd_compr_tstamp;
8 struct snd_compr_params;
9 struct sof_client_dev;
10 struct snd_soc_dai;
11 
12 /*
13  * Callbacks used on platforms where the control for audio is split between
14  * DSP and host, like HDA.
15  */
16 struct sof_probes_host_ops {
17 	int (*startup)(struct sof_client_dev *cdev, struct snd_compr_stream *cstream,
18 		       struct snd_soc_dai *dai, u32 *stream_id);
19 	int (*shutdown)(struct sof_client_dev *cdev, struct snd_compr_stream *cstream,
20 			struct snd_soc_dai *dai);
21 	int (*set_params)(struct sof_client_dev *cdev, struct snd_compr_stream *cstream,
22 			  struct snd_compr_params *params,
23 			  struct snd_soc_dai *dai);
24 	int (*trigger)(struct sof_client_dev *cdev, struct snd_compr_stream *cstream,
25 		       int cmd, struct snd_soc_dai *dai);
26 	int (*pointer)(struct sof_client_dev *cdev, struct snd_compr_stream *cstream,
27 		       struct snd_compr_tstamp *tstamp,
28 		       struct snd_soc_dai *dai);
29 };
30 
31 struct sof_probe_point_desc {
32 	unsigned int buffer_id;
33 	unsigned int purpose;
34 	unsigned int stream_tag;
35 } __packed;
36 
37 struct sof_probes_ipc_ops {
38 	int (*init)(struct sof_client_dev *cdev, u32 stream_tag,
39 		    size_t buffer_size);
40 	int (*deinit)(struct sof_client_dev *cdev);
41 	int (*points_info)(struct sof_client_dev *cdev,
42 			   struct sof_probe_point_desc **desc,
43 			   size_t *num_desc);
44 	int (*points_add)(struct sof_client_dev *cdev,
45 			  struct sof_probe_point_desc *desc,
46 			  size_t num_desc);
47 	int (*points_remove)(struct sof_client_dev *cdev,
48 			     unsigned int *buffer_id, size_t num_buffer_id);
49 };
50 
51 extern const struct sof_probes_ipc_ops ipc3_probe_ops;
52 extern const struct sof_probes_ipc_ops ipc4_probe_ops;
53 
54 struct sof_probes_priv {
55 	struct dentry *dfs_points;
56 	struct dentry *dfs_points_remove;
57 	u32 extractor_stream_tag;
58 	struct snd_soc_card card;
59 	void *ipc_priv;
60 
61 	const struct sof_probes_host_ops *host_ops;
62 	const struct sof_probes_ipc_ops *ipc_ops;
63 };
64 
65 #endif
66