| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* |
| 3 | * Copyright(c) 2021 Intel Corporation |
| 4 | * |
| 5 | * Authors: Cezary Rojewski <cezary.rojewski@intel.com> |
| 6 | * Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com> |
| 7 | */ |
| 8 | |
| 9 | #ifndef __SOUND_SOC_INTEL_AVS_PATH_H |
| 10 | #define __SOUND_SOC_INTEL_AVS_PATH_H |
| 11 | |
| 12 | #include <linux/list.h> |
| 13 | #include "avs.h" |
| 14 | #include "topology.h" |
| 15 | |
| 16 | #define AVS_COND_TYPE_NONE 0 |
| 17 | #define AVS_COND_TYPE_AECREF 1 |
| 18 | |
| 19 | struct avs_path { |
| 20 | u32 dma_id; |
| 21 | struct list_head ppl_list; |
| 22 | u32 state; |
| 23 | |
| 24 | /* condpath navigation for standard paths */ |
| 25 | struct list_head source_list; |
| 26 | struct list_head sink_list; |
| 27 | |
| 28 | /* conditional path fields */ |
| 29 | struct avs_path *source; |
| 30 | struct avs_path *sink; |
| 31 | struct list_head source_node; |
| 32 | struct list_head sink_node; |
| 33 | |
| 34 | struct avs_tplg_path *template; |
| 35 | struct avs_dev *owner; |
| 36 | /* device path management */ |
| 37 | struct list_head node; |
| 38 | }; |
| 39 | |
| 40 | struct avs_path_pipeline { |
| 41 | u8 instance_id; |
| 42 | struct list_head mod_list; |
| 43 | struct list_head binding_list; |
| 44 | |
| 45 | struct avs_tplg_pipeline *template; |
| 46 | struct avs_path *owner; |
| 47 | /* path pipelines management */ |
| 48 | struct list_head node; |
| 49 | }; |
| 50 | |
| 51 | struct avs_path_module { |
| 52 | u16 module_id; |
| 53 | u8 instance_id; |
| 54 | union avs_gtw_attributes gtw_attrs; |
| 55 | |
| 56 | struct avs_tplg_module *template; |
| 57 | struct avs_path_pipeline *owner; |
| 58 | /* pipeline modules management */ |
| 59 | struct list_head node; |
| 60 | }; |
| 61 | |
| 62 | struct avs_path_binding { |
| 63 | struct avs_path_module *source; |
| 64 | u8 source_pin; |
| 65 | struct avs_path_module *sink; |
| 66 | u8 sink_pin; |
| 67 | |
| 68 | struct avs_tplg_binding *template; |
| 69 | struct avs_path_pipeline *owner; |
| 70 | /* pipeline bindings management */ |
| 71 | struct list_head node; |
| 72 | }; |
| 73 | |
| 74 | void avs_path_free(struct avs_path *path); |
| 75 | struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id, |
| 76 | struct avs_tplg_path_template *template, |
| 77 | struct snd_pcm_hw_params *fe_params, |
| 78 | struct snd_pcm_hw_params *be_params); |
| 79 | int avs_path_bind(struct avs_path *path); |
| 80 | int avs_path_unbind(struct avs_path *path); |
| 81 | int avs_path_reset(struct avs_path *path); |
| 82 | int avs_path_pause(struct avs_path *path); |
| 83 | int avs_path_run(struct avs_path *path, int trigger); |
| 84 | |
| 85 | int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template *template, |
| 86 | struct snd_pcm_hw_constraint_list *rate_list, |
| 87 | struct snd_pcm_hw_constraint_list *channels_list, |
| 88 | struct snd_pcm_hw_constraint_list *sample_bits_list); |
| 89 | |
| 90 | int avs_peakvol_set_volume(struct avs_dev *adev, struct avs_path_module *mod, |
| 91 | struct soc_mixer_control *mc, long *input); |
| 92 | int avs_peakvol_set_mute(struct avs_dev *adev, struct avs_path_module *mod, |
| 93 | struct soc_mixer_control *mc, long *input); |
| 94 | |
| 95 | #endif |
| 96 | |