mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-09 12:04:15 +08:00
Merge series "ASoC: tidyup error message timing" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark Indicating error message when failed case is very useful for debuging. In many case, it uses below style. int function(...) { ... return ret; } int caller(...) { ... ret = function(...); if (ret < 0) dev_err(...) ... } This is not so bad, but in this style *each caller* needs to indicate duplicate same error message, and some caller is forgetting to do it. And caller can't indicate detail function() error information. I know many people have many opinion, but if function() indicates error message, we can get same and detail information without forgot, and it is better. This patch-set tidyup to do it. int function(...) { ... if (ret < 0) dev_err(...) return ret; } int caller(...) { ... ret = function(...); ... } Kuninori Morimoto (14): ASoC: soc-pcm: indicate error message at soc_pcm_open() ASoC: soc-pcm: indicate error message at soc_pcm_hw_params() ASoC: soc-pcm: indicate error message at soc_pcm_prepare() ASoC: soc-pcm: indicate error message at dpcm_path_get() ASoC: soc-pcm: indicate error message at dpcm_be_dai_trigger() ASoC: soc-pcm: indicate error message at dpcm_apply_symmetry() ASoC: soc-pcm: indicate error message at dpcm_run_update_startup/shutdown() ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_startup() ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_hw_params() ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_prepare() ASoC: soc-pcm: don't indicate error message for soc_pcm_hw_free() ASoC: soc-pcm: don't indicate error message for dpcm_be_dai_hw_free() ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx() ASoC: don't indicate error message for snd_soc_[pcm_]component_xxx() include/sound/soc-dpcm.h | 2 +- sound/soc/soc-compress.c | 9 +- sound/soc/soc-core.c | 22 +---- sound/soc/soc-dapm.c | 24 ++--- sound/soc/soc-pcm.c | 197 +++++++++++++++++++-------------------- 5 files changed, 108 insertions(+), 146 deletions(-) -- 2.25.1
This commit is contained in:
commit
3722e4ecef
@ -153,7 +153,7 @@ void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
int do_hw_free, struct snd_soc_dpcm *last);
|
int do_hw_free, struct snd_soc_dpcm *last);
|
||||||
void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream);
|
void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream);
|
||||||
void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream);
|
void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream);
|
||||||
int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream);
|
void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream);
|
||||||
int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int tream);
|
int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int tream);
|
||||||
int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int cmd);
|
int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, int cmd);
|
||||||
int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream);
|
int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream);
|
||||||
|
@ -115,9 +115,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
|
|||||||
ret = dpcm_path_get(fe, stream, &list);
|
ret = dpcm_path_get(fe, stream, &list);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto be_err;
|
goto be_err;
|
||||||
else if (ret == 0)
|
|
||||||
dev_dbg(fe->dev, "Compress ASoC: %s no valid %s route\n",
|
|
||||||
fe->dai_link->name, stream ? "capture" : "playback");
|
|
||||||
/* calculate valid and active FE <-> BE dpcms */
|
/* calculate valid and active FE <-> BE dpcms */
|
||||||
dpcm_process_paths(fe, stream, &list, 1);
|
dpcm_process_paths(fe, stream, &list, 1);
|
||||||
fe->dpcm[stream].runtime = fe_substream->runtime;
|
fe->dpcm[stream].runtime = fe_substream->runtime;
|
||||||
@ -177,7 +175,6 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
|
|||||||
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
|
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
|
int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
|
||||||
int ret;
|
|
||||||
|
|
||||||
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
||||||
|
|
||||||
@ -185,9 +182,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
|
|||||||
|
|
||||||
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
|
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
|
||||||
|
|
||||||
ret = dpcm_be_dai_hw_free(fe, stream);
|
dpcm_be_dai_hw_free(fe, stream);
|
||||||
if (ret < 0)
|
|
||||||
dev_err(fe->dev, "Compressed ASoC: hw_free failed: %d\n", ret);
|
|
||||||
|
|
||||||
dpcm_be_dai_shutdown(fe, stream);
|
dpcm_be_dai_shutdown(fe, stream);
|
||||||
|
|
||||||
|
@ -1088,12 +1088,8 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
|
|||||||
|
|
||||||
/* create compress_device if possible */
|
/* create compress_device if possible */
|
||||||
ret = snd_soc_dai_compress_new(cpu_dai, rtd, num);
|
ret = snd_soc_dai_compress_new(cpu_dai, rtd, num);
|
||||||
if (ret != -ENOTSUPP) {
|
if (ret != -ENOTSUPP)
|
||||||
if (ret < 0)
|
|
||||||
dev_err(card->dev, "ASoC: can't create compress %s\n",
|
|
||||||
dai_link->stream_name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
/* create the pcm */
|
/* create the pcm */
|
||||||
ret = soc_new_pcm(rtd, num);
|
ret = soc_new_pcm(rtd, num);
|
||||||
@ -1207,11 +1203,9 @@ static int soc_probe_component(struct snd_soc_card *card,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = snd_soc_component_probe(component);
|
ret = snd_soc_component_probe(component);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(component->dev,
|
|
||||||
"ASoC: failed to probe component %d\n", ret);
|
|
||||||
goto err_probe;
|
goto err_probe;
|
||||||
}
|
|
||||||
WARN(dapm->idle_bias_off &&
|
WARN(dapm->idle_bias_off &&
|
||||||
dapm->bias_level != SND_SOC_BIAS_OFF,
|
dapm->bias_level != SND_SOC_BIAS_OFF,
|
||||||
"codec %s can not start from non-off bias with idle_bias_off==1\n",
|
"codec %s can not start from non-off bias with idle_bias_off==1\n",
|
||||||
@ -1422,11 +1416,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
|||||||
|
|
||||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||||
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
|
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
|
||||||
if (ret != 0 && ret != -ENOTSUPP) {
|
if (ret != 0 && ret != -ENOTSUPP)
|
||||||
dev_warn(codec_dai->dev,
|
|
||||||
"ASoC: Failed to set DAI format: %d\n", ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1455,11 +1446,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
|||||||
fmt = inv_dai_fmt;
|
fmt = inv_dai_fmt;
|
||||||
|
|
||||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
||||||
if (ret != 0 && ret != -ENOTSUPP) {
|
if (ret != 0 && ret != -ENOTSUPP)
|
||||||
dev_warn(cpu_dai->dev,
|
|
||||||
"ASoC: Failed to set DAI format: %d\n", ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3831,11 +3831,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
|
|||||||
source = path->source->priv;
|
source = path->source->priv;
|
||||||
|
|
||||||
ret = snd_soc_dai_startup(source, substream);
|
ret = snd_soc_dai_startup(source, substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(source->dev,
|
|
||||||
"ASoC: startup() failed: %d\n", ret);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
snd_soc_dai_activate(source, substream->stream);
|
snd_soc_dai_activate(source, substream->stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3844,11 +3842,9 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
|
|||||||
sink = path->sink->priv;
|
sink = path->sink->priv;
|
||||||
|
|
||||||
ret = snd_soc_dai_startup(sink, substream);
|
ret = snd_soc_dai_startup(sink, substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(sink->dev,
|
|
||||||
"ASoC: startup() failed: %d\n", ret);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
snd_soc_dai_activate(sink, substream->stream);
|
snd_soc_dai_activate(sink, substream->stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3943,11 +3939,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
|
|||||||
snd_soc_dapm_widget_for_each_sink_path(w, path) {
|
snd_soc_dapm_widget_for_each_sink_path(w, path) {
|
||||||
sink = path->sink->priv;
|
sink = path->sink->priv;
|
||||||
|
|
||||||
ret = snd_soc_dai_digital_mute(sink, 0,
|
snd_soc_dai_digital_mute(sink, 0, SNDRV_PCM_STREAM_PLAYBACK);
|
||||||
SNDRV_PCM_STREAM_PLAYBACK);
|
|
||||||
if (ret != 0 && ret != -ENOTSUPP)
|
|
||||||
dev_warn(sink->dev,
|
|
||||||
"ASoC: Failed to unmute: %d\n", ret);
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3956,11 +3948,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
|
|||||||
snd_soc_dapm_widget_for_each_sink_path(w, path) {
|
snd_soc_dapm_widget_for_each_sink_path(w, path) {
|
||||||
sink = path->sink->priv;
|
sink = path->sink->priv;
|
||||||
|
|
||||||
ret = snd_soc_dai_digital_mute(sink, 1,
|
snd_soc_dai_digital_mute(sink, 1, SNDRV_PCM_STREAM_PLAYBACK);
|
||||||
SNDRV_PCM_STREAM_PLAYBACK);
|
|
||||||
if (ret != 0 && ret != -ENOTSUPP)
|
|
||||||
dev_warn(sink->dev,
|
|
||||||
"ASoC: Failed to mute: %d\n", ret);
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,8 +792,10 @@ dynamic:
|
|||||||
err:
|
err:
|
||||||
mutex_unlock(&rtd->card->pcm_mutex);
|
mutex_unlock(&rtd->card->pcm_mutex);
|
||||||
pm_err:
|
pm_err:
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
soc_pcm_clean(substream, 1);
|
soc_pcm_clean(substream, 1);
|
||||||
|
dev_err(rtd->dev, "%s() failed (%d)", __func__, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -830,10 +832,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = snd_soc_pcm_dai_prepare(substream);
|
ret = snd_soc_pcm_dai_prepare(substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(rtd->dev, "ASoC: DAI prepare error: %d\n", ret);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
/* cancel any delayed stream shutdown that is pending */
|
/* cancel any delayed stream shutdown that is pending */
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||||
@ -850,6 +850,10 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&rtd->card->pcm_mutex);
|
mutex_unlock(&rtd->card->pcm_mutex);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(rtd->dev, "ASoC: %s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,8 +1003,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
out:
|
out:
|
||||||
mutex_unlock(&rtd->card->pcm_mutex);
|
mutex_unlock(&rtd->card->pcm_mutex);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
soc_pcm_hw_clean(substream, 1);
|
soc_pcm_hw_clean(substream, 1);
|
||||||
|
dev_err(rtd->dev, "ASoC: %s() failed (%d)\n", __func__, ret);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1282,8 +1288,12 @@ int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
|
|||||||
fe->card->component_chaining ?
|
fe->card->component_chaining ?
|
||||||
NULL : dpcm_end_walk_at_be);
|
NULL : dpcm_end_walk_at_be);
|
||||||
|
|
||||||
dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
|
if (paths > 0)
|
||||||
|
dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
|
||||||
stream ? "capture" : "playback");
|
stream ? "capture" : "playback");
|
||||||
|
else if (paths == 0)
|
||||||
|
dev_dbg(fe->dev, "ASoC: %s no valid %s path\n", fe->dai_link->name,
|
||||||
|
stream ? "capture" : "playback");
|
||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
@ -1463,15 +1473,16 @@ void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_pcm_runtime *be;
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
int err, count = 0;
|
int err, count = 0;
|
||||||
|
|
||||||
/* only startup BE DAIs that are either sinks or sources to this FE DAI */
|
/* only startup BE DAIs that are either sinks or sources to this FE DAI */
|
||||||
for_each_dpcm_be(fe, stream, dpcm) {
|
for_each_dpcm_be(fe, stream, dpcm) {
|
||||||
|
struct snd_pcm_substream *be_substream;
|
||||||
|
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
be = dpcm->be;
|
||||||
struct snd_pcm_substream *be_substream =
|
be_substream = snd_soc_dpcm_get_substream(be, stream);
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
|
||||||
|
|
||||||
if (!be_substream) {
|
if (!be_substream) {
|
||||||
dev_err(be->dev, "ASoC: no backend %s stream\n",
|
dev_err(be->dev, "ASoC: no backend %s stream\n",
|
||||||
@ -1504,7 +1515,6 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
be_substream->runtime = be->dpcm[stream].runtime;
|
be_substream->runtime = be->dpcm[stream].runtime;
|
||||||
err = soc_pcm_open(be_substream);
|
err = soc_pcm_open(be_substream);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(be->dev, "ASoC: BE open failed %d\n", err);
|
|
||||||
be->dpcm[stream].users--;
|
be->dpcm[stream].users--;
|
||||||
if (be->dpcm[stream].users < 0)
|
if (be->dpcm[stream].users < 0)
|
||||||
dev_err(be->dev, "ASoC: no users %s at unwind %d\n",
|
dev_err(be->dev, "ASoC: no users %s at unwind %d\n",
|
||||||
@ -1524,6 +1534,9 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
unwind:
|
unwind:
|
||||||
dpcm_be_dai_startup_rollback(fe, stream, dpcm);
|
dpcm_be_dai_startup_rollback(fe, stream, dpcm);
|
||||||
|
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed at %s (%d)\n",
|
||||||
|
__func__, be->dai_link->name, err);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1695,7 +1708,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
|
|||||||
/* Symmetry only applies if we've got an active stream. */
|
/* Symmetry only applies if we've got an active stream. */
|
||||||
err = soc_pcm_apply_symmetry(fe_substream, fe_cpu_dai);
|
err = soc_pcm_apply_symmetry(fe_substream, fe_cpu_dai);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* apply symmetry for BE */
|
/* apply symmetry for BE */
|
||||||
@ -1720,11 +1733,14 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
|
|||||||
for_each_rtd_dais(rtd, i, dai) {
|
for_each_rtd_dais(rtd, i, dai) {
|
||||||
err = soc_pcm_apply_symmetry(fe_substream, dai);
|
err = soc_pcm_apply_symmetry(fe_substream, dai);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
error:
|
||||||
|
if (err < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s failed (%d)\n", __func__, err);
|
||||||
|
|
||||||
return 0;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
||||||
@ -1735,19 +1751,15 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
|||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
||||||
|
|
||||||
ret = dpcm_be_dai_startup(fe, stream);
|
ret = dpcm_be_dai_startup(fe, stream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret);
|
|
||||||
goto be_err;
|
goto be_err;
|
||||||
}
|
|
||||||
|
|
||||||
dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);
|
dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);
|
||||||
|
|
||||||
/* start the DAI frontend */
|
/* start the DAI frontend */
|
||||||
ret = soc_pcm_open(fe_substream);
|
ret = soc_pcm_open(fe_substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret);
|
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
|
||||||
|
|
||||||
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
|
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
|
||||||
|
|
||||||
@ -1758,15 +1770,16 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
|||||||
dpcm_runtime_setup_be_rate(fe_substream);
|
dpcm_runtime_setup_be_rate(fe_substream);
|
||||||
|
|
||||||
ret = dpcm_apply_symmetry(fe_substream, stream);
|
ret = dpcm_apply_symmetry(fe_substream, stream);
|
||||||
if (ret < 0)
|
|
||||||
dev_err(fe->dev, "ASoC: failed to apply dpcm symmetry %d\n",
|
|
||||||
ret);
|
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dpcm_be_dai_startup_unwind(fe, stream);
|
dpcm_be_dai_startup_unwind(fe, stream);
|
||||||
be_err:
|
be_err:
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "%s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1793,7 +1806,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
|
void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
{
|
{
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
|
|
||||||
@ -1832,14 +1845,12 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
|
static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
|
struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
|
||||||
int err, stream = substream->stream;
|
int stream = substream->stream;
|
||||||
|
|
||||||
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
||||||
@ -1847,16 +1858,11 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
|
|||||||
dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
|
dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
|
||||||
|
|
||||||
/* call hw_free on the frontend */
|
/* call hw_free on the frontend */
|
||||||
err = soc_pcm_hw_free(substream);
|
soc_pcm_hw_free(substream);
|
||||||
if (err < 0)
|
|
||||||
dev_err(fe->dev,"ASoC: hw_free FE %s failed\n",
|
|
||||||
fe->dai_link->name);
|
|
||||||
|
|
||||||
/* only hw_params backends that are either sinks or sources
|
/* only hw_params backends that are either sinks or sources
|
||||||
* to this frontend DAI */
|
* to this frontend DAI */
|
||||||
err = dpcm_be_dai_hw_free(fe, stream);
|
dpcm_be_dai_hw_free(fe, stream);
|
||||||
if (err < 0)
|
|
||||||
dev_err(fe->dev, "ASoC: hw_free BE failed %d\n", err);
|
|
||||||
|
|
||||||
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
|
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
@ -1867,14 +1873,14 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
|
|||||||
|
|
||||||
int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
|
int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_pcm_runtime *be;
|
||||||
|
struct snd_pcm_substream *be_substream;
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for_each_dpcm_be(fe, stream, dpcm) {
|
for_each_dpcm_be(fe, stream, dpcm) {
|
||||||
|
be = dpcm->be;
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
be_substream = snd_soc_dpcm_get_substream(be, stream);
|
||||||
struct snd_pcm_substream *be_substream =
|
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
|
||||||
|
|
||||||
/* is this op for this BE ? */
|
/* is this op for this BE ? */
|
||||||
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
||||||
@ -1906,22 +1912,21 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
be->dai_link->name);
|
be->dai_link->name);
|
||||||
|
|
||||||
ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params);
|
ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(dpcm->be->dev,
|
|
||||||
"ASoC: hw_params BE failed %d\n", ret);
|
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
|
dev_dbg(fe->dev, "ASoC: %s() failed at %s (%d)\n",
|
||||||
|
__func__, be->dai_link->name, ret);
|
||||||
|
|
||||||
/* disable any enabled and non active backends */
|
/* disable any enabled and non active backends */
|
||||||
for_each_dpcm_be_rollback(fe, stream, dpcm) {
|
for_each_dpcm_be_rollback(fe, stream, dpcm) {
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
be = dpcm->be;
|
||||||
struct snd_pcm_substream *be_substream =
|
be_substream = snd_soc_dpcm_get_substream(be, stream);
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
|
||||||
|
|
||||||
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
||||||
continue;
|
continue;
|
||||||
@ -1954,10 +1959,8 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
|
|||||||
memcpy(&fe->dpcm[stream].hw_params, params,
|
memcpy(&fe->dpcm[stream].hw_params, params,
|
||||||
sizeof(struct snd_pcm_hw_params));
|
sizeof(struct snd_pcm_hw_params));
|
||||||
ret = dpcm_be_dai_hw_params(fe, stream);
|
ret = dpcm_be_dai_hw_params(fe, stream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n",
|
dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n",
|
||||||
fe->dai_link->name, params_rate(params),
|
fe->dai_link->name, params_rate(params),
|
||||||
@ -1965,29 +1968,33 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
|
|||||||
|
|
||||||
/* call hw_params on the frontend */
|
/* call hw_params on the frontend */
|
||||||
ret = soc_pcm_hw_params(substream, params);
|
ret = soc_pcm_hw_params(substream, params);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret);
|
|
||||||
dpcm_be_dai_hw_free(fe, stream);
|
dpcm_be_dai_hw_free(fe, stream);
|
||||||
} else
|
else
|
||||||
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
|
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
mutex_unlock(&fe->card->mutex);
|
mutex_unlock(&fe->card->mutex);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
||||||
int cmd)
|
int cmd)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_pcm_runtime *be;
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
for_each_dpcm_be(fe, stream, dpcm) {
|
for_each_dpcm_be(fe, stream, dpcm) {
|
||||||
|
struct snd_pcm_substream *be_substream;
|
||||||
|
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
be = dpcm->be;
|
||||||
struct snd_pcm_substream *be_substream =
|
be_substream = snd_soc_dpcm_get_substream(be, stream);
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
|
||||||
|
|
||||||
/* is this op for this BE ? */
|
/* is this op for this BE ? */
|
||||||
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
if (!snd_soc_dpcm_be_can_update(fe, be, stream))
|
||||||
@ -2005,7 +2012,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
||||||
break;
|
break;
|
||||||
@ -2015,7 +2022,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
||||||
break;
|
break;
|
||||||
@ -2025,7 +2032,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
|
||||||
break;
|
break;
|
||||||
@ -2039,7 +2046,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
|
||||||
break;
|
break;
|
||||||
@ -2052,7 +2059,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_SUSPEND;
|
||||||
break;
|
break;
|
||||||
@ -2065,13 +2072,16 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
|
|||||||
|
|
||||||
ret = soc_pcm_trigger(be_substream, cmd);
|
ret = soc_pcm_trigger(be_substream, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto end;
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end:
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed at %s (%d)\n",
|
||||||
|
__func__, be->dai_link->name, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
|
EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
|
||||||
@ -2237,14 +2247,15 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
be->dai_link->name);
|
be->dai_link->name);
|
||||||
|
|
||||||
ret = soc_pcm_prepare(be_substream);
|
ret = soc_pcm_prepare(be_substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(be->dev, "ASoC: backend prepare failed %d\n",
|
|
||||||
ret);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
|
be->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2273,11 +2284,8 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
|
|||||||
|
|
||||||
/* call prepare on the frontend */
|
/* call prepare on the frontend */
|
||||||
ret = soc_pcm_prepare(substream);
|
ret = soc_pcm_prepare(substream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: prepare FE %s failed\n",
|
|
||||||
fe->dai_link->name);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
|
fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
|
||||||
|
|
||||||
@ -2285,6 +2293,9 @@ out:
|
|||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
mutex_unlock(&fe->card->mutex);
|
mutex_unlock(&fe->card->mutex);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2304,27 +2315,24 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
fe->dai_link->name);
|
fe->dai_link->name);
|
||||||
|
|
||||||
err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
|
err = snd_soc_pcm_dai_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
|
||||||
if (err < 0)
|
|
||||||
dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err);
|
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n",
|
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n",
|
||||||
fe->dai_link->name);
|
fe->dai_link->name);
|
||||||
|
|
||||||
err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP);
|
err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP);
|
||||||
if (err < 0)
|
|
||||||
dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dpcm_be_dai_hw_free(fe, stream);
|
dpcm_be_dai_hw_free(fe, stream);
|
||||||
if (err < 0)
|
|
||||||
dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err);
|
|
||||||
|
|
||||||
dpcm_be_dai_shutdown(fe, stream);
|
dpcm_be_dai_shutdown(fe, stream);
|
||||||
|
|
||||||
/* run the stream event for each BE */
|
/* run the stream event for each BE */
|
||||||
dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP);
|
dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP);
|
||||||
|
|
||||||
return 0;
|
if (err < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed (%d)\n", __func__, err);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
@ -2365,7 +2373,6 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS)
|
if (fe->dpcm[stream].state == SND_SOC_DPCM_STATE_HW_PARAMS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
ret = dpcm_be_dai_prepare(fe, stream);
|
ret = dpcm_be_dai_prepare(fe, stream);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto hw_free;
|
goto hw_free;
|
||||||
@ -2384,20 +2391,16 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
|||||||
fe->dai_link->name);
|
fe->dai_link->name);
|
||||||
|
|
||||||
ret = snd_soc_pcm_dai_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);
|
|
||||||
goto hw_free;
|
goto hw_free;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n",
|
dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n",
|
||||||
fe->dai_link->name);
|
fe->dai_link->name);
|
||||||
|
|
||||||
ret = dpcm_be_dai_trigger(fe, stream,
|
ret = dpcm_be_dai_trigger(fe, stream,
|
||||||
SNDRV_PCM_TRIGGER_START);
|
SNDRV_PCM_TRIGGER_START);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret);
|
|
||||||
goto hw_free;
|
goto hw_free;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2422,6 +2425,9 @@ disconnect:
|
|||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
|
spin_unlock_irqrestore(&fe->card->dpcm_lock, flags);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2430,7 +2436,6 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
|
|||||||
struct snd_soc_dapm_widget_list *list;
|
struct snd_soc_dapm_widget_list *list;
|
||||||
int stream;
|
int stream;
|
||||||
int count, paths;
|
int count, paths;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!fe->dai_link->dynamic)
|
if (!fe->dai_link->dynamic)
|
||||||
return 0;
|
return 0;
|
||||||
@ -2462,24 +2467,17 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
paths = dpcm_path_get(fe, stream, &list);
|
paths = dpcm_path_get(fe, stream, &list);
|
||||||
if (paths < 0) {
|
if (paths < 0)
|
||||||
dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
|
|
||||||
fe->dai_link->name,
|
|
||||||
stream == SNDRV_PCM_STREAM_PLAYBACK ?
|
|
||||||
"playback" : "capture");
|
|
||||||
return paths;
|
return paths;
|
||||||
}
|
|
||||||
|
|
||||||
/* update any playback/capture paths */
|
/* update any playback/capture paths */
|
||||||
count = dpcm_process_paths(fe, stream, &list, new);
|
count = dpcm_process_paths(fe, stream, &list, new);
|
||||||
if (count) {
|
if (count) {
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
|
||||||
if (new)
|
if (new)
|
||||||
ret = dpcm_run_update_startup(fe, stream);
|
dpcm_run_update_startup(fe, stream);
|
||||||
else
|
else
|
||||||
ret = dpcm_run_update_shutdown(fe, stream);
|
dpcm_run_update_shutdown(fe, stream);
|
||||||
if (ret < 0)
|
|
||||||
dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
|
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
|
|
||||||
dpcm_clear_pending_state(fe, stream);
|
dpcm_clear_pending_state(fe, stream);
|
||||||
@ -2561,12 +2559,8 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
|
|||||||
fe->dpcm[stream].runtime = fe_substream->runtime;
|
fe->dpcm[stream].runtime = fe_substream->runtime;
|
||||||
|
|
||||||
ret = dpcm_path_get(fe, stream, &list);
|
ret = dpcm_path_get(fe, stream, &list);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
goto open_end;
|
goto open_end;
|
||||||
} else if (ret == 0) {
|
|
||||||
dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
|
|
||||||
fe->dai_link->name, stream ? "capture" : "playback");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculate valid and active FE <-> BE dpcms */
|
/* calculate valid and active FE <-> BE dpcms */
|
||||||
dpcm_process_paths(fe, stream, &list, 1);
|
dpcm_process_paths(fe, stream, &list, 1);
|
||||||
@ -2787,11 +2781,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
|
|||||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
|
||||||
|
|
||||||
ret = snd_soc_pcm_component_new(rtd);
|
ret = snd_soc_pcm_component_new(rtd);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(rtd->dev, "ASoC: pcm constructor failed for dailink %s: %d\n",
|
|
||||||
rtd->dai_link->name, ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
pcm->no_device_suspend = true;
|
pcm->no_device_suspend = true;
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user