Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright(c) 2021 Intel Corporation. All rights reserved.
0004  *
0005  * Authors: Cezary Rojewski <cezary.rojewski@intel.com>
0006  *          Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
0007  */
0008 
0009 #ifndef __SOUND_SOC_INTEL_AVS_TPLG_H
0010 #define __SOUND_SOC_INTEL_AVS_TPLG_H
0011 
0012 #include <linux/list.h>
0013 #include "messages.h"
0014 
0015 #define INVALID_OBJECT_ID   UINT_MAX
0016 
0017 struct snd_soc_component;
0018 
0019 struct avs_tplg {
0020     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0021     u32 version;
0022     struct snd_soc_component *comp;
0023 
0024     struct avs_tplg_library *libs;
0025     u32 num_libs;
0026     struct avs_audio_format *fmts;
0027     u32 num_fmts;
0028     struct avs_tplg_modcfg_base *modcfgs_base;
0029     u32 num_modcfgs_base;
0030     struct avs_tplg_modcfg_ext *modcfgs_ext;
0031     u32 num_modcfgs_ext;
0032     struct avs_tplg_pplcfg *pplcfgs;
0033     u32 num_pplcfgs;
0034     struct avs_tplg_binding *bindings;
0035     u32 num_bindings;
0036 
0037     struct list_head path_tmpl_list;
0038 };
0039 
0040 struct avs_tplg_library {
0041     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0042 };
0043 
0044 /* Matches header of struct avs_mod_cfg_base. */
0045 struct avs_tplg_modcfg_base {
0046     u32 cpc;
0047     u32 ibs;
0048     u32 obs;
0049     u32 is_pages;
0050 };
0051 
0052 struct avs_tplg_pin_format {
0053     u32 pin_index;
0054     u32 iobs;
0055     struct avs_audio_format *fmt;
0056 };
0057 
0058 struct avs_tplg_modcfg_ext {
0059     guid_t type;
0060 
0061     union {
0062         struct {
0063             u16 num_input_pins;
0064             u16 num_output_pins;
0065             struct avs_tplg_pin_format *pin_fmts;
0066         } generic;
0067         struct {
0068             struct avs_audio_format *out_fmt;
0069             struct avs_audio_format *blob_fmt; /* optional override */
0070             u32 feature_mask;
0071             union avs_virtual_index vindex;
0072             u32 dma_type;
0073             u32 dma_buffer_size;
0074             u32 config_length;
0075             /* config_data part of priv data */
0076         } copier;
0077         struct {
0078             u32 out_channel_config;
0079             u32 coefficients_select;
0080             s32 coefficients[AVS_CHANNELS_MAX];
0081             u32 channel_map;
0082         } updown_mix;
0083         struct {
0084             u32 out_freq;
0085         } src;
0086         struct {
0087             u32 out_freq;
0088             u8 mode;
0089             u8 disable_jitter_buffer;
0090         } asrc;
0091         struct {
0092             u32 cpc_lp_mode;
0093         } wov;
0094         struct {
0095             struct avs_audio_format *ref_fmt;
0096             struct avs_audio_format *out_fmt;
0097             u32 cpc_lp_mode;
0098         } aec;
0099         struct {
0100             struct avs_audio_format *ref_fmt;
0101             struct avs_audio_format *out_fmt;
0102         } mux;
0103         struct {
0104             struct avs_audio_format *out_fmt;
0105         } micsel;
0106     };
0107 };
0108 
0109 /* Specifies path behaviour during PCM ->trigger(START) command. */
0110 enum avs_tplg_trigger {
0111     AVS_TPLG_TRIGGER_AUTO = 0,
0112 };
0113 
0114 struct avs_tplg_pplcfg {
0115     u16 req_size;
0116     u8 priority;
0117     bool lp;
0118     u16 attributes;
0119     enum avs_tplg_trigger trigger;
0120 };
0121 
0122 struct avs_tplg_binding {
0123     char target_tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0124     u32 target_path_tmpl_id;
0125     u32 target_ppl_id;
0126     u32 target_mod_id;
0127     u8 target_mod_pin;
0128     u32 mod_id;
0129     u8 mod_pin;
0130     u8 is_sink;
0131 };
0132 
0133 struct avs_tplg_path_template_id {
0134     u32 id;
0135     char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0136 };
0137 
0138 struct avs_tplg_path_template {
0139     u32 id;
0140 
0141     struct list_head path_list;
0142 
0143     struct avs_tplg *owner;
0144     /* Driver path templates management. */
0145     struct list_head node;
0146 };
0147 
0148 struct avs_tplg_path {
0149     u32 id;
0150 
0151     /* Path format requirements. */
0152     struct avs_audio_format *fe_fmt;
0153     struct avs_audio_format *be_fmt;
0154 
0155     struct list_head ppl_list;
0156 
0157     struct avs_tplg_path_template *owner;
0158     /* Path template path-variants management. */
0159     struct list_head node;
0160 };
0161 
0162 struct avs_tplg_pipeline {
0163     u32 id;
0164 
0165     struct avs_tplg_pplcfg *cfg;
0166     struct avs_tplg_binding **bindings;
0167     u32 num_bindings;
0168     struct list_head mod_list;
0169 
0170     struct avs_tplg_path *owner;
0171     /* Path pipelines management. */
0172     struct list_head node;
0173 };
0174 
0175 struct avs_tplg_module {
0176     u32 id;
0177 
0178     struct avs_tplg_modcfg_base *cfg_base;
0179     struct avs_audio_format *in_fmt;
0180     u8 core_id;
0181     u8 domain;
0182     struct avs_tplg_modcfg_ext *cfg_ext;
0183 
0184     struct avs_tplg_pipeline *owner;
0185     /* Pipeline modules management. */
0186     struct list_head node;
0187 };
0188 
0189 struct avs_tplg *avs_tplg_new(struct snd_soc_component *comp);
0190 
0191 int avs_load_topology(struct snd_soc_component *comp, const char *filename);
0192 int avs_remove_topology(struct snd_soc_component *comp);
0193 
0194 #endif