19 #include <linux/kernel.h>
23 #include <linux/slab.h>
25 #include <linux/export.h>
34 #define DPCM_MAX_BE_USERS 8
46 dev_dbg(be->
dev,
"pm: BE %s event %d dir %d\n",
63 if (!soc_dai->
driver->symmetric_rates &&
73 "Not enforcing symmetric_rates due to race\n");
77 dev_dbg(soc_dai->
dev,
"Symmetry forces %dHz rate\n", soc_dai->
rate);
84 "Unable to apply rate symmetry constraint: %d\n", ret);
96 static int sample_sizes[] = {
106 bits = dai->
driver->playback.sig_bits;
108 bits = dai->
driver->capture.sig_bits;
113 for (i = 0; i <
ARRAY_SIZE(sample_sizes); i++) {
114 if (bits >= sample_sizes[i])
118 sample_sizes[i], bits);
121 "Failed to set MSB %d/%d: %d\n",
122 bits, sample_sizes[i], ret);
142 pm_runtime_get_sync(cpu_dai->
dev);
143 pm_runtime_get_sync(codec_dai->
dev);
144 pm_runtime_get_sync(platform->
dev);
149 if (cpu_dai->
driver->ops->startup) {
150 ret = cpu_dai->
driver->ops->startup(substream, cpu_dai);
152 dev_err(cpu_dai->
dev,
"can't open interface %s: %d\n",
158 if (platform->
driver->ops && platform->
driver->ops->open) {
159 ret = platform->
driver->ops->open(substream);
161 dev_err(platform->
dev,
"can't open platform %s: %d\n",
162 platform->
name, ret);
167 if (codec_dai->
driver->ops->startup) {
168 ret = codec_dai->
driver->ops->startup(substream, codec_dai);
170 dev_err(codec_dai->
dev,
"can't open codec %s: %d\n",
171 codec_dai->
name, ret);
177 ret = rtd->
dai_link->ops->startup(substream);
179 pr_err(
"asoc: %s startup failed: %d\n",
191 runtime->
hw.rate_min =
194 runtime->
hw.rate_max =
197 runtime->
hw.channels_min =
199 cpu_dai_drv->
playback.channels_min);
200 runtime->
hw.channels_max =
202 cpu_dai_drv->
playback.channels_max);
203 runtime->
hw.formats =
209 runtime->
hw.rates |= cpu_dai_drv->
playback.rates;
212 runtime->
hw.rates |= codec_dai_drv->
playback.rates;
214 runtime->
hw.rate_min =
216 cpu_dai_drv->
capture.rate_min);
217 runtime->
hw.rate_max =
219 cpu_dai_drv->
capture.rate_max);
220 runtime->
hw.channels_min =
222 cpu_dai_drv->
capture.channels_min);
223 runtime->
hw.channels_max =
225 cpu_dai_drv->
capture.channels_max);
226 runtime->
hw.formats =
230 if (codec_dai_drv->
capture.rates
232 runtime->
hw.rates |= cpu_dai_drv->
capture.rates;
235 runtime->
hw.rates |= codec_dai_drv->
capture.rates;
240 if (!runtime->
hw.rates) {
245 if (!runtime->
hw.formats) {
250 if (!runtime->
hw.channels_min || !runtime->
hw.channels_max ||
251 runtime->
hw.channels_min > runtime->
hw.channels_max) {
257 soc_pcm_apply_msb(substream, codec_dai);
258 soc_pcm_apply_msb(substream, cpu_dai);
262 ret = soc_pcm_apply_symmetry(substream, cpu_dai);
268 ret = soc_pcm_apply_symmetry(substream, codec_dai);
275 pr_debug(
"asoc: rate mask 0x%x\n", runtime->
hw.rates);
276 pr_debug(
"asoc: min ch %d max ch %d\n", runtime->
hw.channels_min,
277 runtime->
hw.channels_max);
278 pr_debug(
"asoc: min rate %d max rate %d\n", runtime->
hw.rate_min,
279 runtime->
hw.rate_max);
291 rtd->
codec->active++;
297 rtd->
dai_link->ops->shutdown(substream);
300 if (codec_dai->
driver->ops->shutdown)
301 codec_dai->
driver->ops->shutdown(substream, codec_dai);
304 if (platform->
driver->ops && platform->
driver->ops->close)
305 platform->
driver->ops->close(substream);
308 if (cpu_dai->
driver->ops->shutdown)
309 cpu_dai->
driver->ops->shutdown(substream, cpu_dai);
313 pm_runtime_put(platform->
dev);
314 pm_runtime_put(codec_dai->
dev);
315 pm_runtime_put(cpu_dai->
dev);
333 pr_debug(
"pop wq checking: %s status: %s waiting: %s\n",
334 codec_dai->
driver->playback.stream_name,
336 codec_dai->
pop_wait ?
"yes" :
"no");
388 if (cpu_dai->
driver->ops->shutdown)
389 cpu_dai->
driver->ops->shutdown(substream, cpu_dai);
391 if (codec_dai->
driver->ops->shutdown)
392 codec_dai->
driver->ops->shutdown(substream, codec_dai);
395 rtd->
dai_link->ops->shutdown(substream);
397 if (platform->
driver->ops && platform->
driver->ops->close)
398 platform->
driver->ops->close(substream);
403 rtd->
dai_link->ignore_pmdown_time) {
422 pm_runtime_put(platform->
dev);
423 pm_runtime_put(codec_dai->
dev);
424 pm_runtime_put(cpu_dai->
dev);
445 ret = rtd->
dai_link->ops->prepare(substream);
447 pr_err(
"asoc: machine prepare error: %d\n", ret);
452 if (platform->
driver->ops && platform->
driver->ops->prepare) {
453 ret = platform->
driver->ops->prepare(substream);
455 dev_err(platform->
dev,
"platform prepare error: %d\n",
461 if (codec_dai->
driver->ops->prepare) {
462 ret = codec_dai->
driver->ops->prepare(substream, codec_dai);
464 dev_err(codec_dai->
dev,
"DAI prepare error: %d\n",
470 if (cpu_dai->
driver->ops->prepare) {
471 ret = cpu_dai->
driver->ops->prepare(substream, cpu_dai);
473 dev_err(cpu_dai->
dev,
"DAI prepare error: %d\n",
513 ret = rtd->
dai_link->ops->hw_params(substream, params);
515 pr_err(
"asoc: machine hw_params failed: %d\n", ret);
520 if (codec_dai->
driver->ops->hw_params) {
521 ret = codec_dai->
driver->ops->hw_params(substream, params, codec_dai);
523 dev_err(codec_dai->
dev,
"can't set %s hw params: %d\n",
524 codec_dai->
name, ret);
529 if (cpu_dai->
driver->ops->hw_params) {
530 ret = cpu_dai->
driver->ops->hw_params(substream, params, cpu_dai);
532 dev_err(cpu_dai->
dev,
"%s hw params failed: %d\n",
538 if (platform->
driver->ops && platform->
driver->ops->hw_params) {
539 ret = platform->
driver->ops->hw_params(substream, params);
541 dev_err(platform->
dev,
"%s hw params failed: %d\n",
542 platform->
name, ret);
556 if (cpu_dai->
driver->ops->hw_free)
557 cpu_dai->
driver->ops->hw_free(substream, cpu_dai);
560 if (codec_dai->
driver->ops->hw_free)
561 codec_dai->
driver->ops->hw_free(substream, codec_dai);
565 rtd->
dai_link->ops->hw_free(substream);
590 rtd->
dai_link->ops->hw_free(substream);
593 if (platform->
driver->ops && platform->
driver->ops->hw_free)
594 platform->
driver->ops->hw_free(substream);
597 if (codec_dai->
driver->ops->hw_free)
598 codec_dai->
driver->ops->hw_free(substream, codec_dai);
600 if (cpu_dai->
driver->ops->hw_free)
601 cpu_dai->
driver->ops->hw_free(substream, cpu_dai);
615 if (codec_dai->
driver->ops->trigger) {
616 ret = codec_dai->
driver->ops->trigger(substream, cmd, codec_dai);
621 if (platform->
driver->ops && platform->
driver->ops->trigger) {
622 ret = platform->
driver->ops->trigger(substream, cmd);
627 if (cpu_dai->
driver->ops->trigger) {
628 ret = cpu_dai->
driver->ops->trigger(substream, cmd, cpu_dai);
644 if (codec_dai->
driver->ops->bespoke_trigger) {
645 ret = codec_dai->
driver->ops->bespoke_trigger(substream, cmd, codec_dai);
650 if (platform->
driver->bespoke_trigger) {
651 ret = platform->
driver->bespoke_trigger(substream, cmd);
656 if (cpu_dai->
driver->ops->bespoke_trigger) {
657 ret = cpu_dai->
driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
678 if (platform->
driver->ops && platform->
driver->ops->pointer)
679 offset = platform->
driver->ops->pointer(substream);
681 if (cpu_dai->
driver->ops->delay)
682 delay += cpu_dai->
driver->ops->delay(substream, cpu_dai);
684 if (codec_dai->
driver->ops->delay)
685 delay += codec_dai->
driver->ops->delay(substream, codec_dai);
687 if (platform->
driver->delay)
688 delay += platform->
driver->delay(substream, codec_dai);
703 if (dpcm->
be == be && dpcm->
fe == fe)
713 be->
dpcm[stream].runtime = fe->
dpcm[stream].runtime;
715 list_add(&dpcm->
list_be, &fe->
dpcm[stream].be_clients);
716 list_add(&dpcm->
list_fe, &be->
dpcm[stream].fe_clients);
718 dev_dbg(fe->
dev,
" connected new DPCM %s path %s %s %s\n",
719 stream ?
"capture" :
"playback", fe->
dai_link->name,
720 stream ?
"<-" :
"->", be->
dai_link->name);
722 #ifdef CONFIG_DEBUG_FS
724 fe->debugfs_dpcm_root, &dpcm->
state);
737 if (!be->
dpcm[stream].users)
746 dev_dbg(fe->
dev,
" reparent %s path %s %s %s\n",
747 stream ?
"capture" :
"playback",
748 dpcm->
fe->dai_link->name,
749 stream ?
"<-" :
"->", dpcm->
be->dai_link->name);
763 dev_dbg(fe->
dev,
"BE %s disconnect check for %s\n",
764 stream ?
"capture" :
"playback",
765 dpcm->
be->dai_link->name);
770 dev_dbg(fe->
dev,
" freed DSP %s path %s %s %s\n",
771 stream ?
"capture" :
"playback", fe->
dai_link->name,
772 stream ?
"<-" :
"->", dpcm->
be->dai_link->name);
775 dpcm_be_reparent(fe, dpcm->
be, stream);
777 #ifdef CONFIG_DEBUG_FS
800 if (be->
cpu_dai->playback_widget == widget ||
801 be->
codec_dai->playback_widget == widget)
812 if (be->
cpu_dai->capture_widget == widget ||
818 dev_err(card->
dev,
"can't get %s BE for %s\n",
819 stream ?
"capture" :
"playback", widget->
name);
827 return rtd->
cpu_dai->playback_widget;
829 return rtd->
cpu_dai->capture_widget;
847 if (widget == list->
widgets[i])
869 dev_dbg(fe->
dev,
"found %d audio %s paths\n", paths,
870 stream ?
"capture" :
"playback");
893 widget = rtd_get_cpu_widget(dpcm->
be, stream);
896 if (widget && widget_in_list(list, widget))
900 widget = rtd_get_codec_widget(dpcm->
be, stream);
903 if (widget && widget_in_list(list, widget))
907 stream ?
"capture" :
"playback",
908 dpcm->
be->dai_link->name, fe->
dai_link->name);
914 dev_dbg(fe->
dev,
"found %d old BE paths for pruning\n", prune);
933 be = dpcm_get_be(card, list->
widgets[i], stream);
945 if (!fe->
dpcm[stream].runtime)
949 err = dpcm_be_connect(fe, be, stream);
962 dev_dbg(fe->
dev,
"found %d new BE paths\n",
new);
974 return dpcm_add_paths(fe, stream, list);
976 return dpcm_prune_paths(fe, stream, list);
984 dpcm->be->dpcm[stream].runtime_update =
1000 if (be->
dpcm[stream].users == 0)
1001 dev_err(be->
dev,
"no users %s at close - state %d\n",
1002 stream ?
"capture" :
"playback",
1003 be->
dpcm[stream].state);
1005 if (--be->
dpcm[stream].users != 0)
1011 soc_pcm_close(be_substream);
1035 dev_err(be->
dev,
"too many users %s at open %d\n",
1036 stream ?
"capture" :
"playback",
1037 be->
dpcm[stream].state);
1039 if (be->
dpcm[stream].users++ != 0)
1049 err = soc_pcm_open(be_substream);
1051 dev_err(be->
dev,
"BE open failed %d\n", err);
1053 if (be->
dpcm[stream].users < 0)
1054 dev_err(be->
dev,
"no users %s at unwind %d\n",
1055 stream ?
"capture" :
"playback",
1056 be->
dpcm[stream].state);
1078 if (be->
dpcm[stream].users == 0)
1079 dev_err(be->
dev,
"no users %s at close %d\n",
1080 stream ?
"capture" :
"playback",
1081 be->
dpcm[stream].state);
1083 if (--be->
dpcm[stream].users != 0)
1089 soc_pcm_close(be_substream);
1105 runtime->
hw.rate_min = cpu_dai_drv->
playback.rate_min;
1106 runtime->
hw.rate_max = cpu_dai_drv->
playback.rate_max;
1107 runtime->
hw.channels_min = cpu_dai_drv->
playback.channels_min;
1108 runtime->
hw.channels_max = cpu_dai_drv->
playback.channels_max;
1109 runtime->
hw.formats &= cpu_dai_drv->
playback.formats;
1110 runtime->
hw.rates = cpu_dai_drv->
playback.rates;
1112 runtime->
hw.rate_min = cpu_dai_drv->
capture.rate_min;
1113 runtime->
hw.rate_max = cpu_dai_drv->
capture.rate_max;
1114 runtime->
hw.channels_min = cpu_dai_drv->
capture.channels_min;
1115 runtime->
hw.channels_max = cpu_dai_drv->
capture.channels_max;
1116 runtime->
hw.formats &= cpu_dai_drv->
capture.formats;
1117 runtime->
hw.rates = cpu_dai_drv->
capture.rates;
1125 int stream = fe_substream->
stream, ret = 0;
1129 ret = dpcm_be_dai_startup(fe, fe_substream->
stream);
1131 dev_err(fe->
dev,
"dpcm: failed to start some BEs %d\n", ret);
1138 ret = soc_pcm_open(fe_substream);
1140 dev_err(fe->
dev,
"dpcm: failed to start FE %d\n", ret);
1146 dpcm_set_fe_runtime(fe_substream);
1153 dpcm_be_dai_startup_unwind(fe, fe_substream->
stream);
1174 if (be->
dpcm[stream].users == 0)
1175 dev_err(be->
dev,
"no users %s at close - state %d\n",
1176 stream ?
"capture" :
"playback",
1177 be->
dpcm[stream].state);
1179 if (--be->
dpcm[stream].users != 0)
1187 dpcm->
fe->dai_link->name);
1189 soc_pcm_close(be_substream);
1200 int stream = substream->
stream;
1205 dpcm_be_dai_shutdown(fe, substream->
stream);
1210 soc_pcm_close(substream);
1247 dpcm->
fe->dai_link->name);
1249 soc_pcm_hw_free(be_substream);
1268 err = soc_pcm_hw_free(substream);
1270 dev_err(fe->
dev,
"dpcm: hw_free FE %s failed\n",
1275 err = dpcm_be_dai_hw_free(fe, stream);
1309 dpcm->
fe->dai_link->name);
1316 if (be->
dai_link->be_hw_params_fixup) {
1317 ret = be->
dai_link->be_hw_params_fixup(be,
1321 "dpcm: hw_params BE fixup failed %d\n",
1327 ret = soc_pcm_hw_params(be_substream, &dpcm->
hw_params);
1330 "dpcm: hw_params BE failed %d\n", ret);
1358 soc_pcm_hw_free(be_substream);
1375 ret = dpcm_be_dai_hw_params(fe, substream->
stream);
1377 dev_err(fe->
dev,
"dpcm: hw_params BE failed %d\n", ret);
1381 dev_dbg(fe->
dev,
"dpcm: hw_params FE %s rate %d chan %x fmt %d\n",
1386 ret = soc_pcm_hw_params(substream, params);
1388 dev_err(fe->
dev,
"dpcm: hw_params FE failed %d\n", ret);
1389 dpcm_be_dai_hw_free(fe, stream);
1404 dev_dbg(dpcm->
be->dev,
"dpcm: trigger BE %s cmd %d\n",
1405 dpcm->
fe->dai_link->name, cmd);
1407 ret = soc_pcm_trigger(substream, cmd);
1409 dev_err(dpcm->
be->dev,
"dpcm: trigger BE failed %d\n", ret);
1436 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1446 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1456 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1469 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1482 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1495 ret = dpcm_do_trigger(dpcm, be_substream, cmd);
1520 dev_dbg(fe->
dev,
"dpcm: pre trigger FE %s cmd %d\n",
1523 ret = soc_pcm_trigger(substream, cmd);
1525 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", ret);
1529 ret = dpcm_be_dai_trigger(fe, substream->
stream, cmd);
1534 ret = dpcm_be_dai_trigger(fe, substream->
stream, cmd);
1536 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", ret);
1540 dev_dbg(fe->
dev,
"dpcm: post trigger FE %s cmd %d\n",
1543 ret = soc_pcm_trigger(substream, cmd);
1548 dev_dbg(fe->
dev,
"dpcm: bespoke trigger FE %s cmd %d\n",
1551 ret = soc_pcm_bespoke_trigger(substream, cmd);
1553 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", ret);
1558 dev_err(fe->
dev,
"dpcm: invalid trigger cmd %d for %s\n", cmd,
1602 dpcm->
fe->dai_link->name);
1604 ret = soc_pcm_prepare(be_substream);
1606 dev_err(be->
dev,
"dpcm: backend prepare failed %d\n",
1619 int stream = substream->
stream, ret = 0;
1628 if (list_empty(&fe->
dpcm[stream].be_clients)) {
1629 dev_err(fe->
dev,
"dpcm: no backend DAIs enabled for %s\n",
1635 ret = dpcm_be_dai_prepare(fe, substream->
stream);
1640 ret = soc_pcm_prepare(substream);
1642 dev_err(fe->
dev,
"dpcm: prepare FE %s failed\n",
1659 unsigned int cmd,
void *
arg)
1664 if (platform->
driver->ops->ioctl)
1665 return platform->
driver->ops->ioctl(substream, cmd, arg);
1676 dev_dbg(fe->
dev,
"runtime %s close on FE %s\n",
1677 stream ?
"capture" :
"playback", fe->
dai_link->name);
1681 dev_dbg(fe->
dev,
"dpcm: bespoke trigger FE %s cmd stop\n",
1686 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", err);
1688 dev_dbg(fe->
dev,
"dpcm: trigger FE %s cmd stop\n",
1693 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", err);
1696 err = dpcm_be_dai_hw_free(fe, stream);
1698 dev_err(fe->
dev,
"dpcm: hw_free FE failed %d\n", err);
1700 err = dpcm_be_dai_shutdown(fe, stream);
1702 dev_err(fe->
dev,
"dpcm: shutdown FE failed %d\n", err);
1718 dev_dbg(fe->
dev,
"runtime %s open on FE %s\n",
1719 stream ?
"capture" :
"playback", fe->
dai_link->name);
1727 ret = dpcm_be_dai_startup(fe, stream);
1737 ret = dpcm_be_dai_hw_params(fe, stream);
1748 ret = dpcm_be_dai_prepare(fe, stream);
1764 dev_dbg(fe->
dev,
"dpcm: bespoke trigger FE %s cmd start\n",
1769 dev_err(fe->
dev,
"dpcm: bespoke trigger FE failed %d\n", ret);
1773 dev_dbg(fe->
dev,
"dpcm: trigger FE %s cmd start\n",
1776 ret = dpcm_be_dai_trigger(fe, stream,
1779 dev_err(fe->
dev,
"dpcm: trigger FE failed %d\n", ret);
1787 dpcm_be_dai_hw_free(fe, stream);
1789 dpcm_be_dai_shutdown(fe, stream);
1806 ret = dpcm_run_update_startup(fe, stream);
1808 dev_err(fe->
dev,
"failed to startup some BEs\n");
1819 ret = dpcm_run_update_shutdown(fe, stream);
1821 dev_err(fe->
dev,
"failed to shutdown some BEs\n");
1836 card = widget->
codec->card;
1843 for (i = 0; i < card->
num_rtd; i++) {
1856 dev_dbg(fe->
dev,
"DPCM runtime update for FE %s\n",
1860 if (!fe->
cpu_dai->driver->playback.channels_min)
1889 if (!fe->
cpu_dai->driver->capture.channels_min)
1916 dpcm_path_put(&list);
1940 drv->
ops->digital_mute(dai, mute);
1952 int stream = fe_substream->
stream;
1957 if (dpcm_path_get(fe, stream, &list) <= 0) {
1958 dev_dbg(fe->
dev,
"asoc: %s no valid %s route\n",
1959 fe->
dai_link->name, stream ?
"capture" :
"playback");
1963 dpcm_process_paths(fe, stream, &list, 1);
1965 ret = dpcm_fe_dai_startup(fe_substream);
1971 dpcm_be_disconnect(fe, stream);
1972 fe->dpcm[stream].runtime =
NULL;
1975 dpcm_clear_pending_state(fe, stream);
1976 dpcm_path_put(&list);
1985 int stream = fe_substream->stream,
ret;
1988 ret = dpcm_fe_dai_shutdown(fe_substream);
1992 dpcm->
state = SND_SOC_DPCM_LINK_STATE_FREE;
1994 dpcm_be_disconnect(fe, stream);
1996 fe->dpcm[stream].runtime = NULL;
2009 int ret = 0, playback = 0, capture = 0;
2011 if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
2012 if (cpu_dai->
driver->playback.channels_min)
2014 if (cpu_dai->
driver->capture.channels_min)
2017 if (codec_dai->
driver->playback.channels_min)
2019 if (codec_dai->
driver->capture.channels_min)
2024 if (rtd->dai_link->no_pcm) {
2025 snprintf(new_name,
sizeof(new_name),
"(%s)",
2026 rtd->dai_link->stream_name);
2029 playback, capture, &pcm);
2031 if (rtd->dai_link->dynamic)
2032 snprintf(new_name,
sizeof(new_name),
"%s (*)",
2033 rtd->dai_link->stream_name);
2035 snprintf(new_name,
sizeof(new_name),
"%s %s-%d",
2036 rtd->dai_link->stream_name, codec_dai->
name, num);
2038 ret =
snd_pcm_new(rtd->card->snd_card, new_name, num, playback,
2042 dev_err(rtd->card->dev,
"can't create pcm for %s\n",
2043 rtd->dai_link->name);
2046 dev_dbg(rtd->card->dev,
"registered pcm #%d %s\n",num, new_name);
2054 if (rtd->dai_link->no_pcm) {
2063 if (rtd->dai_link->dynamic) {
2064 rtd->ops.open = dpcm_fe_dai_open;
2065 rtd->ops.hw_params = dpcm_fe_dai_hw_params;
2066 rtd->ops.prepare = dpcm_fe_dai_prepare;
2067 rtd->ops.trigger = dpcm_fe_dai_trigger;
2068 rtd->ops.hw_free = dpcm_fe_dai_hw_free;
2069 rtd->ops.close = dpcm_fe_dai_close;
2070 rtd->ops.pointer = soc_pcm_pointer;
2071 rtd->ops.ioctl = soc_pcm_ioctl;
2073 rtd->ops.open = soc_pcm_open;
2074 rtd->ops.hw_params = soc_pcm_hw_params;
2075 rtd->ops.prepare = soc_pcm_prepare;
2076 rtd->ops.trigger = soc_pcm_trigger;
2077 rtd->ops.hw_free = soc_pcm_hw_free;
2078 rtd->ops.close = soc_pcm_close;
2079 rtd->ops.pointer = soc_pcm_pointer;
2080 rtd->ops.ioctl = soc_pcm_ioctl;
2083 if (platform->
driver->ops) {
2084 rtd->ops.ack = platform->
driver->ops->ack;
2085 rtd->ops.copy = platform->
driver->ops->copy;
2086 rtd->ops.silence = platform->
driver->ops->silence;
2087 rtd->ops.page = platform->
driver->ops->page;
2088 rtd->ops.mmap = platform->
driver->ops->mmap;
2097 if (platform->
driver->pcm_new) {
2098 ret = platform->
driver->pcm_new(rtd);
2100 dev_err(platform->
dev,
"pcm constructor failed\n");
2107 dev_info(rtd->card->dev,
" %s <-> %s mapping ok\n", codec_dai->
name,
2127 be->
dpcm[stream].runtime_update))
2137 return be->
pcm->streams[
stream].substream;
2172 state = dpcm->
fe->dpcm[stream].state;
2199 state = dpcm->
fe->dpcm[stream].state;
2215 if (platform->
driver->ops->trigger)
2216 return platform->
driver->ops->trigger(substream, cmd);
2221 #ifdef CONFIG_DEBUG_FS
2251 int stream,
char *
buf,
size_t size)
2258 offset +=
snprintf(buf + offset, size - offset,
2260 stream ?
"Capture" :
"Playback");
2262 offset +=
snprintf(buf + offset, size - offset,
"State: %s\n",
2263 dpcm_state_string(fe->
dpcm[stream].state));
2267 offset +=
snprintf(buf + offset, size - offset,
2269 "Format = %s, Channels = %d, Rate = %d\n",
2275 offset +=
snprintf(buf + offset, size - offset,
"Backends:\n");
2277 if (list_empty(&fe->
dpcm[stream].be_clients)) {
2278 offset +=
snprintf(buf + offset, size - offset,
2279 " No active DSP links\n");
2287 offset +=
snprintf(buf + offset, size - offset,
2290 offset +=
snprintf(buf + offset, size - offset,
2292 dpcm_state_string(be->
dpcm[stream].state));
2296 offset +=
snprintf(buf + offset, size - offset,
2297 " Hardware Params: "
2298 "Format = %s, Channels = %d, Rate = %d\n",
2308 static ssize_t dpcm_state_read_file(
struct file *
file,
char __user *user_buf,
2309 size_t count, loff_t *ppos)
2319 if (fe->
cpu_dai->driver->playback.channels_min)
2321 buf + offset, out_count - offset);
2323 if (fe->
cpu_dai->driver->capture.channels_min)
2325 buf + offset, out_count - offset);
2335 .read = dpcm_state_read_file,
2345 rtd->
card->debugfs_card_root);
2346 if (!rtd->debugfs_dpcm_root) {
2348 "ASoC: Failed to create dpcm debugfs directory %s\n",
2354 rtd->debugfs_dpcm_root,
2355 rtd, &dpcm_state_fops);