All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH v3 07/21] ASoC: use snd_soc_xxx_active()
Date: 15 May 2020 09:46:51 +0900	[thread overview]
Message-ID: <8736826n44.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87d0766n64.wl-kuninori.morimoto.gx@renesas.com>


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

We have snd_soc_dai/dai_stream/component_active() macro
This patch uses it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/soc-compress.c |  4 ++--
 sound/soc/soc-core.c     | 11 ++++++-----
 sound/soc/soc-pcm.c      | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index def3ae78b4a7..62ece729e425 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -231,10 +231,10 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
 
 	snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);
 
-	if (!cpu_dai->active)
+	if (!snd_soc_dai_active(cpu_dai))
 		cpu_dai->rate = 0;
 
-	if (!codec_dai->active)
+	if (!snd_soc_dai_active(codec_dai))
 		codec_dai->rate = 0;
 
 	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->shutdown)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 95d8189e45ab..e697258d2ffc 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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_active(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_active(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_active(dai, playback))
 				snd_soc_dai_digital_mute(dai, 0, playback);
 		}
 	}
@@ -718,7 +719,7 @@ int snd_soc_resume(struct device *dev)
 
 	/* activate pins from sleep state */
 	for_each_card_components(card, component)
-		if (component->active)
+		if (snd_soc_component_active(component))
 			pinctrl_pm_select_default_state(component->dev);
 
 	dev_dbg(dev, "ASoC: Scheduling resume work\n");
@@ -1943,7 +1944,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
 
 	/* deactivate pins to sleep state */
 	for_each_card_components(card, component)
-		if (!component->active)
+		if (!snd_soc_component_active(component))
 			pinctrl_pm_select_sleep_state(component->dev);
 
 probe_end:
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 8d414f0ae2f9..b7899da4217e 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -750,7 +750,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	}
 
 	for_each_rtd_components(rtd, i, component)
-		if (!component->active)
+		if (!snd_soc_component_active(component))
 			pinctrl_pm_select_sleep_state(component->dev);
 
 	return 0;
@@ -844,7 +844,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
 
 	/* Symmetry only applies if we've already got an active stream. */
 	for_each_rtd_dais(rtd, i, dai) {
-		if (dai->active) {
+		if (snd_soc_dai_active(dai)) {
 			ret = soc_pcm_apply_symmetry(substream, dai);
 			if (ret != 0)
 				goto config_err;
@@ -882,7 +882,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
 	}
 
 	for_each_rtd_components(rtd, i, component)
-		if (!component->active)
+		if (!snd_soc_component_active(component))
 			pinctrl_pm_select_sleep_state(component->dev);
 
 	return ret;
@@ -1136,9 +1136,9 @@ 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];
+		int active = snd_soc_dai_stream_active(dai, substream->stream);
 
-		if (dai->active == 1) {
+		if (snd_soc_dai_active(dai) == 1) {
 			dai->rate = 0;
 			dai->channels = 0;
 			dai->sample_bits = 0;
@@ -1907,7 +1907,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
 
 	for_each_rtd_cpu_dais (fe, i, fe_cpu_dai) {
 		/* Symmetry only applies if we've got an active stream. */
-		if (fe_cpu_dai->active) {
+		if (snd_soc_dai_active(fe_cpu_dai)) {
 			err = soc_pcm_apply_symmetry(fe_substream, fe_cpu_dai);
 			if (err < 0)
 				return err;
@@ -1936,7 +1936,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
 
 		/* Symmetry only applies if we've got an active stream. */
 		for_each_rtd_dais(rtd, i, dai) {
-			if (dai->active) {
+			if (snd_soc_dai_active(dai)) {
 				err = soc_pcm_apply_symmetry(fe_substream, dai);
 				if (err < 0)
 					return err;
@@ -2709,7 +2709,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
 		return 0;
 
 	/* only check active links */
-	if (!asoc_rtd_to_cpu(fe, 0)->active)
+	if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0)))
 		return 0;
 
 	/* DAPM sync will call this to update DSP paths */
@@ -2724,8 +2724,8 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
 			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])
+		if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) ||
+		    !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream))
 			continue;
 
 		paths = dpcm_path_get(fe, stream, &list);
-- 
2.17.1


  parent reply	other threads:[~2020-05-15  0:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  0:45 [PATCH v3 00/21] ASoC: cleanup DAI/Component activity Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 01/21] ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 02/21] ASoC: soc-dai: add snd_soc_dai_action() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 03/21] ASoC: soc-dapm: use snd_soc_dai_activate()/deactivate() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 04/21] ASoC: soc-dai: add snd_soc_dai_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 05/21] ASoC: soc-component: add snd_soc_component_active() Kuninori Morimoto
2020-05-15  0:46 ` [PATCH v3 06/21] ASoC: soc-dai: add snd_soc_dai_stream_active() Kuninori Morimoto
2020-05-15  0:46 ` Kuninori Morimoto [this message]
2020-05-15  0:46 ` [PATCH v3 08/21] ASoC: atomel: use snd_soc_xxx_active() Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 09/21] ASoC: bcm: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 10/21] ASoC: cirrus: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 11/21] ASoC: codecs: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 12/21] ASoC: fsl: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 13/21] ASoC: intel: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 14/21] ASoC: jz4740: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 15/21] ASoC: mediatek: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 16/21] ASoC: meson: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 17/21] ASoC: pxa: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 18/21] ASoC: ti: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 19/21] ASoC: uniphier: " Kuninori Morimoto
2020-05-15  0:47 ` [PATCH v3 20/21] ASoC: dwc: " Kuninori Morimoto
2020-05-15  0:48 ` [PATCH v3 21/21] ASoC: cleanup dai / component active code Kuninori Morimoto
2020-05-18 16:41 ` [PATCH v3 00/21] ASoC: cleanup DAI/Component activity Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736826n44.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.