Commit 54b59270 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: codecs: 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>
Link: https://lore.kernel.org/r/875zaxxxi4.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f795ff78
......@@ -902,7 +902,7 @@ 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_stream(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;
......@@ -1136,17 +1136,19 @@ 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_stream,
.hw_params = pm860x_pcm_hw_params,
.set_fmt = pm860x_pcm_set_dai_fmt,
.set_sysclk = pm860x_set_dai_sysclk,
.no_capture_mute = 1,
};
static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = {
.digital_mute = pm860x_digital_mute,
.mute_stream = pm860x_mute_stream,
.hw_params = pm860x_i2s_hw_params,
.set_fmt = pm860x_i2s_set_dai_fmt,
.set_sysclk = pm860x_set_dai_sysclk,
.no_capture_mute = 1,
};
#define PM860X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | \
......
......@@ -143,7 +143,7 @@ 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);
......@@ -371,10 +371,11 @@ 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,
.no_capture_mute = 1,
};
/* codec DAI instance */
......
......@@ -573,7 +573,7 @@ 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_stream(struct snd_soc_dai *dai, int mute, int direction)
{
struct snd_soc_component *component = dai->component;
unsigned int mask = ADAU1701_DSPCTRL_DAM;
......@@ -631,8 +631,9 @@ 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_stream,
.startup = adau1701_startup,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver adau1701_dai = {
......
......@@ -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);
......@@ -1237,7 +1237,8 @@ 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,
.no_capture_mute = 1,
};
static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
......@@ -1370,7 +1371,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);
......@@ -1391,7 +1393,8 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver cpcap_dai[] = {
......
......@@ -30,7 +30,7 @@ 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;
......@@ -87,8 +87,9 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver cq93vc_dai = {
......
......@@ -860,7 +860,7 @@ 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)
{
snd_soc_component_update_bits(dai->component, ISABELLE_DAC1_SOFTRAMP_REG,
BIT(4), (mute ? BIT(4) : 0));
......@@ -868,7 +868,7 @@ static int isabelle_hs_mute(struct snd_soc_dai *dai, int mute)
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)
{
snd_soc_component_update_bits(dai->component, ISABELLE_DAC2_SOFTRAMP_REG,
BIT(4), (mute ? BIT(4) : 0));
......@@ -876,7 +876,7 @@ static int isabelle_hf_mute(struct snd_soc_dai *dai, int mute)
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)
{
snd_soc_component_update_bits(dai->component, ISABELLE_DAC3_SOFTRAMP_REG,
BIT(4), (mute ? BIT(4) : 0));
......@@ -1014,19 +1014,22 @@ 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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
static const struct snd_soc_dai_ops isabelle_ul_dai_ops = {
......
......@@ -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_stream(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);
......@@ -752,7 +752,8 @@ 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_stream,
.no_capture_mute = 1,
};
#define JZ_CODEC_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
......
......@@ -1218,35 +1218,35 @@ 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)
{
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)
{
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)
{
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)
{
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)
{
snd_soc_component_update_bits(dai->component, LM49453_P0_DAC_DSP_REG, BIT(7)|BIT(6),
(mute ? (BIT(7)|BIT(6)) : 0));
......@@ -1288,35 +1288,40 @@ 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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
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,
.no_capture_mute = 1,
};
/* LM49453 dai structure. */
......
......@@ -372,7 +372,7 @@ 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);
......@@ -492,9 +492,10 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver ml26124_dai = {
......
......@@ -900,7 +900,7 @@ 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;
......@@ -967,10 +967,11 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver nau8822_dai = {
......
......@@ -107,7 +107,7 @@ 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_stream(struct snd_soc_dai *dai, int mute, int direction)
{
struct rk3328_codec_priv *rk3328 =
snd_soc_component_get_drvdata(dai->component);
......@@ -316,9 +316,10 @@ 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_stream,
.startup = rk3328_pcm_startup,
.shutdown = rk3328_pcm_shutdown,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver rk3328_dai[] = {
......
......@@ -775,7 +775,7 @@ 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_stream(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;
......@@ -1160,9 +1160,10 @@ 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_stream,
.set_fmt = sgtl5000_set_dai_fmt,
.set_sysclk = sgtl5000_set_dai_sysclk,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver sgtl5000_dai = {
......
......@@ -251,7 +251,7 @@ 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;
......@@ -291,7 +291,8 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver sta529_dai = {
......
......@@ -93,7 +93,7 @@ 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_stream(struct snd_soc_dai *dai, int mute, int direction)
{
struct snd_soc_component *component = dai->component;
......@@ -251,8 +251,9 @@ 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_stream,
.set_fmt = tfa9879_set_fmt,
.no_capture_mute = 1,
};
#define TFA9879_RATES SNDRV_PCM_RATE_8000_96000
......
......@@ -997,7 +997,7 @@ 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_stream(struct snd_soc_dai *dai, int mute, int direction)
{
switch (dai->id) {
case TWL6040_DAI_LEGACY:
......@@ -1020,7 +1020,8 @@ 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_stream,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver twl6040_dai[] = {
......
......@@ -117,7 +117,7 @@ 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;
......@@ -416,9 +416,10 @@ 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,
.no_capture_mute = 1,
};
static struct snd_soc_dai_driver uda134x_dai = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment