xref: /linux/sound/soc/sof/sof-client-probes.h (revision 05a54fa773284d1a7923cdfdd8f0c8dabb98bd26)
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_tstamp64;
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_tstamp64 *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 enum sof_probe_info_type {
38 	PROBES_INFO_ACTIVE_PROBES,
39 	PROBES_INFO_AVAILABE_PROBES,
40 };
41 
42 struct sof_probes_ipc_ops {
43 	int (*init)(struct sof_client_dev *cdev, u32 stream_tag,
44 		    size_t buffer_size);
45 	int (*deinit)(struct sof_client_dev *cdev);
46 	int (*points_info)(struct sof_client_dev *cdev,
47 			   struct sof_probe_point_desc **desc,
48 			   size_t *num_desc, enum sof_probe_info_type type);
49 	int (*point_print)(struct sof_client_dev *cdev, char *buf, size_t size,
50 			   struct sof_probe_point_desc *desc);
51 	int (*points_add)(struct sof_client_dev *cdev,
52 			  struct sof_probe_point_desc *desc,
53 			  size_t num_desc);
54 	int (*points_remove)(struct sof_client_dev *cdev,
55 			     unsigned int *buffer_id, size_t num_buffer_id);
56 };
57 
58 extern const struct sof_probes_ipc_ops ipc3_probe_ops;
59 extern const struct sof_probes_ipc_ops ipc4_probe_ops;
60 
61 struct sof_probes_priv {
62 	struct dentry *dfs_points;
63 	struct dentry *dfs_points_remove;
64 	u32 extractor_stream_tag;
65 	struct snd_soc_card card;
66 	void *ipc_priv;
67 
68 	const struct sof_probes_host_ops *host_ops;
69 	const struct sof_probes_ipc_ops *ipc_ops;
70 };
71 
72 #endif
73