Commit 79ca7825 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: soc-dai: add snd_soc_dai_xxx()" from Kuninori Morimoto...

Merge series "ASoC: soc-dai: add snd_soc_dai_xxx()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We have soc-dai.c today. DAI related functions
should be implemented in it.
These patches are v2 of doing it.

Link: https://lore.kernel.org/r/871rofunaq.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (17):
  ASoC: soc-dai: add soc_dai_err()
  ASoC: soc-dai: don't overwide dai->driver->ops
  ASoC: soc-dai: add snd_soc_pcm_dai_new()
  ASoC: soc-dai: add snd_soc_pcm_dai_prepare()
  ASoC: soc-dai: add snd_soc_pcm_dai_trigger()
  ASoC: soc-dai: add snd_soc_pcm_dai_bespoke_trigger()
  ASoC: soc-dai: add snd_soc_pcm_dai_probe()
  ASoC: soc-dai: add snd_soc_pcm_dai_remove()
  ASoC: soc-dai: add snd_soc_dai_compr_start()
  ASoC: soc-dai: add snd_soc_dai_compr_shutdown()
  ASoC: soc-dai: add snd_soc_dai_compr_trigger()
  ASoC: soc-dai: add snd_soc_dai_compr_set_params()
  ASoC: soc-dai: add snd_soc_dai_compr_get_params()
  ASoC: soc-dai: add snd_soc_dai_compr_ack()
  ASoC: soc-dai: add snd_soc_dai_compr_pointer()
  ASoC: soc-dai: add snd_soc_dai_compr_set_metadata()
  ASoC: soc-dai: add snd_soc_dai_compr_get_metadata()

 include/sound/soc-dai.h  |  41 +++-
 sound/soc/soc-compress.c | 104 ++++-----
 sound/soc/soc-core.c     |  85 +-------
 sound/soc/soc-dai.c      | 453 +++++++++++++++++++++++++++++----------
 sound/soc/soc-pcm.c      |  50 +----
 5 files changed, 434 insertions(+), 299 deletions(-)

--
2.17.1
parents fd443a20 94d72819
...@@ -154,22 +154,47 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, ...@@ -154,22 +154,47 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream); struct snd_pcm_substream *substream);
void snd_soc_dai_shutdown(struct snd_soc_dai *dai, void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream); struct snd_pcm_substream *substream);
int snd_soc_dai_prepare(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream);
int snd_soc_dai_trigger(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream, int cmd);
int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream, int cmd);
snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
struct snd_pcm_substream *substream); struct snd_pcm_substream *substream);
void snd_soc_dai_suspend(struct snd_soc_dai *dai); void snd_soc_dai_suspend(struct snd_soc_dai *dai);
void snd_soc_dai_resume(struct snd_soc_dai *dai); void snd_soc_dai_resume(struct snd_soc_dai *dai);
int snd_soc_dai_probe(struct snd_soc_dai *dai);
int snd_soc_dai_remove(struct snd_soc_dai *dai);
int snd_soc_dai_compress_new(struct snd_soc_dai *dai, int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
struct snd_soc_pcm_runtime *rtd, int num); struct snd_soc_pcm_runtime *rtd, int num);
bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream);
int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order);
int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order);
int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd);
int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream);
int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd);
int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int cmd);
int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream);
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream);
int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream, int cmd);
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_compr_params *params);
int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_codec *params);
int snd_soc_dai_compr_ack(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
size_t bytes);
int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp);
int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_compr_metadata *metadata);
int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_compr_metadata *metadata);
struct snd_soc_dai_ops { struct snd_soc_dai_ops {
/* /*
* DAI clocking configuration, all optional. * DAI clocking configuration, all optional.
......
...@@ -87,15 +87,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -87,15 +87,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) { ret = snd_soc_dai_compr_startup(cpu_dai, cstream);
ret = cpu_dai->driver->cops->startup(cstream, cpu_dai); if (ret < 0)
if (ret < 0) { goto out;
dev_err(cpu_dai->dev,
"Compress ASoC: can't open interface %s: %d\n",
cpu_dai->name, ret);
goto out;
}
}
ret = soc_compr_components_open(cstream, &component); ret = soc_compr_components_open(cstream, &component);
if (ret < 0) if (ret < 0)
...@@ -120,8 +114,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -120,8 +114,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
machine_err: machine_err:
soc_compr_components_free(cstream, component); soc_compr_components_free(cstream, component);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) snd_soc_dai_compr_shutdown(cpu_dai, cstream);
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
out: out:
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
pm_err: pm_err:
...@@ -178,15 +171,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) ...@@ -178,15 +171,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
goto out; goto out;
} }
if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) { ret = snd_soc_dai_compr_startup(cpu_dai, cstream);
ret = cpu_dai->driver->cops->startup(cstream, cpu_dai); if (ret < 0)
if (ret < 0) { goto out;
dev_err(cpu_dai->dev,
"Compress ASoC: can't open interface %s: %d\n",
cpu_dai->name, ret);
goto out;
}
}
ret = soc_compr_components_open(cstream, &component); ret = soc_compr_components_open(cstream, &component);
if (ret < 0) if (ret < 0)
...@@ -216,8 +203,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) ...@@ -216,8 +203,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
machine_err: machine_err:
soc_compr_components_free(cstream, component); soc_compr_components_free(cstream, component);
open_err: open_err:
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) snd_soc_dai_compr_shutdown(cpu_dai, cstream);
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
out: out:
dpcm_path_put(&list); dpcm_path_put(&list);
be_err: be_err:
...@@ -256,8 +242,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream) ...@@ -256,8 +242,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
soc_compr_components_free(cstream, NULL); soc_compr_components_free(cstream, NULL);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) snd_soc_dai_compr_shutdown(cpu_dai, cstream);
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
snd_soc_dapm_stream_stop(rtd, stream); snd_soc_dapm_stream_stop(rtd, stream);
...@@ -313,8 +298,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) ...@@ -313,8 +298,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
soc_compr_components_free(cstream, NULL); soc_compr_components_free(cstream, NULL);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) snd_soc_dai_compr_shutdown(cpu_dai, cstream);
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
mutex_unlock(&fe->card->mutex); mutex_unlock(&fe->card->mutex);
return 0; return 0;
...@@ -354,8 +338,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) ...@@ -354,8 +338,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
if (ret < 0) if (ret < 0)
goto out; goto out;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd);
cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai); if (ret < 0)
goto out;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -388,11 +373,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) ...@@ -388,11 +373,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) { ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd);
ret = cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai); if (ret < 0)
if (ret < 0) goto out;
goto out;
}
ret = soc_compr_components_trigger(cstream, cmd); ret = soc_compr_components_trigger(cstream, cmd);
if (ret < 0) if (ret < 0)
...@@ -460,11 +443,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, ...@@ -460,11 +443,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
* that these callbacks will configure everything for this compress * that these callbacks will configure everything for this compress
* path, like configuring a PCM port for a CODEC. * path, like configuring a PCM port for a CODEC.
*/ */
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) { ret = snd_soc_dai_compr_set_params(cpu_dai, cstream, params);
ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai); if (ret < 0)
if (ret < 0) goto err;
goto err;
}
ret = soc_compr_components_set_params(cstream, params); ret = soc_compr_components_set_params(cstream, params);
if (ret < 0) if (ret < 0)
...@@ -530,11 +511,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, ...@@ -530,11 +511,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
if (ret < 0) if (ret < 0)
goto out; goto out;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) { ret = snd_soc_dai_compr_set_params(cpu_dai, cstream, params);
ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai); if (ret < 0)
if (ret < 0) goto out;
goto out;
}
ret = soc_compr_components_set_params(cstream, params); ret = soc_compr_components_set_params(cstream, params);
if (ret < 0) if (ret < 0)
...@@ -565,11 +544,9 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, ...@@ -565,11 +544,9 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_params) { ret = snd_soc_dai_compr_get_params(cpu_dai, cstream, params);
ret = cpu_dai->driver->cops->get_params(cstream, params, cpu_dai); if (ret < 0)
if (ret < 0) goto err;
goto err;
}
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops || if (!component->driver->compress_ops ||
...@@ -641,11 +618,9 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) ...@@ -641,11 +618,9 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->ack) { ret = snd_soc_dai_compr_ack(cpu_dai, cstream, bytes);
ret = cpu_dai->driver->cops->ack(cstream, bytes, cpu_dai); if (ret < 0)
if (ret < 0) goto err;
goto err;
}
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops || if (!component->driver->compress_ops ||
...@@ -673,8 +648,9 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -673,8 +648,9 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) ret = snd_soc_dai_compr_pointer(cpu_dai, cstream, tstamp);
cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); if (ret < 0)
goto out;
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops || if (!component->driver->compress_ops ||
...@@ -685,7 +661,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -685,7 +661,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
component, cstream, tstamp); component, cstream, tstamp);
break; break;
} }
out:
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
return ret; return ret;
} }
...@@ -721,11 +697,9 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, ...@@ -721,11 +697,9 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) { ret = snd_soc_dai_compr_set_metadata(cpu_dai, cstream, metadata);
ret = cpu_dai->driver->cops->set_metadata(cstream, metadata, cpu_dai); if (ret < 0)
if (ret < 0) return ret;
return ret;
}
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops || if (!component->driver->compress_ops ||
...@@ -749,11 +723,9 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, ...@@ -749,11 +723,9 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) { ret = snd_soc_dai_compr_get_metadata(cpu_dai, cstream, metadata);
ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai); if (ret < 0)
if (ret < 0) return ret;
return ret;
}
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops || if (!component->driver->compress_ops ||
......
...@@ -742,9 +742,6 @@ static inline void soc_resume_init(struct snd_soc_card *card) ...@@ -742,9 +742,6 @@ static inline void soc_resume_init(struct snd_soc_card *card)
} }
#endif #endif
static const struct snd_soc_dai_ops null_dai_ops = {
};
static struct device_node static struct device_node
*soc_component_to_node(struct snd_soc_component *component) *soc_component_to_node(struct snd_soc_component *component)
{ {
...@@ -1039,27 +1036,6 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card, ...@@ -1039,27 +1036,6 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
} }
EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime); EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime);
static int soc_dai_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *dai;
int i, ret = 0;
for_each_rtd_dais(rtd, i, dai) {
struct snd_soc_dai_driver *drv = dai->driver;
if (drv->pcm_new)
ret = drv->pcm_new(rtd, dai);
if (ret < 0) {
dev_err(dai->dev,
"ASoC: Failed to bind %s with pcm device\n",
dai->name);
return ret;
}
}
return 0;
}
static int soc_init_pcm_runtime(struct snd_soc_card *card, static int soc_init_pcm_runtime(struct snd_soc_card *card,
struct snd_soc_pcm_runtime *rtd) struct snd_soc_pcm_runtime *rtd)
{ {
...@@ -1124,7 +1100,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, ...@@ -1124,7 +1100,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
return ret; return ret;
} }
return soc_dai_pcm_new(rtd); return snd_soc_pcm_dai_new(rtd);
} }
static void soc_set_name_prefix(struct snd_soc_card *card, static void soc_set_name_prefix(struct snd_soc_card *card,
...@@ -1280,64 +1256,23 @@ static int soc_probe_component(struct snd_soc_card *card, ...@@ -1280,64 +1256,23 @@ static int soc_probe_component(struct snd_soc_card *card,
return ret; return ret;
} }
static void soc_remove_dai(struct snd_soc_dai *dai, int order)
{
int err;
if (!dai || !dai->probed || !dai->driver ||
dai->driver->remove_order != order)
return;
err = snd_soc_dai_remove(dai);
if (err < 0)
dev_err(dai->dev,
"ASoC: failed to remove %s: %d\n",
dai->name, err);
dai->probed = 0;
}
static int soc_probe_dai(struct snd_soc_dai *dai, int order)
{
int ret;
if (dai->probed ||
dai->driver->probe_order != order)
return 0;
ret = snd_soc_dai_probe(dai);
if (ret < 0) {
dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n",
dai->name, ret);
return ret;
}
dai->probed = 1;
return 0;
}
static void soc_remove_link_dais(struct snd_soc_card *card) static void soc_remove_link_dais(struct snd_soc_card *card)
{ {
int i;
struct snd_soc_dai *dai;
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
int order; int order;
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
/* remove DAIs */ /* remove all rtd connected DAIs in good order */
for_each_rtd_dais(rtd, i, dai) snd_soc_pcm_dai_remove(rtd, order);
soc_remove_dai(dai, order);
} }
} }
} }
static int soc_probe_link_dais(struct snd_soc_card *card) static int soc_probe_link_dais(struct snd_soc_card *card)
{ {
struct snd_soc_dai *dai;
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
int i, order, ret; int order, ret;
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
...@@ -1346,12 +1281,10 @@ static int soc_probe_link_dais(struct snd_soc_card *card) ...@@ -1346,12 +1281,10 @@ static int soc_probe_link_dais(struct snd_soc_card *card)
"ASoC: probe %s dai link %d late %d\n", "ASoC: probe %s dai link %d late %d\n",
card->name, rtd->num, order); card->name, rtd->num, order);
/* probe the CPU DAI */ /* probe all rtd connected DAIs in good order */
for_each_rtd_dais(rtd, i, dai) { ret = snd_soc_pcm_dai_probe(rtd, order);
ret = soc_probe_dai(dai, order); if (ret)
if (ret) return ret;
return ret;
}
} }
} }
...@@ -2406,8 +2339,6 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, ...@@ -2406,8 +2339,6 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
dai->component = component; dai->component = component;
dai->dev = dev; dai->dev = dev;
dai->driver = dai_drv; dai->driver = dai_drv;
if (!dai->driver->ops)
dai->driver->ops = &null_dai_ops;
/* see for_each_component_dais */ /* see for_each_component_dais */
list_add_tail(&dai->list, &component->dai_list); list_add_tail(&dai->list, &component->dai_list);
......
This diff is collapsed.
...@@ -950,13 +950,10 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -950,13 +950,10 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
for_each_rtd_dais(rtd, i, dai) { ret = snd_soc_pcm_dai_prepare(substream);
ret = snd_soc_dai_prepare(dai, substream); if (ret < 0) {
if (ret < 0) { dev_err(rtd->dev, "ASoC: DAI prepare error: %d\n", ret);
dev_err(dai->dev, goto out;
"ASoC: DAI prepare error: %d\n", ret);
goto out;
}
} }
/* cancel any delayed stream shutdown that is pending */ /* cancel any delayed stream shutdown that is pending */
...@@ -1195,7 +1192,6 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) ...@@ -1195,7 +1192,6 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *dai;
int i, ret; int i, ret;
ret = soc_rtd_trigger(rtd, substream, cmd); ret = soc_rtd_trigger(rtd, substream, cmd);
...@@ -1208,27 +1204,18 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) ...@@ -1208,27 +1204,18 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
for_each_rtd_dais(rtd, i, dai) { return snd_soc_pcm_dai_trigger(substream, cmd);
ret = snd_soc_dai_trigger(dai, substream, cmd);
if (ret < 0)
return ret;
}
return 0;
} }
static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *dai;
int i, ret; int i, ret;
for_each_rtd_dais(rtd, i, dai) { ret = snd_soc_pcm_dai_trigger(substream, cmd);
ret = snd_soc_dai_trigger(dai, substream, cmd); if (ret < 0)
if (ret < 0) return ret;
return ret;
}
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
ret = snd_soc_component_trigger(component, substream, cmd); ret = snd_soc_component_trigger(component, substream, cmd);
...@@ -1265,21 +1252,6 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1265,21 +1252,6 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
int cmd)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *dai;
int i, ret;
for_each_rtd_dais(rtd, i, dai) {
ret = snd_soc_dai_bespoke_trigger(dai, substream, cmd);
if (ret < 0)
return ret;
}
return 0;
}
/* /*
* soc level wrapper for pointer callback * soc level wrapper for pointer callback
* If cpu_dai, codec_dai, component driver has the delay callback, then * If cpu_dai, codec_dai, component driver has the delay callback, then
...@@ -2483,7 +2455,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -2483,7 +2455,7 @@ static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n", dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n",
fe->dai_link->name, cmd); fe->dai_link->name, cmd);
ret = soc_pcm_bespoke_trigger(substream, cmd); ret = snd_soc_pcm_dai_bespoke_trigger(substream, cmd);
break; break;
default: default:
dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd, dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd,
...@@ -2628,7 +2600,7 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -2628,7 +2600,7 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n", dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n",
fe->dai_link->name); fe->dai_link->name);
err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP); err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
if (err < 0) if (err < 0)
dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err); dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err);
} else { } else {
...@@ -2706,7 +2678,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -2706,7 +2678,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n", dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n",
fe->dai_link->name); fe->dai_link->name);
ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START); ret = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START);
if (ret < 0) { if (ret < 0) {
dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret); dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret);
goto hw_free; goto hw_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment