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 15/19] ASoC: codecs: da*: merge .digital_mute() into .mute_stream()
Date: 23 Jun 2020 10:20:54 +0900	[thread overview]
Message-ID: <87tuz21sso.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/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


  parent reply	other threads:[~2020-06-24  8:03 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 ` [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 ` Kuninori Morimoto [this message]
2020-06-23 15:16   ` [PATCH 15/19] ASoC: codecs: da*: " 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=87tuz21sso.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.