@@ -138,6 +138,7 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
int direction);
int snd_soc_dai_activity(struct snd_soc_dai *dai);
+#define snd_soc_dai_stream_activity(dai, stream) (dai)->stream_active[stream]
int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai,
unsigned int *tx_num, unsigned int *tx_slot,
@@ -356,9 +356,9 @@ static int cs4271_hw_params(struct snd_pcm_substream *substream,
*/
if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
- !dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]) ||
+ !snd_soc_dai_stream_activity(dai, SNDRV_PCM_STREAM_CAPTURE)) ||
(substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
- !dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])) {
+ !snd_soc_dai_stream_activity(dai, SNDRV_PCM_STREAM_PLAYBACK])) {
ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
CS4271_MODE2_PDN,
CS4271_MODE2_PDN);
@@ -429,7 +429,7 @@ static int dw_i2s_resume(struct snd_soc_component *component)
for_each_component_dais(component, dai) {
for_each_pcm_streams(stream)
- if (dai->stream_active[stream])
+ if (snd_soc_dai_stream_activity(dai, stream))
dw_i2s_config(dev, stream);
}
@@ -372,7 +372,8 @@ void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
dev_dbg(rtd->dev,
"ASoC: pop wq checking: %s status: %s waiting: %s\n",
codec_dai->driver->playback.stream_name,
- codec_dai->stream_active[playback] ? "active" : "inactive",
+ snd_soc_dai_stream_activity(codec_dai, playback) ?
+ "active" : "inactive",
rtd->pop_wait ? "yes" : "no");
/* are we waiting on this codec DAI stream */
@@ -546,7 +547,7 @@ int snd_soc_suspend(struct device *dev)
continue;
for_each_rtd_codec_dais(rtd, i, dai) {
- if (dai->stream_active[playback])
+ if (snd_soc_dai_stream_activity(dai, playback))
snd_soc_dai_digital_mute(dai, 1, playback);
}
}
@@ -688,7 +689,7 @@ static void soc_resume_deferred(struct work_struct *work)
continue;
for_each_rtd_codec_dais(rtd, i, dai) {
- if (dai->stream_active[playback])
+ if (snd_soc_dai_stream_activity(dai, playback))
snd_soc_dai_digital_mute(dai, 0, playback);
}
}
@@ -311,7 +311,7 @@ int snd_soc_dai_activity(struct snd_soc_dai *dai)
active = 0;
for_each_pcm_streams(stream)
- active += dai->stream_active[stream];
+ active += snd_soc_dai_stream_activity(dai, stream);
return active;
}
@@ -3835,7 +3835,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
"ASoC: startup() failed: %d\n", ret);
goto out;
}
- source->stream_active[substream->stream]++;
+ snd_soc_dai_stream_activity(source, substream->stream)++;
}
substream->stream = SNDRV_PCM_STREAM_PLAYBACK;
@@ -3848,7 +3848,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
"ASoC: startup() failed: %d\n", ret);
goto out;
}
- sink->stream_active[substream->stream]++;
+ snd_soc_dai_stream_activity(sink, substream->stream)++;
}
substream->hw_opened = 1;
@@ -3978,14 +3978,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
substream->stream = SNDRV_PCM_STREAM_CAPTURE;
snd_soc_dapm_widget_for_each_source_path(w, path) {
source = path->source->priv;
- source->stream_active[substream->stream]--;
+ snd_soc_dai_stream_activity(source, substream->stream)--;
snd_soc_dai_shutdown(source, substream);
}
substream->stream = SNDRV_PCM_STREAM_PLAYBACK;
snd_soc_dapm_widget_for_each_sink_path(w, path) {
sink = path->sink->priv;
- sink->stream_active[substream->stream]--;
+ snd_soc_dai_stream_activity(sink, substream->stream)--;
snd_soc_dai_shutdown(sink, substream);
}
break;
@@ -265,7 +265,7 @@ static void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
lockdep_assert_held(&rtd->card->pcm_mutex);
for_each_rtd_dais(rtd, i, dai) {
- dai->stream_active[stream] += action;
+ snd_soc_dai_stream_activity(dai, stream) += action;
snd_soc_component_activity(dai->component) += action;
}
}
@@ -1157,15 +1157,13 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
/* clear the corresponding DAIs parameters when going to be inactive */
for_each_rtd_dais(rtd, i, dai) {
- int active = dai->stream_active[substream->stream];
-
if (snd_soc_dai_activity(dai) == 1) {
dai->rate = 0;
dai->channels = 0;
dai->sample_bits = 0;
}
- if (active == 1)
+ if (snd_soc_dai_stream_activity(dai, substream->stream) == 1)
snd_soc_dai_digital_mute(dai, 1, substream->stream);
}
@@ -2716,6 +2714,8 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
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_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(fe, 0);
int stream;
int count, paths;
int ret;
@@ -2730,7 +2730,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
return 0;
/* only check active links */
- if (!snd_soc_dai_activity(asoc_rtd_to_cpu(fe, 0)))
+ if (!snd_soc_dai_activity(cpu_dai))
return 0;
/* DAPM sync will call this to update DSP paths */
@@ -2740,13 +2740,14 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
for_each_pcm_streams(stream) {
/* skip if FE doesn't have playback/capture capability */
- if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) ||
- !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream))
+ if (!snd_soc_dai_stream_valid(cpu_dai, stream) ||
+ !snd_soc_dai_stream_valid(codec_dai, stream))
continue;
/* skip if FE isn't currently playing/capturing */
- if (!asoc_rtd_to_cpu(fe, 0)->stream_active[stream] ||
- !asoc_rtd_to_codec(fe, 0)->stream_active[stream])
+ /* skip if FE isn't currently playing/capturing */
+ if (!snd_soc_dai_stream_activity(cpu_dai, stream) ||
+ !snd_soc_dai_stream_activity(codec_dai, stream))
continue;
paths = dpcm_path_get(fe, stream, &list);