664 lines · c
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */2/*3 * This file is provided under a dual BSD/GPLv2 license. When using or4 * redistributing this file, you may do so under either license.5 *6 * Copyright(c) 2019 Intel Corporation7 *8 * Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>9 */10 11#ifndef __SOUND_SOC_SOF_AUDIO_H12#define __SOUND_SOC_SOF_AUDIO_H13 14#include <linux/workqueue.h>15 16#include <sound/soc.h>17#include <sound/control.h>18#include <sound/sof/stream.h> /* needs to be included before control.h */19#include <sound/sof/control.h>20#include <sound/sof/dai.h>21#include <sound/sof/topology.h>22#include "sof-priv.h"23 24#define SOF_AUDIO_PCM_DRV_NAME "sof-audio-component"25 26/*27 * The ipc4 firmware only supports up to 8 sink or source pins28 * per widget, because only 3 bits are used for queue(pin) ID29 * in ipc4 protocol.30 */31#define SOF_WIDGET_MAX_NUM_PINS 832 33/* Widget pin type */34#define SOF_PIN_TYPE_INPUT 035#define SOF_PIN_TYPE_OUTPUT 136 37/* max number of FE PCMs before BEs */38#define SOF_BE_PCM_BASE 1639 40#define DMA_CHAN_INVALID 0xFFFFFFFF41 42#define WIDGET_IS_DAI(id) ((id) == snd_soc_dapm_dai_in || (id) == snd_soc_dapm_dai_out)43#define WIDGET_IS_AIF(id) ((id) == snd_soc_dapm_aif_in || (id) == snd_soc_dapm_aif_out)44#define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id))45#define WIDGET_IS_COPIER(id) (WIDGET_IS_AIF_OR_DAI(id) || (id) == snd_soc_dapm_buffer)46 47#define SOF_DAI_PARAM_INTEL_SSP_MCLK 048#define SOF_DAI_PARAM_INTEL_SSP_BCLK 149#define SOF_DAI_PARAM_INTEL_SSP_TDM_SLOTS 250 51enum sof_widget_op {52 SOF_WIDGET_PREPARE,53 SOF_WIDGET_SETUP,54 SOF_WIDGET_FREE,55 SOF_WIDGET_UNPREPARE,56};57 58/*59 * Volume fractional word length define to 16 sets60 * the volume linear gain value to use Qx.16 format61 */62#define VOLUME_FWL 1663 64#define SOF_TLV_ITEMS 365 66static inline u32 mixer_to_ipc(unsigned int value, u32 *volume_map, int size)67{68 if (value >= size)69 return volume_map[size - 1];70 71 return volume_map[value];72}73 74static inline u32 ipc_to_mixer(u32 value, u32 *volume_map, int size)75{76 int i;77 78 for (i = 0; i < size; i++) {79 if (volume_map[i] >= value)80 return i;81 }82 83 return i - 1;84}85 86struct snd_sof_widget;87struct snd_sof_route;88struct snd_sof_control;89struct snd_sof_dai;90struct snd_sof_pcm;91 92struct snd_sof_dai_config_data {93 int dai_index;94 int dai_data; /* contains DAI-specific information */95 int dai_node_id; /* contains DAI-specific information for Gateway configuration */96};97 98/**99 * struct sof_ipc_pcm_ops - IPC-specific PCM ops100 * @hw_params: Function pointer for hw_params101 * @hw_free: Function pointer for hw_free102 * @trigger: Function pointer for trigger103 * @dai_link_fixup: Function pointer for DAI link fixup104 * @pcm_setup: Function pointer for IPC-specific PCM set up that can be used for allocating105 * additional memory in the SOF PCM stream structure106 * @pcm_free: Function pointer for PCM free that can be used for freeing any107 * additional memory in the SOF PCM stream structure108 * @pointer: Function pointer for pcm pointer109 * Note: the @pointer callback may return -EOPNOTSUPP which should be110 * handled in a same way as if the callback is not provided111 * @delay: Function pointer for pcm delay reporting112 * @reset_hw_params_during_stop: Flag indicating whether the hw_params should be reset during the113 * STOP pcm trigger114 * @ipc_first_on_start: Send IPC before invoking platform trigger during115 * START/PAUSE_RELEASE triggers116 * @platform_stop_during_hw_free: Invoke the platform trigger during hw_free. This is needed for117 * IPC4 where a pipeline is only paused during stop/pause/suspend118 * triggers. The FW keeps the host DMA running in this case and119 * therefore the host must do the same and should stop the DMA during120 * hw_free.121 * @d0i3_supported_in_s0ix: Allow DSP D0I3 during S0iX122 */123struct sof_ipc_pcm_ops {124 int (*hw_params)(struct snd_soc_component *component, struct snd_pcm_substream *substream,125 struct snd_pcm_hw_params *params,126 struct snd_sof_platform_stream_params *platform_params);127 int (*hw_free)(struct snd_soc_component *component, struct snd_pcm_substream *substream);128 int (*trigger)(struct snd_soc_component *component, struct snd_pcm_substream *substream,129 int cmd);130 int (*dai_link_fixup)(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);131 int (*pcm_setup)(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm);132 void (*pcm_free)(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm);133 int (*pointer)(struct snd_soc_component *component,134 struct snd_pcm_substream *substream,135 snd_pcm_uframes_t *pointer);136 snd_pcm_sframes_t (*delay)(struct snd_soc_component *component,137 struct snd_pcm_substream *substream);138 bool reset_hw_params_during_stop;139 bool ipc_first_on_start;140 bool platform_stop_during_hw_free;141 bool d0i3_supported_in_s0ix;142};143 144/**145 * struct sof_ipc_tplg_control_ops - IPC-specific ops for topology kcontrol IO146 */147struct sof_ipc_tplg_control_ops {148 bool (*volume_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);149 int (*volume_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);150 bool (*switch_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);151 int (*switch_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);152 bool (*enum_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);153 int (*enum_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);154 int (*bytes_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);155 int (*bytes_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);156 int (*bytes_ext_get)(struct snd_sof_control *scontrol,157 const unsigned int __user *binary_data, unsigned int size);158 int (*bytes_ext_volatile_get)(struct snd_sof_control *scontrol,159 const unsigned int __user *binary_data, unsigned int size);160 int (*bytes_ext_put)(struct snd_sof_control *scontrol,161 const unsigned int __user *binary_data, unsigned int size);162 /* update control data based on notification from the DSP */163 void (*update)(struct snd_sof_dev *sdev, void *ipc_control_message);164 /* Optional callback to setup kcontrols associated with an swidget */165 int (*widget_kcontrol_setup)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);166 /* mandatory callback to set up volume table for volume kcontrols */167 int (*set_up_volume_table)(struct snd_sof_control *scontrol, int tlv[SOF_TLV_ITEMS],168 int size);169};170 171/**172 * struct sof_ipc_tplg_widget_ops - IPC-specific ops for topology widgets173 * @ipc_setup: Function pointer for setting up widget IPC params174 * @ipc_free: Function pointer for freeing widget IPC params175 * @token_list: List of token ID's that should be parsed for the widget176 * @token_list_size: number of elements in token_list177 * @bind_event: Function pointer for binding events to the widget178 * @ipc_prepare: Optional op for preparing a widget for set up179 * @ipc_unprepare: Optional op for unpreparing a widget180 */181struct sof_ipc_tplg_widget_ops {182 int (*ipc_setup)(struct snd_sof_widget *swidget);183 void (*ipc_free)(struct snd_sof_widget *swidget);184 enum sof_tokens *token_list;185 int token_list_size;186 int (*bind_event)(struct snd_soc_component *scomp, struct snd_sof_widget *swidget,187 u16 event_type);188 int (*ipc_prepare)(struct snd_sof_widget *swidget,189 struct snd_pcm_hw_params *fe_params,190 struct snd_sof_platform_stream_params *platform_params,191 struct snd_pcm_hw_params *source_params, int dir);192 void (*ipc_unprepare)(struct snd_sof_widget *swidget);193};194 195/**196 * struct sof_ipc_tplg_ops - IPC-specific topology ops197 * @widget: Array of pointers to IPC-specific ops for widgets. This should always be of size198 * SND_SOF_DAPM_TYPE_COUNT i.e one per widget type. Unsupported widget types will be199 * initialized to 0.200 * @control: Pointer to the IPC-specific ops for topology kcontrol IO201 * @route_setup: Function pointer for setting up pipeline connections202 * @route_free: Function pointer for freeing pipeline connections.203 * @token_list: List of all tokens supported by the IPC version. The size of the token_list204 * array should be SOF_TOKEN_COUNT. The unused elements in the array will be205 * initialized to 0.206 * @control_setup: Function pointer for setting up kcontrol IPC-specific data207 * @control_free: Function pointer for freeing kcontrol IPC-specific data208 * @pipeline_complete: Function pointer for pipeline complete IPC209 * @widget_setup: Function pointer for setting up setup in the DSP210 * @widget_free: Function pointer for freeing widget in the DSP211 * @dai_config: Function pointer for sending DAI config IPC to the DSP212 * @dai_get_param: Function pointer for getting the DAI parameter213 * @set_up_all_pipelines: Function pointer for setting up all topology pipelines214 * @tear_down_all_pipelines: Function pointer for tearing down all topology pipelines215 * @parse_manifest: Function pointer for ipc4 specific parsing of topology manifest216 * @link_setup: Function pointer for IPC-specific DAI link set up217 *218 * Note: function pointers (ops) are optional219 */220struct sof_ipc_tplg_ops {221 const struct sof_ipc_tplg_widget_ops *widget;222 const struct sof_ipc_tplg_control_ops *control;223 int (*route_setup)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);224 int (*route_free)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);225 const struct sof_token_info *token_list;226 int (*control_setup)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);227 int (*control_free)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);228 int (*pipeline_complete)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);229 int (*widget_setup)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);230 int (*widget_free)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);231 int (*dai_config)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,232 unsigned int flags, struct snd_sof_dai_config_data *data);233 int (*dai_get_param)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int param_type);234 int (*set_up_all_pipelines)(struct snd_sof_dev *sdev, bool verify);235 int (*tear_down_all_pipelines)(struct snd_sof_dev *sdev, bool verify);236 int (*parse_manifest)(struct snd_soc_component *scomp, int index,237 struct snd_soc_tplg_manifest *man);238 int (*link_setup)(struct snd_sof_dev *sdev, struct snd_soc_dai_link *link);239};240 241/** struct snd_sof_tuple - Tuple info242 * @token: Token ID243 * @value: union of a string or a u32 values244 */245struct snd_sof_tuple {246 u32 token;247 union {248 u32 v;249 const char *s;250 } value;251};252 253/*254 * List of SOF token ID's. The order of ID's does not matter as token arrays are looked up based on255 * the ID.256 */257enum sof_tokens {258 SOF_PCM_TOKENS,259 SOF_PIPELINE_TOKENS,260 SOF_SCHED_TOKENS,261 SOF_ASRC_TOKENS,262 SOF_SRC_TOKENS,263 SOF_COMP_TOKENS,264 SOF_BUFFER_TOKENS,265 SOF_VOLUME_TOKENS,266 SOF_PROCESS_TOKENS,267 SOF_DAI_TOKENS,268 SOF_DAI_LINK_TOKENS,269 SOF_HDA_TOKENS,270 SOF_SSP_TOKENS,271 SOF_ALH_TOKENS,272 SOF_DMIC_TOKENS,273 SOF_DMIC_PDM_TOKENS,274 SOF_ESAI_TOKENS,275 SOF_SAI_TOKENS,276 SOF_AFE_TOKENS,277 SOF_CORE_TOKENS,278 SOF_COMP_EXT_TOKENS,279 SOF_IN_AUDIO_FORMAT_TOKENS,280 SOF_OUT_AUDIO_FORMAT_TOKENS,281 SOF_COPIER_DEEP_BUFFER_TOKENS,282 SOF_COPIER_TOKENS,283 SOF_AUDIO_FMT_NUM_TOKENS,284 SOF_COPIER_FORMAT_TOKENS,285 SOF_GAIN_TOKENS,286 SOF_ACPDMIC_TOKENS,287 SOF_ACPI2S_TOKENS,288 SOF_MICFIL_TOKENS,289 SOF_ACP_SDW_TOKENS,290 291 /* this should be the last */292 SOF_TOKEN_COUNT,293};294 295/**296 * struct sof_topology_token - SOF topology token definition297 * @token: Token number298 * @type: Token type299 * @get_token: Function pointer to parse the token value and save it in a object300 * @offset: Offset within an object to save the token value into301 */302struct sof_topology_token {303 u32 token;304 u32 type;305 int (*get_token)(void *elem, void *object, u32 offset);306 u32 offset;307};308 309struct sof_token_info {310 const char *name;311 const struct sof_topology_token *tokens;312 int count;313};314 315/**316 * struct snd_sof_pcm_stream_pipeline_list - List of pipelines associated with a PCM stream317 * @pipelines: array of pipelines318 * @count: number of pipeline widgets in the @pipe_widgets array319 */320struct snd_sof_pcm_stream_pipeline_list {321 struct snd_sof_pipeline **pipelines;322 u32 count;323};324 325/* PCM stream, mapped to FW component */326struct snd_sof_pcm_stream {327 u32 comp_id;328 struct snd_dma_buffer page_table;329 struct sof_ipc_stream_posn posn;330 struct snd_pcm_substream *substream;331 struct snd_compr_stream *cstream;332 struct work_struct period_elapsed_work;333 struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */334 bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */335 unsigned int dsp_max_burst_size_in_ms; /* The maximum size of the host DMA burst in ms */336 /*337 * flag to indicate that the DSP pipelines should be kept338 * active or not while suspending the stream339 */340 bool suspend_ignored;341 struct snd_sof_pcm_stream_pipeline_list pipeline_list;342 343 /* used by IPC implementation and core does not touch it */344 void *private;345};346 347/* ALSA SOF PCM device */348struct snd_sof_pcm {349 struct snd_soc_component *scomp;350 struct snd_sof_pcm_stream stream[2];351 struct list_head list; /* list in sdev pcm list */352 struct snd_pcm_hw_params params[2];353 bool prepared[2]; /* PCM_PARAMS set successfully */354 bool pending_stop[2]; /* only used if (!pcm_ops->platform_stop_during_hw_free) */355 356 /* Must be last - ends in a flex-array member. */357 struct snd_soc_tplg_pcm pcm;358};359 360struct snd_sof_led_control {361 unsigned int use_led;362 unsigned int direction;363 int led_value;364};365 366/* ALSA SOF Kcontrol device */367struct snd_sof_control {368 struct snd_soc_component *scomp;369 const char *name;370 int comp_id;371 int min_volume_step; /* min volume step for volume_table */372 int max_volume_step; /* max volume step for volume_table */373 int num_channels;374 unsigned int access;375 int info_type;376 int index; /* pipeline ID */377 void *priv; /* private data copied from topology */378 size_t priv_size; /* size of private data */379 size_t max_size;380 void *ipc_control_data;381 void *old_ipc_control_data;382 int max; /* applicable to volume controls */383 u32 size; /* cdata size */384 u32 *volume_table; /* volume table computed from tlv data*/385 386 struct list_head list; /* list in sdev control list */387 388 struct snd_sof_led_control led_ctl;389 390 /* if true, the control's data needs to be updated from Firmware */391 bool comp_data_dirty;392};393 394/** struct snd_sof_dai_link - DAI link info395 * @tuples: array of parsed tuples396 * @num_tuples: number of tuples in the tuples array397 * @link: Pointer to snd_soc_dai_link398 * @hw_configs: Pointer to hw configs in topology399 * @num_hw_configs: Number of hw configs in topology400 * @default_hw_cfg_id: Default hw config ID401 * @type: DAI type402 * @list: item in snd_sof_dev dai_link list403 */404struct snd_sof_dai_link {405 struct snd_sof_tuple *tuples;406 int num_tuples;407 struct snd_soc_dai_link *link;408 struct snd_soc_tplg_hw_config *hw_configs;409 int num_hw_configs;410 int default_hw_cfg_id;411 int type;412 struct list_head list;413};414 415/* ASoC SOF DAPM widget */416struct snd_sof_widget {417 struct snd_soc_component *scomp;418 int comp_id;419 int pipeline_id;420 /*421 * the prepared flag is used to indicate that a widget has been prepared for getting set422 * up in the DSP.423 */424 bool prepared;425 426 struct mutex setup_mutex; /* to protect the swidget setup and free operations */427 428 /*429 * use_count is protected by the PCM mutex held by the core and the430 * setup_mutex against non stream domain races (kcontrol access for431 * example)432 */433 int use_count;434 435 int core;436 int id; /* id is the DAPM widget type */437 /*438 * Instance ID is set dynamically when the widget gets set up in the FW. It should be439 * unique for each module type across all pipelines. This will not be used in SOF_IPC.440 */441 int instance_id;442 443 /*444 * Flag indicating if the widget should be set up dynamically when a PCM is opened.445 * This flag is only set for the scheduler type widget in topology. During topology446 * loading, this flag is propagated to all the widgets belonging to the same pipeline.447 * When this flag is not set, a widget is set up at the time of topology loading448 * and retained until the DSP enters D3. It will need to be set up again when resuming449 * from D3.450 */451 bool dynamic_pipeline_widget;452 453 struct snd_soc_dapm_widget *widget;454 struct list_head list; /* list in sdev widget list */455 struct snd_sof_pipeline *spipe;456 void *module_info;457 458 const guid_t uuid;459 460 int num_tuples;461 struct snd_sof_tuple *tuples;462 463 /*464 * The allowed range for num_input/output_pins is [0, SOF_WIDGET_MAX_NUM_PINS].465 * Widgets may have zero input or output pins, for example the tone widget has466 * zero input pins.467 */468 u32 num_input_pins;469 u32 num_output_pins;470 471 /*472 * The input/output pin binding array, it takes the form of473 * [widget_name_connected_to_pin0, widget_name_connected_to_pin1, ...],474 * with the index as the queue ID.475 *476 * The array is used for special pin binding. Note that even if there477 * is only one input/output pin requires special pin binding, pin binding478 * should be defined for all input/output pins in topology, for pin(s) that479 * are not used, give the value "NotConnected".480 *481 * If pin binding is not defined in topology, nothing to parse in the kernel,482 * input_pin_binding and output_pin_binding shall be NULL.483 */484 char **input_pin_binding;485 char **output_pin_binding;486 487 struct ida output_queue_ida;488 struct ida input_queue_ida;489 490 void *private; /* core does not touch this */491};492 493/** struct snd_sof_pipeline - ASoC SOF pipeline494 * @pipe_widget: Pointer to the pipeline widget495 * @started_count: Count of number of PCM's that have started this pipeline496 * @paused_count: Count of number of PCM's that have started and have currently paused this497 pipeline498 * @complete: flag used to indicate that pipeline set up is complete.499 * @core_mask: Mask containing target cores for all modules in the pipeline500 * @list: List item in sdev pipeline_list501 */502struct snd_sof_pipeline {503 struct snd_sof_widget *pipe_widget;504 int started_count;505 int paused_count;506 int complete;507 unsigned long core_mask;508 struct list_head list;509};510 511/* ASoC SOF DAPM route */512struct snd_sof_route {513 struct snd_soc_component *scomp;514 515 struct snd_soc_dapm_route *route;516 struct list_head list; /* list in sdev route list */517 struct snd_sof_widget *src_widget;518 struct snd_sof_widget *sink_widget;519 bool setup;520 521 int src_queue_id;522 int dst_queue_id;523 524 void *private;525};526 527/* ASoC DAI device */528struct snd_sof_dai {529 struct snd_soc_component *scomp;530 const char *name;531 u32 type;532 533 int number_configs;534 int current_config;535 struct list_head list; /* list in sdev dai list */536 /* core should not touch this */537 const void *platform_private;538 void *private;539};540 541/*542 * Kcontrols.543 */544 545int snd_sof_volume_get(struct snd_kcontrol *kcontrol,546 struct snd_ctl_elem_value *ucontrol);547int snd_sof_volume_put(struct snd_kcontrol *kcontrol,548 struct snd_ctl_elem_value *ucontrol);549int snd_sof_volume_info(struct snd_kcontrol *kcontrol,550 struct snd_ctl_elem_info *uinfo);551int snd_sof_switch_get(struct snd_kcontrol *kcontrol,552 struct snd_ctl_elem_value *ucontrol);553int snd_sof_switch_put(struct snd_kcontrol *kcontrol,554 struct snd_ctl_elem_value *ucontrol);555int snd_sof_enum_get(struct snd_kcontrol *kcontrol,556 struct snd_ctl_elem_value *ucontrol);557int snd_sof_enum_put(struct snd_kcontrol *kcontrol,558 struct snd_ctl_elem_value *ucontrol);559int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,560 struct snd_ctl_elem_value *ucontrol);561int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,562 struct snd_ctl_elem_value *ucontrol);563int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,564 const unsigned int __user *binary_data,565 unsigned int size);566int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,567 unsigned int __user *binary_data,568 unsigned int size);569int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int __user *binary_data,570 unsigned int size);571void snd_sof_control_notify(struct snd_sof_dev *sdev,572 struct sof_ipc_ctrl_data *cdata);573 574/*575 * Topology.576 * There is no snd_sof_free_topology since topology components will577 * be freed by snd_soc_unregister_component,578 */579int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file);580 581/*582 * Stream IPC583 */584int snd_sof_ipc_stream_posn(struct snd_soc_component *scomp,585 struct snd_sof_pcm *spcm, int direction,586 struct sof_ipc_stream_posn *posn);587 588struct snd_sof_widget *snd_sof_find_swidget(struct snd_soc_component *scomp,589 const char *name);590struct snd_sof_widget *591snd_sof_find_swidget_sname(struct snd_soc_component *scomp,592 const char *pcm_name, int dir);593struct snd_sof_dai *snd_sof_find_dai(struct snd_soc_component *scomp,594 const char *name);595 596static inline597struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_soc_component *scomp,598 struct snd_soc_pcm_runtime *rtd)599{600 struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);601 struct snd_sof_pcm *spcm;602 603 list_for_each_entry(spcm, &sdev->pcm_list, list) {604 if (le32_to_cpu(spcm->pcm.dai_id) == rtd->dai_link->id)605 return spcm;606 }607 608 return NULL;609}610 611struct snd_sof_pcm *snd_sof_find_spcm_name(struct snd_soc_component *scomp,612 const char *name);613struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp,614 unsigned int comp_id,615 int *direction);616void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream);617void snd_sof_pcm_init_elapsed_work(struct work_struct *work);618 619#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)620void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream);621void snd_sof_compr_init_elapsed_work(struct work_struct *work);622#else623static inline void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) { }624static inline void snd_sof_compr_init_elapsed_work(struct work_struct *work) { }625#endif626 627/* DAI link fixup */628int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);629 630/* PM */631bool snd_sof_stream_suspend_ignored(struct snd_sof_dev *sdev);632bool snd_sof_dsp_only_d0i3_compatible_stream_active(struct snd_sof_dev *sdev);633 634/* Machine driver enumeration */635int sof_machine_register(struct snd_sof_dev *sdev, void *pdata);636void sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata);637 638int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);639int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);640int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsource,641 struct snd_soc_dapm_widget *wsink);642 643/* PCM */644int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,645 struct snd_pcm_hw_params *fe_params,646 struct snd_sof_platform_stream_params *platform_params,647 int dir);648int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir);649int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_sof_dev *sdev,650 struct snd_sof_pcm *spcm);651int sof_pcm_stream_free(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,652 struct snd_sof_pcm *spcm, int dir, bool free_widget_list);653int get_token_u32(void *elem, void *object, u32 offset);654int get_token_u16(void *elem, void *object, u32 offset);655int get_token_comp_format(void *elem, void *object, u32 offset);656int get_token_dai_type(void *elem, void *object, u32 offset);657int get_token_uuid(void *elem, void *object, u32 offset);658int get_token_string(void *elem, void *object, u32 offset);659int sof_update_ipc_object(struct snd_soc_component *scomp, void *object, enum sof_tokens token_id,660 struct snd_sof_tuple *tuples, int num_tuples,661 size_t object_size, int token_instance_num);662u32 vol_compute_gain(u32 value, int *tlv);663#endif664