Unverified Commit 26d3c16e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()



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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/87v9ixwiwr.wl-kuninori.morimoto.gx@renesas.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4c66c2fc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -942,7 +942,7 @@ 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;
@@ -1426,11 +1426,12 @@ 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,
	 .set_clkdiv	= wm8350_set_clkdiv,
	 .no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8350_dai = {
+3 −2
Original line number Diff line number Diff line
@@ -1092,7 +1092,7 @@ 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;
@@ -1222,11 +1222,12 @@ 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,
	.set_pll = wm8400_set_dai_pll,
	.no_capture_mute = 1,
};

/*
+3 −2
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ 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;
@@ -547,10 +547,11 @@ 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,
	.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8510_dai = {
+3 −2
Original line number Diff line number Diff line
@@ -800,7 +800,7 @@ 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;
@@ -866,7 +866,8 @@ 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,
	.no_capture_mute = 1,
};

static const struct snd_soc_dai_ops wm8580_dai_ops_capture = {
+3 −2
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ 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;
@@ -329,9 +329,10 @@ 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,
	.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8711_dai = {
Loading