Skip to contentSkip to conversation

ASoC: merge .digital_mute() into .mute_stream()

PATCH In review Kuninori Morimoto 1 participant 6 messages Jul 17, 2020 – Jul 20, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover ASoC: merge .digital_mute() into .mute_stream()

Hi Mark

These are v4 digital_mute() patch which adjusts
to atmel which had conflict on v3.

v3 -> v4
- tidyup for atmel which had conflict

v2 -> v3
- uses "xxx_mute_stream" for .mute_stream naming if it was better
- removed verbose Cc email address

v1 -> v2
- return -ENOTSUPP at hdmi-codec
- add new .no_capture_mute flag and emulate .digital_mute() by .mute_stream()

Kuninori Morimoto (3):
ASoC: soc-dai: remove .digital_mute
ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec
ASoC: soc-xxx: add asoc_substream_to_rtd()

 include/sound/soc-dai.h               |  1 -
 include/sound/soc.h                   |  2 +
 sound/soc/soc-component.c             | 20 ++++-----
 sound/soc/soc-core.c                  |  4 +-
 sound/soc/soc-dai.c                   | 12 ++----
 sound/soc/soc-dapm.c                  |  6 +--
 sound/soc/soc-generic-dmaengine-pcm.c |  4 +-
 sound/soc/soc-link.c                  | 12 +++---
 sound/soc/soc-pcm.c                   | 62 +++++++++++++--------------
 sound/soc/soc-utils.c                 |  2 +-
 10 files changed, 61 insertions(+), 64 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/3 ASoC: soc-dai: remove .digital_mute

From: Kuninori Morimoto <[email protected]>

All drivers are now using .mute_stream.
Let's remove .digital_mute.

---
 include/sound/soc-dai.h | 1 -
 sound/soc/soc-dai.c     | 4 ----
 2 files changed, 5 deletions(-)
include/sound/soc-dai.h +0 -1
index e0e061b8e9bd..2c5a49411276 100644
@@ -246,7 +246,6 @@ struct snd_soc_dai_ops {
 	 * DAI digital mute - optional.
 	 * Called by soc-core to minimise any pops.
 	 */
-	int (*digital_mute)(struct snd_soc_dai *dai, int mute);
 	int (*mute_stream)(struct snd_soc_dai *dai, int mute, int stream);
 
 	/*
sound/soc/soc-dai.c +0 -4
index 458d2ea44329..c89a1929d141 100644
@@ -307,10 +307,6 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
 	    (direction == SNDRV_PCM_STREAM_PLAYBACK ||
 	     !dai->driver->ops->no_capture_mute))
 		ret = dai->driver->ops->mute_stream(dai, mute, direction);
-	else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
-		 dai->driver->ops &&
-		 dai->driver->ops->digital_mute)
-		ret = dai->driver->ops->digital_mute(dai, mute);
 
 	return soc_dai_ret(dai, ret);
 }
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 1/3 ASoC: atmel: merge .digital_mute() into .mute_stream()

In reply to Kuninori Morimoto

From: Kuninori Morimoto <[email protected]>

snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction.
We can merge digital_mute() into mute_stream

	int snd_soc_dai_digital_mute(xxx, int direction)
	{
		...
		else if (dai->driver->ops->mute_stream)
(1)			return dai->driver->ops->mute_stream(xxx, direction);
		else if (direction == SNDRV_PCM_STREAM_PLAYBACK &&
			 dai->driver->ops->digital_mute)
(2)			return dai->driver->ops->digital_mute(xxx);
		...
	}

-

---
 sound/soc/atmel/atmel-classd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/atmel/atmel-classd.c +4 -3
index 2d35b08f0565..0469f50a0366 100644
@@ -288,8 +288,8 @@ static int atmel_classd_component_resume(struct snd_soc_component *component)
 	return regcache_sync(dd->regmap);
 }
 
-static int atmel_classd_cpu_dai_digital_mute(struct snd_soc_dai *cpu_dai,
-					     int mute)
+static int atmel_classd_cpu_dai_mute_stream(struct snd_soc_dai *cpu_dai,
+					    int mute, int direction)
 {
 	struct snd_soc_component *component = cpu_dai->component;
 	u32 mask, val;
@@ -432,10 +432,11 @@ static int atmel_classd_cpu_dai_trigger(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops atmel_classd_cpu_dai_ops = {
 	.startup        = atmel_classd_cpu_dai_startup,
 	.shutdown       = atmel_classd_cpu_dai_shutdown,
-	.digital_mute	= atmel_classd_cpu_dai_digital_mute,
+	.mute_stream	= atmel_classd_cpu_dai_mute_stream,
 	.hw_params	= atmel_classd_cpu_dai_hw_params,
 	.prepare	= atmel_classd_cpu_dai_prepare,
 	.trigger	= atmel_classd_cpu_dai_trigger,
+	.no_capture_mute = 1,
 };
 
 static struct snd_soc_dai_driver atmel_classd_cpu_dai = {
Signature · 1 line
2.25.1
#3 lore raw

PATCH v4 2/3 ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec

In reply to Kuninori Morimoto

From: Kuninori Morimoto <[email protected]>

snd_soc_dai_digital_mute() is used for both CPU and Codec. For example, soc_pcm_prepare() / soc_pcm_hw_free() are caring both CPU and Codec.

But soc_resume_deferred() / snd_soc_suspend() are not. This patch cares it.

---
 sound/soc/soc-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +2 -2
index 7c58e45c1c3f..defd96b14c28 100644
@@ -548,7 +548,7 @@ int snd_soc_suspend(struct device *dev)
 		if (rtd->dai_link->ignore_suspend)
 			continue;
 
-		for_each_rtd_codec_dais(rtd, i, dai) {
+		for_each_rtd_dais(rtd, i, dai) {
 			if (snd_soc_dai_stream_active(dai, playback))
 				snd_soc_dai_digital_mute(dai, 1, playback);
 		}
@@ -687,7 +687,7 @@ static void soc_resume_deferred(struct work_struct *work)
 		if (rtd->dai_link->ignore_suspend)
 			continue;
 
-		for_each_rtd_codec_dais(rtd, i, dai) {
+		for_each_rtd_dais(rtd, i, dai) {
 			if (snd_soc_dai_stream_active(dai, playback))
 				snd_soc_dai_digital_mute(dai, 0, playback);
 		}
Signature · 1 line
2.25.1
#4 lore raw
In reply to Kuninori Morimoto

Hi Mark

Quoted 2 lines

These are v4 digital_mute() patch which adjusts
to atmel which had conflict on v3.

I'm sorry but my posted patch has strange numbers. The correct order is

[3/3] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec [2/3] ASoC: soc-dai: remove .digital_mute
[1/3] ASoC: atmel: merge .digital_mute() into .mute_stream()

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#5 lore raw

Hi Mark

Quoted 9 lines
Quoted 2 lines

These are v4 digital_mute() patch which adjusts
to atmel which had conflict on v3.

I'm sorry but my posted patch has strange numbers. The correct order is

[3/3] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec [2/3] ASoC: soc-dai: remove .digital_mute
[1/3] ASoC: atmel: merge .digital_mute() into .mute_stream()

Maybe because of my above fault,
it seems "[2/3] ASoC: soc-dai: remove .digital_mute" patch is not applied on for-5.9 branch

Thank you for your help !!

Best regards
---
Kuninori Morimoto