soc-dapm.c (5c68005083d620b1499fc81926a514d39ae8b88c) | soc-dapm.c (1c943f60e830d0b959c765df09d4c4b254de0481) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2// 3// soc-dapm.c -- ALSA SoC Dynamic Audio Power Management 4// 5// Copyright 2005 Wolfson Microelectronics PLC. 6// Author: Liam Girdwood <lrg@slimlogic.co.uk> 7// 8// Features: --- 2202 unchanged lines hidden (view full) --- 2211 2212 if (!dapm->debugfs_dapm || !w->name) 2213 return; 2214 2215 debugfs_create_file(w->name, 0444, dapm->debugfs_dapm, w, 2216 &dapm_widget_power_fops); 2217} 2218 | 1// SPDX-License-Identifier: GPL-2.0+ 2// 3// soc-dapm.c -- ALSA SoC Dynamic Audio Power Management 4// 5// Copyright 2005 Wolfson Microelectronics PLC. 6// Author: Liam Girdwood <lrg@slimlogic.co.uk> 7// 8// Features: --- 2202 unchanged lines hidden (view full) --- 2211 2212 if (!dapm->debugfs_dapm || !w->name) 2213 return; 2214 2215 debugfs_create_file(w->name, 0444, dapm->debugfs_dapm, w, 2216 &dapm_widget_power_fops); 2217} 2218 |
2219static void dapm_debugfs_free_widget(struct snd_soc_dapm_widget *w) 2220{ 2221 struct snd_soc_dapm_context *dapm = w->dapm; 2222 2223 if (!dapm->debugfs_dapm || !w->name) 2224 return; 2225 2226 debugfs_lookup_and_remove(w->name, dapm->debugfs_dapm); 2227} 2228 |
|
2219static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) 2220{ 2221 debugfs_remove_recursive(dapm->debugfs_dapm); 2222 dapm->debugfs_dapm = NULL; 2223} 2224 2225#else 2226void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, 2227 struct dentry *parent) 2228{ 2229} 2230 2231static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) 2232{ 2233} 2234 | 2229static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) 2230{ 2231 debugfs_remove_recursive(dapm->debugfs_dapm); 2232 dapm->debugfs_dapm = NULL; 2233} 2234 2235#else 2236void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, 2237 struct dentry *parent) 2238{ 2239} 2240 2241static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) 2242{ 2243} 2244 |
2245static inline void dapm_debugfs_free_widget(struct snd_soc_dapm_widget *w) 2246{ 2247} 2248 |
|
2235static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) 2236{ 2237} 2238 2239#endif 2240 2241/* 2242 * soc_dapm_connect_path() - Connects or disconnects a path --- 247 unchanged lines hidden (view full) --- 2490 * While removing the path, remove reference to it from both 2491 * source and sink widgets so that path is removed only once. 2492 */ 2493 snd_soc_dapm_for_each_direction(dir) { 2494 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) 2495 dapm_free_path(p); 2496 } 2497 | 2249static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) 2250{ 2251} 2252 2253#endif 2254 2255/* 2256 * soc_dapm_connect_path() - Connects or disconnects a path --- 247 unchanged lines hidden (view full) --- 2504 * While removing the path, remove reference to it from both 2505 * source and sink widgets so that path is removed only once. 2506 */ 2507 snd_soc_dapm_for_each_direction(dir) { 2508 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) 2509 dapm_free_path(p); 2510 } 2511 |
2512 dapm_debugfs_free_widget(w); 2513 |
|
2498 kfree(w->kcontrols); 2499 kfree_const(w->name); 2500 kfree_const(w->sname); 2501 kfree(w); 2502} 2503EXPORT_SYMBOL_GPL(snd_soc_dapm_free_widget); 2504 2505/* free all dapm widgets and resources */ --- 1811 unchanged lines hidden (view full) --- 4317 if (dai) { 4318 snd_soc_dapm_add_path(dapm, src, dai, NULL, NULL); 4319 src = dai; 4320 } 4321 4322 snd_soc_dapm_add_path(dapm, src, sink, NULL, NULL); 4323} 4324 | 2514 kfree(w->kcontrols); 2515 kfree_const(w->name); 2516 kfree_const(w->sname); 2517 kfree(w); 2518} 2519EXPORT_SYMBOL_GPL(snd_soc_dapm_free_widget); 2520 2521/* free all dapm widgets and resources */ --- 1811 unchanged lines hidden (view full) --- 4333 if (dai) { 4334 snd_soc_dapm_add_path(dapm, src, dai, NULL, NULL); 4335 src = dai; 4336 } 4337 4338 snd_soc_dapm_add_path(dapm, src, sink, NULL, NULL); 4339} 4340 |
4325static int get_stream_cpu(struct snd_soc_dai_link *dai_link, int stream) 4326{ 4327 /* 4328 * [Normal] 4329 * 4330 * Playback 4331 * CPU : SNDRV_PCM_STREAM_PLAYBACK 4332 * Codec: SNDRV_PCM_STREAM_PLAYBACK 4333 * 4334 * Playback 4335 * CPU : SNDRV_PCM_STREAM_CAPTURE 4336 * Codec: SNDRV_PCM_STREAM_CAPTURE 4337 */ 4338 if (!dai_link->c2c_params) 4339 return stream; 4340 4341 /* 4342 * [Codec2Codec] 4343 * 4344 * Playback 4345 * CPU : SNDRV_PCM_STREAM_CAPTURE 4346 * Codec: SNDRV_PCM_STREAM_PLAYBACK 4347 * 4348 * Capture 4349 * CPU : SNDRV_PCM_STREAM_PLAYBACK 4350 * Codec: SNDRV_PCM_STREAM_CAPTURE 4351 */ 4352 if (stream == SNDRV_PCM_STREAM_CAPTURE) 4353 return SNDRV_PCM_STREAM_PLAYBACK; 4354 4355 return SNDRV_PCM_STREAM_CAPTURE; 4356} 4357 | |
4358static void dapm_connect_dai_pair(struct snd_soc_card *card, 4359 struct snd_soc_pcm_runtime *rtd, 4360 struct snd_soc_dai *codec_dai, 4361 struct snd_soc_dai *cpu_dai) 4362{ 4363 struct snd_soc_dai_link *dai_link = rtd->dai_link; 4364 struct snd_soc_dapm_widget *codec, *cpu; 4365 struct snd_soc_dai *src_dai[] = { cpu_dai, codec_dai }; 4366 struct snd_soc_dai *sink_dai[] = { codec_dai, cpu_dai }; 4367 struct snd_soc_dapm_widget **src[] = { &cpu, &codec }; 4368 struct snd_soc_dapm_widget **sink[] = { &codec, &cpu }; 4369 char *widget_name[] = { "playback", "capture" }; 4370 int stream; 4371 4372 for_each_pcm_streams(stream) { 4373 int stream_cpu, stream_codec; 4374 | 4341static void dapm_connect_dai_pair(struct snd_soc_card *card, 4342 struct snd_soc_pcm_runtime *rtd, 4343 struct snd_soc_dai *codec_dai, 4344 struct snd_soc_dai *cpu_dai) 4345{ 4346 struct snd_soc_dai_link *dai_link = rtd->dai_link; 4347 struct snd_soc_dapm_widget *codec, *cpu; 4348 struct snd_soc_dai *src_dai[] = { cpu_dai, codec_dai }; 4349 struct snd_soc_dai *sink_dai[] = { codec_dai, cpu_dai }; 4350 struct snd_soc_dapm_widget **src[] = { &cpu, &codec }; 4351 struct snd_soc_dapm_widget **sink[] = { &codec, &cpu }; 4352 char *widget_name[] = { "playback", "capture" }; 4353 int stream; 4354 4355 for_each_pcm_streams(stream) { 4356 int stream_cpu, stream_codec; 4357 |
4375 stream_cpu = get_stream_cpu(dai_link, stream); | 4358 stream_cpu = snd_soc_get_stream_cpu(dai_link, stream); |
4376 stream_codec = stream; 4377 4378 /* connect BE DAI playback if widgets are valid */ 4379 cpu = snd_soc_dai_get_widget(cpu_dai, stream_cpu); 4380 codec = snd_soc_dai_get_widget(codec_dai, stream_codec); 4381 4382 if (!cpu || !codec) 4383 continue; --- 496 unchanged lines hidden --- | 4359 stream_codec = stream; 4360 4361 /* connect BE DAI playback if widgets are valid */ 4362 cpu = snd_soc_dai_get_widget(cpu_dai, stream_cpu); 4363 codec = snd_soc_dai_get_widget(codec_dai, stream_codec); 4364 4365 if (!cpu || !codec) 4366 continue; --- 496 unchanged lines hidden --- |