Commit 7083f877 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
parent d74c2a15
...@@ -2612,6 +2612,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -2612,6 +2612,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) 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 count, paths; int count, paths;
if (!fe->dai_link->dynamic) if (!fe->dai_link->dynamic)
...@@ -2625,69 +2626,42 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) ...@@ -2625,69 +2626,42 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n", dev_dbg(fe->dev, "ASoC: DPCM %s runtime update for FE %s\n",
new ? "new" : "old", fe->dai_link->name); new ? "new" : "old", fe->dai_link->name);
/* skip if FE doesn't have playback capability */ for_each_pcm_streams(stream) {
if (!snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_PLAYBACK) ||
!snd_soc_dai_stream_valid(fe->codec_dai, SNDRV_PCM_STREAM_PLAYBACK))
goto capture;
/* skip if FE isn't currently playing */
if (!fe->cpu_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK] ||
!fe->codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])
goto capture;
paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list);
if (paths < 0) {
dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
fe->dai_link->name, "playback");
return paths;
}
/* update any playback paths */
count = dpcm_process_paths(fe, SNDRV_PCM_STREAM_PLAYBACK, &list, new);
if (count) {
if (new)
dpcm_run_new_update(fe, SNDRV_PCM_STREAM_PLAYBACK);
else
dpcm_run_old_update(fe, SNDRV_PCM_STREAM_PLAYBACK);
dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_PLAYBACK); /* skip if FE doesn't have playback/capture capability */
dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_PLAYBACK); if (!snd_soc_dai_stream_valid(fe->cpu_dai, stream) ||
} !snd_soc_dai_stream_valid(fe->codec_dai, stream))
continue;
dpcm_path_put(&list);
capture: /* skip if FE isn't currently playing/capturing */
/* skip if FE doesn't have capture capability */ if (!fe->cpu_dai->stream_active[stream] ||
if (!snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_CAPTURE) || !fe->codec_dai->stream_active[stream])
!snd_soc_dai_stream_valid(fe->codec_dai, SNDRV_PCM_STREAM_CAPTURE)) continue;
return 0;
/* skip if FE isn't currently capturing */ paths = dpcm_path_get(fe, stream, &list);
if (!fe->cpu_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] || if (paths < 0) {
!fe->codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]) dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
return 0; fe->dai_link->name,
stream == SNDRV_PCM_STREAM_PLAYBACK ?
"playback" : "capture");
return paths;
}
paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); /* update any playback/capture paths */
if (paths < 0) { count = dpcm_process_paths(fe, stream, &list, new);
dev_warn(fe->dev, "ASoC: %s no valid %s path\n", if (count) {
fe->dai_link->name, "capture"); if (new)
return paths; dpcm_run_new_update(fe, stream);
} else
dpcm_run_old_update(fe, stream);
/* update any old capture paths */ dpcm_clear_pending_state(fe, stream);
count = dpcm_process_paths(fe, SNDRV_PCM_STREAM_CAPTURE, &list, new); dpcm_be_disconnect(fe, stream);
if (count) { }
if (new)
dpcm_run_new_update(fe, SNDRV_PCM_STREAM_CAPTURE);
else
dpcm_run_old_update(fe, SNDRV_PCM_STREAM_CAPTURE);
dpcm_clear_pending_state(fe, SNDRV_PCM_STREAM_CAPTURE); dpcm_path_put(&list);
dpcm_be_disconnect(fe, SNDRV_PCM_STREAM_CAPTURE);
} }
dpcm_path_put(&list);
return 0; return 0;
} }
...@@ -3114,19 +3088,18 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf, ...@@ -3114,19 +3088,18 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
{ {
struct snd_soc_pcm_runtime *fe = file->private_data; struct snd_soc_pcm_runtime *fe = file->private_data;
ssize_t out_count = PAGE_SIZE, offset = 0, ret = 0; ssize_t out_count = PAGE_SIZE, offset = 0, ret = 0;
int stream;
char *buf; char *buf;
buf = kmalloc(out_count, GFP_KERNEL); buf = kmalloc(out_count, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
if (snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) for_each_pcm_streams(stream)
offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_PLAYBACK, if (snd_soc_dai_stream_valid(fe->cpu_dai, stream))
buf + offset, out_count - offset); offset += dpcm_show_state(fe, stream,
buf + offset,
if (snd_soc_dai_stream_valid(fe->cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) out_count - offset);
offset += dpcm_show_state(fe, SNDRV_PCM_STREAM_CAPTURE,
buf + offset, out_count - offset);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, offset); ret = simple_read_from_buffer(user_buf, count, ppos, buf, offset);
......
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