All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream()
@ 2020-06-23  1:16 Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 01/19] ASoC: hdmi-codec: " Kuninori Morimoto
                   ` (19 more replies)
  0 siblings, 20 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:16 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Kuninori Morimoto, Neil Armstrong,
	David Airlie, "Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Mark Brown, Christophe JAILLET,
	Dan Murphy, Matthias Brugger, "Nuno Sá",
	Vincent Abriou, kbuild test robot, Peter Ujfalusi, Jernej Skrabec,
	Support Opensource, Marek Szyprowski, Jason Yan, Stephen Boyd,
	Pankaj Bharadiya, David Rhodes, Seung-Woo Kim, Sandy Huang,
	Pavel Dobias, Philipp Puschmann, Kyungmin Park,
	Vishwas A Deshpande, Daniel Vetter, Colin Ian King,
	Kevin Cernekee, Lucas Stach, Shawn Guo, Peter Rosin,
	M R Swami Reddy


Hi Mark

ALSA SoC has 2 mute callbacks (= .digital_mute(), .mute_stream()).
But the difference between these 2 is very small.
	.digital_mute() is for Playback
	.mute_stream()  is for Playback/Capture

This patch-set merges .digital_mute() into .mute_stream(),
and removes .digital_mute().

Kuninori Morimoto (19):
  ASoC: hdmi-codec: merge .digital_mute() into .mute_stream()
  ASoC: ti: merge .digital_mute() into .mute_stream()
  ASoC: spear: merge .digital_mute() into .mute_stream()
  ASoC: meson: merge .digital_mute() into .mute_stream()
  ASoC: atmel: merge .digital_mute() into .mute_stream()
  ASoC: codecs: merge .digital_mute() into .mute_stream()
  ASoC: codecs: tlv*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: ssm*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: pcm*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: max*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: alc*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: es*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: da*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: cs*: merge .digital_mute() into .mute_stream()
  ASoC: codecs: ak*: merge .digital_mute() into .mute_stream()
  ASoC: soc-dai: remove .digital_mute
  ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec

 drivers/gpu/drm/bridge/sii902x.c       |  9 ++++---
 drivers/gpu/drm/exynos/exynos_hdmi.c   |  8 ++++--
 drivers/gpu/drm/i2c/tda998x_drv.c      |  9 ++++---
 drivers/gpu/drm/mediatek/mtk_hdmi.c    |  8 ++++--
 drivers/gpu/drm/rockchip/cdn-dp-core.c |  9 ++++---
 drivers/gpu/drm/sti/sti_hdmi.c         |  8 ++++--
 drivers/gpu/drm/zte/zx_hdmi.c          |  9 ++++---
 include/sound/hdmi-codec.h             |  3 ++-
 include/sound/soc-dai.h                |  1 -
 sound/soc/atmel/atmel-classd.c         | 10 +++++---
 sound/soc/codecs/88pm860x-codec.c      |  9 ++++---
 sound/soc/codecs/ad193x.c              |  7 ++++--
 sound/soc/codecs/adau1701.c            |  7 ++++--
 sound/soc/codecs/ak4458.c              |  7 ++++--
 sound/soc/codecs/ak4535.c              |  8 ++++--
 sound/soc/codecs/ak4641.c              |  9 ++++---
 sound/soc/codecs/alc5623.c             |  7 ++++--
 sound/soc/codecs/alc5632.c             |  7 ++++--
 sound/soc/codecs/cpcap.c               | 15 ++++++++---
 sound/soc/codecs/cq93vc.c              |  7 ++++--
 sound/soc/codecs/cs4265.c              |  7 ++++--
 sound/soc/codecs/cs4270.c              |  7 ++++--
 sound/soc/codecs/cs42l42.c             |  7 ++++--
 sound/soc/codecs/cs42l51.c             |  7 ++++--
 sound/soc/codecs/cs42l52.c             |  7 ++++--
 sound/soc/codecs/cs42l56.c             |  7 ++++--
 sound/soc/codecs/cs42xx8.c             |  7 ++++--
 sound/soc/codecs/cs4341.c              |  7 ++++--
 sound/soc/codecs/cs4349.c              |  7 ++++--
 sound/soc/codecs/da7210.c              |  7 ++++--
 sound/soc/codecs/da7213.c              |  7 ++++--
 sound/soc/codecs/da9055.c              |  7 ++++--
 sound/soc/codecs/es8316.c              |  7 ++++--
 sound/soc/codecs/es8328.c              |  7 ++++--
 sound/soc/codecs/hdmi-codec.c          | 13 +++++-----
 sound/soc/codecs/isabelle.c            | 21 +++++++++++-----
 sound/soc/codecs/jz4770.c              |  7 ++++--
 sound/soc/codecs/lm49453.c             | 35 ++++++++++++++++++--------
 sound/soc/codecs/max98088.c            | 16 +++++++++---
 sound/soc/codecs/max98090.c            |  8 ++++--
 sound/soc/codecs/max9867.c             |  7 ++++--
 sound/soc/codecs/ml26124.c             |  7 ++++--
 sound/soc/codecs/nau8822.c             |  7 ++++--
 sound/soc/codecs/pcm1681.c             |  7 ++++--
 sound/soc/codecs/pcm1789.c             |  7 ++++--
 sound/soc/codecs/pcm179x.c             |  7 ++++--
 sound/soc/codecs/pcm3168a.c            |  7 ++++--
 sound/soc/codecs/pcm512x.c             |  7 ++++--
 sound/soc/codecs/rk3328_codec.c        |  7 ++++--
 sound/soc/codecs/sgtl5000.c            |  7 ++++--
 sound/soc/codecs/ssm2518.c             |  7 ++++--
 sound/soc/codecs/ssm2602.c             |  7 ++++--
 sound/soc/codecs/ssm4567.c             |  7 ++++--
 sound/soc/codecs/sta529.c              |  7 ++++--
 sound/soc/codecs/tas2552.c             |  7 ++++--
 sound/soc/codecs/tas2562.c             |  7 ++++--
 sound/soc/codecs/tas2770.c             |  7 ++++--
 sound/soc/codecs/tas571x.c             |  7 ++++--
 sound/soc/codecs/tas5720.c             |  7 ++++--
 sound/soc/codecs/tas6424.c             |  7 ++++--
 sound/soc/codecs/tfa9879.c             |  7 ++++--
 sound/soc/codecs/tlv320aic23.c         |  7 ++++--
 sound/soc/codecs/tlv320aic26.c         |  7 ++++--
 sound/soc/codecs/tlv320aic31xx.c       |  8 ++++--
 sound/soc/codecs/tlv320aic32x4.c       |  7 ++++--
 sound/soc/codecs/tlv320aic3x.c         |  7 ++++--
 sound/soc/codecs/twl6040.c             |  7 ++++--
 sound/soc/codecs/uda134x.c             |  7 ++++--
 sound/soc/codecs/wm8350.c              |  7 ++++--
 sound/soc/codecs/wm8400.c              |  7 ++++--
 sound/soc/codecs/wm8510.c              |  7 ++++--
 sound/soc/codecs/wm8580.c              |  7 ++++--
 sound/soc/codecs/wm8711.c              |  7 ++++--
 sound/soc/codecs/wm8728.c              |  7 ++++--
 sound/soc/codecs/wm8731.c              |  7 ++++--
 sound/soc/codecs/wm8741.c              |  7 ++++--
 sound/soc/codecs/wm8750.c              |  7 ++++--
 sound/soc/codecs/wm8753.c              |  9 ++++---
 sound/soc/codecs/wm8770.c              |  7 ++++--
 sound/soc/codecs/wm8776.c              |  7 ++++--
 sound/soc/codecs/wm8900.c              |  7 ++++--
 sound/soc/codecs/wm8903.c              |  7 ++++--
 sound/soc/codecs/wm8904.c              |  7 ++++--
 sound/soc/codecs/wm8940.c              |  7 ++++--
 sound/soc/codecs/wm8955.c              |  7 ++++--
 sound/soc/codecs/wm8960.c              |  7 ++++--
 sound/soc/codecs/wm8961.c              |  7 ++++--
 sound/soc/codecs/wm8962.c              |  7 ++++--
 sound/soc/codecs/wm8971.c              |  7 ++++--
 sound/soc/codecs/wm8974.c              |  7 ++++--
 sound/soc/codecs/wm8978.c              |  7 ++++--
 sound/soc/codecs/wm8983.c              |  7 ++++--
 sound/soc/codecs/wm8985.c              |  7 ++++--
 sound/soc/codecs/wm8988.c              |  7 ++++--
 sound/soc/codecs/wm8990.c              |  7 ++++--
 sound/soc/codecs/wm8991.c              |  7 ++++--
 sound/soc/codecs/wm8993.c              |  7 ++++--
 sound/soc/codecs/wm8994.c              | 10 +++++---
 sound/soc/codecs/wm8995.c              |  9 ++++---
 sound/soc/codecs/wm9081.c              |  7 ++++--
 sound/soc/meson/axg-spdifout.c         |  7 ++++--
 sound/soc/soc-core.c                   |  4 +--
 sound/soc/soc-dai.c                    |  4 ---
 sound/soc/spear/spdif_out.c            | 10 +++++---
 sound/soc/ti/ams-delta.c               | 11 +++++---
 105 files changed, 576 insertions(+), 243 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 01/19] ASoC: hdmi-codec: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
@ 2020-06-23  1:19 ` Kuninori Morimoto
  2020-06-23 15:18   ` Pierre-Louis Bossart
  2020-06-23  1:19 ` [PATCH 02/19] ASoC: ti: " Kuninori Morimoto
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

For hdmi-codec, we need to update struct hdmi_codec_ops,
and all its users in the same time.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/gpu/drm/bridge/sii902x.c       |  9 ++++++---
 drivers/gpu/drm/exynos/exynos_hdmi.c   |  8 ++++++--
 drivers/gpu/drm/i2c/tda998x_drv.c      |  9 ++++++---
 drivers/gpu/drm/mediatek/mtk_hdmi.c    |  8 ++++++--
 drivers/gpu/drm/rockchip/cdn-dp-core.c |  9 ++++++---
 drivers/gpu/drm/sti/sti_hdmi.c         |  8 ++++++--
 drivers/gpu/drm/zte/zx_hdmi.c          |  9 ++++++---
 include/sound/hdmi-codec.h             |  3 ++-
 sound/soc/codecs/hdmi-codec.c          | 13 +++++++------
 9 files changed, 51 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 6dad025f8da7..68b850f3a027 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -672,11 +672,14 @@ static void sii902x_audio_shutdown(struct device *dev, void *data)
 	clk_disable_unprepare(sii902x->audio.mclk);
 }
 
-static int sii902x_audio_digital_mute(struct device *dev,
-				      void *data, bool enable)
+static int sii902x_audio_mute(struct device *dev, void *data,
+			      bool enable, int direction)
 {
 	struct sii902x *sii902x = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mutex_lock(&sii902x->mutex);
 
 	sii902x_mute(sii902x, enable);
@@ -724,7 +727,7 @@ static int sii902x_audio_get_dai_id(struct snd_soc_component *component,
 static const struct hdmi_codec_ops sii902x_audio_codec_ops = {
 	.hw_params = sii902x_audio_hw_params,
 	.audio_shutdown = sii902x_audio_shutdown,
-	.digital_mute = sii902x_audio_digital_mute,
+	.mute_stream = sii902x_audio_mute,
 	.get_eld = sii902x_audio_get_eld,
 	.get_dai_id = sii902x_audio_get_dai_id,
 };
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 95dd399aa9cc..f0f8fb9c62ec 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1604,10 +1604,14 @@ static int hdmi_audio_hw_params(struct device *dev, void *data,
 	return 0;
 }
 
-static int hdmi_audio_digital_mute(struct device *dev, void *data, bool mute)
+static int hdmi_audio_mute(struct device *dev, void *data,
+			   bool mute, int direction)
 {
 	struct hdmi_context *hdata = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mutex_lock(&hdata->mutex);
 
 	hdata->audio.mute = mute;
@@ -1634,7 +1638,7 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,
 static const struct hdmi_codec_ops audio_codec_ops = {
 	.hw_params = hdmi_audio_hw_params,
 	.audio_shutdown = hdmi_audio_shutdown,
-	.digital_mute = hdmi_audio_digital_mute,
+	.mute_stream = hdmi_audio_mute,
 	.get_eld = hdmi_audio_get_eld,
 };
 
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 9517f522dcb9..e24cbfbb154a 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1133,11 +1133,14 @@ static void tda998x_audio_shutdown(struct device *dev, void *data)
 	mutex_unlock(&priv->audio_mutex);
 }
 
-static int tda998x_audio_digital_mute(struct device *dev, void *data,
-				      bool enable)
+static int tda998x_audio_mute_stream(struct device *dev, void *data,
+				     bool enable, int direction)
 {
 	struct tda998x_priv *priv = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mutex_lock(&priv->audio_mutex);
 
 	tda998x_audio_mute(priv, enable);
@@ -1162,7 +1165,7 @@ static int tda998x_audio_get_eld(struct device *dev, void *data,
 static const struct hdmi_codec_ops audio_codec_ops = {
 	.hw_params = tda998x_audio_hw_params,
 	.audio_shutdown = tda998x_audio_shutdown,
-	.digital_mute = tda998x_audio_digital_mute,
+	.mute_stream = tda998x_audio_mute_stream,
 	.get_eld = tda998x_audio_get_eld,
 };
 
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index 5feb760617cb..7721b4762758 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1647,10 +1647,14 @@ static void mtk_hdmi_audio_shutdown(struct device *dev, void *data)
 }
 
 static int
-mtk_hdmi_audio_digital_mute(struct device *dev, void *data, bool enable)
+mtk_hdmi_audio_mute(struct device *dev, void *data,
+		    bool enable, int direction)
 {
 	struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	dev_dbg(dev, "%s(%d)\n", __func__, enable);
 
 	if (enable)
@@ -1692,7 +1696,7 @@ static const struct hdmi_codec_ops mtk_hdmi_audio_codec_ops = {
 	.hw_params = mtk_hdmi_audio_hw_params,
 	.audio_startup = mtk_hdmi_audio_startup,
 	.audio_shutdown = mtk_hdmi_audio_shutdown,
-	.digital_mute = mtk_hdmi_audio_digital_mute,
+	.mute_stream = mtk_hdmi_audio_mute,
 	.get_eld = mtk_hdmi_audio_get_eld,
 	.hook_plugged_cb = mtk_hdmi_audio_hook_plugged_cb,
 };
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index c634b95b50f7..aacde58b8fe8 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -817,12 +817,15 @@ static void cdn_dp_audio_shutdown(struct device *dev, void *data)
 	mutex_unlock(&dp->lock);
 }
 
-static int cdn_dp_audio_digital_mute(struct device *dev, void *data,
-				     bool enable)
+static int cdn_dp_audio_mute_stream(struct device *dev, void *data,
+				    bool enable, int direction)
 {
 	struct cdn_dp_device *dp = dev_get_drvdata(dev);
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mutex_lock(&dp->lock);
 	if (!dp->active) {
 		ret = -ENODEV;
@@ -849,7 +852,7 @@ static int cdn_dp_audio_get_eld(struct device *dev, void *data,
 static const struct hdmi_codec_ops audio_codec_ops = {
 	.hw_params = cdn_dp_audio_hw_params,
 	.audio_shutdown = cdn_dp_audio_shutdown,
-	.digital_mute = cdn_dp_audio_digital_mute,
+	.mute_stream = cdn_dp_audio_mute_stream,
 	.get_eld = cdn_dp_audio_get_eld,
 };
 
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 5b15c4974e6b..471ac2139a64 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1191,10 +1191,14 @@ static int hdmi_audio_hw_params(struct device *dev,
 	return 0;
 }
 
-static int hdmi_audio_digital_mute(struct device *dev, void *data, bool enable)
+static int hdmi_audio_mute(struct device *dev, void *data,
+			   bool enable, int direction)
 {
 	struct sti_hdmi *hdmi = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	DRM_DEBUG_DRIVER("%s\n", enable ? "enable" : "disable");
 
 	if (enable)
@@ -1219,7 +1223,7 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size
 static const struct hdmi_codec_ops audio_codec_ops = {
 	.hw_params = hdmi_audio_hw_params,
 	.audio_shutdown = hdmi_audio_shutdown,
-	.digital_mute = hdmi_audio_digital_mute,
+	.mute_stream = hdmi_audio_mute,
 	.get_eld = hdmi_audio_get_eld,
 };
 
diff --git a/drivers/gpu/drm/zte/zx_hdmi.c b/drivers/gpu/drm/zte/zx_hdmi.c
index 76a16d997a23..bb4ab395f71d 100644
--- a/drivers/gpu/drm/zte/zx_hdmi.c
+++ b/drivers/gpu/drm/zte/zx_hdmi.c
@@ -439,11 +439,14 @@ static int zx_hdmi_audio_hw_params(struct device *dev,
 	return zx_hdmi_infoframe_trans(hdmi, &frame, FSEL_AUDIO);
 }
 
-static int zx_hdmi_audio_digital_mute(struct device *dev, void *data,
-				      bool enable)
+static int zx_hdmi_audio_mute(struct device *dev, void *data,
+			      bool enable, int direction)
 {
 	struct zx_hdmi *hdmi = dev_get_drvdata(dev);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (enable)
 		hdmi_writeb_mask(hdmi, TPI_AUD_CONFIG, TPI_AUD_MUTE,
 				 TPI_AUD_MUTE);
@@ -468,7 +471,7 @@ static const struct hdmi_codec_ops zx_hdmi_codec_ops = {
 	.audio_startup = zx_hdmi_audio_startup,
 	.hw_params = zx_hdmi_audio_hw_params,
 	.audio_shutdown = zx_hdmi_audio_shutdown,
-	.digital_mute = zx_hdmi_audio_digital_mute,
+	.mute_stream = zx_hdmi_audio_mute,
 	.get_eld = zx_hdmi_audio_get_eld,
 };
 
diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
index 83b17682e01c..4b7cc86bae95 100644
--- a/include/sound/hdmi-codec.h
+++ b/include/sound/hdmi-codec.h
@@ -76,7 +76,8 @@ struct hdmi_codec_ops {
 	 * Mute/unmute HDMI audio stream.
 	 * Optional
 	 */
-	int (*digital_mute)(struct device *dev, void *data, bool enable);
+	int (*mute_stream)(struct device *dev, void *data,
+			   bool enable, int direction);
 
 	/*
 	 * Provides EDID-Like-Data from connected HDMI device.
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index f005751da2cc..422ed5cd427f 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -558,13 +558,14 @@ static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai,
 	return 0;
 }
 
-static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)
+static int hdmi_codec_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
 
-	if (hcp->hcd.ops->digital_mute)
-		return hcp->hcd.ops->digital_mute(dai->dev->parent,
-						  hcp->hcd.data, mute);
+	if (hcp->hcd.ops->mute_stream)
+		return hcp->hcd.ops->mute_stream(dai->dev->parent,
+						 hcp->hcd.data,
+						 mute, direction);
 
 	return 0;
 }
@@ -574,14 +575,14 @@ static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = {
 	.shutdown	= hdmi_codec_shutdown,
 	.hw_params	= hdmi_codec_hw_params,
 	.set_fmt	= hdmi_codec_i2s_set_fmt,
-	.digital_mute	= hdmi_codec_digital_mute,
+	.mute_stream	= hdmi_codec_mute,
 };
 
 static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = {
 	.startup	= hdmi_codec_startup,
 	.shutdown	= hdmi_codec_shutdown,
 	.hw_params	= hdmi_codec_hw_params,
-	.digital_mute	= hdmi_codec_digital_mute,
+	.mute_stream	= hdmi_codec_mute,
 };
 
 #define HDMI_RATES	(SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 02/19] ASoC: ti: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 01/19] ASoC: hdmi-codec: " Kuninori Morimoto
@ 2020-06-23  1:19 ` Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 03/19] ASoC: spear: " Kuninori Morimoto
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/ti/ams-delta.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sound/soc/ti/ams-delta.c b/sound/soc/ti/ams-delta.c
index e17cd5e939f0..4fd3ec39bde4 100644
--- a/sound/soc/ti/ams-delta.c
+++ b/sound/soc/ti/ams-delta.c
@@ -420,10 +420,13 @@ static struct snd_soc_ops ams_delta_ops;
  * Shares hardware with codec config pulse generation */
 static bool ams_delta_muted = 1;
 
-static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
+static int ams_delta_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	int apply;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (ams_delta_muted == mute)
 		return 0;
 
@@ -439,18 +442,18 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
 
 /* Our codec DAI probably doesn't have its own .ops structure */
 static const struct snd_soc_dai_ops ams_delta_dai_ops = {
-	.digital_mute = ams_delta_digital_mute,
+	.mute_stream = ams_delta_mute,
 };
 
 /* Will be used if the codec ever has its own digital_mute function */
 static int ams_delta_startup(struct snd_pcm_substream *substream)
 {
-	return ams_delta_digital_mute(NULL, 0);
+	return ams_delta_digital_mute(NULL, 0, substream->stream);
 }
 
 static void ams_delta_shutdown(struct snd_pcm_substream *substream)
 {
-	ams_delta_digital_mute(NULL, 1);
+	ams_delta_digital_mute(NULL, 1, substream->stream);
 }
 
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 03/19] ASoC: spear: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 01/19] ASoC: hdmi-codec: " Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 02/19] ASoC: ti: " Kuninori Morimoto
@ 2020-06-23  1:19 ` Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 04/19] ASoC: meson: " Kuninori Morimoto
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/spear/spdif_out.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 58d5843811f9..c53c59f3b359 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -188,11 +188,14 @@ static int spdif_out_trigger(struct snd_pcm_substream *substream, int cmd,
 	return ret;
 }
 
-static int spdif_digital_mute(struct snd_soc_dai *dai, int mute)
+static int spdif_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
 	u32 val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	host->saved_params.mute = mute;
 	val = readl(host->io_base + SPDIF_OUT_CTRL);
 	val &= ~SPDIF_OPMODE_MASK;
@@ -229,7 +232,8 @@ static int spdif_mute_put(struct snd_kcontrol *kcontrol,
 	if (host->saved_params.mute == ucontrol->value.integer.value[0])
 		return 0;
 
-	spdif_digital_mute(cpu_dai, ucontrol->value.integer.value[0]);
+	spdif_mute(cpu_dai, ucontrol->value.integer.value[0],
+		   SNDRV_PCM_STREAM_PLAYBACK);
 
 	return 1;
 }
@@ -250,7 +254,7 @@ static int spdif_soc_dai_probe(struct snd_soc_dai *dai)
 }
 
 static const struct snd_soc_dai_ops spdif_out_dai_ops = {
-	.digital_mute	= spdif_digital_mute,
+	.mute_stream	= spdif_mute,
 	.startup	= spdif_out_startup,
 	.shutdown	= spdif_out_shutdown,
 	.trigger	= spdif_out_trigger,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 04/19] ASoC: meson: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2020-06-23  1:19 ` [PATCH 03/19] ASoC: spear: " Kuninori Morimoto
@ 2020-06-23  1:19 ` Kuninori Morimoto
  2020-06-23  1:19 ` [PATCH 05/19] ASoC: atmel: " Kuninori Morimoto
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/meson/axg-spdifout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/soc/meson/axg-spdifout.c b/sound/soc/meson/axg-spdifout.c
index 7ce6aa97ddf7..b5dcbfc35a1b 100644
--- a/sound/soc/meson/axg-spdifout.c
+++ b/sound/soc/meson/axg-spdifout.c
@@ -108,10 +108,13 @@ static int axg_spdifout_trigger(struct snd_pcm_substream *substream, int cmd,
 	}
 }
 
-static int axg_spdifout_digital_mute(struct snd_soc_dai *dai, int mute)
+static int axg_spdifout_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct axg_spdifout *priv = snd_soc_dai_get_drvdata(dai);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	/* Use spdif valid bit to perform digital mute */
 	regmap_update_bits(priv->map, SPDIFOUT_CTRL0, SPDIFOUT_CTRL0_VSET,
 			   mute ? SPDIFOUT_CTRL0_VSET : 0);
@@ -285,7 +288,7 @@ static void axg_spdifout_shutdown(struct snd_pcm_substream *substream,
 
 static const struct snd_soc_dai_ops axg_spdifout_ops = {
 	.trigger	= axg_spdifout_trigger,
-	.digital_mute	= axg_spdifout_digital_mute,
+	.mute_stream	= axg_spdifout_mute,
 	.hw_params	= axg_spdifout_hw_params,
 	.startup	= axg_spdifout_startup,
 	.shutdown	= axg_spdifout_shutdown,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 05/19] ASoC: atmel: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2020-06-23  1:19 ` [PATCH 04/19] ASoC: meson: " Kuninori Morimoto
@ 2020-06-23  1:19 ` Kuninori Morimoto
  2020-06-23 11:29   ` Alexandre Belloni
  2020-06-23  1:20 ` [PATCH 06/19] ASoC: codecs: " Kuninori Morimoto
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/atmel/atmel-classd.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index e98601eccfa3..59231c0371b8 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -327,12 +327,16 @@ static int atmel_classd_codec_dai_startup(struct snd_pcm_substream *substream,
 	return clk_prepare_enable(dd->gclk);
 }
 
-static int atmel_classd_codec_dai_digital_mute(struct snd_soc_dai *codec_dai,
-	int mute)
+static int atmel_classd_codec_dai_mute(struct snd_soc_dai *codec_dai,
+				       int mute,
+				       int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	u32 mask, val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mask = CLASSD_MR_LMUTE_MASK | CLASSD_MR_RMUTE_MASK;
 
 	if (mute)
@@ -469,7 +473,7 @@ static int atmel_classd_codec_dai_trigger(struct snd_pcm_substream *substream,
 }
 
 static const struct snd_soc_dai_ops atmel_classd_codec_dai_ops = {
-	.digital_mute	= atmel_classd_codec_dai_digital_mute,
+	.mute_stream	= atmel_classd_codec_dai_mute,
 	.startup	= atmel_classd_codec_dai_startup,
 	.shutdown	= atmel_classd_codec_dai_shutdown,
 	.hw_params	= atmel_classd_codec_dai_hw_params,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 06/19] ASoC: codecs: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2020-06-23  1:19 ` [PATCH 05/19] ASoC: atmel: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 07/19] ASoC: codecs: tlv*: " Kuninori Morimoto
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/88pm860x-codec.c |  9 +++++---
 sound/soc/codecs/ad193x.c         |  7 +++++--
 sound/soc/codecs/adau1701.c       |  7 +++++--
 sound/soc/codecs/cpcap.c          | 15 +++++++++----
 sound/soc/codecs/cq93vc.c         |  7 +++++--
 sound/soc/codecs/isabelle.c       | 21 +++++++++++++------
 sound/soc/codecs/jz4770.c         |  7 +++++--
 sound/soc/codecs/lm49453.c        | 35 ++++++++++++++++++++++---------
 sound/soc/codecs/ml26124.c        |  7 +++++--
 sound/soc/codecs/nau8822.c        |  7 +++++--
 sound/soc/codecs/rk3328_codec.c   |  7 +++++--
 sound/soc/codecs/sgtl5000.c       |  7 +++++--
 sound/soc/codecs/sta529.c         |  7 +++++--
 sound/soc/codecs/tfa9879.c        |  7 +++++--
 sound/soc/codecs/twl6040.c        |  7 +++++--
 sound/soc/codecs/uda134x.c        |  7 +++++--
 16 files changed, 117 insertions(+), 47 deletions(-)

diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 068914d0ef3d..c668029258b0 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -902,11 +902,14 @@ static const struct snd_soc_dapm_route pm860x_dapm_routes[] = {
  * Use MUTE_LEFT & MUTE_RIGHT to implement digital mute.
  * These bits can also be used to mute.
  */
-static int pm860x_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int pm860x_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	int data = 0, mask = MUTE_LEFT | MUTE_RIGHT;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		data = mask;
 	snd_soc_component_update_bits(component, PM860X_DAC_OFFSET, mask, data);
@@ -1136,14 +1139,14 @@ static int pm860x_set_bias_level(struct snd_soc_component *component,
 }
 
 static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = {
-	.digital_mute	= pm860x_digital_mute,
+	.mute_stream	= pm860x_mute,
 	.hw_params	= pm860x_pcm_hw_params,
 	.set_fmt	= pm860x_pcm_set_dai_fmt,
 	.set_sysclk	= pm860x_set_dai_sysclk,
 };
 
 static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = {
-	.digital_mute	= pm860x_digital_mute,
+	.mute_stream	= pm860x_mute,
 	.hw_params	= pm860x_i2s_hw_params,
 	.set_fmt	= pm860x_i2s_set_dai_fmt,
 	.set_sysclk	= pm860x_set_dai_sysclk,
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 980e024a5720..5af815f1028d 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -143,10 +143,13 @@ static inline bool ad193x_has_adc(const struct ad193x_priv *ad193x)
  * DAI ops entries
  */
 
-static int ad193x_mute(struct snd_soc_dai *dai, int mute)
+static int ad193x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(dai->component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2,
 				    AD193X_DAC_MASTER_MUTE,
@@ -371,7 +374,7 @@ static int ad193x_startup(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops ad193x_dai_ops = {
 	.startup = ad193x_startup,
 	.hw_params = ad193x_hw_params,
-	.digital_mute = ad193x_mute,
+	.mute_stream = ad193x_mute,
 	.set_tdm_slot = ad193x_set_tdm_slot,
 	.set_sysclk	= ad193x_set_dai_sysclk,
 	.set_fmt = ad193x_set_dai_fmt,
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index 115e296b2ad6..2aa41f91386f 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -573,13 +573,16 @@ static int adau1701_set_bias_level(struct snd_soc_component *component,
 	return 0;
 }
 
-static int adau1701_digital_mute(struct snd_soc_dai *dai, int mute)
+static int adau1701_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	unsigned int mask = ADAU1701_DSPCTRL_DAM;
 	struct adau1701 *adau1701 = snd_soc_component_get_drvdata(component);
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = 0;
 	else
@@ -631,7 +634,7 @@ static int adau1701_startup(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops adau1701_dai_ops = {
 	.set_fmt	= adau1701_set_dai_fmt,
 	.hw_params	= adau1701_hw_params,
-	.digital_mute	= adau1701_digital_mute,
+	.mute_stream	= adau1701_mute,
 	.startup	= adau1701_startup,
 };
 
diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
index d7f05b384f1f..24a1d1196d3a 100644
--- a/sound/soc/codecs/cpcap.c
+++ b/sound/soc/codecs/cpcap.c
@@ -1216,7 +1216,7 @@ static int cpcap_hifi_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return regmap_update_bits(cpcap->regmap, reg, mask, val);
 }
 
-static int cpcap_hifi_set_mute(struct snd_soc_dai *dai, int mute)
+static int cpcap_hifi_set_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
@@ -1224,6 +1224,9 @@ static int cpcap_hifi_set_mute(struct snd_soc_dai *dai, int mute)
 	static const u16 mask = BIT(CPCAP_BIT_ST_DAC_SW);
 	u16 val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = 0;
 	else
@@ -1237,7 +1240,7 @@ static const struct snd_soc_dai_ops cpcap_dai_hifi_ops = {
 	.hw_params	= cpcap_hifi_hw_params,
 	.set_sysclk	= cpcap_hifi_set_dai_sysclk,
 	.set_fmt	= cpcap_hifi_set_dai_fmt,
-	.digital_mute	= cpcap_hifi_set_mute,
+	.mute_stream	= cpcap_hifi_set_mute,
 };
 
 static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
@@ -1370,7 +1373,8 @@ static int cpcap_voice_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int cpcap_voice_set_mute(struct snd_soc_dai *dai, int mute)
+static int cpcap_voice_set_mute(struct snd_soc_dai *dai,
+				int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
@@ -1378,6 +1382,9 @@ static int cpcap_voice_set_mute(struct snd_soc_dai *dai, int mute)
 	static const u16 mask = BIT(CPCAP_BIT_CDC_SW);
 	u16 val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = 0;
 	else
@@ -1391,7 +1398,7 @@ static const struct snd_soc_dai_ops cpcap_dai_voice_ops = {
 	.hw_params	= cpcap_voice_hw_params,
 	.set_sysclk	= cpcap_voice_set_dai_sysclk,
 	.set_fmt	= cpcap_voice_set_dai_fmt,
-	.digital_mute	= cpcap_voice_set_mute,
+	.mute_stream	= cpcap_voice_set_mute,
 };
 
 static struct snd_soc_dai_driver cpcap_dai[] = {
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index b0cc61178a41..4a41cc551bdd 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -30,11 +30,14 @@ static const struct snd_kcontrol_new cq93vc_snd_controls[] = {
 	SOC_SINGLE("Mono DAC Playback Volume", DAVINCI_VC_REG09, 0, 0x3f, 0),
 };
 
-static int cq93vc_mute(struct snd_soc_dai *dai, int mute)
+static int cq93vc_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u8 reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		reg = DAVINCI_VC_REG09_MUTE;
 	else
@@ -87,7 +90,7 @@ static int cq93vc_set_bias_level(struct snd_soc_component *component,
 #define CQ93VC_FORMATS	(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE)
 
 static const struct snd_soc_dai_ops cq93vc_dai_ops = {
-	.digital_mute	= cq93vc_mute,
+	.mute_stream	= cq93vc_mute,
 	.set_sysclk	= cq93vc_set_dai_sysclk,
 };
 
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index 3626f70f7768..204b89d6aa4a 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -860,24 +860,33 @@ static const struct snd_soc_dapm_route isabelle_intercon[] = {
 	{ "LINEOUT2", NULL, "LINEOUT2 Driver" },
 };
 
-static int isabelle_hs_mute(struct snd_soc_dai *dai, int mute)
+static int isabelle_hs_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, ISABELLE_DAC1_SOFTRAMP_REG,
 			BIT(4), (mute ? BIT(4) : 0));
 
 	return 0;
 }
 
-static int isabelle_hf_mute(struct snd_soc_dai *dai, int mute)
+static int isabelle_hf_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, ISABELLE_DAC2_SOFTRAMP_REG,
 			BIT(4), (mute ? BIT(4) : 0));
 
 	return 0;
 }
 
-static int isabelle_line_mute(struct snd_soc_dai *dai, int mute)
+static int isabelle_line_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, ISABELLE_DAC3_SOFTRAMP_REG,
 			BIT(4), (mute ? BIT(4) : 0));
 
@@ -1014,19 +1023,19 @@ static int isabelle_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 static const struct snd_soc_dai_ops isabelle_hs_dai_ops = {
 	.hw_params	= isabelle_hw_params,
 	.set_fmt	= isabelle_set_dai_fmt,
-	.digital_mute	= isabelle_hs_mute,
+	.mute_stream	= isabelle_hs_mute,
 };
 
 static const struct snd_soc_dai_ops isabelle_hf_dai_ops = {
 	.hw_params	= isabelle_hw_params,
 	.set_fmt	= isabelle_set_dai_fmt,
-	.digital_mute	= isabelle_hf_mute,
+	.mute_stream	= isabelle_hf_mute,
 };
 
 static const struct snd_soc_dai_ops isabelle_line_dai_ops = {
 	.hw_params	= isabelle_hw_params,
 	.set_fmt	= isabelle_set_dai_fmt,
-	.digital_mute	= isabelle_line_mute,
+	.mute_stream	= isabelle_line_mute,
 };
 
 static const struct snd_soc_dai_ops isabelle_ul_dai_ops = {
diff --git a/sound/soc/codecs/jz4770.c b/sound/soc/codecs/jz4770.c
index 34775aa62402..c9e2ac155421 100644
--- a/sound/soc/codecs/jz4770.c
+++ b/sound/soc/codecs/jz4770.c
@@ -264,7 +264,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream,
 	return ret;
 }
 
-static int jz4770_codec_digital_mute(struct snd_soc_dai *dai, int mute)
+static int jz4770_codec_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *codec = dai->component;
 	struct jz_codec *jz_codec = snd_soc_component_get_drvdata(codec);
@@ -272,6 +272,9 @@ static int jz4770_codec_digital_mute(struct snd_soc_dai *dai, int mute)
 	unsigned int val;
 	int change, err;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	change = snd_soc_component_update_bits(codec, JZ4770_CODEC_REG_CR_DAC,
 					       REG_CR_DAC_MUTE,
 					       mute ? REG_CR_DAC_MUTE : 0);
@@ -753,7 +756,7 @@ static const struct snd_soc_dai_ops jz4770_codec_dai_ops = {
 	.shutdown	= jz4770_codec_shutdown,
 	.hw_params	= jz4770_codec_hw_params,
 	.trigger	= jz4770_codec_pcm_trigger,
-	.digital_mute	= jz4770_codec_digital_mute,
+	.mute_stream	= jz4770_codec_mute,
 };
 
 #define JZ_CODEC_FORMATS (SNDRV_PCM_FMTBIT_S16_LE  | \
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index f864b07cb0b8..32a384d0ec18 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -1218,36 +1218,51 @@ static int lm49453_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
 	return 0;
 }
 
-static int lm49453_hp_mute(struct snd_soc_dai *dai, int mute)
+static int lm49453_hp_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(1)|BIT(0),
 			    (mute ? (BIT(1)|BIT(0)) : 0));
 	return 0;
 }
 
-static int lm49453_lo_mute(struct snd_soc_dai *dai, int mute)
+static int lm49453_lo_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(3)|BIT(2),
 			    (mute ? (BIT(3)|BIT(2)) : 0));
 	return 0;
 }
 
-static int lm49453_ls_mute(struct snd_soc_dai *dai, int mute)
+static int lm49453_ls_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(5)|BIT(4),
 			    (mute ? (BIT(5)|BIT(4)) : 0));
 	return 0;
 }
 
-static int lm49453_ep_mute(struct snd_soc_dai *dai, int mute)
+static int lm49453_ep_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(4),
 			    (mute ? BIT(4) : 0));
 	return 0;
 }
 
-static int lm49453_ha_mute(struct snd_soc_dai *dai, int mute)
+static int lm49453_ha_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(7)|BIT(6),
 			    (mute ? (BIT(7)|BIT(6)) : 0));
 	return 0;
@@ -1288,35 +1303,35 @@ static const struct snd_soc_dai_ops lm49453_headset_dai_ops = {
 	.hw_params	= lm49453_hw_params,
 	.set_sysclk	= lm49453_set_dai_sysclk,
 	.set_fmt	= lm49453_set_dai_fmt,
-	.digital_mute	= lm49453_hp_mute,
+	.mute_stream	= lm49453_hp_mute,
 };
 
 static const struct snd_soc_dai_ops lm49453_speaker_dai_ops = {
 	.hw_params	= lm49453_hw_params,
 	.set_sysclk	= lm49453_set_dai_sysclk,
 	.set_fmt	= lm49453_set_dai_fmt,
-	.digital_mute	= lm49453_ls_mute,
+	.mute_stream	= lm49453_ls_mute,
 };
 
 static const struct snd_soc_dai_ops lm49453_haptic_dai_ops = {
 	.hw_params	= lm49453_hw_params,
 	.set_sysclk	= lm49453_set_dai_sysclk,
 	.set_fmt	= lm49453_set_dai_fmt,
-	.digital_mute	= lm49453_ha_mute,
+	.mute_stream	= lm49453_ha_mute,
 };
 
 static const struct snd_soc_dai_ops lm49453_ep_dai_ops = {
 	.hw_params	= lm49453_hw_params,
 	.set_sysclk	= lm49453_set_dai_sysclk,
 	.set_fmt	= lm49453_set_dai_fmt,
-	.digital_mute	= lm49453_ep_mute,
+	.mute_stream	= lm49453_ep_mute,
 };
 
 static const struct snd_soc_dai_ops lm49453_lineout_dai_ops = {
 	.hw_params	= lm49453_hw_params,
 	.set_sysclk	= lm49453_set_dai_sysclk,
 	.set_fmt	= lm49453_set_dai_fmt,
-	.digital_mute	= lm49453_lo_mute,
+	.mute_stream	= lm49453_lo_mute,
 };
 
 /* LM49453 dai structure. */
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 55823bc95d06..cbfd3919e31c 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -372,11 +372,14 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int ml26124_mute(struct snd_soc_dai *dai, int mute)
+static int ml26124_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	switch (priv->substream->stream) {
 	case SNDRV_PCM_STREAM_CAPTURE:
 		snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(0), 1);
@@ -492,7 +495,7 @@ static int ml26124_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops ml26124_dai_ops = {
 	.hw_params	= ml26124_hw_params,
-	.digital_mute	= ml26124_mute,
+	.mute_stream	= ml26124_mute,
 	.set_fmt	= ml26124_set_dai_fmt,
 	.set_sysclk	= ml26124_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c
index 79928ddeb7a1..9e7937f889cd 100644
--- a/sound/soc/codecs/nau8822.c
+++ b/sound/soc/codecs/nau8822.c
@@ -900,10 +900,13 @@ static int nau8822_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int nau8822_mute(struct snd_soc_dai *dai, int mute)
+static int nau8822_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	dev_dbg(component->dev, "%s: %d\n", __func__, mute);
 
 	if (mute)
@@ -967,7 +970,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops nau8822_dai_ops = {
 	.hw_params	= nau8822_hw_params,
-	.digital_mute	= nau8822_mute,
+	.mute_stream	= nau8822_mute,
 	.set_fmt	= nau8822_set_dai_fmt,
 	.set_sysclk	= nau8822_set_dai_sysclk,
 	.set_pll	= nau8822_set_pll,
diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c
index 115706a55577..7f235d0da3f5 100644
--- a/sound/soc/codecs/rk3328_codec.c
+++ b/sound/soc/codecs/rk3328_codec.c
@@ -107,12 +107,15 @@ static int rk3328_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	return 0;
 }
 
-static int rk3328_digital_mute(struct snd_soc_dai *dai, int mute)
+static int rk3328_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct rk3328_codec_priv *rk3328 =
 		snd_soc_component_get_drvdata(dai->component);
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = HPOUTL_MUTE | HPOUTR_MUTE;
 	else
@@ -316,7 +319,7 @@ static void rk3328_pcm_shutdown(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops rk3328_dai_ops = {
 	.hw_params = rk3328_hw_params,
 	.set_fmt = rk3328_set_dai_fmt,
-	.digital_mute = rk3328_digital_mute,
+	.mute_stream = rk3328_mute,
 	.startup = rk3328_pcm_startup,
 	.shutdown = rk3328_pcm_shutdown,
 };
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index eb08976a7d06..9a87c08caca3 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -775,11 +775,14 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
 };
 
 /* mute the codec used by alsa core */
-static int sgtl5000_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int sgtl5000_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	u16 i2s_pwr = SGTL5000_I2S_IN_POWERUP;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	/*
 	 * During 'digital mute' do not mute DAC
 	 * because LINE_IN would be muted aswell. We want to mute
@@ -1160,7 +1163,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops sgtl5000_ops = {
 	.hw_params = sgtl5000_pcm_hw_params,
-	.digital_mute = sgtl5000_digital_mute,
+	.mute_stream = sgtl5000_mute,
 	.set_fmt = sgtl5000_set_dai_fmt,
 	.set_sysclk = sgtl5000_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index 2881a0f7bb39..3bcb55b240df 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -251,10 +251,13 @@ static int sta529_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int sta529_mute(struct snd_soc_dai *dai, int mute)
+static int sta529_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	u8 val = 0;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val |= CODEC_MUTE_VAL;
 
@@ -291,7 +294,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
 static const struct snd_soc_dai_ops sta529_dai_ops = {
 	.hw_params	=	sta529_hw_params,
 	.set_fmt	=	sta529_set_dai_fmt,
-	.digital_mute	=	sta529_mute,
+	.mute_stream	=	sta529_mute,
 };
 
 static struct snd_soc_dai_driver sta529_dai = {
diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c
index abc114a3ae2b..d59a2b1e380c 100644
--- a/sound/soc/codecs/tfa9879.c
+++ b/sound/soc/codecs/tfa9879.c
@@ -93,10 +93,13 @@ static int tfa9879_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int tfa9879_digital_mute(struct snd_soc_dai *dai, int mute)
+static int tfa9879_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(component, TFA9879_MISC_CONTROL,
 				      TFA9879_S_MUTE_MASK,
 				      !!mute << TFA9879_S_MUTE_SHIFT);
@@ -251,7 +254,7 @@ static const struct regmap_config tfa9879_regmap = {
 
 static const struct snd_soc_dai_ops tfa9879_dai_ops = {
 	.hw_params = tfa9879_hw_params,
-	.digital_mute = tfa9879_digital_mute,
+	.mute_stream = tfa9879_mute,
 	.set_fmt = tfa9879_set_fmt,
 };
 
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index f34637afee51..9fead4faa739 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -997,8 +997,11 @@ static void twl6040_mute_path(struct snd_soc_component *component, enum twl6040_
 	}
 }
 
-static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)
+static int twl6040_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	switch (dai->id) {
 	case TWL6040_DAI_LEGACY:
 		twl6040_mute_path(dai->component, TWL6040_DAI_DL1, mute);
@@ -1020,7 +1023,7 @@ static const struct snd_soc_dai_ops twl6040_dai_ops = {
 	.hw_params	= twl6040_hw_params,
 	.prepare	= twl6040_prepare,
 	.set_sysclk	= twl6040_set_dai_sysclk,
-	.digital_mute	= twl6040_digital_mute,
+	.mute_stream	= twl6040_mute,
 };
 
 static struct snd_soc_dai_driver twl6040_dai[] = {
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 1cc7f56912dc..a58291581813 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -117,12 +117,15 @@ static inline void uda134x_reset(struct snd_soc_component *component)
 	regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, mask, 0);
 }
 
-static int uda134x_mute(struct snd_soc_dai *dai, int mute)
+static int uda134x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(dai->component);
 	unsigned int mask = 1<<2;
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	pr_debug("%s mute: %d\n", __func__, mute);
 
 	if (mute)
@@ -416,7 +419,7 @@ static const struct snd_soc_dai_ops uda134x_dai_ops = {
 	.startup	= uda134x_startup,
 	.shutdown	= uda134x_shutdown,
 	.hw_params	= uda134x_hw_params,
-	.digital_mute	= uda134x_mute,
+	.mute_stream	= uda134x_mute,
 	.set_sysclk	= uda134x_set_dai_sysclk,
 	.set_fmt	= uda134x_set_dai_fmt,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 07/19] ASoC: codecs: tlv*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 06/19] ASoC: codecs: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 08/19] ASoC: codecs: tas*: " Kuninori Morimoto
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/tlv320aic23.c   | 7 +++++--
 sound/soc/codecs/tlv320aic26.c   | 7 +++++--
 sound/soc/codecs/tlv320aic31xx.c | 8 ++++++--
 sound/soc/codecs/tlv320aic32x4.c | 7 +++++--
 sound/soc/codecs/tlv320aic3x.c   | 7 +++++--
 5 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index d22f75e8fb6a..74a11ccd9ca2 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -404,11 +404,14 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
 		aic23->requested_adc = 0;
 }
 
-static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute)
+static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, TLV320AIC23_DIGT);
 	if (mute)
 		reg |= TLV320AIC23_DACM_MUTE;
@@ -512,7 +515,7 @@ static const struct snd_soc_dai_ops tlv320aic23_dai_ops = {
 	.prepare	= tlv320aic23_pcm_prepare,
 	.hw_params	= tlv320aic23_hw_params,
 	.shutdown	= tlv320aic23_shutdown,
-	.digital_mute	= tlv320aic23_mute,
+	.mute_stream	= tlv320aic23_mute,
 	.set_fmt	= tlv320aic23_set_dai_fmt,
 	.set_sysclk	= tlv320aic23_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index 032b39735643..afc2a6bf0da4 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -134,12 +134,15 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
 /**
  * aic26_mute - Mute control to reduce noise when changing audio format
  */
-static int aic26_mute(struct snd_soc_dai *dai, int mute)
+static int aic26_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct aic26 *aic26 = snd_soc_component_get_drvdata(component);
 	u16 reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	dev_dbg(&aic26->spi->dev, "aic26_mute(dai=%p, mute=%i)\n",
 		dai, mute);
 
@@ -211,7 +214,7 @@ static int aic26_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 
 static const struct snd_soc_dai_ops aic26_dai_ops = {
 	.hw_params	= aic26_hw_params,
-	.digital_mute	= aic26_mute,
+	.mute_stream	= aic26_mute,
 	.set_sysclk	= aic26_set_sysclk,
 	.set_fmt	= aic26_set_fmt,
 };
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 31daa60695bd..e7f68bc46826 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -972,10 +972,14 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream,
 	return aic31xx_setup_pll(component, params);
 }
 
-static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute)
+static int aic31xx_dac_mute(struct snd_soc_dai *codec_dai, int mute,
+			    int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		snd_soc_component_update_bits(component, AIC31XX_DACMUTE,
 				    AIC31XX_DACMUTE_MASK,
@@ -1378,7 +1382,7 @@ static const struct snd_soc_dai_ops aic31xx_dai_ops = {
 	.hw_params	= aic31xx_hw_params,
 	.set_sysclk	= aic31xx_set_dai_sysclk,
 	.set_fmt	= aic31xx_set_dai_fmt,
-	.digital_mute	= aic31xx_dac_mute,
+	.mute_stream	= aic31xx_dac_mute,
 };
 
 static struct snd_soc_dai_driver dac31xx_dai_driver[] = {
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 8682daec016e..19a0a02ee909 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -812,10 +812,13 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int aic32x4_mute(struct snd_soc_dai *dai, int mute)
+static int aic32x4_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(component, AIC32X4_DACMUTE,
 				AIC32X4_MUTEON, mute ? AIC32X4_MUTEON : 0);
 
@@ -866,7 +869,7 @@ static int aic32x4_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops aic32x4_ops = {
 	.hw_params = aic32x4_hw_params,
-	.digital_mute = aic32x4_mute,
+	.mute_stream = aic32x4_mute,
 	.set_fmt = aic32x4_set_dai_fmt,
 	.set_sysclk = aic32x4_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 6860743ecdca..8b3d5af987cc 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1216,12 +1216,15 @@ static int aic3x_prepare(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int aic3x_mute(struct snd_soc_dai *dai, int mute)
+static int aic3x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u8 ldac_reg = snd_soc_component_read(component, LDAC_VOL) & ~MUTE_ON;
 	u8 rdac_reg = snd_soc_component_read(component, RDAC_VOL) & ~MUTE_ON;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		snd_soc_component_write(component, LDAC_VOL, ldac_reg | MUTE_ON);
 		snd_soc_component_write(component, RDAC_VOL, rdac_reg | MUTE_ON);
@@ -1481,7 +1484,7 @@ static int aic3x_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops aic3x_dai_ops = {
 	.hw_params	= aic3x_hw_params,
 	.prepare	= aic3x_prepare,
-	.digital_mute	= aic3x_mute,
+	.mute_stream	= aic3x_mute,
 	.set_sysclk	= aic3x_set_dai_sysclk,
 	.set_fmt	= aic3x_set_dai_fmt,
 	.set_tdm_slot	= aic3x_set_dai_tdm_slot,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 08/19] ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 07/19] ASoC: codecs: tlv*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 09/19] ASoC: codecs: ssm*: " Kuninori Morimoto
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/tas2552.c | 7 +++++--
 sound/soc/codecs/tas2562.c | 7 +++++--
 sound/soc/codecs/tas2770.c | 7 +++++--
 sound/soc/codecs/tas571x.c | 7 +++++--
 sound/soc/codecs/tas5720.c | 7 +++++--
 sound/soc/codecs/tas6424.c | 7 +++++--
 6 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index 529c0fb93f9b..32610af4d5e7 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -465,11 +465,14 @@ static int tas2552_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	return 0;
 }
 
-static int tas2552_mute(struct snd_soc_dai *dai, int mute)
+static int tas2552_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	u8 cfg1_reg = 0;
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		cfg1_reg |= TAS2552_MUTE;
 
@@ -519,7 +522,7 @@ static const struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
 	.set_sysclk	= tas2552_set_dai_sysclk,
 	.set_fmt	= tas2552_set_dai_fmt,
 	.set_tdm_slot	= tas2552_set_dai_tdm_slot,
-	.digital_mute = tas2552_mute,
+	.mute_stream	= tas2552_mute,
 };
 
 /* Formats supported by TAS2552 driver. */
diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 7fae88655a0f..c818be9536be 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -334,10 +334,13 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	return 0;
 }
 
-static int tas2562_mute(struct snd_soc_dai *dai, int mute)
+static int tas2562_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_update_bits(component, TAS2562_PWR_CTRL,
 					     TAS2562_MODE_MASK,
 					     mute ? TAS2562_MUTE : 0);
@@ -552,7 +555,7 @@ static const struct snd_soc_dai_ops tas2562_speaker_dai_ops = {
 	.hw_params	= tas2562_hw_params,
 	.set_fmt	= tas2562_set_dai_fmt,
 	.set_tdm_slot	= tas2562_set_dai_tdm_slot,
-	.digital_mute	= tas2562_mute,
+	.mute_stream	= tas2562_mute,
 };
 
 static struct snd_soc_dai_driver tas2562_dai[] = {
diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
index 54c8135fe43c..60ef721fb456 100644
--- a/sound/soc/codecs/tas2770.c
+++ b/sound/soc/codecs/tas2770.c
@@ -189,11 +189,14 @@ static const struct snd_soc_dapm_route tas2770_audio_map[] = {
 	{"VSENSE", "Switch", "VMON"},
 };
 
-static int tas2770_mute(struct snd_soc_dai *dai, int mute)
+static int tas2770_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		ret = snd_soc_component_update_bits(component,
 			TAS2770_PWR_CTRL,
@@ -530,7 +533,7 @@ static int tas2770_set_dai_tdm_slot(struct snd_soc_dai *dai,
 }
 
 static struct snd_soc_dai_ops tas2770_dai_ops = {
-	.digital_mute = tas2770_mute,
+	.mute_stream = tas2770_mute,
 	.hw_params  = tas2770_hw_params,
 	.set_fmt    = tas2770_set_fmt,
 	.set_tdm_slot = tas2770_set_dai_tdm_slot,
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c
index 5b7f9fcf6cbf..a65a874fa974 100644
--- a/sound/soc/codecs/tas571x.c
+++ b/sound/soc/codecs/tas571x.c
@@ -301,12 +301,15 @@ static int tas571x_hw_params(struct snd_pcm_substream *substream,
 				  TAS571X_SDI_FMT_MASK, val);
 }
 
-static int tas571x_mute(struct snd_soc_dai *dai, int mute)
+static int tas571x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u8 sysctl2;
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	sysctl2 = mute ? TAS571X_SYS_CTRL_2_SDN_MASK : 0;
 
 	ret = snd_soc_component_update_bits(component,
@@ -354,7 +357,7 @@ static int tas571x_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops tas571x_dai_ops = {
 	.set_fmt	= tas571x_set_dai_fmt,
 	.hw_params	= tas571x_hw_params,
-	.digital_mute	= tas571x_mute,
+	.mute_stream	= tas571x_mute,
 };
 
 
diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index e159f839d928..b445f4cf035e 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -199,11 +199,14 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	return ret;
 }
 
-static int tas5720_mute(struct snd_soc_dai *dai, int mute)
+static int tas5720_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	ret = snd_soc_component_update_bits(component, TAS5720_DIGITAL_CTRL2_REG,
 				  TAS5720_MUTE, mute ? TAS5720_MUTE : 0);
 	if (ret < 0) {
@@ -604,7 +607,7 @@ static const struct snd_soc_dai_ops tas5720_speaker_dai_ops = {
 	.hw_params	= tas5720_hw_params,
 	.set_fmt	= tas5720_set_dai_fmt,
 	.set_tdm_slot	= tas5720_set_dai_tdm_slot,
-	.digital_mute	= tas5720_mute,
+	.mute_stream	= tas5720_mute,
 };
 
 /*
diff --git a/sound/soc/codecs/tas6424.c b/sound/soc/codecs/tas6424.c
index aaba39295079..33b97a603a1d 100644
--- a/sound/soc/codecs/tas6424.c
+++ b/sound/soc/codecs/tas6424.c
@@ -252,12 +252,15 @@ static int tas6424_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	return 0;
 }
 
-static int tas6424_mute(struct snd_soc_dai *dai, int mute)
+static int tas6424_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct tas6424_data *tas6424 = snd_soc_component_get_drvdata(component);
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	dev_dbg(component->dev, "%s() mute=%d\n", __func__, mute);
 
 	if (tas6424->mute_gpio) {
@@ -382,7 +385,7 @@ static const struct snd_soc_dai_ops tas6424_speaker_dai_ops = {
 	.hw_params	= tas6424_hw_params,
 	.set_fmt	= tas6424_set_dai_fmt,
 	.set_tdm_slot	= tas6424_set_dai_tdm_slot,
-	.digital_mute	= tas6424_mute,
+	.mute_stream	= tas6424_mute,
 };
 
 static struct snd_soc_dai_driver tas6424_dai[] = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 09/19] ASoC: codecs: ssm*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 08/19] ASoC: codecs: tas*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 10/19] ASoC: codecs: pcm*: " Kuninori Morimoto
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/ssm2518.c | 7 +++++--
 sound/soc/codecs/ssm2602.c | 7 +++++--
 sound/soc/codecs/ssm4567.c | 7 +++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
index c47e3c4762fe..da4ed07b0912 100644
--- a/sound/soc/codecs/ssm2518.c
+++ b/sound/soc/codecs/ssm2518.c
@@ -388,11 +388,14 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream,
 				SSM2518_POWER1_MCS_MASK, mcs << 1);
 }
 
-static int ssm2518_mute(struct snd_soc_dai *dai, int mute)
+static int ssm2518_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct ssm2518 *ssm2518 = snd_soc_component_get_drvdata(dai->component);
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = SSM2518_MUTE_CTRL_MUTE_MASTER;
 	else
@@ -623,7 +626,7 @@ static int ssm2518_startup(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops ssm2518_dai_ops = {
 	.startup = ssm2518_startup,
 	.hw_params	= ssm2518_hw_params,
-	.digital_mute	= ssm2518_mute,
+	.mute_stream	= ssm2518_mute,
 	.set_fmt	= ssm2518_set_dai_fmt,
 	.set_tdm_slot	= ssm2518_set_tdm_slot,
 };
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 464a4d7873bb..7a3c068b16dc 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -338,10 +338,13 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
+static int ssm2602_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(dai->component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI,
 				    APDIGI_ENABLE_DAC_MUTE,
@@ -505,7 +508,7 @@ static int ssm2602_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops ssm2602_dai_ops = {
 	.startup	= ssm2602_startup,
 	.hw_params	= ssm2602_hw_params,
-	.digital_mute	= ssm2602_mute,
+	.mute_stream	= ssm2602_mute,
 	.set_sysclk	= ssm2602_set_dai_sysclk,
 	.set_fmt	= ssm2602_set_dai_fmt,
 };
diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
index bb4958bb8fe9..a59f485c2d7f 100644
--- a/sound/soc/codecs/ssm4567.c
+++ b/sound/soc/codecs/ssm4567.c
@@ -220,11 +220,14 @@ static int ssm4567_hw_params(struct snd_pcm_substream *substream,
 				SSM4567_DAC_FS_MASK, dacfs);
 }
 
-static int ssm4567_mute(struct snd_soc_dai *dai, int mute)
+static int ssm4567_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct ssm4567 *ssm4567 = snd_soc_component_get_drvdata(dai->component);
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	val = mute ? SSM4567_DAC_MUTE : 0;
 	return regmap_update_bits(ssm4567->regmap, SSM4567_REG_DAC_CTRL,
 			SSM4567_DAC_MUTE, val);
@@ -390,7 +393,7 @@ static int ssm4567_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops ssm4567_dai_ops = {
 	.hw_params	= ssm4567_hw_params,
-	.digital_mute	= ssm4567_mute,
+	.mute_stream	= ssm4567_mute,
 	.set_fmt	= ssm4567_set_dai_fmt,
 	.set_tdm_slot	= ssm4567_set_tdm_slot,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 10/19] ASoC: codecs: pcm*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 09/19] ASoC: codecs: ssm*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 11/19] ASoC: codecs: max*: " Kuninori Morimoto
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/pcm1681.c  | 7 +++++--
 sound/soc/codecs/pcm1789.c  | 7 +++++--
 sound/soc/codecs/pcm179x.c  | 7 +++++--
 sound/soc/codecs/pcm3168a.c | 7 +++++--
 sound/soc/codecs/pcm512x.c  | 7 +++++--
 5 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 4767e158cd5e..0f641d29b8b3 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -147,12 +147,15 @@ static int pcm1681_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int pcm1681_digital_mute(struct snd_soc_dai *dai, int mute)
+static int pcm1681_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct pcm1681_private *priv = snd_soc_component_get_drvdata(component);
 	int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = PCM1681_SOFT_MUTE_ALL;
 	else
@@ -205,7 +208,7 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops pcm1681_dai_ops = {
 	.set_fmt	= pcm1681_set_dai_fmt,
 	.hw_params	= pcm1681_hw_params,
-	.digital_mute	= pcm1681_digital_mute,
+	.mute_stream	= pcm1681_mute,
 };
 
 static const struct snd_soc_dapm_widget pcm1681_dapm_widgets[] = {
diff --git a/sound/soc/codecs/pcm1789.c b/sound/soc/codecs/pcm1789.c
index 8df6447c76a6..eb887802c6d0 100644
--- a/sound/soc/codecs/pcm1789.c
+++ b/sound/soc/codecs/pcm1789.c
@@ -60,11 +60,14 @@ static int pcm1789_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int pcm1789_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int pcm1789_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	struct pcm1789_private *priv = snd_soc_component_get_drvdata(component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return regmap_update_bits(priv->regmap, PCM1789_SOFT_MUTE,
 				  PCM1789_MUTE_MASK,
 				  mute ? 0 : PCM1789_MUTE_MASK);
@@ -167,7 +170,7 @@ static int pcm1789_trigger(struct snd_pcm_substream *substream, int cmd,
 static const struct snd_soc_dai_ops pcm1789_dai_ops = {
 	.set_fmt	= pcm1789_set_dai_fmt,
 	.hw_params	= pcm1789_hw_params,
-	.digital_mute	= pcm1789_digital_mute,
+	.mute_stream	= pcm1789_mute,
 	.trigger	= pcm1789_trigger,
 };
 
diff --git a/sound/soc/codecs/pcm179x.c b/sound/soc/codecs/pcm179x.c
index 9e70b7385c69..cc944250ad71 100644
--- a/sound/soc/codecs/pcm179x.c
+++ b/sound/soc/codecs/pcm179x.c
@@ -76,12 +76,15 @@ static int pcm179x_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int pcm179x_digital_mute(struct snd_soc_dai *dai, int mute)
+static int pcm179x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct pcm179x_private *priv = snd_soc_component_get_drvdata(component);
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	ret = regmap_update_bits(priv->regmap, PCM179X_SOFT_MUTE,
 				 PCM179X_MUTE_MASK, !!mute);
 	if (ret < 0)
@@ -145,7 +148,7 @@ static int pcm179x_hw_params(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops pcm179x_dai_ops = {
 	.set_fmt	= pcm179x_set_dai_fmt,
 	.hw_params	= pcm179x_hw_params,
-	.digital_mute	= pcm179x_digital_mute,
+	.mute_stream	= pcm179x_mute,
 };
 
 static const DECLARE_TLV_DB_SCALE(pcm179x_dac_tlv, -12000, 50, 1);
diff --git a/sound/soc/codecs/pcm3168a.c b/sound/soc/codecs/pcm3168a.c
index 9711fab296eb..e9756c45e15d 100644
--- a/sound/soc/codecs/pcm3168a.c
+++ b/sound/soc/codecs/pcm3168a.c
@@ -290,11 +290,14 @@ static int pcm3168a_reset(struct pcm3168a_priv *pcm3168a)
 			PCM3168A_MRST_MASK | PCM3168A_SRST_MASK);
 }
 
-static int pcm3168a_digital_mute(struct snd_soc_dai *dai, int mute)
+static int pcm3168a_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct pcm3168a_priv *pcm3168a = snd_soc_component_get_drvdata(component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	regmap_write(pcm3168a->regmap, PCM3168A_DAC_MUTE, mute ? 0xff : 0);
 
 	return 0;
@@ -570,7 +573,7 @@ static const struct snd_soc_dai_ops pcm3168a_dai_ops = {
 	.set_fmt	= pcm3168a_set_dai_fmt,
 	.set_sysclk	= pcm3168a_set_dai_sysclk,
 	.hw_params	= pcm3168a_hw_params,
-	.digital_mute	= pcm3168a_digital_mute,
+	.mute_stream	= pcm3168a_mute,
 	.set_tdm_slot	= pcm3168a_set_tdm_slot,
 };
 
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index 4cbef9affffd..5a82a59d6336 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -1394,13 +1394,16 @@ static int pcm512x_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
 	return 0;
 }
 
-static int pcm512x_digital_mute(struct snd_soc_dai *dai, int mute)
+static int pcm512x_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
 	int ret;
 	unsigned int mute_det;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	mutex_lock(&pcm512x->mutex);
 
 	if (mute) {
@@ -1445,7 +1448,7 @@ static const struct snd_soc_dai_ops pcm512x_dai_ops = {
 	.startup = pcm512x_dai_startup,
 	.hw_params = pcm512x_hw_params,
 	.set_fmt = pcm512x_set_fmt,
-	.digital_mute = pcm512x_digital_mute,
+	.mute_stream = pcm512x_mute,
 	.set_bclk_ratio = pcm512x_set_bclk_ratio,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 11/19] ASoC: codecs: max*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 10/19] ASoC: codecs: pcm*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 12/19] ASoC: codecs: alc*: " Kuninori Morimoto
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/max98088.c | 16 ++++++++++++----
 sound/soc/codecs/max98090.c |  8 ++++++--
 sound/soc/codecs/max9867.c  |  7 +++++--
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 1f1817634a41..60096e732517 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1274,11 +1274,15 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai,
        return 0;
 }
 
-static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int max98088_dai1_mute(struct snd_soc_dai *codec_dai, int mute,
+			      int direction)
 {
        struct snd_soc_component *component = codec_dai->component;
        int reg;
 
+       if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+                return 0;
+
        if (mute)
                reg = M98088_DAI_MUTE;
        else
@@ -1289,11 +1293,15 @@ static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, int mute)
        return 0;
 }
 
-static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int max98088_dai2_mute(struct snd_soc_dai *codec_dai, int mute,
+			      int direction)
 {
        struct snd_soc_component *component = codec_dai->component;
        int reg;
 
+       if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+               return 0;
+
        if (mute)
                reg = M98088_DAI_MUTE;
        else
@@ -1354,14 +1362,14 @@ static const struct snd_soc_dai_ops max98088_dai1_ops = {
        .set_sysclk = max98088_dai_set_sysclk,
        .set_fmt = max98088_dai1_set_fmt,
        .hw_params = max98088_dai1_hw_params,
-       .digital_mute = max98088_dai1_digital_mute,
+       .mute_stream = max98088_dai1_mute,
 };
 
 static const struct snd_soc_dai_ops max98088_dai2_ops = {
        .set_sysclk = max98088_dai_set_sysclk,
        .set_fmt = max98088_dai2_set_fmt,
        .hw_params = max98088_dai2_hw_params,
-       .digital_mute = max98088_dai2_digital_mute,
+       .mute_stream = max98088_dai2_mute,
 };
 
 static struct snd_soc_dai_driver max98088_dai[] = {
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index a61c5638652d..05a1a7f13b36 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2017,11 +2017,15 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai,
 	return 0;
 }
 
-static int max98090_dai_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int max98090_dai_mute(struct snd_soc_dai *codec_dai, int mute,
+			     int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	int regval;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	regval = mute ? M98090_DVM_MASK : 0;
 	snd_soc_component_update_bits(component, M98090_REG_DAI_PLAYBACK_LEVEL,
 		M98090_DVM_MASK, regval);
@@ -2347,7 +2351,7 @@ static const struct snd_soc_dai_ops max98090_dai_ops = {
 	.set_fmt = max98090_dai_set_fmt,
 	.set_tdm_slot = max98090_set_tdm_slot,
 	.hw_params = max98090_dai_hw_params,
-	.digital_mute = max98090_dai_digital_mute,
+	.mute_stream = max98090_dai_mute,
 	.trigger = max98090_dai_trigger,
 };
 
diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c
index c72cb2888c21..b4ac9f696a5d 100644
--- a/sound/soc/codecs/max9867.c
+++ b/sound/soc/codecs/max9867.c
@@ -283,11 +283,14 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int max9867_mute(struct snd_soc_dai *dai, int mute)
+static int max9867_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return regmap_update_bits(max9867->regmap, MAX9867_DACLEVEL,
 				  1 << 6, !!mute << 6);
 }
@@ -393,7 +396,7 @@ static int max9867_dai_set_fmt(struct snd_soc_dai *codec_dai,
 static const struct snd_soc_dai_ops max9867_dai_ops = {
 	.set_sysclk	= max9867_set_dai_sysclk,
 	.set_fmt	= max9867_dai_set_fmt,
-	.digital_mute	= max9867_mute,
+	.mute_stream	= max9867_mute,
 	.startup	= max9867_startup,
 	.hw_params	= max9867_dai_hw_params,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 12/19] ASoC: codecs: alc*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 11/19] ASoC: codecs: max*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 13/19] ASoC: codecs: wm*: " Kuninori Morimoto
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/alc5623.c | 7 +++++--
 sound/soc/codecs/alc5632.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index c70c49bb4a3e..de7cabaa211c 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -737,12 +737,15 @@ static int alc5623_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int alc5623_mute(struct snd_soc_dai *dai, int mute)
+static int alc5623_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 hp_mute = ALC5623_MISC_M_DAC_L_INPUT | ALC5623_MISC_M_DAC_R_INPUT;
 	u16 mute_reg = snd_soc_component_read(component, ALC5623_MISC_CTRL) & ~hp_mute;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		mute_reg |= hp_mute;
 
@@ -829,7 +832,7 @@ static int alc5623_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops alc5623_dai_ops = {
 		.hw_params = alc5623_pcm_hw_params,
-		.digital_mute = alc5623_mute,
+		.mute_stream = alc5623_mute,
 		.set_fmt = alc5623_set_dai_fmt,
 		.set_sysclk = alc5623_set_dai_sysclk,
 		.set_pll = alc5623_set_dai_pll,
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
index f49543163f69..f90bd77438b8 100644
--- a/sound/soc/codecs/alc5632.c
+++ b/sound/soc/codecs/alc5632.c
@@ -902,13 +902,16 @@ static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int alc5632_mute(struct snd_soc_dai *dai, int mute)
+static int alc5632_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L
 						|ALC5632_MISC_HP_DEPOP_MUTE_R;
 	u16 mute_reg = snd_soc_component_read(component, ALC5632_MISC_CTRL) & ~hp_mute;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		mute_reg |= hp_mute;
 
@@ -1005,7 +1008,7 @@ static int alc5632_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops alc5632_dai_ops = {
 		.hw_params = alc5632_pcm_hw_params,
-		.digital_mute = alc5632_mute,
+		.mute_stream = alc5632_mute,
 		.set_fmt = alc5632_set_dai_fmt,
 		.set_sysclk = alc5632_set_dai_sysclk,
 		.set_pll = alc5632_set_dai_pll,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 13/19] ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 12/19] ASoC: codecs: alc*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23 10:29   ` Charles Keepax
  2020-06-23  1:20 ` [PATCH 14/19] ASoC: codecs: es*: " Kuninori Morimoto
                   ` (6 subsequent siblings)
  19 siblings, 1 reply; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/wm8350.c |  7 +++++--
 sound/soc/codecs/wm8400.c |  7 +++++--
 sound/soc/codecs/wm8510.c |  7 +++++--
 sound/soc/codecs/wm8580.c |  7 +++++--
 sound/soc/codecs/wm8711.c |  7 +++++--
 sound/soc/codecs/wm8728.c |  7 +++++--
 sound/soc/codecs/wm8731.c |  7 +++++--
 sound/soc/codecs/wm8741.c |  7 +++++--
 sound/soc/codecs/wm8750.c |  7 +++++--
 sound/soc/codecs/wm8753.c |  9 ++++++---
 sound/soc/codecs/wm8770.c |  7 +++++--
 sound/soc/codecs/wm8776.c |  7 +++++--
 sound/soc/codecs/wm8900.c |  7 +++++--
 sound/soc/codecs/wm8903.c |  7 +++++--
 sound/soc/codecs/wm8904.c |  7 +++++--
 sound/soc/codecs/wm8940.c |  7 +++++--
 sound/soc/codecs/wm8955.c |  7 +++++--
 sound/soc/codecs/wm8960.c |  7 +++++--
 sound/soc/codecs/wm8961.c |  7 +++++--
 sound/soc/codecs/wm8962.c |  7 +++++--
 sound/soc/codecs/wm8971.c |  7 +++++--
 sound/soc/codecs/wm8974.c |  7 +++++--
 sound/soc/codecs/wm8978.c |  7 +++++--
 sound/soc/codecs/wm8983.c |  7 +++++--
 sound/soc/codecs/wm8985.c |  7 +++++--
 sound/soc/codecs/wm8988.c |  7 +++++--
 sound/soc/codecs/wm8990.c |  7 +++++--
 sound/soc/codecs/wm8991.c |  7 +++++--
 sound/soc/codecs/wm8993.c |  7 +++++--
 sound/soc/codecs/wm8994.c | 10 +++++++---
 sound/soc/codecs/wm8995.c |  9 ++++++---
 sound/soc/codecs/wm9081.c |  7 +++++--
 32 files changed, 164 insertions(+), 67 deletions(-)

diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 7fe7c1e91882..470f2655418f 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -942,11 +942,14 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8350_mute(struct snd_soc_dai *dai, int mute)
+static int wm8350_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	unsigned int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = WM8350_DAC_MUTE_ENA;
 	else
@@ -1426,7 +1429,7 @@ EXPORT_SYMBOL_GPL(wm8350_mic_jack_detect);
 
 static const struct snd_soc_dai_ops wm8350_dai_ops = {
 	 .hw_params	= wm8350_pcm_hw_params,
-	 .digital_mute	= wm8350_mute,
+	 .mute_stream	= wm8350_mute,
 	 .set_fmt	= wm8350_set_dai_fmt,
 	 .set_sysclk	= wm8350_set_dai_sysclk,
 	 .set_pll	= wm8350_set_fll,
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 2551eb0f1868..5709a2c45c3e 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1104,11 +1104,14 @@ static int wm8400_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8400_mute(struct snd_soc_dai *dai, int mute)
+static int wm8400_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 val = snd_soc_component_read(component, WM8400_DAC_CTRL) & ~WM8400_DAC_MUTE;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8400_DAC_CTRL, val | WM8400_DAC_MUTE);
 	else
@@ -1234,7 +1237,7 @@ static int wm8400_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8400_dai_ops = {
 	.hw_params = wm8400_hw_params,
-	.digital_mute = wm8400_mute,
+	.mute_stream = wm8400_mute,
 	.set_fmt = wm8400_set_dai_fmt,
 	.set_clkdiv = wm8400_set_dai_clkdiv,
 	.set_sysclk = wm8400_set_dai_sysclk,
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 63a877a8ee2b..b480dfe47267 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -487,11 +487,14 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8510_mute(struct snd_soc_dai *dai, int mute)
+static int wm8510_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8510_DAC) & 0xffbf;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8510_DAC, mute_reg | 0x40);
 	else
@@ -547,7 +550,7 @@ static int wm8510_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8510_dai_ops = {
 	.hw_params	= wm8510_pcm_hw_params,
-	.digital_mute	= wm8510_mute,
+	.mute_stream	= wm8510_mute,
 	.set_fmt	= wm8510_set_dai_fmt,
 	.set_clkdiv	= wm8510_set_dai_clkdiv,
 	.set_pll	= wm8510_set_dai_pll,
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index d1fc529d20e7..63284d3a9518 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -800,11 +800,14 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id,
 	return 0;
 }
 
-static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8580_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	unsigned int reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, WM8580_DAC_CONTROL5);
 
 	if (mute)
@@ -866,7 +869,7 @@ static const struct snd_soc_dai_ops wm8580_dai_ops_playback = {
 	.set_fmt	= wm8580_set_paif_dai_fmt,
 	.set_clkdiv	= wm8580_set_dai_clkdiv,
 	.set_pll	= wm8580_set_dai_pll,
-	.digital_mute	= wm8580_digital_mute,
+	.mute_stream	= wm8580_mute,
 };
 
 static const struct snd_soc_dai_ops wm8580_dai_ops_capture = {
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 8a0f93f54b60..cbbb46a6ccac 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -204,11 +204,14 @@ static void wm8711_shutdown(struct snd_pcm_substream *substream,
 	}
 }
 
-static int wm8711_mute(struct snd_soc_dai *dai, int mute)
+static int wm8711_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8711_APDIGI) & 0xfff7;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8711_APDIGI, mute_reg | 0x8);
 	else
@@ -329,7 +332,7 @@ static const struct snd_soc_dai_ops wm8711_ops = {
 	.prepare = wm8711_pcm_prepare,
 	.hw_params = wm8711_hw_params,
 	.shutdown = wm8711_shutdown,
-	.digital_mute = wm8711_mute,
+	.mute_stream = wm8711_mute,
 	.set_sysclk = wm8711_set_dai_sysclk,
 	.set_fmt = wm8711_set_dai_fmt,
 };
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index bb5521f544ba..b33c50e82725 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -69,11 +69,14 @@ static const struct snd_soc_dapm_route wm8728_intercon[] = {
 	{"VOUTR", NULL, "DAC"},
 };
 
-static int wm8728_mute(struct snd_soc_dai *dai, int mute)
+static int wm8728_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8728_DACCTL);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8728_DACCTL, mute_reg | 1);
 	else
@@ -192,7 +195,7 @@ static int wm8728_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8728_dai_ops = {
 	.hw_params	= wm8728_hw_params,
-	.digital_mute	= wm8728_mute,
+	.mute_stream	= wm8728_mute,
 	.set_fmt	= wm8728_set_dai_fmt,
 };
 
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index cae2cc38d93c..9b6b2e95d3cc 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -366,11 +366,14 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8731_mute(struct snd_soc_dai *dai, int mute)
+static int wm8731_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8731_APDIGI) & 0xfff7;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8731_APDIGI, mute_reg | 0x8);
 	else
@@ -546,7 +549,7 @@ static int wm8731_startup(struct snd_pcm_substream *substream,
 static const struct snd_soc_dai_ops wm8731_dai_ops = {
 	.startup	= wm8731_startup,
 	.hw_params	= wm8731_hw_params,
-	.digital_mute	= wm8731_mute,
+	.mute_stream	= wm8731_mute,
 	.set_sysclk	= wm8731_set_dai_sysclk,
 	.set_fmt	= wm8731_set_dai_fmt,
 };
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 328df81ee839..283b875a344d 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -364,10 +364,13 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int wm8741_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8741_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(component, WM8741_VOLUME_CONTROL,
 			WM8741_SOFT_MASK, !!mute << WM8741_SOFT_SHIFT);
 	return 0;
@@ -386,7 +389,7 @@ static const struct snd_soc_dai_ops wm8741_dai_ops = {
 	.hw_params	= wm8741_hw_params,
 	.set_sysclk	= wm8741_set_dai_sysclk,
 	.set_fmt	= wm8741_set_dai_fmt,
-	.digital_mute   = wm8741_mute,
+	.mute_stream	= wm8741_mute,
 };
 
 static struct snd_soc_dai_driver wm8741_dai = {
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 970941f8ae81..a8d6195e27f9 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -606,11 +606,14 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8750_mute(struct snd_soc_dai *dai, int mute)
+static int wm8750_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8750_ADCDAC) & 0xfff7;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8750_ADCDAC, mute_reg | 0x8);
 	else
@@ -660,7 +663,7 @@ static int wm8750_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8750_dai_ops = {
 	.hw_params	= wm8750_pcm_hw_params,
-	.digital_mute	= wm8750_mute,
+	.mute_stream	= wm8750_mute,
 	.set_fmt	= wm8750_set_dai_fmt,
 	.set_sysclk	= wm8750_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index a1b6765c8f23..09d8d8177f2f 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1295,12 +1295,15 @@ static int wm8753_voice_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return wm8753_voice_write_dai_fmt(component, fmt);
 };
 
-static int wm8753_mute(struct snd_soc_dai *dai, int mute)
+static int wm8753_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8753_DAC) & 0xfff7;
 	struct wm8753_priv *wm8753 = snd_soc_component_get_drvdata(component);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	/* the digital mute covers the HiFi and Voice DAC's on the WM8753.
 	 * make sure we check if they are not both active when we mute */
 	if (mute && wm8753->dai_func == 1) {
@@ -1380,7 +1383,7 @@ static int wm8753_set_bias_level(struct snd_soc_component *component,
  */
 static const struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = {
 	.hw_params	= wm8753_i2s_hw_params,
-	.digital_mute	= wm8753_mute,
+	.mute_stream	= wm8753_mute,
 	.set_fmt	= wm8753_hifi_set_dai_fmt,
 	.set_clkdiv	= wm8753_set_dai_clkdiv,
 	.set_pll	= wm8753_set_dai_pll,
@@ -1389,7 +1392,7 @@ static const struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = {
 
 static const struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = {
 	.hw_params	= wm8753_pcm_hw_params,
-	.digital_mute	= wm8753_mute,
+	.mute_stream	= wm8753_mute,
 	.set_fmt	= wm8753_voice_set_dai_fmt,
 	.set_clkdiv	= wm8753_set_dai_clkdiv,
 	.set_pll	= wm8753_set_dai_pll,
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index d51be2531e2e..9242231a9886 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -472,10 +472,13 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8770_mute(struct snd_soc_dai *dai, int mute)
+static int wm8770_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	component = dai->component;
 	return snd_soc_component_update_bits(component, WM8770_DACMUTE, 0x10,
 				   !!mute << 4);
@@ -538,7 +541,7 @@ static int wm8770_set_bias_level(struct snd_soc_component *component,
 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
 
 static const struct snd_soc_dai_ops wm8770_dai_ops = {
-	.digital_mute = wm8770_mute,
+	.mute_stream = wm8770_mute,
 	.hw_params = wm8770_hw_params,
 	.set_fmt = wm8770_set_fmt,
 	.set_sysclk = wm8770_set_sysclk,
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index f174d7ce2b13..367612e2fc25 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -309,10 +309,13 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8776_mute(struct snd_soc_dai *dai, int mute)
+static int wm8776_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_write(component, WM8776_DACMUTE, !!mute);
 }
 
@@ -361,7 +364,7 @@ static int wm8776_set_bias_level(struct snd_soc_component *component,
 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
 
 static const struct snd_soc_dai_ops wm8776_dac_ops = {
-	.digital_mute	= wm8776_mute,
+	.mute_stream	= wm8776_mute,
 	.hw_params      = wm8776_hw_params,
 	.set_fmt        = wm8776_set_fmt,
 	.set_sysclk     = wm8776_set_sysclk,
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 3921af63adf2..428c39e560ff 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -967,11 +967,14 @@ static int wm8900_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8900_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	u16 reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, WM8900_REG_DACCTRL);
 
 	if (mute)
@@ -997,7 +1000,7 @@ static const struct snd_soc_dai_ops wm8900_dai_ops = {
 	.set_clkdiv	= wm8900_set_dai_clkdiv,
 	.set_pll	= wm8900_set_dai_pll,
 	.set_fmt	= wm8900_set_dai_fmt,
-	.digital_mute	= wm8900_digital_mute,
+	.mute_stream	= wm8900_mute,
 };
 
 static struct snd_soc_dai_driver wm8900_dai = {
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 5de663d61ba6..2cb1c5b29f8f 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1307,11 +1307,14 @@ static int wm8903_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int wm8903_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8903_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	u16 reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, WM8903_DAC_DIGITAL_1);
 
 	if (mute)
@@ -1737,7 +1740,7 @@ static irqreturn_t wm8903_irq(int irq, void *data)
 
 static const struct snd_soc_dai_ops wm8903_dai_ops = {
 	.hw_params	= wm8903_hw_params,
-	.digital_mute	= wm8903_digital_mute,
+	.mute_stream	= wm8903_mute,
 	.set_fmt	= wm8903_set_dai_fmt,
 	.set_sysclk	= wm8903_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 3f0e49c51fd5..eba04e40d782 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1846,11 +1846,14 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id,
 	return 0;
 }
 
-static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8904_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = WM8904_DAC_MUTE;
 	else
@@ -1962,7 +1965,7 @@ static const struct snd_soc_dai_ops wm8904_dai_ops = {
 	.set_tdm_slot = wm8904_set_tdm_slot,
 	.set_pll = wm8904_set_fll,
 	.hw_params = wm8904_hw_params,
-	.digital_mute = wm8904_digital_mute,
+	.mute_stream = wm8904_mute,
 };
 
 static struct snd_soc_dai_driver wm8904_dai = {
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 41d87e172775..165fe1abc323 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -452,11 +452,14 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
 	return ret;
 }
 
-static int wm8940_mute(struct snd_soc_dai *dai, int mute)
+static int wm8940_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8940_DAC) & 0xffbf;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		mute_reg |= 0x40;
 
@@ -664,7 +667,7 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
 static const struct snd_soc_dai_ops wm8940_dai_ops = {
 	.hw_params = wm8940_i2s_hw_params,
 	.set_sysclk = wm8940_set_dai_sysclk,
-	.digital_mute = wm8940_mute,
+	.mute_stream = wm8940_mute,
 	.set_fmt = wm8940_set_dai_fmt,
 	.set_clkdiv = wm8940_set_dai_clkdiv,
 	.set_pll = wm8940_set_dai_pll,
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 73c192f58382..12ffd1660189 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -745,11 +745,14 @@ static int wm8955_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 }
 
 
-static int wm8955_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8955_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	int val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = WM8955_DACMU;
 	else
@@ -848,7 +851,7 @@ static const struct snd_soc_dai_ops wm8955_dai_ops = {
 	.set_sysclk = wm8955_set_sysclk,
 	.set_fmt = wm8955_set_fmt,
 	.hw_params = wm8955_hw_params,
-	.digital_mute = wm8955_digital_mute,
+	.mute_stream = wm8955_mute,
 };
 
 static struct snd_soc_dai_driver wm8955_dai = {
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 96c4400e92f8..13819cbca22a 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -878,10 +878,13 @@ static int wm8960_hw_free(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8960_mute(struct snd_soc_dai *dai, int mute)
+static int wm8960_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_update_bits(component, WM8960_DACCTL1, 0x8, 0x8);
 	else
@@ -1315,7 +1318,7 @@ static int wm8960_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
 static const struct snd_soc_dai_ops wm8960_dai_ops = {
 	.hw_params = wm8960_hw_params,
 	.hw_free = wm8960_hw_free,
-	.digital_mute = wm8960_mute,
+	.mute_stream = wm8960_mute,
 	.set_fmt = wm8960_set_dai_fmt,
 	.set_clkdiv = wm8960_set_dai_clkdiv,
 	.set_pll = wm8960_set_dai_pll,
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index d11a38a0b283..84ecfc90a1f5 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -698,11 +698,14 @@ static int wm8961_set_tristate(struct snd_soc_dai *dai, int tristate)
 	return snd_soc_component_write(component, WM8961_ADDITIONAL_CONTROL_2, reg);
 }
 
-static int wm8961_digital_mute(struct snd_soc_dai *dai, int mute)
+static int wm8961_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 reg = snd_soc_component_read(component, WM8961_ADC_DAC_CONTROL_1);
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		reg |= WM8961_DACMU;
 	else
@@ -806,7 +809,7 @@ static const struct snd_soc_dai_ops wm8961_dai_ops = {
 	.hw_params = wm8961_hw_params,
 	.set_sysclk = wm8961_set_sysclk,
 	.set_fmt = wm8961_set_fmt,
-	.digital_mute = wm8961_digital_mute,
+	.mute_stream = wm8961_mute,
 	.set_tristate = wm8961_set_tristate,
 	.set_clkdiv = wm8961_set_clkdiv,
 };
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 6ef022295f55..b3dfac8f77d3 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2918,11 +2918,14 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s
 	return 0;
 }
 
-static int wm8962_mute(struct snd_soc_dai *dai, int mute)
+static int wm8962_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int val, ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		val = WM8962_DAC_MUTE | WM8962_DAC_MUTE_ALT;
 	else
@@ -2951,7 +2954,7 @@ static const struct snd_soc_dai_ops wm8962_dai_ops = {
 	.hw_params = wm8962_hw_params,
 	.set_sysclk = wm8962_set_dai_sysclk,
 	.set_fmt = wm8962_set_dai_fmt,
-	.digital_mute = wm8962_mute,
+	.mute_stream = wm8962_mute,
 };
 
 static struct snd_soc_dai_driver wm8962_dai = {
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 2cefb795da03..345e6c2ce22f 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -536,11 +536,14 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8971_mute(struct snd_soc_dai *dai, int mute)
+static int wm8971_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8971_ADCDAC) & 0xfff7;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8971_ADCDAC, mute_reg | 0x8);
 	else
@@ -602,7 +605,7 @@ static int wm8971_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8971_dai_ops = {
 	.hw_params	= wm8971_pcm_hw_params,
-	.digital_mute	= wm8971_mute,
+	.mute_stream	= wm8971_mute,
 	.set_fmt	= wm8971_set_dai_fmt,
 	.set_sysclk	= wm8971_set_dai_sysclk,
 };
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 953d12e4576f..d3231989d4a2 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -559,11 +559,14 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8974_mute(struct snd_soc_dai *dai, int mute)
+static int wm8974_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8974_DAC) & 0xffbf;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8974_DAC, mute_reg | 0x40);
 	else
@@ -616,7 +619,7 @@ static int wm8974_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8974_ops = {
 	.hw_params = wm8974_pcm_hw_params,
-	.digital_mute = wm8974_mute,
+	.mute_stream = wm8974_mute,
 	.set_fmt = wm8974_set_dai_fmt,
 	.set_clkdiv = wm8974_set_dai_clkdiv,
 	.set_pll = wm8974_set_dai_pll,
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index e01ba5394527..fe491ab0d2b8 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -836,10 +836,13 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8978_mute(struct snd_soc_dai *dai, int mute)
+static int wm8978_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	dev_dbg(component->dev, "%s: %d\n", __func__, mute);
 
 	if (mute)
@@ -893,7 +896,7 @@ static int wm8978_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8978_dai_ops = {
 	.hw_params	= wm8978_hw_params,
-	.digital_mute	= wm8978_mute,
+	.mute_stream	= wm8978_mute,
 	.set_fmt	= wm8978_set_dai_fmt,
 	.set_clkdiv	= wm8978_set_dai_clkdiv,
 	.set_sysclk	= wm8978_set_dai_sysclk,
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c
index 78e1a302c54c..1b91a1636823 100644
--- a/sound/soc/codecs/wm8983.c
+++ b/sound/soc/codecs/wm8983.c
@@ -557,10 +557,13 @@ static bool wm8983_writeable(struct device *dev, unsigned int reg)
 	}
 }
 
-static int wm8983_dac_mute(struct snd_soc_dai *dai, int mute)
+static int wm8983_dac_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_update_bits(component, WM8983_DAC_CONTROL,
 				   WM8983_SOFTMUTE_MASK,
 				   !!mute << WM8983_SOFTMUTE_SHIFT);
@@ -943,7 +946,7 @@ static int wm8983_probe(struct snd_soc_component *component)
 }
 
 static const struct snd_soc_dai_ops wm8983_dai_ops = {
-	.digital_mute = wm8983_dac_mute,
+	.mute_stream = wm8983_dac_mute,
 	.hw_params = wm8983_hw_params,
 	.set_fmt = wm8983_set_fmt,
 	.set_sysclk = wm8983_set_sysclk,
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index 62f2c603eb2d..61b25f82bddd 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -649,10 +649,13 @@ static int wm8985_reset(struct snd_soc_component *component)
 	return snd_soc_component_write(component, WM8985_SOFTWARE_RESET, 0x0);
 }
 
-static int wm8985_dac_mute(struct snd_soc_dai *dai, int mute)
+static int wm8985_dac_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_update_bits(component, WM8985_DAC_CONTROL,
 				   WM8985_SOFTMUTE_MASK,
 				   !!mute << WM8985_SOFTMUTE_SHIFT);
@@ -1072,7 +1075,7 @@ static int wm8985_probe(struct snd_soc_component *component)
 }
 
 static const struct snd_soc_dai_ops wm8985_dai_ops = {
-	.digital_mute = wm8985_dac_mute,
+	.mute_stream = wm8985_dac_mute,
 	.hw_params = wm8985_hw_params,
 	.set_fmt = wm8985_set_fmt,
 	.set_sysclk = wm8985_set_sysclk,
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 646cfd8b2693..7e7c561f88ab 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -707,11 +707,14 @@ static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8988_mute(struct snd_soc_dai *dai, int mute)
+static int wm8988_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, WM8988_ADCDAC) & 0xfff7;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, WM8988_ADCDAC, mute_reg | 0x8);
 	else
@@ -766,7 +769,7 @@ static const struct snd_soc_dai_ops wm8988_ops = {
 	.hw_params = wm8988_pcm_hw_params,
 	.set_fmt = wm8988_set_dai_fmt,
 	.set_sysclk = wm8988_set_dai_sysclk,
-	.digital_mute = wm8988_mute,
+	.mute_stream = wm8988_mute,
 };
 
 static struct snd_soc_dai_driver wm8988_dai = {
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index 13bca8ebf677..22613df4969d 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -998,11 +998,14 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8990_mute(struct snd_soc_dai *dai, int mute)
+static int wm8990_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	val  = snd_soc_component_read(component, WM8990_DAC_CTRL) & ~WM8990_DAC_MUTE;
 
 	if (mute)
@@ -1152,7 +1155,7 @@ static int wm8990_set_bias_level(struct snd_soc_component *component,
  */
 static const struct snd_soc_dai_ops wm8990_dai_ops = {
 	.hw_params	= wm8990_hw_params,
-	.digital_mute	= wm8990_mute,
+	.mute_stream	= wm8990_mute,
 	.set_fmt	= wm8990_set_dai_fmt,
 	.set_clkdiv	= wm8990_set_dai_clkdiv,
 	.set_pll	= wm8990_set_dai_pll,
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c
index ba71c2f59511..1830eb9ada28 100644
--- a/sound/soc/codecs/wm8991.c
+++ b/sound/soc/codecs/wm8991.c
@@ -1064,11 +1064,14 @@ static int wm8991_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8991_mute(struct snd_soc_dai *dai, int mute)
+static int wm8991_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 val;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	val  = snd_soc_component_read(component, WM8991_DAC_CTRL) & ~WM8991_DAC_MUTE;
 	if (mute)
 		snd_soc_component_write(component, WM8991_DAC_CTRL, val | WM8991_DAC_MUTE);
@@ -1196,7 +1199,7 @@ static int wm8991_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops wm8991_ops = {
 	.hw_params = wm8991_hw_params,
-	.digital_mute = wm8991_mute,
+	.mute_stream = wm8991_mute,
 	.set_fmt = wm8991_set_dai_fmt,
 	.set_clkdiv = wm8991_set_dai_clkdiv,
 	.set_pll = wm8991_set_dai_pll
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 207c0211caa9..fbce5e4692fa 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -1330,11 +1330,14 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm8993_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8993_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	unsigned int reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, WM8993_DAC_CTRL);
 
 	if (mute)
@@ -1444,7 +1447,7 @@ static const struct snd_soc_dai_ops wm8993_ops = {
 	.set_sysclk = wm8993_set_sysclk,
 	.set_fmt = wm8993_set_dai_fmt,
 	.hw_params = wm8993_hw_params,
-	.digital_mute = wm8993_digital_mute,
+	.mute_stream = wm8993_mute,
 	.set_pll = wm8993_set_fll,
 	.set_tdm_slot = wm8993_set_tdm_slot,
 };
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 5e1ce243feb1..fa188d422f0b 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3110,12 +3110,16 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
 	return snd_soc_component_update_bits(component, aif1_reg, WM8994_AIF1_WL_MASK, aif1);
 }
 
-static int wm8994_aif_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm8994_aif_mute(struct snd_soc_dai *codec_dai, int mute,
+			   int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	int mute_reg;
 	int reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	switch (codec_dai->id) {
 	case 1:
 		mute_reg = WM8994_AIF1_DAC1_FILTERS_1;
@@ -3187,7 +3191,7 @@ static const struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
 	.set_sysclk	= wm8994_set_dai_sysclk,
 	.set_fmt	= wm8994_set_dai_fmt,
 	.hw_params	= wm8994_hw_params,
-	.digital_mute	= wm8994_aif_mute,
+	.mute_stream	= wm8994_aif_mute,
 	.set_pll	= wm8994_set_fll,
 	.set_tristate	= wm8994_set_tristate,
 };
@@ -3196,7 +3200,7 @@ static const struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
 	.set_sysclk	= wm8994_set_dai_sysclk,
 	.set_fmt	= wm8994_set_dai_fmt,
 	.hw_params	= wm8994_hw_params,
-	.digital_mute   = wm8994_aif_mute,
+	.mute_stream	= wm8994_aif_mute,
 	.set_pll	= wm8994_set_fll,
 	.set_tristate	= wm8994_set_tristate,
 };
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 276ffa84cc31..a79906fa0cea 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -1417,11 +1417,14 @@ static bool wm8995_volatile(struct device *dev, unsigned int reg)
 	}
 }
 
-static int wm8995_aif_mute(struct snd_soc_dai *dai, int mute)
+static int wm8995_aif_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int mute_reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	switch (dai->id) {
 	case 0:
 		mute_reg = WM8995_AIF1_DAC1_FILTERS_1;
@@ -2094,7 +2097,7 @@ static const struct snd_soc_dai_ops wm8995_aif1_dai_ops = {
 	.set_sysclk = wm8995_set_dai_sysclk,
 	.set_fmt = wm8995_set_dai_fmt,
 	.hw_params = wm8995_hw_params,
-	.digital_mute = wm8995_aif_mute,
+	.mute_stream = wm8995_aif_mute,
 	.set_pll = wm8995_set_fll,
 	.set_tristate = wm8995_set_tristate,
 };
@@ -2103,7 +2106,7 @@ static const struct snd_soc_dai_ops wm8995_aif2_dai_ops = {
 	.set_sysclk = wm8995_set_dai_sysclk,
 	.set_fmt = wm8995_set_dai_fmt,
 	.hw_params = wm8995_hw_params,
-	.digital_mute = wm8995_aif_mute,
+	.mute_stream = wm8995_aif_mute,
 	.set_pll = wm8995_set_fll,
 	.set_tristate = wm8995_set_tristate,
 };
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index be5c9c2b0162..60e20aeb81ae 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1147,11 +1147,14 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int wm9081_digital_mute(struct snd_soc_dai *codec_dai, int mute)
+static int wm9081_mute(struct snd_soc_dai *codec_dai, int mute, int direction)
 {
 	struct snd_soc_component *component = codec_dai->component;
 	unsigned int reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, WM9081_DAC_DIGITAL_2);
 
 	if (mute)
@@ -1232,7 +1235,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
 static const struct snd_soc_dai_ops wm9081_dai_ops = {
 	.hw_params = wm9081_hw_params,
 	.set_fmt = wm9081_set_dai_fmt,
-	.digital_mute = wm9081_digital_mute,
+	.mute_stream = wm9081_mute,
 	.set_tdm_slot = wm9081_set_tdm_slot,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 14/19] ASoC: codecs: es*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (12 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 13/19] ASoC: codecs: wm*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:20 ` [PATCH 15/19] ASoC: codecs: da*: " Kuninori Morimoto
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/es8316.c | 7 +++++--
 sound/soc/codecs/es8328.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 36eef1fb3d18..6e0066fc9e26 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -507,8 +507,11 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int es8316_mute(struct snd_soc_dai *dai, int mute)
+static int es8316_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	snd_soc_component_update_bits(dai->component, ES8316_DAC_SET1, 0x20,
 			    mute ? 0x20 : 0);
 	return 0;
@@ -522,7 +525,7 @@ static const struct snd_soc_dai_ops es8316_ops = {
 	.hw_params = es8316_pcm_hw_params,
 	.set_fmt = es8316_set_dai_fmt,
 	.set_sysclk = es8316_set_dai_sysclk,
-	.digital_mute = es8316_mute,
+	.mute_stream = es8316_mute,
 };
 
 static struct snd_soc_dai_driver es8316_dai = {
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
index fdf64c29f563..b8ac7b31e2b9 100644
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -449,8 +449,11 @@ static const struct snd_soc_dapm_route es8328_dapm_routes[] = {
 	{ "ROUT2", NULL, "Right Out 2" },
 };
 
-static int es8328_mute(struct snd_soc_dai *dai, int mute)
+static int es8328_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_update_bits(dai->component, ES8328_DACCONTROL3,
 			ES8328_DACCONTROL3_DACMUTE,
 			mute ? ES8328_DACCONTROL3_DACMUTE : 0);
@@ -692,7 +695,7 @@ static int es8328_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops es8328_dai_ops = {
 	.startup	= es8328_startup,
 	.hw_params	= es8328_hw_params,
-	.digital_mute	= es8328_mute,
+	.mute_stream	= es8328_mute,
 	.set_sysclk	= es8328_set_sysclk,
 	.set_fmt	= es8328_set_dai_fmt,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 15/19] ASoC: codecs: da*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (13 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 14/19] ASoC: codecs: es*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23 15:16   ` Adam Thomson
  2020-06-23  1:20 ` [PATCH 16/19] ASoC: codecs: cs*: " Kuninori Morimoto
                   ` (4 subsequent siblings)
  19 siblings, 1 reply; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/da7210.c | 7 +++++--
 sound/soc/codecs/da7213.c | 7 +++++--
 sound/soc/codecs/da9055.c | 7 +++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 0c99dcf242e4..8e5e5cd4bcbe 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -924,11 +924,14 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
 	return 0;
 }
 
-static int da7210_mute(struct snd_soc_dai *dai, int mute)
+static int da7210_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u8 mute_reg = snd_soc_component_read(component, DA7210_DAC_HPF) & 0xFB;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_write(component, DA7210_DAC_HPF, mute_reg | 0x4);
 	else
@@ -1034,7 +1037,7 @@ static const struct snd_soc_dai_ops da7210_dai_ops = {
 	.set_fmt	= da7210_set_dai_fmt,
 	.set_sysclk	= da7210_set_dai_sysclk,
 	.set_pll	= da7210_set_dai_pll,
-	.digital_mute	= da7210_mute,
+	.mute_stream	= da7210_mute,
 };
 
 static struct snd_soc_dai_driver da7210_dai = {
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index cc4ae7b311b4..55f8097112e1 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -1321,10 +1321,13 @@ static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
-static int da7213_mute(struct snd_soc_dai *dai, int mute)
+static int da7213_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		snd_soc_component_update_bits(component, DA7213_DAC_L_CTRL,
 				    DA7213_MUTE_EN, DA7213_MUTE_EN);
@@ -1507,7 +1510,7 @@ static int da7213_set_component_pll(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops da7213_dai_ops = {
 	.hw_params	= da7213_hw_params,
 	.set_fmt	= da7213_set_dai_fmt,
-	.digital_mute	= da7213_mute,
+	.mute_stream	= da7213_mute,
 };
 
 static struct snd_soc_dai_driver da7213_dai = {
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index e93436ccb674..e388b1c0ba19 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -1211,10 +1211,13 @@ static int da9055_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
-static int da9055_mute(struct snd_soc_dai *dai, int mute)
+static int da9055_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		snd_soc_component_update_bits(component, DA9055_DAC_L_CTRL,
 				    DA9055_DAC_L_MUTE_EN, DA9055_DAC_L_MUTE_EN);
@@ -1324,7 +1327,7 @@ static const struct snd_soc_dai_ops da9055_dai_ops = {
 	.set_fmt	= da9055_set_dai_fmt,
 	.set_sysclk	= da9055_set_dai_sysclk,
 	.set_pll	= da9055_set_dai_pll,
-	.digital_mute	= da9055_mute,
+	.mute_stream	= da9055_mute,
 };
 
 static struct snd_soc_dai_driver da9055_dai = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 16/19] ASoC: codecs: cs*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (14 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 15/19] ASoC: codecs: da*: " Kuninori Morimoto
@ 2020-06-23  1:20 ` Kuninori Morimoto
  2020-06-23  1:21 ` [PATCH 17/19] ASoC: codecs: ak*: " Kuninori Morimoto
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/cs4265.c  | 7 +++++--
 sound/soc/codecs/cs4270.c  | 7 +++++--
 sound/soc/codecs/cs42l42.c | 7 +++++--
 sound/soc/codecs/cs42l51.c | 7 +++++--
 sound/soc/codecs/cs42l52.c | 7 +++++--
 sound/soc/codecs/cs42l56.c | 7 +++++--
 sound/soc/codecs/cs42xx8.c | 7 +++++--
 sound/soc/codecs/cs4341.c  | 7 +++++--
 sound/soc/codecs/cs4349.c  | 7 +++++--
 9 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index 2fb65f246b0c..06182df8948a 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -378,10 +378,13 @@ static int cs4265_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
-static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs4265_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		snd_soc_component_update_bits(component, CS4265_DAC_CTL,
 			CS4265_DAC_CTL_MUTE,
@@ -498,7 +501,7 @@ static int cs4265_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops cs4265_ops = {
 	.hw_params	= cs4265_pcm_hw_params,
-	.digital_mute	= cs4265_digital_mute,
+	.mute_stream	= cs4265_mute,
 	.set_fmt	= cs4265_set_fmt,
 	.set_sysclk	= cs4265_set_sysclk,
 };
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 3e8dabc14f05..3c45406339f4 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -406,12 +406,15 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
  * board does not have the MUTEA or MUTEB pins connected to such circuitry,
  * then this function will do nothing.
  */
-static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
+static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
 	int reg6;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg6 = snd_soc_component_read(component, CS4270_MUTE);
 
 	if (mute)
@@ -471,7 +474,7 @@ static const struct snd_soc_dai_ops cs4270_dai_ops = {
 	.hw_params	= cs4270_hw_params,
 	.set_sysclk	= cs4270_set_dai_sysclk,
 	.set_fmt	= cs4270_set_dai_fmt,
-	.digital_mute	= cs4270_dai_mute,
+	.mute_stream	= cs4270_dai_mute,
 };
 
 static struct snd_soc_dai_driver cs4270_dai = {
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 3bc2fa229ef3..4ef52eae1999 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -849,12 +849,15 @@ static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
 	return 0;
 }
 
-static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs42l42_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	unsigned int regval;
 	u8 fullScaleVol;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		/* Mark SCLK as not present to turn on the internal
 		 * oscillator.
@@ -909,7 +912,7 @@ static const struct snd_soc_dai_ops cs42l42_ops = {
 	.hw_params	= cs42l42_pcm_hw_params,
 	.set_fmt	= cs42l42_set_dai_fmt,
 	.set_sysclk	= cs42l42_set_sysclk,
-	.digital_mute = cs42l42_digital_mute
+	.mute_stream	= cs42l42_mute
 };
 
 static struct snd_soc_dai_driver cs42l42_dai = {
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index dde9812490de..b419a578968e 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -484,12 +484,15 @@ static int cs42l51_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute)
+static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int reg;
 	int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = snd_soc_component_read(component, CS42L51_DAC_OUT_CTL);
 
 	if (mute)
@@ -511,7 +514,7 @@ static const struct snd_soc_dai_ops cs42l51_dai_ops = {
 	.hw_params      = cs42l51_hw_params,
 	.set_sysclk     = cs42l51_set_dai_sysclk,
 	.set_fmt        = cs42l51_set_dai_fmt,
-	.digital_mute   = cs42l51_dai_mute,
+	.mute_stream    = cs42l51_dai_mute,
 };
 
 static struct snd_soc_dai_driver cs42l51_dai = {
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 2ea4cba3be2a..7d2a77b3114b 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -784,10 +784,13 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
-static int cs42l52_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs42l52_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute)
 		snd_soc_component_update_bits(component, CS42L52_PB_CTL1,
 				    CS42L52_PB_CTL1_MUTE_MASK,
@@ -865,7 +868,7 @@ static int cs42l52_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops cs42l52_ops = {
 	.hw_params	= cs42l52_pcm_hw_params,
-	.digital_mute	= cs42l52_digital_mute,
+	.mute_stream	= cs42l52_mute,
 	.set_fmt	= cs42l52_set_fmt,
 	.set_sysclk	= cs42l52_set_sysclk,
 };
diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index ac569ab3d30f..77749849cf8f 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -800,10 +800,13 @@ static int cs42l56_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	return 0;
 }
 
-static int cs42l56_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs42l56_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (mute) {
 		/* Hit the DSP Mixer first */
 		snd_soc_component_update_bits(component, CS42L56_DSP_MUTE_CTL,
@@ -929,7 +932,7 @@ static int cs42l56_set_bias_level(struct snd_soc_component *component,
 
 static const struct snd_soc_dai_ops cs42l56_ops = {
 	.hw_params	= cs42l56_pcm_hw_params,
-	.digital_mute	= cs42l56_digital_mute,
+	.mute_stream	= cs42l56_mute,
 	.set_fmt	= cs42l56_set_dai_fmt,
 	.set_sysclk	= cs42l56_set_sysclk,
 };
diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c
index 94b1adb088fd..b08d44794cdb 100644
--- a/sound/soc/codecs/cs42xx8.c
+++ b/sound/soc/codecs/cs42xx8.c
@@ -362,13 +362,16 @@ static int cs42xx8_hw_free(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int cs42xx8_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs42xx8_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component);
 	u8 dac_unmute = cs42xx8->tx_channels ?
 		        ~((0x1 << cs42xx8->tx_channels) - 1) : 0;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	regmap_write(cs42xx8->regmap, CS42XX8_DACMUTE,
 		     mute ? CS42XX8_DACMUTE_ALL : dac_unmute);
 
@@ -380,7 +383,7 @@ static const struct snd_soc_dai_ops cs42xx8_dai_ops = {
 	.set_sysclk	= cs42xx8_set_dai_sysclk,
 	.hw_params	= cs42xx8_hw_params,
 	.hw_free	= cs42xx8_hw_free,
-	.digital_mute	= cs42xx8_digital_mute,
+	.mute_stream	= cs42xx8_mute,
 };
 
 static struct snd_soc_dai_driver cs42xx8_dai = {
diff --git a/sound/soc/codecs/cs4341.c b/sound/soc/codecs/cs4341.c
index ade7477d04f1..a47ad98eafd6 100644
--- a/sound/soc/codecs/cs4341.c
+++ b/sound/soc/codecs/cs4341.c
@@ -116,11 +116,14 @@ static int cs4341_hw_params(struct snd_pcm_substream *substream,
 					     CS4341_MODE2_DIF, mode);
 }
 
-static int cs4341_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs4341_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int ret;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	ret = snd_soc_component_update_bits(component, CS4341_REG_VOLA,
 					    CS4341_VOLX_MUTE,
 					    mute ? CS4341_VOLX_MUTE : 0);
@@ -174,7 +177,7 @@ static const struct snd_kcontrol_new cs4341_controls[] = {
 static const struct snd_soc_dai_ops cs4341_dai_ops = {
 	.set_fmt	= cs4341_set_fmt,
 	.hw_params	= cs4341_hw_params,
-	.digital_mute	= cs4341_digital_mute,
+	.mute_stream	= cs4341_mute,
 };
 
 static struct snd_soc_dai_driver cs4341_dai = {
diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c
index 3381209a882d..208a94dd4eed 100644
--- a/sound/soc/codecs/cs4349.c
+++ b/sound/soc/codecs/cs4349.c
@@ -131,11 +131,14 @@ static int cs4349_pcm_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int cs4349_digital_mute(struct snd_soc_dai *dai, int mute)
+static int cs4349_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	int reg;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	reg = 0;
 	if (mute)
 		reg = MUTE_AB_MASK;
@@ -236,7 +239,7 @@ static const struct snd_soc_dapm_route cs4349_routes[] = {
 static const struct snd_soc_dai_ops cs4349_dai_ops = {
 	.hw_params	= cs4349_pcm_hw_params,
 	.set_fmt	= cs4349_set_dai_fmt,
-	.digital_mute	= cs4349_digital_mute,
+	.mute_stream	= cs4349_mute,
 };
 
 static struct snd_soc_dai_driver cs4349_dai = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 17/19] ASoC: codecs: ak*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (15 preceding siblings ...)
  2020-06-23  1:20 ` [PATCH 16/19] ASoC: codecs: cs*: " Kuninori Morimoto
@ 2020-06-23  1:21 ` Kuninori Morimoto
  2020-06-23  1:21 ` [PATCH 18/19] ASoC: soc-dai: remove .digital_mute Kuninori Morimoto
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/ak4458.c | 7 +++++--
 sound/soc/codecs/ak4535.c | 8 ++++++--
 sound/soc/codecs/ak4641.c | 9 ++++++---
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
index f180cb5dfe4f..7ffae5950142 100644
--- a/sound/soc/codecs/ak4458.c
+++ b/sound/soc/codecs/ak4458.c
@@ -401,13 +401,16 @@ static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 
 static const int att_speed[] = { 4080, 2040, 510, 255 };
 
-static int ak4458_set_dai_mute(struct snd_soc_dai *dai, int mute)
+static int ak4458_set_dai_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
 	int nfs, ndt, ret, reg;
 	int ats;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	nfs = ak4458->fs;
 
 	reg = snd_soc_component_read(component, AK4458_0B_CONTROL7);
@@ -495,7 +498,7 @@ static const struct snd_soc_dai_ops ak4458_dai_ops = {
 	.startup        = ak4458_startup,
 	.hw_params	= ak4458_hw_params,
 	.set_fmt	= ak4458_set_dai_fmt,
-	.digital_mute	= ak4458_set_dai_mute,
+	.mute_stream	= ak4458_set_dai_mute,
 	.set_tdm_slot	= ak4458_set_tdm_slot,
 };
 
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index f5ad1f59eb46..37bbe239a515 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -309,10 +309,14 @@ static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
-static int ak4535_mute(struct snd_soc_dai *dai, int mute)
+static int ak4535_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 	u16 mute_reg = snd_soc_component_read(component, AK4535_DAC);
+
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	if (!mute)
 		snd_soc_component_write(component, AK4535_DAC, mute_reg & ~0x20);
 	else
@@ -348,7 +352,7 @@ static int ak4535_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops ak4535_dai_ops = {
 	.hw_params	= ak4535_hw_params,
 	.set_fmt	= ak4535_set_dai_fmt,
-	.digital_mute	= ak4535_mute,
+	.mute_stream	= ak4535_mute,
 	.set_sysclk	= ak4535_set_dai_sysclk,
 };
 
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 2d5b640aab58..2602970a824e 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -405,10 +405,13 @@ static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return snd_soc_component_write(component, AK4641_MODE1, mode1);
 }
 
-static int ak4641_mute(struct snd_soc_dai *dai, int mute)
+static int ak4641_mute(struct snd_soc_dai *dai, int mute, int direction)
 {
 	struct snd_soc_component *component = dai->component;
 
+	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
+		return 0;
+
 	return snd_soc_component_update_bits(component, AK4641_DAC, 0x20, mute ? 0x20 : 0);
 }
 
@@ -467,14 +470,14 @@ static int ak4641_set_bias_level(struct snd_soc_component *component,
 static const struct snd_soc_dai_ops ak4641_i2s_dai_ops = {
 	.hw_params    = ak4641_i2s_hw_params,
 	.set_fmt      = ak4641_i2s_set_dai_fmt,
-	.digital_mute = ak4641_mute,
+	.mute_stream  = ak4641_mute,
 	.set_sysclk   = ak4641_set_dai_sysclk,
 };
 
 static const struct snd_soc_dai_ops ak4641_pcm_dai_ops = {
 	.hw_params    = NULL, /* rates are controlled by BT chip */
 	.set_fmt      = ak4641_pcm_set_dai_fmt,
-	.digital_mute = ak4641_mute,
+	.mute_stream  = ak4641_mute,
 	.set_sysclk   = ak4641_set_dai_sysclk,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 18/19] ASoC: soc-dai: remove .digital_mute
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (16 preceding siblings ...)
  2020-06-23  1:21 ` [PATCH 17/19] ASoC: codecs: ak*: " Kuninori Morimoto
@ 2020-06-23  1:21 ` Kuninori Morimoto
  2020-06-23 15:31   ` Dan Murphy
  2020-06-23  1:21 ` [PATCH 19/19] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec Kuninori Morimoto
  2020-06-23  9:34 ` [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Peter Ujfalusi
  19 siblings, 1 reply; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy


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

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-dai.h | 1 -
 sound/soc/soc-dai.c     | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 212257e84fac..a3db208cd062 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -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);
 
 	/*
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index b05e18b63a1c..b0fc3d8b1798 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -301,10 +301,6 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
 	if (dai->driver->ops &&
 	    dai->driver->ops->mute_stream)
 		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);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 19/19] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (17 preceding siblings ...)
  2020-06-23  1:21 ` [PATCH 18/19] ASoC: soc-dai: remove .digital_mute Kuninori Morimoto
@ 2020-06-23  1:21 ` Kuninori Morimoto
  2020-06-23  9:34 ` [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Peter Ujfalusi
  19 siblings, 0 replies; 26+ messages in thread
From: Kuninori Morimoto @ 2020-06-23  1:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

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

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.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 62c0c9482018..d84d91d8e3e0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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);
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream()
  2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
                   ` (18 preceding siblings ...)
  2020-06-23  1:21 ` [PATCH 19/19] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec Kuninori Morimoto
@ 2020-06-23  9:34 ` Peter Ujfalusi
  19 siblings, 0 replies; 26+ messages in thread
From: Peter Ujfalusi @ 2020-06-23  9:34 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle, Heiko Stübner,
	Neil Armstrong, David Airlie, Michał Mirosław,
	Jonghwan Choi, Alexandre Belloni, Paul Cercueil, Andrzej Hajda,
	Frank Shi, Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, Nuno Sá, Vincent Abriou, kbuild test robot,
	Jernej Skrabec, Support Opensource, Marek Szyprowski, Jason Yan,
	Stephen Boyd, Pankaj Bharadiya, David Rhodes, Seung-Woo Kim,
	Sandy Huang, Pavel Dobias, Philipp Puschmann, Kyungmin Park,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Shawn Guo,
	Peter Rosin, Lucas Stach

Hi Morimoto-san,

On 23/06/2020 4.16, Kuninori Morimoto wrote:
> 
> Hi Mark
> 
> ALSA SoC has 2 mute callbacks (= .digital_mute(), .mute_stream()).
> But the difference between these 2 is very small.
> 	.digital_mute() is for Playback
> 	.mute_stream()  is for Playback/Capture
> 
> This patch-set merges .digital_mute() into .mute_stream(),
> and removes .digital_mute().

Instead of finding the patch to ack, I just checked the series and:
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

- Péter

> Kuninori Morimoto (19):
>   ASoC: hdmi-codec: merge .digital_mute() into .mute_stream()
>   ASoC: ti: merge .digital_mute() into .mute_stream()
>   ASoC: spear: merge .digital_mute() into .mute_stream()
>   ASoC: meson: merge .digital_mute() into .mute_stream()
>   ASoC: atmel: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: tlv*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: ssm*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: pcm*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: max*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: alc*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: es*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: da*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: cs*: merge .digital_mute() into .mute_stream()
>   ASoC: codecs: ak*: merge .digital_mute() into .mute_stream()
>   ASoC: soc-dai: remove .digital_mute
>   ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec
> 
>  drivers/gpu/drm/bridge/sii902x.c       |  9 ++++---
>  drivers/gpu/drm/exynos/exynos_hdmi.c   |  8 ++++--
>  drivers/gpu/drm/i2c/tda998x_drv.c      |  9 ++++---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c    |  8 ++++--
>  drivers/gpu/drm/rockchip/cdn-dp-core.c |  9 ++++---
>  drivers/gpu/drm/sti/sti_hdmi.c         |  8 ++++--
>  drivers/gpu/drm/zte/zx_hdmi.c          |  9 ++++---
>  include/sound/hdmi-codec.h             |  3 ++-
>  include/sound/soc-dai.h                |  1 -
>  sound/soc/atmel/atmel-classd.c         | 10 +++++---
>  sound/soc/codecs/88pm860x-codec.c      |  9 ++++---
>  sound/soc/codecs/ad193x.c              |  7 ++++--
>  sound/soc/codecs/adau1701.c            |  7 ++++--
>  sound/soc/codecs/ak4458.c              |  7 ++++--
>  sound/soc/codecs/ak4535.c              |  8 ++++--
>  sound/soc/codecs/ak4641.c              |  9 ++++---
>  sound/soc/codecs/alc5623.c             |  7 ++++--
>  sound/soc/codecs/alc5632.c             |  7 ++++--
>  sound/soc/codecs/cpcap.c               | 15 ++++++++---
>  sound/soc/codecs/cq93vc.c              |  7 ++++--
>  sound/soc/codecs/cs4265.c              |  7 ++++--
>  sound/soc/codecs/cs4270.c              |  7 ++++--
>  sound/soc/codecs/cs42l42.c             |  7 ++++--
>  sound/soc/codecs/cs42l51.c             |  7 ++++--
>  sound/soc/codecs/cs42l52.c             |  7 ++++--
>  sound/soc/codecs/cs42l56.c             |  7 ++++--
>  sound/soc/codecs/cs42xx8.c             |  7 ++++--
>  sound/soc/codecs/cs4341.c              |  7 ++++--
>  sound/soc/codecs/cs4349.c              |  7 ++++--
>  sound/soc/codecs/da7210.c              |  7 ++++--
>  sound/soc/codecs/da7213.c              |  7 ++++--
>  sound/soc/codecs/da9055.c              |  7 ++++--
>  sound/soc/codecs/es8316.c              |  7 ++++--
>  sound/soc/codecs/es8328.c              |  7 ++++--
>  sound/soc/codecs/hdmi-codec.c          | 13 +++++-----
>  sound/soc/codecs/isabelle.c            | 21 +++++++++++-----
>  sound/soc/codecs/jz4770.c              |  7 ++++--
>  sound/soc/codecs/lm49453.c             | 35 ++++++++++++++++++--------
>  sound/soc/codecs/max98088.c            | 16 +++++++++---
>  sound/soc/codecs/max98090.c            |  8 ++++--
>  sound/soc/codecs/max9867.c             |  7 ++++--
>  sound/soc/codecs/ml26124.c             |  7 ++++--
>  sound/soc/codecs/nau8822.c             |  7 ++++--
>  sound/soc/codecs/pcm1681.c             |  7 ++++--
>  sound/soc/codecs/pcm1789.c             |  7 ++++--
>  sound/soc/codecs/pcm179x.c             |  7 ++++--
>  sound/soc/codecs/pcm3168a.c            |  7 ++++--
>  sound/soc/codecs/pcm512x.c             |  7 ++++--
>  sound/soc/codecs/rk3328_codec.c        |  7 ++++--
>  sound/soc/codecs/sgtl5000.c            |  7 ++++--
>  sound/soc/codecs/ssm2518.c             |  7 ++++--
>  sound/soc/codecs/ssm2602.c             |  7 ++++--
>  sound/soc/codecs/ssm4567.c             |  7 ++++--
>  sound/soc/codecs/sta529.c              |  7 ++++--
>  sound/soc/codecs/tas2552.c             |  7 ++++--
>  sound/soc/codecs/tas2562.c             |  7 ++++--
>  sound/soc/codecs/tas2770.c             |  7 ++++--
>  sound/soc/codecs/tas571x.c             |  7 ++++--
>  sound/soc/codecs/tas5720.c             |  7 ++++--
>  sound/soc/codecs/tas6424.c             |  7 ++++--
>  sound/soc/codecs/tfa9879.c             |  7 ++++--
>  sound/soc/codecs/tlv320aic23.c         |  7 ++++--
>  sound/soc/codecs/tlv320aic26.c         |  7 ++++--
>  sound/soc/codecs/tlv320aic31xx.c       |  8 ++++--
>  sound/soc/codecs/tlv320aic32x4.c       |  7 ++++--
>  sound/soc/codecs/tlv320aic3x.c         |  7 ++++--
>  sound/soc/codecs/twl6040.c             |  7 ++++--
>  sound/soc/codecs/uda134x.c             |  7 ++++--
>  sound/soc/codecs/wm8350.c              |  7 ++++--
>  sound/soc/codecs/wm8400.c              |  7 ++++--
>  sound/soc/codecs/wm8510.c              |  7 ++++--
>  sound/soc/codecs/wm8580.c              |  7 ++++--
>  sound/soc/codecs/wm8711.c              |  7 ++++--
>  sound/soc/codecs/wm8728.c              |  7 ++++--
>  sound/soc/codecs/wm8731.c              |  7 ++++--
>  sound/soc/codecs/wm8741.c              |  7 ++++--
>  sound/soc/codecs/wm8750.c              |  7 ++++--
>  sound/soc/codecs/wm8753.c              |  9 ++++---
>  sound/soc/codecs/wm8770.c              |  7 ++++--
>  sound/soc/codecs/wm8776.c              |  7 ++++--
>  sound/soc/codecs/wm8900.c              |  7 ++++--
>  sound/soc/codecs/wm8903.c              |  7 ++++--
>  sound/soc/codecs/wm8904.c              |  7 ++++--
>  sound/soc/codecs/wm8940.c              |  7 ++++--
>  sound/soc/codecs/wm8955.c              |  7 ++++--
>  sound/soc/codecs/wm8960.c              |  7 ++++--
>  sound/soc/codecs/wm8961.c              |  7 ++++--
>  sound/soc/codecs/wm8962.c              |  7 ++++--
>  sound/soc/codecs/wm8971.c              |  7 ++++--
>  sound/soc/codecs/wm8974.c              |  7 ++++--
>  sound/soc/codecs/wm8978.c              |  7 ++++--
>  sound/soc/codecs/wm8983.c              |  7 ++++--
>  sound/soc/codecs/wm8985.c              |  7 ++++--
>  sound/soc/codecs/wm8988.c              |  7 ++++--
>  sound/soc/codecs/wm8990.c              |  7 ++++--
>  sound/soc/codecs/wm8991.c              |  7 ++++--
>  sound/soc/codecs/wm8993.c              |  7 ++++--
>  sound/soc/codecs/wm8994.c              | 10 +++++---
>  sound/soc/codecs/wm8995.c              |  9 ++++---
>  sound/soc/codecs/wm9081.c              |  7 ++++--
>  sound/soc/meson/axg-spdifout.c         |  7 ++++--
>  sound/soc/soc-core.c                   |  4 +--
>  sound/soc/soc-dai.c                    |  4 ---
>  sound/soc/spear/spdif_out.c            | 10 +++++---
>  sound/soc/ti/ams-delta.c               | 11 +++++---
>  105 files changed, 576 insertions(+), 243 deletions(-)
> 


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 13/19] ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:20 ` [PATCH 13/19] ASoC: codecs: wm*: " Kuninori Morimoto
@ 2020-06-23 10:29   ` Charles Keepax
  0 siblings, 0 replies; 26+ messages in thread
From: Charles Keepax @ 2020-06-23 10:29 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Philipp Zabel, Jonas Karlman, Liam Girdwood, Nicolas Ferre,
	Chuhong Yuan, Robin Murphy, James Schulman, Inki Dae,
	Masahiro Yamada, Mark Brown, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

On Tue, Jun 23, 2020 at 10:20:43AM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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);
> 		...
> 	}
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 05/19] ASoC: atmel: merge .digital_mute() into .mute_stream()
  2020-06-23  1:19 ` [PATCH 05/19] ASoC: atmel: " Kuninori Morimoto
@ 2020-06-23 11:29   ` Alexandre Belloni
  0 siblings, 0 replies; 26+ messages in thread
From: Alexandre Belloni @ 2020-06-23 11:29 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi, Paul Cercueil,
	Andrzej Hajda, Frank Shi, Laurent Pinchart, Benjamin Gaignard,
	Andrew F. Davis, Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Mark Brown, Christophe JAILLET,
	Dan Murphy, Matthias Brugger, "Nuno Sá",
	Vincent Abriou, Peter Ujfalusi, Jernej Skrabec,
	Support Opensource, Marek Szyprowski, Jason Yan, Stephen Boyd,
	Pankaj Bharadiya, David Rhodes, Seung-Woo Kim, Sandy Huang,
	Pavel Dobias, Philipp Puschmann, Kyungmin Park,
	Vishwas A Deshpande, Daniel Vetter, Colin Ian King,
	Kevin Cernekee, Lucas Stach, Shawn Guo, Peter Rosin,
	M R Swami Reddy

On 23/06/2020 10:19:56+0900, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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);
> 		...
> 	}
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  sound/soc/atmel/atmel-classd.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
> index e98601eccfa3..59231c0371b8 100644
> --- a/sound/soc/atmel/atmel-classd.c
> +++ b/sound/soc/atmel/atmel-classd.c
> @@ -327,12 +327,16 @@ static int atmel_classd_codec_dai_startup(struct snd_pcm_substream *substream,
>  	return clk_prepare_enable(dd->gclk);
>  }
>  
> -static int atmel_classd_codec_dai_digital_mute(struct snd_soc_dai *codec_dai,
> -	int mute)
> +static int atmel_classd_codec_dai_mute(struct snd_soc_dai *codec_dai,
> +				       int mute,
> +				       int direction)
>  {
>  	struct snd_soc_component *component = codec_dai->component;
>  	u32 mask, val;
>  
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +
>  	mask = CLASSD_MR_LMUTE_MASK | CLASSD_MR_RMUTE_MASK;
>  
>  	if (mute)
> @@ -469,7 +473,7 @@ static int atmel_classd_codec_dai_trigger(struct snd_pcm_substream *substream,
>  }
>  
>  static const struct snd_soc_dai_ops atmel_classd_codec_dai_ops = {
> -	.digital_mute	= atmel_classd_codec_dai_digital_mute,
> +	.mute_stream	= atmel_classd_codec_dai_mute,
>  	.startup	= atmel_classd_codec_dai_startup,
>  	.shutdown	= atmel_classd_codec_dai_shutdown,
>  	.hw_params	= atmel_classd_codec_dai_hw_params,
> -- 
> 2.25.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 26+ messages in thread

* RE: [PATCH 15/19] ASoC: codecs: da*: merge .digital_mute() into .mute_stream()
  2020-06-23  1:20 ` [PATCH 15/19] ASoC: codecs: da*: " Kuninori Morimoto
@ 2020-06-23 15:16   ` Adam Thomson
  0 siblings, 0 replies; 26+ messages in thread
From: Adam Thomson @ 2020-06-23 15:16 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle,
	"Heiko Stübner", Neil Armstrong, David Airlie,
	"Michał Mirosław", Jonghwan Choi,
	Alexandre Belloni, Paul Cercueil, Andrzej Hajda, Frank Shi,
	Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, "Nuno Sá", Vincent Abriou,
	Peter Ujfalusi, Jernej Skrabec, Support Opensource,
	Marek Szyprowski, Jason Yan, Stephen Boyd, Pankaj Bharadiya,
	David Rhodes, Seung-Woo Kim, Sandy Huang, Pavel Dobias,
	Philipp Puschmann, Kyungmin Park, Vishwas A Deshpande,
	Daniel Vetter, Colin Ian King, Kevin Cernekee, Lucas Stach,
	Shawn Guo, Peter Rosin, M R Swami Reddy

On 23 June 2020 02:21, Kuninori Morimoto wrote:

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 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);
> 		...
> 	}
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> ---
>  sound/soc/codecs/da7210.c | 7 +++++--
>  sound/soc/codecs/da7213.c | 7 +++++--
>  sound/soc/codecs/da9055.c | 7 +++++--
>  3 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
> index 0c99dcf242e4..8e5e5cd4bcbe 100644
> --- a/sound/soc/codecs/da7210.c
> +++ b/sound/soc/codecs/da7210.c
> @@ -924,11 +924,14 @@ static int da7210_set_dai_fmt(struct snd_soc_dai
> *codec_dai, u32 fmt)
>  	return 0;
>  }
> 
> -static int da7210_mute(struct snd_soc_dai *dai, int mute)
> +static int da7210_mute(struct snd_soc_dai *dai, int mute, int direction)
>  {
>  	struct snd_soc_component *component = dai->component;
>  	u8 mute_reg = snd_soc_component_read(component,
> DA7210_DAC_HPF) & 0xFB;
> 
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +
>  	if (mute)
>  		snd_soc_component_write(component, DA7210_DAC_HPF,
> mute_reg | 0x4);
>  	else
> @@ -1034,7 +1037,7 @@ static const struct snd_soc_dai_ops da7210_dai_ops = {
>  	.set_fmt	= da7210_set_dai_fmt,
>  	.set_sysclk	= da7210_set_dai_sysclk,
>  	.set_pll	= da7210_set_dai_pll,
> -	.digital_mute	= da7210_mute,
> +	.mute_stream	= da7210_mute,
>  };
> 
>  static struct snd_soc_dai_driver da7210_dai = {
> diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
> index cc4ae7b311b4..55f8097112e1 100644
> --- a/sound/soc/codecs/da7213.c
> +++ b/sound/soc/codecs/da7213.c
> @@ -1321,10 +1321,13 @@ static int da7213_set_dai_fmt(struct snd_soc_dai
> *codec_dai, unsigned int fmt)
>  	return 0;
>  }
> 
> -static int da7213_mute(struct snd_soc_dai *dai, int mute)
> +static int da7213_mute(struct snd_soc_dai *dai, int mute, int direction)
>  {
>  	struct snd_soc_component *component = dai->component;
> 
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +
>  	if (mute) {
>  		snd_soc_component_update_bits(component,
> DA7213_DAC_L_CTRL,
>  				    DA7213_MUTE_EN, DA7213_MUTE_EN);
> @@ -1507,7 +1510,7 @@ static int da7213_set_component_pll(struct
> snd_soc_component *component,
>  static const struct snd_soc_dai_ops da7213_dai_ops = {
>  	.hw_params	= da7213_hw_params,
>  	.set_fmt	= da7213_set_dai_fmt,
> -	.digital_mute	= da7213_mute,
> +	.mute_stream	= da7213_mute,
>  };
> 
>  static struct snd_soc_dai_driver da7213_dai = {
> diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
> index e93436ccb674..e388b1c0ba19 100644
> --- a/sound/soc/codecs/da9055.c
> +++ b/sound/soc/codecs/da9055.c
> @@ -1211,10 +1211,13 @@ static int da9055_set_dai_fmt(struct snd_soc_dai
> *codec_dai, unsigned int fmt)
>  	return 0;
>  }
> 
> -static int da9055_mute(struct snd_soc_dai *dai, int mute)
> +static int da9055_mute(struct snd_soc_dai *dai, int mute, int direction)
>  {
>  	struct snd_soc_component *component = dai->component;
> 
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +
>  	if (mute) {
>  		snd_soc_component_update_bits(component,
> DA9055_DAC_L_CTRL,
>  				    DA9055_DAC_L_MUTE_EN,
> DA9055_DAC_L_MUTE_EN);
> @@ -1324,7 +1327,7 @@ static const struct snd_soc_dai_ops da9055_dai_ops = {
>  	.set_fmt	= da9055_set_dai_fmt,
>  	.set_sysclk	= da9055_set_dai_sysclk,
>  	.set_pll	= da9055_set_dai_pll,
> -	.digital_mute	= da9055_mute,
> +	.mute_stream	= da9055_mute,
>  };
> 
>  static struct snd_soc_dai_driver da9055_dai = {
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 01/19] ASoC: hdmi-codec: merge .digital_mute() into .mute_stream()
  2020-06-23  1:19 ` [PATCH 01/19] ASoC: hdmi-codec: " Kuninori Morimoto
@ 2020-06-23 15:18   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 26+ messages in thread
From: Pierre-Louis Bossart @ 2020-06-23 15:18 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle, Heiko Stübner,
	Neil Armstrong, David Airlie, Michał Mirosław,
	Jonghwan Choi, Alexandre Belloni, Paul Cercueil, Andrzej Hajda,
	Frank Shi, Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko, Kai Vehmanen,
	Lars-Peter Clausen, Joonyoung Shim, Matthias Reichl,
	Katsuhiro Suzuki, Kevin Hilman, Masahiro Yamada, Takashi Iwai,
	YueHaibing, Russell King, Krzysztof Kozlowski, Daniel Drake,
	Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim, Ranjani Sridharan,
	Dinghao Liu, Codrin Ciubotariu, Cheng-Yi Chiang, Chun-Kuang Hu,
	Bartosz Golaszewski, Charles Keepax, Philipp Zabel, Jonas Karlman,
	Liam Girdwood, Nicolas Ferre, Chuhong Yuan, Robin Murphy,
	James Schulman, Inki Dae, Christophe JAILLET, Dan Murphy,
	Matthias Brugger, Nuno Sá, Vincent Abriou, Peter Ujfalusi,
	Jernej Skrabec, Support Opensource, Marek Szyprowski, Jason Yan,
	Stephen Boyd, Pankaj Bharadiya, David Rhodes, Seung-Woo Kim,
	Sandy Huang, Pavel Dobias, Philipp Puschmann, Kyungmin Park,
	Vishwas A Deshpande, Daniel Vetter, Colin Ian King,
	Kevin Cernekee, Lucas Stach, Shawn Guo, Peter Rosin,
	M R Swami Reddy


> -static int sii902x_audio_digital_mute(struct device *dev,
> -				      void *data, bool enable)
> +static int sii902x_audio_mute(struct device *dev, void *data,
> +			      bool enable, int direction)
>   {
>   	struct sii902x *sii902x = dev_get_drvdata(dev);
>   
> +	if (direction != SNDRV_PCM_STREAM_PLAYBACK)
> +		return 0;
> +

Thanks for this clean-up Morimoto-san.

One question: in all the codec changes the return is now 0.

But in the previous implementation based on digital_mute, when the wrong 
direction was used it would have been -ENOTSUPP.

int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
			     int direction)
{
	int ret = -ENOTSUPP;

	if (dai->driver->ops &&
	    dai->driver->ops->mute_stream)
		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);

<<< none of the branches taken for capture + digital_mute supported, so 
return -ENOTSUPP.

	return soc_dai_ret(dai, ret);
}

Was this change intentional?

We also want to check why this return value is only tested in 
soc-dapm.c, if this digital_mute can fail then we are missing tests left 
and right - maybe that's a follow-up change?


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 18/19] ASoC: soc-dai: remove .digital_mute
  2020-06-23  1:21 ` [PATCH 18/19] ASoC: soc-dai: remove .digital_mute Kuninori Morimoto
@ 2020-06-23 15:31   ` Dan Murphy
  0 siblings, 0 replies; 26+ messages in thread
From: Dan Murphy @ 2020-06-23 15:31 UTC (permalink / raw)
  To: Kuninori Morimoto, Mark Brown
  Cc: Shengjiu Wang, Linux-ALSA, Michael Walle, Heiko Stübner,
	Neil Armstrong, David Airlie, Michał Mirosław,
	Jonghwan Choi, Alexandre Belloni, Paul Cercueil, Andrzej Hajda,
	Frank Shi, Laurent Pinchart, Benjamin Gaignard, Andrew F. Davis,
	Fabio Estevam, Jerome Brunet, Nikita Yushchenko,
	Pierre-Louis Bossart, Lars-Peter Clausen, Joonyoung Shim,
	Matthias Reichl, Katsuhiro Suzuki, Kevin Hilman, Kai Vehmanen,
	Takashi Iwai, YueHaibing, Russell King, Krzysztof Kozlowski,
	Daniel Drake, Tzung-Bi Shih, Ludovic Desroches, Kukjin Kim,
	Ranjani Sridharan, Dinghao Liu, Codrin Ciubotariu,
	Cheng-Yi Chiang, Chun-Kuang Hu, Bartosz Golaszewski,
	Charles Keepax, Philipp Zabel, Jonas Karlman, Liam Girdwood,
	Nicolas Ferre, Chuhong Yuan, Robin Murphy, James Schulman,
	Inki Dae, Masahiro Yamada, Christophe JAILLET, Matthias Brugger,
	Nuno Sá, Vincent Abriou, Peter Ujfalusi, Jernej Skrabec,
	Support Opensource, Marek Szyprowski, Jason Yan, Stephen Boyd,
	Pankaj Bharadiya, David Rhodes, Seung-Woo Kim, Sandy Huang,
	Pavel Dobias, Philipp Puschmann, Kyungmin Park, Daniel Vetter,
	Colin Ian King, Kevin Cernekee, Shawn Guo, Peter Rosin,
	Lucas Stach

Kuninori

On 6/22/20 8:21 PM, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> All drivers are now using .mute_stream.
> Let's remove .digital_mute.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   include/sound/soc-dai.h | 1 -
>   sound/soc/soc-dai.c     | 4 ----
>   2 files changed, 5 deletions(-)
>
> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
> index 212257e84fac..a3db208cd062 100644
> --- a/include/sound/soc-dai.h
> +++ b/include/sound/soc-dai.h
> @@ -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);
>   
>   	/*
> diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
> index b05e18b63a1c..b0fc3d8b1798 100644
> --- a/sound/soc/soc-dai.c
> +++ b/sound/soc/soc-dai.c
> @@ -301,10 +301,6 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
>   	if (dai->driver->ops &&
>   	    dai->driver->ops->mute_stream)
>   		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);

Instead of putting the direction check in every codec driver can't the 
check just part of the function? And then maybe a flag in dai_ops to 
override that call to mute?

if (direction != SNDRV_PCM_STREAM_PLAYBACK)
         return 0;

I did not look at every codec driver as there are too many.

Dan



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2020-06-24  8:09 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-23  1:16 [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Kuninori Morimoto
2020-06-23  1:19 ` [PATCH 01/19] ASoC: hdmi-codec: " Kuninori Morimoto
2020-06-23 15:18   ` Pierre-Louis Bossart
2020-06-23  1:19 ` [PATCH 02/19] ASoC: ti: " Kuninori Morimoto
2020-06-23  1:19 ` [PATCH 03/19] ASoC: spear: " Kuninori Morimoto
2020-06-23  1:19 ` [PATCH 04/19] ASoC: meson: " Kuninori Morimoto
2020-06-23  1:19 ` [PATCH 05/19] ASoC: atmel: " Kuninori Morimoto
2020-06-23 11:29   ` Alexandre Belloni
2020-06-23  1:20 ` [PATCH 06/19] ASoC: codecs: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 07/19] ASoC: codecs: tlv*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 08/19] ASoC: codecs: tas*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 09/19] ASoC: codecs: ssm*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 10/19] ASoC: codecs: pcm*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 11/19] ASoC: codecs: max*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 12/19] ASoC: codecs: alc*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 13/19] ASoC: codecs: wm*: " Kuninori Morimoto
2020-06-23 10:29   ` Charles Keepax
2020-06-23  1:20 ` [PATCH 14/19] ASoC: codecs: es*: " Kuninori Morimoto
2020-06-23  1:20 ` [PATCH 15/19] ASoC: codecs: da*: " Kuninori Morimoto
2020-06-23 15:16   ` Adam Thomson
2020-06-23  1:20 ` [PATCH 16/19] ASoC: codecs: cs*: " Kuninori Morimoto
2020-06-23  1:21 ` [PATCH 17/19] ASoC: codecs: ak*: " Kuninori Morimoto
2020-06-23  1:21 ` [PATCH 18/19] ASoC: soc-dai: remove .digital_mute Kuninori Morimoto
2020-06-23 15:31   ` Dan Murphy
2020-06-23  1:21 ` [PATCH 19/19] ASoC: soc-core: snd_soc_dai_digital_mute() for both CPU/Codec Kuninori Morimoto
2020-06-23  9:34 ` [PATCH 00/19] ASoC: merge .digital_mute() into .mute_stream() Peter Ujfalusi

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.