aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-20 09:48:55 -0500
committerTakashi Iwai <tiwai@suse.de>2014-01-20 09:48:55 -0500
commit7552f34a790069a008bd3e2ab4c0954b30c2f63b (patch)
treed51ab23d4d59248c969c25bb2fc14f45158ff5ae
parent258753361534a40ad7180c742da813fc659e427b (diff)
parentac6d7c48e3a5e82e876114b9ca0b489e96997743 (diff)
Merge tag 'asoc-v3.14-3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Last updates for the merge window A couple more fixes plus some extensions to DPCM for use with compressed audio from Liam which arrived just after my previous pull request.
-rw-r--r--include/sound/soc-dpcm.h22
-rw-r--r--include/sound/soc.h1
-rw-r--r--sound/soc/soc-compress.c301
-rw-r--r--sound/soc/soc-dapm.c11
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c9
-rw-r--r--sound/soc/soc-pcm.c29
6 files changed, 347 insertions, 26 deletions
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 047d657c331c..2883a7a6f9f3 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -11,6 +11,7 @@
11#ifndef __LINUX_SND_SOC_DPCM_H 11#ifndef __LINUX_SND_SOC_DPCM_H
12#define __LINUX_SND_SOC_DPCM_H 12#define __LINUX_SND_SOC_DPCM_H
13 13
14#include <linux/slab.h>
14#include <linux/list.h> 15#include <linux/list.h>
15#include <sound/pcm.h> 16#include <sound/pcm.h>
16 17
@@ -135,4 +136,25 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
135int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd); 136int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
136int soc_dpcm_runtime_update(struct snd_soc_card *); 137int soc_dpcm_runtime_update(struct snd_soc_card *);
137 138
139int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
140 int stream, struct snd_soc_dapm_widget_list **list_);
141int dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
142 int stream, struct snd_soc_dapm_widget_list **list, int new);
143int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream);
144int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream);
145void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream);
146void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream);
147int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream);
148int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int tream);
149int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int cmd);
150int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream);
151int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
152 int event);
153
154static inline void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
155{
156 kfree(*list);
157}
158
159
138#endif 160#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 03ce45bf8ade..9a001472b96a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1042,6 +1042,7 @@ struct snd_soc_pcm_runtime {
1042 1042
1043 /* Dynamic PCM BE runtime data */ 1043 /* Dynamic PCM BE runtime data */
1044 struct snd_soc_dpcm_runtime dpcm[2]; 1044 struct snd_soc_dpcm_runtime dpcm[2];
1045 int fe_compr;
1045 1046
1046 long pmdown_time; 1047 long pmdown_time;
1047 unsigned char pop_wait:1; 1048 unsigned char pop_wait:1;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 53c9ecdd119f..5e9690c85d8f 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -24,6 +24,7 @@
24#include <sound/compress_driver.h> 24#include <sound/compress_driver.h>
25#include <sound/soc.h> 25#include <sound/soc.h>
26#include <sound/initval.h> 26#include <sound/initval.h>
27#include <sound/soc-dpcm.h>
27 28
28static int soc_compr_open(struct snd_compr_stream *cstream) 29static int soc_compr_open(struct snd_compr_stream *cstream)
29{ 30{
@@ -75,6 +76,98 @@ out:
75 return ret; 76 return ret;
76} 77}
77 78
79static int soc_compr_open_fe(struct snd_compr_stream *cstream)
80{
81 struct snd_soc_pcm_runtime *fe = cstream->private_data;
82 struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream;
83 struct snd_soc_platform *platform = fe->platform;
84 struct snd_soc_dai *cpu_dai = fe->cpu_dai;
85 struct snd_soc_dai *codec_dai = fe->codec_dai;
86 struct snd_soc_dpcm *dpcm;
87 struct snd_soc_dapm_widget_list *list;
88 int stream;
89 int ret = 0;
90
91 if (cstream->direction == SND_COMPRESS_PLAYBACK)
92 stream = SNDRV_PCM_STREAM_PLAYBACK;
93 else
94 stream = SNDRV_PCM_STREAM_CAPTURE;
95
96 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
97
98 if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
99 ret = platform->driver->compr_ops->open(cstream);
100 if (ret < 0) {
101 pr_err("compress asoc: can't open platform %s\n", platform->name);
102 goto out;
103 }
104 }
105
106 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->startup) {
107 ret = fe->dai_link->compr_ops->startup(cstream);
108 if (ret < 0) {
109 pr_err("compress asoc: %s startup failed\n", fe->dai_link->name);
110 goto machine_err;
111 }
112 }
113
114 fe->dpcm[stream].runtime = fe_substream->runtime;
115
116 if (dpcm_path_get(fe, stream, &list) <= 0) {
117 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
118 fe->dai_link->name, stream ? "capture" : "playback");
119 }
120
121 /* calculate valid and active FE <-> BE dpcms */
122 dpcm_process_paths(fe, stream, &list, 1);
123
124 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
125
126 ret = dpcm_be_dai_startup(fe, stream);
127 if (ret < 0) {
128 /* clean up all links */
129 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be)
130 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
131
132 dpcm_be_disconnect(fe, stream);
133 fe->dpcm[stream].runtime = NULL;
134 goto fe_err;
135 }
136
137 dpcm_clear_pending_state(fe, stream);
138 dpcm_path_put(&list);
139
140 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
141 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
142
143 if (cstream->direction == SND_COMPRESS_PLAYBACK) {
144 cpu_dai->playback_active++;
145 codec_dai->playback_active++;
146 } else {
147 cpu_dai->capture_active++;
148 codec_dai->capture_active++;
149 }
150
151 cpu_dai->active++;
152 codec_dai->active++;
153 fe->codec->active++;
154
155 mutex_unlock(&fe->card->mutex);
156
157 return 0;
158
159fe_err:
160 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
161 fe->dai_link->compr_ops->shutdown(cstream);
162machine_err:
163 if (platform->driver->compr_ops && platform->driver->compr_ops->free)
164 platform->driver->compr_ops->free(cstream);
165out:
166 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
167 mutex_unlock(&fe->card->mutex);
168 return ret;
169}
170
78/* 171/*
79 * Power down the audio subsystem pmdown_time msecs after close is called. 172 * Power down the audio subsystem pmdown_time msecs after close is called.
80 * This is to ensure there are no pops or clicks in between any music tracks 173 * This is to ensure there are no pops or clicks in between any music tracks
@@ -164,6 +257,65 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
164 return 0; 257 return 0;
165} 258}
166 259
260static int soc_compr_free_fe(struct snd_compr_stream *cstream)
261{
262 struct snd_soc_pcm_runtime *fe = cstream->private_data;
263 struct snd_soc_platform *platform = fe->platform;
264 struct snd_soc_dai *cpu_dai = fe->cpu_dai;
265 struct snd_soc_dai *codec_dai = fe->codec_dai;
266 struct snd_soc_dpcm *dpcm;
267 int stream, ret;
268
269 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
270
271 if (cstream->direction == SND_COMPRESS_PLAYBACK) {
272 stream = SNDRV_PCM_STREAM_PLAYBACK;
273 cpu_dai->playback_active--;
274 codec_dai->playback_active--;
275 } else {
276 stream = SNDRV_PCM_STREAM_CAPTURE;
277 cpu_dai->capture_active--;
278 codec_dai->capture_active--;
279 }
280
281 cpu_dai->active--;
282 codec_dai->active--;
283 fe->codec->active--;
284
285 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
286
287 ret = dpcm_be_dai_hw_free(fe, stream);
288 if (ret < 0)
289 dev_err(fe->dev, "compressed hw_free failed %d\n", ret);
290
291 ret = dpcm_be_dai_shutdown(fe, stream);
292
293 /* mark FE's links ready to prune */
294 list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be)
295 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
296
297 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
298 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
299 else
300 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
301
302 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
303 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
304
305 dpcm_be_disconnect(fe, stream);
306
307 fe->dpcm[stream].runtime = NULL;
308
309 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
310 fe->dai_link->compr_ops->shutdown(cstream);
311
312 if (platform->driver->compr_ops && platform->driver->compr_ops->free)
313 platform->driver->compr_ops->free(cstream);
314
315 mutex_unlock(&fe->card->mutex);
316 return 0;
317}
318
167static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) 319static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
168{ 320{
169 321
@@ -194,6 +346,59 @@ out:
194 return ret; 346 return ret;
195} 347}
196 348
349static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
350{
351 struct snd_soc_pcm_runtime *fe = cstream->private_data;
352 struct snd_soc_platform *platform = fe->platform;
353 int ret = 0, stream;
354
355 if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
356 cmd == SND_COMPR_TRIGGER_DRAIN) {
357
358 if (platform->driver->compr_ops &&
359 platform->driver->compr_ops->trigger)
360 return platform->driver->compr_ops->trigger(cstream, cmd);
361 }
362
363 if (cstream->direction == SND_COMPRESS_PLAYBACK)
364 stream = SNDRV_PCM_STREAM_PLAYBACK;
365 else
366 stream = SNDRV_PCM_STREAM_CAPTURE;
367
368
369 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
370
371 if (platform->driver->compr_ops && platform->driver->compr_ops->trigger) {
372 ret = platform->driver->compr_ops->trigger(cstream, cmd);
373 if (ret < 0)
374 goto out;
375 }
376
377 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
378
379 ret = dpcm_be_dai_trigger(fe, stream, cmd);
380
381 switch (cmd) {
382 case SNDRV_PCM_TRIGGER_START:
383 case SNDRV_PCM_TRIGGER_RESUME:
384 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
385 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
386 break;
387 case SNDRV_PCM_TRIGGER_STOP:
388 case SNDRV_PCM_TRIGGER_SUSPEND:
389 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
390 break;
391 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
392 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
393 break;
394 }
395
396out:
397 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
398 mutex_unlock(&fe->card->mutex);
399 return ret;
400}
401
197static int soc_compr_set_params(struct snd_compr_stream *cstream, 402static int soc_compr_set_params(struct snd_compr_stream *cstream,
198 struct snd_compr_params *params) 403 struct snd_compr_params *params)
199{ 404{
@@ -241,6 +446,64 @@ err:
241 return ret; 446 return ret;
242} 447}
243 448
449static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
450 struct snd_compr_params *params)
451{
452 struct snd_soc_pcm_runtime *fe = cstream->private_data;
453 struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream;
454 struct snd_soc_platform *platform = fe->platform;
455 int ret = 0, stream;
456
457 if (cstream->direction == SND_COMPRESS_PLAYBACK)
458 stream = SNDRV_PCM_STREAM_PLAYBACK;
459 else
460 stream = SNDRV_PCM_STREAM_CAPTURE;
461
462 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
463
464 if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) {
465 ret = platform->driver->compr_ops->set_params(cstream, params);
466 if (ret < 0)
467 goto out;
468 }
469
470 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->set_params) {
471 ret = fe->dai_link->compr_ops->set_params(cstream);
472 if (ret < 0)
473 goto out;
474 }
475
476 /*
477 * Create an empty hw_params for the BE as the machine driver must
478 * fix this up to match DSP decoder and ASRC configuration.
479 * I.e. machine driver fixup for compressed BE is mandatory.
480 */
481 memset(&fe->dpcm[fe_substream->stream].hw_params, 0,
482 sizeof(struct snd_pcm_hw_params));
483
484 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
485
486 ret = dpcm_be_dai_hw_params(fe, stream);
487 if (ret < 0)
488 goto out;
489
490 ret = dpcm_be_dai_prepare(fe, stream);
491 if (ret < 0)
492 goto out;
493
494 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
495 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);
496 else
497 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START);
498
499 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
500
501out:
502 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
503 mutex_unlock(&fe->card->mutex);
504 return ret;
505}
506
244static int soc_compr_get_params(struct snd_compr_stream *cstream, 507static int soc_compr_get_params(struct snd_compr_stream *cstream,
245 struct snd_codec *params) 508 struct snd_codec *params)
246{ 509{
@@ -360,6 +623,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
360 623
361 return ret; 624 return ret;
362} 625}
626
363/* ASoC Compress operations */ 627/* ASoC Compress operations */
364static struct snd_compr_ops soc_compr_ops = { 628static struct snd_compr_ops soc_compr_ops = {
365 .open = soc_compr_open, 629 .open = soc_compr_open,
@@ -375,6 +639,21 @@ static struct snd_compr_ops soc_compr_ops = {
375 .get_codec_caps = soc_compr_get_codec_caps 639 .get_codec_caps = soc_compr_get_codec_caps
376}; 640};
377 641
642/* ASoC Dynamic Compress operations */
643static struct snd_compr_ops soc_compr_dyn_ops = {
644 .open = soc_compr_open_fe,
645 .free = soc_compr_free_fe,
646 .set_params = soc_compr_set_params_fe,
647 .get_params = soc_compr_get_params,
648 .set_metadata = soc_compr_set_metadata,
649 .get_metadata = soc_compr_get_metadata,
650 .trigger = soc_compr_trigger_fe,
651 .pointer = soc_compr_pointer,
652 .ack = soc_compr_ack,
653 .get_caps = soc_compr_get_caps,
654 .get_codec_caps = soc_compr_get_codec_caps
655};
656
378/* create a new compress */ 657/* create a new compress */
379int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) 658int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
380{ 659{
@@ -383,6 +662,7 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
383 struct snd_soc_dai *codec_dai = rtd->codec_dai; 662 struct snd_soc_dai *codec_dai = rtd->codec_dai;
384 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 663 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
385 struct snd_compr *compr; 664 struct snd_compr *compr;
665 struct snd_pcm *be_pcm;
386 char new_name[64]; 666 char new_name[64];
387 int ret = 0, direction = 0; 667 int ret = 0, direction = 0;
388 668
@@ -410,7 +690,26 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
410 ret = -ENOMEM; 690 ret = -ENOMEM;
411 goto compr_err; 691 goto compr_err;
412 } 692 }
413 memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); 693
694 if (rtd->dai_link->dynamic) {
695 snprintf(new_name, sizeof(new_name), "(%s)",
696 rtd->dai_link->stream_name);
697
698 ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num,
699 1, 0, &be_pcm);
700 if (ret < 0) {
701 dev_err(rtd->card->dev, "ASoC: can't create compressed for %s\n",
702 rtd->dai_link->name);
703 goto compr_err;
704 }
705
706 rtd->pcm = be_pcm;
707 rtd->fe_compr = 1;
708 be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd;
709 be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd;
710 memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops));
711 } else
712 memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
414 713
415 /* Add copy callback for not memory mapped DSPs */ 714 /* Add copy callback for not memory mapped DSPs */
416 if (platform->driver->compr_ops && platform->driver->compr_ops->copy) 715 if (platform->driver->compr_ops && platform->driver->compr_ops->copy)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2a44fe9122a2..dc8ff13187f7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2476,7 +2476,8 @@ err:
2476} 2476}
2477 2477
2478static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, 2478static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2479 const struct snd_soc_dapm_route *route) 2479 const struct snd_soc_dapm_route *route,
2480 unsigned int is_prefixed)
2480{ 2481{
2481 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; 2482 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w;
2482 struct snd_soc_dapm_widget *wtsource = NULL, *wtsink = NULL; 2483 struct snd_soc_dapm_widget *wtsource = NULL, *wtsink = NULL;
@@ -2486,7 +2487,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2486 char prefixed_source[80]; 2487 char prefixed_source[80];
2487 int ret; 2488 int ret;
2488 2489
2489 if (dapm->codec && dapm->codec->name_prefix) { 2490 if (dapm->codec && dapm->codec->name_prefix && !is_prefixed) {
2490 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s", 2491 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s",
2491 dapm->codec->name_prefix, route->sink); 2492 dapm->codec->name_prefix, route->sink);
2492 sink = prefixed_sink; 2493 sink = prefixed_sink;
@@ -2614,7 +2615,7 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
2614 2615
2615 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 2616 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
2616 for (i = 0; i < num; i++) { 2617 for (i = 0; i < num; i++) {
2617 r = snd_soc_dapm_add_route(dapm, route); 2618 r = snd_soc_dapm_add_route(dapm, route, false);
2618 if (r < 0) { 2619 if (r < 0) {
2619 dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n", 2620 dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
2620 route->source, 2621 route->source,
@@ -3670,7 +3671,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3670 cpu_dai->codec->name, r.source, 3671 cpu_dai->codec->name, r.source,
3671 codec_dai->platform->name, r.sink); 3672 codec_dai->platform->name, r.sink);
3672 3673
3673 snd_soc_dapm_add_route(&card->dapm, &r); 3674 snd_soc_dapm_add_route(&card->dapm, &r, true);
3674 } 3675 }
3675 3676
3676 /* connect BE DAI capture if widgets are valid */ 3677 /* connect BE DAI capture if widgets are valid */
@@ -3681,7 +3682,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3681 codec_dai->codec->name, r.source, 3682 codec_dai->codec->name, r.source,
3682 cpu_dai->platform->name, r.sink); 3683 cpu_dai->platform->name, r.sink);
3683 3684
3684 snd_soc_dapm_add_route(&card->dapm, &r); 3685 snd_soc_dapm_add_route(&card->dapm, &r, true);
3685 } 3686 }
3686 3687
3687 } 3688 }
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 560a7787d8a7..5bace124ef43 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -176,17 +176,20 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
176{ 176{
177 struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); 177 struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
178 struct snd_dmaengine_dai_dma_data *dma_data; 178 struct snd_dmaengine_dai_dma_data *dma_data;
179 dma_filter_fn fn = NULL;
179 180
180 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 181 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
181 182
182 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0]) 183 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
183 return pcm->chan[0]; 184 return pcm->chan[0];
184 185
185 if (pcm->config->compat_request_channel) 186 if (pcm->config && pcm->config->compat_request_channel)
186 return pcm->config->compat_request_channel(rtd, substream); 187 return pcm->config->compat_request_channel(rtd, substream);
187 188
188 return snd_dmaengine_pcm_request_channel(pcm->config->compat_filter_fn, 189 if (pcm->config)
189 dma_data->filter_data); 190 fn = pcm->config->compat_filter_fn;
191
192 return snd_dmaengine_pcm_request_channel(fn, dma_data->filter_data);
190} 193}
191 194
192static bool dmaengine_pcm_can_report_residue(struct dma_chan *chan) 195static bool dmaengine_pcm_can_report_residue(struct dma_chan *chan)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 5932971cf54d..47e1ce771e65 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -58,7 +58,7 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
58EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams); 58EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams);
59 59
60/* DPCM stream event, send event to FE and all active BEs. */ 60/* DPCM stream event, send event to FE and all active BEs. */
61static int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, 61int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
62 int event) 62 int event)
63{ 63{
64 struct snd_soc_dpcm *dpcm; 64 struct snd_soc_dpcm *dpcm;
@@ -885,7 +885,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe,
885} 885}
886 886
887/* disconnect a BE and FE */ 887/* disconnect a BE and FE */
888static void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) 888void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
889{ 889{
890 struct snd_soc_dpcm *dpcm, *d; 890 struct snd_soc_dpcm *dpcm, *d;
891 891
@@ -981,7 +981,7 @@ static int widget_in_list(struct snd_soc_dapm_widget_list *list,
981 return 0; 981 return 0;
982} 982}
983 983
984static int dpcm_path_get(struct snd_soc_pcm_runtime *fe, 984int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
985 int stream, struct snd_soc_dapm_widget_list **list_) 985 int stream, struct snd_soc_dapm_widget_list **list_)
986{ 986{
987 struct snd_soc_dai *cpu_dai = fe->cpu_dai; 987 struct snd_soc_dai *cpu_dai = fe->cpu_dai;
@@ -1003,11 +1003,6 @@ static int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
1003 return paths; 1003 return paths;
1004} 1004}
1005 1005
1006static inline void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
1007{
1008 kfree(*list);
1009}
1010
1011static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream, 1006static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
1012 struct snd_soc_dapm_widget_list **list_) 1007 struct snd_soc_dapm_widget_list **list_)
1013{ 1008{
@@ -1077,7 +1072,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
1077 continue; 1072 continue;
1078 1073
1079 /* don't connect if FE is not running */ 1074 /* don't connect if FE is not running */
1080 if (!fe->dpcm[stream].runtime) 1075 if (!fe->dpcm[stream].runtime && !fe->fe_compr)
1081 continue; 1076 continue;
1082 1077
1083 /* newly connected FE and BE */ 1078 /* newly connected FE and BE */
@@ -1102,7 +1097,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
1102 * Find the corresponding BE DAIs that source or sink audio to this 1097 * Find the corresponding BE DAIs that source or sink audio to this
1103 * FE substream. 1098 * FE substream.
1104 */ 1099 */
1105static int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, 1100int dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
1106 int stream, struct snd_soc_dapm_widget_list **list, int new) 1101 int stream, struct snd_soc_dapm_widget_list **list, int new)
1107{ 1102{
1108 if (new) 1103 if (new)
@@ -1111,7 +1106,7 @@ static int dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
1111 return dpcm_prune_paths(fe, stream, list); 1106 return dpcm_prune_paths(fe, stream, list);
1112} 1107}
1113 1108
1114static void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) 1109void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream)
1115{ 1110{
1116 struct snd_soc_dpcm *dpcm; 1111 struct snd_soc_dpcm *dpcm;
1117 1112
@@ -1149,7 +1144,7 @@ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
1149 } 1144 }
1150} 1145}
1151 1146
1152static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) 1147int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
1153{ 1148{
1154 struct snd_soc_dpcm *dpcm; 1149 struct snd_soc_dpcm *dpcm;
1155 int err, count = 0; 1150 int err, count = 0;
@@ -1301,7 +1296,7 @@ be_err:
1301 return ret; 1296 return ret;
1302} 1297}
1303 1298
1304static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) 1299int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
1305{ 1300{
1306 struct snd_soc_dpcm *dpcm; 1301 struct snd_soc_dpcm *dpcm;
1307 1302
@@ -1362,7 +1357,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1362 return 0; 1357 return 0;
1363} 1358}
1364 1359
1365static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) 1360int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1366{ 1361{
1367 struct snd_soc_dpcm *dpcm; 1362 struct snd_soc_dpcm *dpcm;
1368 1363
@@ -1427,7 +1422,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1427 return 0; 1422 return 0;
1428} 1423}
1429 1424
1430static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) 1425int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
1431{ 1426{
1432 struct snd_soc_dpcm *dpcm; 1427 struct snd_soc_dpcm *dpcm;
1433 int ret; 1428 int ret;
@@ -1557,7 +1552,7 @@ static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm,
1557 return ret; 1552 return ret;
1558} 1553}
1559 1554
1560static int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, 1555int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
1561 int cmd) 1556 int cmd)
1562{ 1557{
1563 struct snd_soc_dpcm *dpcm; 1558 struct snd_soc_dpcm *dpcm;
@@ -1725,7 +1720,7 @@ out:
1725 return ret; 1720 return ret;
1726} 1721}
1727 1722
1728static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) 1723int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
1729{ 1724{
1730 struct snd_soc_dpcm *dpcm; 1725 struct snd_soc_dpcm *dpcm;
1731 int ret = 0; 1726 int ret = 0;