Skip to content

Commit

Permalink
ASoC: codecs: wm*: merge .digital_mute() into .mute_stream()
Browse files Browse the repository at this point in the history
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: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/87v9ixwiwr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Jul 16, 2020
1 parent 4c66c2f commit 26d3c16
Show file tree
Hide file tree
Showing 32 changed files with 106 additions and 70 deletions.
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8350.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8400.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
};

/*
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8510.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8580.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8711.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8728.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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);
Expand Down Expand Up @@ -192,8 +192,9 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8728_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8731.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ 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;
Expand Down Expand Up @@ -546,9 +546,10 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8731_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8741.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ 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;

Expand All @@ -386,7 +386,8 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8741_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8750.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ 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;
Expand Down Expand Up @@ -660,9 +660,10 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8750_dai = {
Expand Down
8 changes: 5 additions & 3 deletions sound/soc/codecs/wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ 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;
Expand Down Expand Up @@ -1382,20 +1382,22 @@ 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,
.set_sysclk = wm8753_set_dai_sysclk,
.no_capture_mute = 1,
};

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,
.set_sysclk = wm8753_set_dai_sysclk,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8753_dai[] = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8770.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ 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;

Expand Down Expand Up @@ -538,10 +538,11 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8770_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8776.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ 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;

Expand Down Expand Up @@ -361,10 +361,11 @@ 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,
.no_capture_mute = 1,
};

static const struct snd_soc_dai_ops wm8776_adc_ops = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8900.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ 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;
Expand Down Expand Up @@ -997,7 +997,8 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8900_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ 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;
Expand Down Expand Up @@ -1737,9 +1737,10 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8903_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8904.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ 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;
Expand Down Expand Up @@ -1962,7 +1962,8 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8904_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8940.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ 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;
Expand Down Expand Up @@ -664,10 +664,11 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8940_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8955.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ 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;
Expand Down Expand Up @@ -848,7 +848,8 @@ 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,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8955_dai = {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/codecs/wm8960.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ 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;

Expand Down Expand Up @@ -1315,11 +1315,12 @@ 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,
.set_sysclk = wm8960_set_dai_sysclk,
.no_capture_mute = 1,
};

static struct snd_soc_dai_driver wm8960_dai = {
Expand Down
Loading

0 comments on commit 26d3c16

Please sign in to comment.