Skip to contentSkip to conversation

ASoC: wm8741: Add digital mute callback

PATCH In review Sergej Sawazki 3 participants 4 messages Oct 30, 2017 – Oct 31, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: wm8741: Add digital mute callback

---
Changes in v2:
* Refactored debug message.

 sound/soc/codecs/wm8741.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/soc/codecs/wm8741.c +12 -0
index b8c1940..5571882 100644
@@ -351,6 +351,17 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+int wm8741_mute(struct snd_soc_dai *codec_dai, int mute)
+{
+	struct snd_soc_codec *codec = codec_dai->codec;
+
+	dev_dbg(codec->dev, "wm8741_mute:    mute = %d\n", mute);
+
+	snd_soc_update_bits(codec, WM8741_VOLUME_CONTROL,
+			WM8741_SOFT_MASK, !!mute << WM8741_SOFT_SHIFT);
+	return 0;
+}
+
 #define WM8741_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
 			SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | \
 			SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | \
@@ -364,6 +375,7 @@ 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,
 };
 
 static struct snd_soc_dai_driver wm8741_dai = {
Signature · 1 line
2.7.4
#1 lore raw
Quoted 13 lines · Sergej Sawazki

---
Changes in v2:
* Refactored debug message.

 sound/soc/codecs/wm8741.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/soc/codecs/wm8741.c +0 -0
index b8c1940..5571882 100644

sound/soc/codecs/wm8741.c static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, · line 358

Quoted 8 lines
sound/soc/codecs/wm8741.c +5 -0
@@ -351,6 +351,17 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+int wm8741_mute(struct snd_soc_dai *codec_dai, int mute)
+{
+	struct snd_soc_codec *codec = codec_dai->codec;
+
+	dev_dbg(codec->dev, "wm8741_mute:    mute = %d\n", mute);

It is still not really normal style to include the function name in the debug messages. How about just "digital mute = %d\n" or something like that?

Thanks,
Charles

maintainer
#2 lore raw
Quoted 7 lines · Charles Keepax

sound/soc/codecs/wm8741.c static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, · line 358

Quoted 1 line · Sergej Sawazki
sound/soc/codecs/wm8741.c +1 -0
+	dev_dbg(codec->dev, "wm8741_mute:    mute = %d\n", mute);

It is still not really normal style to include the function name in the debug messages. How about just "digital mute = %d\n" or something like that?

Or just don't log anything and rely on framework level diagnostics if they're needed.

#3 lore raw
In reply to Charles Keepax

Am 30.10.2017 um 16:41 schrieb Charles Keepax:

Quoted 17 lines · Sergej Sawazki
Quoted 16 lines

---
Changes in v2:
* Refactored debug message.

  sound/soc/codecs/wm8741.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
sound/soc/codecs/wm8741.c +0 -0
index b8c1940..5571882 100644
@@ -351,6 +351,17 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
  	return 0;
  }
 
Quoted 10 lines

sound/soc/codecs/wm8741.c static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, · line 358

Quoted 5 lines
sound/soc/codecs/wm8741.c +5 -0
+int wm8741_mute(struct snd_soc_dai *codec_dai, int mute)
+{
+	struct snd_soc_codec *codec = codec_dai->codec;
+
+	dev_dbg(codec->dev, "wm8741_mute:    mute = %d\n", mute);

It is still not really normal style to include the function name in the debug messages. How about just "digital mute = %d\n" or something like that?

Maybe not really normal, but CONSISTENT. That's the style used throughout the entire file. And it makes the log look consistent.