All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: "Shengjiu Wang" <shengjiu.wang@nxp.com>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	"Michael Walle" <michael@walle.cc>,
	"\"Heiko Stübner\"" <heiko@sntech.de>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"David Airlie" <airlied@linux.ie>,
	"\"Michał Mirosław\"" <mirq-linux@rere.qmqm.pl>,
	"Jonghwan Choi" <charlie.jh@kakaocorp.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Frank Shi" <shifu0704@thundersoft.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	"Andrew F. Davis" <afd@ti.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Nikita Yushchenko" <nikita.yoush@cogentembedded.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Joonyoung Shim" <jy0922.shim@samsung.com>,
	"Matthias Reichl" <hias@horus.com>,
	"Katsuhiro Suzuki" <katsuhiro@katsuster.net>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	"Takashi Iwai" <tiwai@suse.com>,
	YueHaibing <yuehaibing@huawei.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Daniel Drake" <drake@endlessm.com>,
	"Tzung-Bi Shih" <tzungbi@google.com>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	"Dinghao Liu" <dinghao.liu@zju.edu.cn>,
	"Codrin Ciubotariu" <codrin.ciubotariu@microchip.com>,
	"Cheng-Yi Chiang" <cychiang@chromium.org>,
	"Chun-Kuang Hu" <chunkuang.hu@kernel.org>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	"Charles Keepax" <ckeepax@opensource.cirrus.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Chuhong Yuan" <hslester96@gmail.com>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"James Schulman" <james.schulman@cirrus.com>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Dan Murphy" <dmurphy@ti.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"\"Nuno Sá\"" <nuno.sa@analog.com>,
	"Vincent Abriou" <vincent.abriou@st.com>,
	"Peter Ujfalusi" <peter.ujfalusi@ti.com>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Support Opensource" <support.opensource@diasemi.com>,
	"Marek Szyprowski" <m.szyprowski@samsung.com>,
	"Jason Yan" <yanaijie@huawei.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Pankaj Bharadiya" <pankaj.laxminarayan.bharadiya@intel.com>,
	"David Rhodes" <david.rhodes@cirrus.com>,
	"Seung-Woo Kim" <sw0312.kim@samsung.com>,
	"Sandy Huang" <hjc@rock-chips.com>, "Pavel Dobias" <dobias@2n.cz>,
	"Philipp Puschmann" <p.puschmann@pironex.de>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Vishwas A Deshpande" <vishwas.a.deshpande@ti.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Colin Ian King" <colin.king@canonical.com>,
	"Kevin Cernekee" <cernekee@chromium.org>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Peter Rosin" <peda@axentia.se>,
	"M R Swami Reddy" <mr.swami.reddy@ti.com>
Subject: [PATCH 07/19] ASoC: codecs: tlv*: merge .digital_mute() into .mute_stream()
Date: 23 Jun 2020 10:20:08 +0900	[thread overview]
Message-ID: <875zbi37ee.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87ftam37ko.wl-kuninori.morimoto.gx@renesas.com>

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


  parent reply	other threads:[~2020-06-24  7:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Kuninori Morimoto [this message]
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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=875zbi37ee.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=afd@ti.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=cernekee@chromium.org \
    --cc=charlie.jh@kakaocorp.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=chunkuang.hu@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=colin.king@canonical.com \
    --cc=cychiang@chromium.org \
    --cc=daniel@ffwll.ch \
    --cc=david.rhodes@cirrus.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=dmurphy@ti.com \
    --cc=dobias@2n.cz \
    --cc=drake@endlessm.com \
    --cc=festevam@gmail.com \
    --cc=heiko@sntech.de \
    --cc=hias@horus.com \
    --cc=hjc@rock-chips.com \
    --cc=hslester96@gmail.com \
    --cc=inki.dae@samsung.com \
    --cc=james.schulman@cirrus.com \
    --cc=jbrunet@baylibre.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=jy0922.shim@samsung.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=katsuhiro@katsuster.net \
    --cc=kgene@kernel.org \
    --cc=khilman@baylibre.com \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=l.stach@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=ludovic.desroches@microchip.com \
    --cc=m.szyprowski@samsung.com \
    --cc=masahiroy@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=michael@walle.cc \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=mr.swami.reddy@ti.com \
    --cc=narmstrong@baylibre.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=nuno.sa@analog.com \
    --cc=p.puschmann@pironex.de \
    --cc=p.zabel@pengutronix.de \
    --cc=pankaj.laxminarayan.bharadiya@intel.com \
    --cc=paul@crapouillou.net \
    --cc=peda@axentia.se \
    --cc=peter.ujfalusi@ti.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=robin.murphy@arm.com \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@nxp.com \
    --cc=shifu0704@thundersoft.com \
    --cc=support.opensource@diasemi.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tiwai@suse.com \
    --cc=tzungbi@google.com \
    --cc=vincent.abriou@st.com \
    --cc=vishwas.a.deshpande@ti.com \
    --cc=yanaijie@huawei.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

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

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