xref: /openbmc/linux/sound/soc/intel/avs/path.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1f61ad1e9SCezary Rojewski /* SPDX-License-Identifier: GPL-2.0-only */
2f61ad1e9SCezary Rojewski /*
3f61ad1e9SCezary Rojewski  * Copyright(c) 2021 Intel Corporation. All rights reserved.
4f61ad1e9SCezary Rojewski  *
5f61ad1e9SCezary Rojewski  * Authors: Cezary Rojewski <cezary.rojewski@intel.com>
6f61ad1e9SCezary Rojewski  *          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
7f61ad1e9SCezary Rojewski  */
8f61ad1e9SCezary Rojewski 
9f61ad1e9SCezary Rojewski #ifndef __SOUND_SOC_INTEL_AVS_PATH_H
10f61ad1e9SCezary Rojewski #define __SOUND_SOC_INTEL_AVS_PATH_H
11f61ad1e9SCezary Rojewski 
12f61ad1e9SCezary Rojewski #include <linux/list.h>
13f61ad1e9SCezary Rojewski #include "avs.h"
14f61ad1e9SCezary Rojewski #include "topology.h"
15f61ad1e9SCezary Rojewski 
16f61ad1e9SCezary Rojewski struct avs_path {
17f61ad1e9SCezary Rojewski 	u32 dma_id;
18f61ad1e9SCezary Rojewski 	struct list_head ppl_list;
19f61ad1e9SCezary Rojewski 	u32 state;
20f61ad1e9SCezary Rojewski 
21f61ad1e9SCezary Rojewski 	struct avs_tplg_path *template;
22f61ad1e9SCezary Rojewski 	struct avs_dev *owner;
23f61ad1e9SCezary Rojewski 	/* device path management */
24f61ad1e9SCezary Rojewski 	struct list_head node;
25f61ad1e9SCezary Rojewski };
26f61ad1e9SCezary Rojewski 
27f61ad1e9SCezary Rojewski struct avs_path_pipeline {
28f61ad1e9SCezary Rojewski 	u8 instance_id;
29f61ad1e9SCezary Rojewski 	struct list_head mod_list;
30f61ad1e9SCezary Rojewski 	struct list_head binding_list;
31f61ad1e9SCezary Rojewski 
32f61ad1e9SCezary Rojewski 	struct avs_tplg_pipeline *template;
33f61ad1e9SCezary Rojewski 	struct avs_path *owner;
34f61ad1e9SCezary Rojewski 	/* path pipelines management */
35f61ad1e9SCezary Rojewski 	struct list_head node;
36f61ad1e9SCezary Rojewski };
37f61ad1e9SCezary Rojewski 
38f61ad1e9SCezary Rojewski struct avs_path_module {
39f61ad1e9SCezary Rojewski 	u16 module_id;
40*320f4d86SAmadeusz Sławiński 	u8 instance_id;
41274d79e5SCezary Rojewski 	union avs_gtw_attributes gtw_attrs;
42f61ad1e9SCezary Rojewski 
43f61ad1e9SCezary Rojewski 	struct avs_tplg_module *template;
44f61ad1e9SCezary Rojewski 	struct avs_path_pipeline *owner;
45f61ad1e9SCezary Rojewski 	/* pipeline modules management */
46f61ad1e9SCezary Rojewski 	struct list_head node;
47f61ad1e9SCezary Rojewski };
48f61ad1e9SCezary Rojewski 
49f61ad1e9SCezary Rojewski struct avs_path_binding {
50f61ad1e9SCezary Rojewski 	struct avs_path_module *source;
51f61ad1e9SCezary Rojewski 	u8 source_pin;
52f61ad1e9SCezary Rojewski 	struct avs_path_module *sink;
53f61ad1e9SCezary Rojewski 	u8 sink_pin;
54f61ad1e9SCezary Rojewski 
55f61ad1e9SCezary Rojewski 	struct avs_tplg_binding *template;
56f61ad1e9SCezary Rojewski 	struct avs_path_pipeline *owner;
57f61ad1e9SCezary Rojewski 	/* pipeline bindings management */
58f61ad1e9SCezary Rojewski 	struct list_head node;
59f61ad1e9SCezary Rojewski };
60f61ad1e9SCezary Rojewski 
610ef88207SCezary Rojewski void avs_path_free(struct avs_path *path);
620ef88207SCezary Rojewski struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
630ef88207SCezary Rojewski 				 struct avs_tplg_path_template *template,
640ef88207SCezary Rojewski 				 struct snd_pcm_hw_params *fe_params,
650ef88207SCezary Rojewski 				 struct snd_pcm_hw_params *be_params);
66c9605999SCezary Rojewski int avs_path_bind(struct avs_path *path);
67c9605999SCezary Rojewski int avs_path_unbind(struct avs_path *path);
68c9605999SCezary Rojewski int avs_path_reset(struct avs_path *path);
69c9605999SCezary Rojewski int avs_path_pause(struct avs_path *path);
70c9605999SCezary Rojewski int avs_path_run(struct avs_path *path, int trigger);
710ef88207SCezary Rojewski 
72f61ad1e9SCezary Rojewski #endif
73