sof-audio.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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 or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * Copyright(c) 2019 Intel Corporation. All rights reserved.
  7. *
  8. * Author: Ranjani Sridharan <[email protected]>
  9. */
  10. #ifndef __SOUND_SOC_SOF_AUDIO_H
  11. #define __SOUND_SOC_SOF_AUDIO_H
  12. #include <linux/workqueue.h>
  13. #include <sound/soc.h>
  14. #include <sound/control.h>
  15. #include <sound/sof/stream.h> /* needs to be included before control.h */
  16. #include <sound/sof/control.h>
  17. #include <sound/sof/dai.h>
  18. #include <sound/sof/topology.h>
  19. #include "sof-priv.h"
  20. #define SOF_AUDIO_PCM_DRV_NAME "sof-audio-component"
  21. /* max number of FE PCMs before BEs */
  22. #define SOF_BE_PCM_BASE 16
  23. #define DMA_CHAN_INVALID 0xFFFFFFFF
  24. #define WIDGET_IS_DAI(id) ((id) == snd_soc_dapm_dai_in || (id) == snd_soc_dapm_dai_out)
  25. #define WIDGET_IS_AIF(id) ((id) == snd_soc_dapm_aif_in || (id) == snd_soc_dapm_aif_out)
  26. #define WIDGET_IS_AIF_OR_DAI(id) (WIDGET_IS_DAI(id) || WIDGET_IS_AIF(id))
  27. #define SOF_DAI_CLK_INTEL_SSP_MCLK 0
  28. #define SOF_DAI_CLK_INTEL_SSP_BCLK 1
  29. enum sof_widget_op {
  30. SOF_WIDGET_PREPARE,
  31. SOF_WIDGET_SETUP,
  32. SOF_WIDGET_FREE,
  33. SOF_WIDGET_UNPREPARE,
  34. };
  35. /*
  36. * Volume fractional word length define to 16 sets
  37. * the volume linear gain value to use Qx.16 format
  38. */
  39. #define VOLUME_FWL 16
  40. #define SOF_TLV_ITEMS 3
  41. static inline u32 mixer_to_ipc(unsigned int value, u32 *volume_map, int size)
  42. {
  43. if (value >= size)
  44. return volume_map[size - 1];
  45. return volume_map[value];
  46. }
  47. static inline u32 ipc_to_mixer(u32 value, u32 *volume_map, int size)
  48. {
  49. int i;
  50. for (i = 0; i < size; i++) {
  51. if (volume_map[i] >= value)
  52. return i;
  53. }
  54. return i - 1;
  55. }
  56. struct snd_sof_widget;
  57. struct snd_sof_route;
  58. struct snd_sof_control;
  59. struct snd_sof_dai;
  60. struct snd_sof_dai_config_data {
  61. int dai_index;
  62. int dai_data; /* contains DAI-specific information */
  63. };
  64. /**
  65. * struct sof_ipc_pcm_ops - IPC-specific PCM ops
  66. * @hw_params: Function pointer for hw_params
  67. * @hw_free: Function pointer for hw_free
  68. * @trigger: Function pointer for trigger
  69. * @dai_link_fixup: Function pointer for DAI link fixup
  70. */
  71. struct sof_ipc_pcm_ops {
  72. int (*hw_params)(struct snd_soc_component *component, struct snd_pcm_substream *substream,
  73. struct snd_pcm_hw_params *params,
  74. struct snd_sof_platform_stream_params *platform_params);
  75. int (*hw_free)(struct snd_soc_component *component, struct snd_pcm_substream *substream);
  76. int (*trigger)(struct snd_soc_component *component, struct snd_pcm_substream *substream,
  77. int cmd);
  78. int (*dai_link_fixup)(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);
  79. };
  80. /**
  81. * struct sof_ipc_tplg_control_ops - IPC-specific ops for topology kcontrol IO
  82. */
  83. struct sof_ipc_tplg_control_ops {
  84. bool (*volume_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  85. int (*volume_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  86. bool (*switch_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  87. int (*switch_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  88. bool (*enum_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  89. int (*enum_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  90. int (*bytes_put)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  91. int (*bytes_get)(struct snd_sof_control *scontrol, struct snd_ctl_elem_value *ucontrol);
  92. int (*bytes_ext_get)(struct snd_sof_control *scontrol,
  93. const unsigned int __user *binary_data, unsigned int size);
  94. int (*bytes_ext_volatile_get)(struct snd_sof_control *scontrol,
  95. const unsigned int __user *binary_data, unsigned int size);
  96. int (*bytes_ext_put)(struct snd_sof_control *scontrol,
  97. const unsigned int __user *binary_data, unsigned int size);
  98. /* update control data based on notification from the DSP */
  99. void (*update)(struct snd_sof_dev *sdev, void *ipc_control_message);
  100. /* Optional callback to setup kcontrols associated with an swidget */
  101. int (*widget_kcontrol_setup)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  102. /* mandatory callback to set up volume table for volume kcontrols */
  103. int (*set_up_volume_table)(struct snd_sof_control *scontrol, int tlv[SOF_TLV_ITEMS],
  104. int size);
  105. };
  106. /**
  107. * struct sof_ipc_tplg_widget_ops - IPC-specific ops for topology widgets
  108. * @ipc_setup: Function pointer for setting up widget IPC params
  109. * @ipc_free: Function pointer for freeing widget IPC params
  110. * @token_list: List of token ID's that should be parsed for the widget
  111. * @token_list_size: number of elements in token_list
  112. * @bind_event: Function pointer for binding events to the widget
  113. * @ipc_prepare: Optional op for preparing a widget for set up
  114. * @ipc_unprepare: Optional op for unpreparing a widget
  115. */
  116. struct sof_ipc_tplg_widget_ops {
  117. int (*ipc_setup)(struct snd_sof_widget *swidget);
  118. void (*ipc_free)(struct snd_sof_widget *swidget);
  119. enum sof_tokens *token_list;
  120. int token_list_size;
  121. int (*bind_event)(struct snd_soc_component *scomp, struct snd_sof_widget *swidget,
  122. u16 event_type);
  123. int (*ipc_prepare)(struct snd_sof_widget *swidget,
  124. struct snd_pcm_hw_params *fe_params,
  125. struct snd_sof_platform_stream_params *platform_params,
  126. struct snd_pcm_hw_params *source_params, int dir);
  127. void (*ipc_unprepare)(struct snd_sof_widget *swidget);
  128. };
  129. /**
  130. * struct sof_ipc_tplg_ops - IPC-specific topology ops
  131. * @widget: Array of pointers to IPC-specific ops for widgets. This should always be of size
  132. * SND_SOF_DAPM_TYPE_COUNT i.e one per widget type. Unsupported widget types will be
  133. * initialized to 0.
  134. * @control: Pointer to the IPC-specific ops for topology kcontrol IO
  135. * @route_setup: Function pointer for setting up pipeline connections
  136. * @route_free: Optional op for freeing pipeline connections.
  137. * @token_list: List of all tokens supported by the IPC version. The size of the token_list
  138. * array should be SOF_TOKEN_COUNT. The unused elements in the array will be
  139. * initialized to 0.
  140. * @control_setup: Function pointer for setting up kcontrol IPC-specific data
  141. * @control_free: Function pointer for freeing kcontrol IPC-specific data
  142. * @pipeline_complete: Function pointer for pipeline complete IPC
  143. * @widget_setup: Function pointer for setting up setup in the DSP
  144. * @widget_free: Function pointer for freeing widget in the DSP
  145. * @dai_config: Function pointer for sending DAI config IPC to the DSP
  146. * @dai_get_clk: Function pointer for getting the DAI clock setting
  147. * @set_up_all_pipelines: Function pointer for setting up all topology pipelines
  148. * @tear_down_all_pipelines: Function pointer for tearing down all topology pipelines
  149. * @parse_manifest: Optional function pointer for ipc4 specific parsing of topology manifest
  150. */
  151. struct sof_ipc_tplg_ops {
  152. const struct sof_ipc_tplg_widget_ops *widget;
  153. const struct sof_ipc_tplg_control_ops *control;
  154. int (*route_setup)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);
  155. int (*route_free)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);
  156. const struct sof_token_info *token_list;
  157. int (*control_setup)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
  158. int (*control_free)(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol);
  159. int (*pipeline_complete)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  160. int (*widget_setup)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  161. int (*widget_free)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  162. int (*dai_config)(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
  163. unsigned int flags, struct snd_sof_dai_config_data *data);
  164. int (*dai_get_clk)(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, int clk_type);
  165. int (*set_up_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
  166. int (*tear_down_all_pipelines)(struct snd_sof_dev *sdev, bool verify);
  167. int (*parse_manifest)(struct snd_soc_component *scomp, int index,
  168. struct snd_soc_tplg_manifest *man);
  169. };
  170. /** struct snd_sof_tuple - Tuple info
  171. * @token: Token ID
  172. * @value: union of a string or a u32 values
  173. */
  174. struct snd_sof_tuple {
  175. u32 token;
  176. union {
  177. u32 v;
  178. const char *s;
  179. } value;
  180. };
  181. /*
  182. * List of SOF token ID's. The order of ID's does not matter as token arrays are looked up based on
  183. * the ID.
  184. */
  185. enum sof_tokens {
  186. SOF_PCM_TOKENS,
  187. SOF_PIPELINE_TOKENS,
  188. SOF_SCHED_TOKENS,
  189. SOF_ASRC_TOKENS,
  190. SOF_SRC_TOKENS,
  191. SOF_COMP_TOKENS,
  192. SOF_BUFFER_TOKENS,
  193. SOF_VOLUME_TOKENS,
  194. SOF_PROCESS_TOKENS,
  195. SOF_DAI_TOKENS,
  196. SOF_DAI_LINK_TOKENS,
  197. SOF_HDA_TOKENS,
  198. SOF_SSP_TOKENS,
  199. SOF_ALH_TOKENS,
  200. SOF_DMIC_TOKENS,
  201. SOF_DMIC_PDM_TOKENS,
  202. SOF_ESAI_TOKENS,
  203. SOF_SAI_TOKENS,
  204. SOF_AFE_TOKENS,
  205. SOF_CORE_TOKENS,
  206. SOF_COMP_EXT_TOKENS,
  207. SOF_IN_AUDIO_FORMAT_TOKENS,
  208. SOF_OUT_AUDIO_FORMAT_TOKENS,
  209. SOF_AUDIO_FORMAT_BUFFER_SIZE_TOKENS,
  210. SOF_COPIER_GATEWAY_CFG_TOKENS,
  211. SOF_COPIER_TOKENS,
  212. SOF_AUDIO_FMT_NUM_TOKENS,
  213. SOF_COPIER_FORMAT_TOKENS,
  214. SOF_GAIN_TOKENS,
  215. SOF_ACPDMIC_TOKENS,
  216. /* this should be the last */
  217. SOF_TOKEN_COUNT,
  218. };
  219. /**
  220. * struct sof_topology_token - SOF topology token definition
  221. * @token: Token number
  222. * @type: Token type
  223. * @get_token: Function pointer to parse the token value and save it in a object
  224. * @offset: Offset within an object to save the token value into
  225. */
  226. struct sof_topology_token {
  227. u32 token;
  228. u32 type;
  229. int (*get_token)(void *elem, void *object, u32 offset);
  230. u32 offset;
  231. };
  232. struct sof_token_info {
  233. const char *name;
  234. const struct sof_topology_token *tokens;
  235. int count;
  236. };
  237. /* PCM stream, mapped to FW component */
  238. struct snd_sof_pcm_stream {
  239. u32 comp_id;
  240. struct snd_dma_buffer page_table;
  241. struct sof_ipc_stream_posn posn;
  242. struct snd_pcm_substream *substream;
  243. struct snd_compr_stream *cstream;
  244. struct work_struct period_elapsed_work;
  245. struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */
  246. bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
  247. /*
  248. * flag to indicate that the DSP pipelines should be kept
  249. * active or not while suspending the stream
  250. */
  251. bool suspend_ignored;
  252. };
  253. /* ALSA SOF PCM device */
  254. struct snd_sof_pcm {
  255. struct snd_soc_component *scomp;
  256. struct snd_soc_tplg_pcm pcm;
  257. struct snd_sof_pcm_stream stream[2];
  258. struct list_head list; /* list in sdev pcm list */
  259. struct snd_pcm_hw_params params[2];
  260. bool prepared[2]; /* PCM_PARAMS set successfully */
  261. };
  262. struct snd_sof_led_control {
  263. unsigned int use_led;
  264. unsigned int direction;
  265. int led_value;
  266. };
  267. /* ALSA SOF Kcontrol device */
  268. struct snd_sof_control {
  269. struct snd_soc_component *scomp;
  270. const char *name;
  271. int comp_id;
  272. int min_volume_step; /* min volume step for volume_table */
  273. int max_volume_step; /* max volume step for volume_table */
  274. int num_channels;
  275. unsigned int access;
  276. int info_type;
  277. int index; /* pipeline ID */
  278. void *priv; /* private data copied from topology */
  279. size_t priv_size; /* size of private data */
  280. size_t max_size;
  281. void *ipc_control_data;
  282. int max; /* applicable to volume controls */
  283. u32 size; /* cdata size */
  284. u32 *volume_table; /* volume table computed from tlv data*/
  285. struct list_head list; /* list in sdev control list */
  286. struct snd_sof_led_control led_ctl;
  287. /* if true, the control's data needs to be updated from Firmware */
  288. bool comp_data_dirty;
  289. };
  290. /** struct snd_sof_dai_link - DAI link info
  291. * @tuples: array of parsed tuples
  292. * @num_tuples: number of tuples in the tuples array
  293. * @link: Pointer to snd_soc_dai_link
  294. * @hw_configs: Pointer to hw configs in topology
  295. * @num_hw_configs: Number of hw configs in topology
  296. * @default_hw_cfg_id: Default hw config ID
  297. * @type: DAI type
  298. * @list: item in snd_sof_dev dai_link list
  299. */
  300. struct snd_sof_dai_link {
  301. struct snd_sof_tuple *tuples;
  302. int num_tuples;
  303. struct snd_soc_dai_link *link;
  304. struct snd_soc_tplg_hw_config *hw_configs;
  305. int num_hw_configs;
  306. int default_hw_cfg_id;
  307. int type;
  308. struct list_head list;
  309. };
  310. /* ASoC SOF DAPM widget */
  311. struct snd_sof_widget {
  312. struct snd_soc_component *scomp;
  313. int comp_id;
  314. int pipeline_id;
  315. /*
  316. * complete flag is used to indicate that pipeline set up is complete for scheduler type
  317. * widgets. It is unused for all other widget types.
  318. */
  319. int complete;
  320. /*
  321. * the prepared flag is used to indicate that a widget has been prepared for getting set
  322. * up in the DSP.
  323. */
  324. bool prepared;
  325. int use_count; /* use_count will be protected by the PCM mutex held by the core */
  326. int core;
  327. int id; /* id is the DAPM widget type */
  328. /*
  329. * Instance ID is set dynamically when the widget gets set up in the FW. It should be
  330. * unique for each module type across all pipelines. This will not be used in SOF_IPC.
  331. */
  332. int instance_id;
  333. /*
  334. * Flag indicating if the widget should be set up dynamically when a PCM is opened.
  335. * This flag is only set for the scheduler type widget in topology. During topology
  336. * loading, this flag is propagated to all the widgets belonging to the same pipeline.
  337. * When this flag is not set, a widget is set up at the time of topology loading
  338. * and retained until the DSP enters D3. It will need to be set up again when resuming
  339. * from D3.
  340. */
  341. bool dynamic_pipeline_widget;
  342. struct snd_soc_dapm_widget *widget;
  343. struct list_head list; /* list in sdev widget list */
  344. struct snd_sof_widget *pipe_widget;
  345. void *module_info;
  346. const guid_t uuid;
  347. int num_tuples;
  348. struct snd_sof_tuple *tuples;
  349. void *private; /* core does not touch this */
  350. };
  351. /* ASoC SOF DAPM route */
  352. struct snd_sof_route {
  353. struct snd_soc_component *scomp;
  354. struct snd_soc_dapm_route *route;
  355. struct list_head list; /* list in sdev route list */
  356. struct snd_sof_widget *src_widget;
  357. struct snd_sof_widget *sink_widget;
  358. bool setup;
  359. void *private;
  360. };
  361. /* ASoC DAI device */
  362. struct snd_sof_dai {
  363. struct snd_soc_component *scomp;
  364. const char *name;
  365. int number_configs;
  366. int current_config;
  367. struct list_head list; /* list in sdev dai list */
  368. void *private;
  369. };
  370. /*
  371. * Kcontrols.
  372. */
  373. int snd_sof_volume_get(struct snd_kcontrol *kcontrol,
  374. struct snd_ctl_elem_value *ucontrol);
  375. int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
  376. struct snd_ctl_elem_value *ucontrol);
  377. int snd_sof_volume_info(struct snd_kcontrol *kcontrol,
  378. struct snd_ctl_elem_info *uinfo);
  379. int snd_sof_switch_get(struct snd_kcontrol *kcontrol,
  380. struct snd_ctl_elem_value *ucontrol);
  381. int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
  382. struct snd_ctl_elem_value *ucontrol);
  383. int snd_sof_enum_get(struct snd_kcontrol *kcontrol,
  384. struct snd_ctl_elem_value *ucontrol);
  385. int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
  386. struct snd_ctl_elem_value *ucontrol);
  387. int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
  388. struct snd_ctl_elem_value *ucontrol);
  389. int snd_sof_bytes_put(struct snd_kcontrol *kcontrol,
  390. struct snd_ctl_elem_value *ucontrol);
  391. int snd_sof_bytes_ext_put(struct snd_kcontrol *kcontrol,
  392. const unsigned int __user *binary_data,
  393. unsigned int size);
  394. int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,
  395. unsigned int __user *binary_data,
  396. unsigned int size);
  397. int snd_sof_bytes_ext_volatile_get(struct snd_kcontrol *kcontrol, unsigned int __user *binary_data,
  398. unsigned int size);
  399. void snd_sof_control_notify(struct snd_sof_dev *sdev,
  400. struct sof_ipc_ctrl_data *cdata);
  401. /*
  402. * Topology.
  403. * There is no snd_sof_free_topology since topology components will
  404. * be freed by snd_soc_unregister_component,
  405. */
  406. int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file);
  407. /*
  408. * Stream IPC
  409. */
  410. int snd_sof_ipc_stream_posn(struct snd_soc_component *scomp,
  411. struct snd_sof_pcm *spcm, int direction,
  412. struct sof_ipc_stream_posn *posn);
  413. struct snd_sof_widget *snd_sof_find_swidget(struct snd_soc_component *scomp,
  414. const char *name);
  415. struct snd_sof_widget *
  416. snd_sof_find_swidget_sname(struct snd_soc_component *scomp,
  417. const char *pcm_name, int dir);
  418. struct snd_sof_dai *snd_sof_find_dai(struct snd_soc_component *scomp,
  419. const char *name);
  420. static inline
  421. struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_soc_component *scomp,
  422. struct snd_soc_pcm_runtime *rtd)
  423. {
  424. struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
  425. struct snd_sof_pcm *spcm;
  426. list_for_each_entry(spcm, &sdev->pcm_list, list) {
  427. if (le32_to_cpu(spcm->pcm.dai_id) == rtd->dai_link->id)
  428. return spcm;
  429. }
  430. return NULL;
  431. }
  432. struct snd_sof_pcm *snd_sof_find_spcm_name(struct snd_soc_component *scomp,
  433. const char *name);
  434. struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp,
  435. unsigned int comp_id,
  436. int *direction);
  437. void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream);
  438. void snd_sof_pcm_init_elapsed_work(struct work_struct *work);
  439. #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
  440. void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream);
  441. void snd_sof_compr_init_elapsed_work(struct work_struct *work);
  442. #else
  443. static inline void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) { }
  444. static inline void snd_sof_compr_init_elapsed_work(struct work_struct *work) { }
  445. #endif
  446. /* DAI link fixup */
  447. int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);
  448. /* PM */
  449. bool snd_sof_stream_suspend_ignored(struct snd_sof_dev *sdev);
  450. bool snd_sof_dsp_only_d0i3_compatible_stream_active(struct snd_sof_dev *sdev);
  451. /* Machine driver enumeration */
  452. int sof_machine_register(struct snd_sof_dev *sdev, void *pdata);
  453. void sof_machine_unregister(struct snd_sof_dev *sdev, void *pdata);
  454. int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  455. int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
  456. int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsource,
  457. struct snd_soc_dapm_widget *wsink);
  458. /* PCM */
  459. int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
  460. struct snd_pcm_hw_params *fe_params,
  461. struct snd_sof_platform_stream_params *platform_params,
  462. int dir);
  463. int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir);
  464. int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_sof_dev *sdev,
  465. struct snd_sof_pcm *spcm);
  466. int sof_pcm_stream_free(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
  467. struct snd_sof_pcm *spcm, int dir, bool free_widget_list);
  468. int get_token_u32(void *elem, void *object, u32 offset);
  469. int get_token_u16(void *elem, void *object, u32 offset);
  470. int get_token_comp_format(void *elem, void *object, u32 offset);
  471. int get_token_dai_type(void *elem, void *object, u32 offset);
  472. int get_token_uuid(void *elem, void *object, u32 offset);
  473. int sof_update_ipc_object(struct snd_soc_component *scomp, void *object, enum sof_tokens token_id,
  474. struct snd_sof_tuple *tuples, int num_tuples,
  475. size_t object_size, int token_instance_num);
  476. u32 vol_compute_gain(u32 value, int *tlv);
  477. #endif