Skip to contentSkip to conversation

Tidy up ASoC VALUE control macros

PATCH Superseded Charles Keepax 3 participants 18 messages Mar 3, 2025 – Mar 4, 2025

Subsystems (12)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Tidy up ASoC VALUE control macros

Tidy up the ASoC control value macros. Fix some drivers that should be using core macros that aren't, combine the existing core macros to be a little more consistent in style, and update the core macros to use each other where possible.

Changes since v1:
- Add the missing first patch that I managed to forget in v1. This was stopping the series applying, as it was only in my tree.

Thanks,
Charles

Charles Keepax (13):
ASoC: Remove unused helper macro
ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() helper macro
ASoC: sma1307: Use SOC_SINGLE_EXT() helper macro
ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() helper macro
ASoC: wcd938x: Use SOC_SINGLE_EXT_TLV() helper macro
ASoC: wm9712: Use SOC_SINGLE_EXT() helper macro
ASoC: wm9713: Use SOC_DOUBLE_EXT() helper macro
ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() helper macro
ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() helper macro
ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper
ASoC: dapm: Use ASoC control macros where possible
ASoC: Tidy up SOC_DOUBLE_R_* helpers
ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers

 include/sound/soc-dapm.h         | 59 ++++++++------------
 include/sound/soc.h              | 96 +++++++++++---------------------
 sound/soc/atmel/tse850-pcm5142.c | 11 +---
 sound/soc/codecs/adau17x1.c      | 10 ++--
 sound/soc/codecs/jz4760.c        | 32 ++---------
 sound/soc/codecs/jz4770.c        | 40 ++-----------
 sound/soc/codecs/rt715-sdca.c    |  8 ---
 sound/soc/codecs/rt715.c         |  8 ---
 sound/soc/codecs/sma1307.c       | 11 +---
 sound/soc/codecs/tas2562.c       | 14 +----
 sound/soc/codecs/wcd938x.c       |  9 +--
 sound/soc/codecs/wm9712.c        | 10 +---
 sound/soc/codecs/wm9713.c        | 10 +---
 sound/soc/codecs/wsa881x.c       |  9 +--
 14 files changed, 92 insertions(+), 235 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/13 ASoC: Remove unused helper macro

SOC_SINGLE_VALUE_EXT() has no users, so remove it.

---

New since v1.

 include/sound/soc.h | 3 ---
 1 file changed, 3 deletions(-)
include/sound/soc.h +0 -3
index 6bb2fca044c5e..01151a6ada350 100644
@@ -51,9 +51,6 @@ struct platform_device;
 	.sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
 	SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
-#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
-	((unsigned long)&(struct soc_mixer_control) \
-	{.reg = xreg, .max = xmax, .invert = xinvert})
 #define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \
 	((unsigned long)&(struct soc_mixer_control) \
 	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
Signature · 1 line
2.39.5
#2 lore raw

PATCH v2 2/13 ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() helper macro

In reply to Charles Keepax

The rt715 does not appear to use the SOC_DOUBLE_R_EXT() macro and even if it did, the macro is defined identically in the ASoC headers. Remove the redundant macro definitions.

---

No changes since v1.

 sound/soc/codecs/rt715-sdca.c | 8 --------
 sound/soc/codecs/rt715.c      | 8 --------
 2 files changed, 16 deletions(-)
sound/soc/codecs/rt715-sdca.c +0 -8
index 7e10fd9138122..7fb02654c16bd 100644
@@ -427,14 +427,6 @@ static int rt715_sdca_fu_info(struct snd_kcontrol *kcontrol,
 	.private_value = RT715_SDCA_PR_VALUE(reg_base, xcount, xmax, \
 					xshift, xinvert)}
 
-#define SOC_DOUBLE_R_EXT(xname, reg_left, reg_right, xshift, xmax, xinvert,\
-	 xhandler_get, xhandler_put) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
-	.info = snd_soc_info_volsw, \
-	.get = xhandler_get, .put = xhandler_put, \
-	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
-
 #define RT715_SDCA_EXT_TLV(xname, reg_base, xhandler_get,\
 	 xhandler_put, tlv_array, xcount, xmax) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
sound/soc/codecs/rt715.c +0 -8
index 299c9b12377c6..2cf4618520918 100644
@@ -486,14 +486,6 @@ static int rt715_vol_info(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-#define SOC_DOUBLE_R_EXT(xname, reg_left, reg_right, xshift, xmax, xinvert,\
-	 xhandler_get, xhandler_put) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
-	.info = snd_soc_info_volsw, \
-	.get = xhandler_get, .put = xhandler_put, \
-	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
-
 #define RT715_MAIN_SWITCH_EXT(xname, xhandler_get, xhandler_put) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
 	.info = rt715_switch_info, \
Signature · 1 line
2.39.5
#3 lore raw

PATCH v2 3/13 ASoC: sma1307: Use SOC_SINGLE_EXT() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/sma1307.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
sound/soc/codecs/sma1307.c +3 -8
index 480bcea48541e..dac17da9ceddd 100644
@@ -1019,14 +1019,9 @@ static const struct snd_kcontrol_new sma1307_aif_out1_source_control = {
 	.private_value = (unsigned long)&sma1307_aif_out_source_enum
 };
 
-static const struct snd_kcontrol_new sma1307_sdo_control = {
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "Switch",
-	.info = snd_soc_info_volsw,
-	.get = sma1307_dapm_sdo_enable_get,
-	.put = sma1307_dapm_sdo_enable_put,
-	.private_value = SOC_SINGLE_VALUE(SND_SOC_NOPM, 0, 1, 0, 0)
-};
+static const struct snd_kcontrol_new sma1307_sdo_control =
+	SOC_SINGLE_EXT("Switch", SND_SOC_NOPM, 0, 1, 0,
+		       sma1307_dapm_sdo_enable_get, sma1307_dapm_sdo_enable_put);
 
 static const struct snd_kcontrol_new sma1307_enable_control =
 	SOC_DAPM_SINGLE("Switch", SMA1307_00_SYSTEM_CTRL, 0, 1, 0);
Signature · 1 line
2.39.5
#4 lore raw

PATCH v2 4/13 ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/tas2562.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
sound/soc/codecs/tas2562.c +3 -11
index fef7ce39f6643..8e00dcc09d0c2 100644
@@ -513,17 +513,9 @@ static const struct snd_kcontrol_new vsense_switch =
 static const struct snd_kcontrol_new tas2562_snd_controls[] = {
 	SOC_SINGLE_TLV("Amp Gain Volume", TAS2562_PB_CFG1, 1, 0x1c, 0,
 		       tas2562_dac_tlv),
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Digital Volume Control",
-		.index = 0,
-		.tlv.p = dvc_tlv,
-		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,
-		.info = snd_soc_info_volsw,
-		.get = tas2562_volume_control_get,
-		.put = tas2562_volume_control_put,
-		.private_value = SOC_SINGLE_VALUE(TAS2562_DVC_CFG1, 0, 110, 0, 0),
-	},
+	SOC_SINGLE_EXT_TLV("Digital Volume Control", TAS2562_DVC_CFG1, 0, 110, 0,
+			   tas2562_volume_control_get, tas2562_volume_control_put,
+			   dvc_tlv),
 };
 
 static const struct snd_soc_dapm_widget tas2110_dapm_widgets[] = {
Signature · 1 line
2.39.5
#5 lore raw

PATCH v2 5/13 ASoC: wcd938x: Use SOC_SINGLE_EXT_TLV() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/wcd938x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/codecs/wcd938x.c +2 -7
index f2a4f3262bdbc..b536e8bdc5a74 100644
@@ -70,13 +70,8 @@
 #define WCD_MBHC_HS_V_MAX           1600
 
 #define WCD938X_EAR_PA_GAIN_TLV(xname, reg, shift, max, invert, tlv_array) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
-		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
-	.tlv.p = (tlv_array), \
-	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
-	.put = wcd938x_ear_pa_put_gain, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
+	SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, snd_soc_get_volsw, \
+			   wcd938x_ear_pa_put_gain, tlv_array)
 
 enum {
 	WCD9380 = 0,
Signature · 1 line
2.39.5
#6 lore raw

PATCH v2 6/13 ASoC: wm9712: Use SOC_SINGLE_EXT() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/wm9712.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
sound/soc/codecs/wm9712.c +3 -7
index e63921de0c37a..8ff4b5f13b3a4 100644
@@ -275,13 +275,9 @@ static int wm9712_hp_mixer_get(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-#define WM9712_HP_MIXER_CTRL(xname, xmixer, xshift) { \
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = wm9712_hp_mixer_get, .put = wm9712_hp_mixer_put, \
-	.private_value = SOC_SINGLE_VALUE(SND_SOC_NOPM, \
-		(xmixer << 8) | xshift, 1, 0, 0) \
-}
+#define WM9712_HP_MIXER_CTRL(xname, xmixer, xshift) \
+	SOC_SINGLE_EXT(xname, SND_SOC_NOPM, ((xmixer) << 8) | (xshift), \
+		       1, 0, wm9712_hp_mixer_get, wm9712_hp_mixer_put)
 
 /* Left Headphone Mixers */
 static const struct snd_kcontrol_new wm9712_hpl_mixer_controls[] = {
Signature · 1 line
2.39.5
#7 lore raw

PATCH v2 7/13 ASoC: wm9713: Use SOC_DOUBLE_EXT() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/wm9713.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
sound/soc/codecs/wm9713.c +3 -7
index 64b69316e4c70..0aa6491f2c842 100644
@@ -284,13 +284,9 @@ static int wm9713_hp_mixer_get(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-#define WM9713_HP_MIXER_CTRL(xname, xmixer, xshift) { \
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = wm9713_hp_mixer_get, .put = wm9713_hp_mixer_put, \
-	.private_value = SOC_DOUBLE_VALUE(SND_SOC_NOPM, \
-		xshift, xmixer, 1, 0, 0) \
-}
+#define WM9713_HP_MIXER_CTRL(xname, xmixer, xshift) \
+	SOC_DOUBLE_EXT(xname, SND_SOC_NOPM, xshift, xmixer, 1, 0, \
+		       wm9713_hp_mixer_get, wm9713_hp_mixer_put)
 
 /* Left Headphone Mixers */
 static const struct snd_kcontrol_new wm9713_hpl_mixer_controls[] = {
Signature · 1 line
2.39.5
#8 lore raw

PATCH v2 8/13 ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() helper macro

In reply to Charles Keepax

Rather than open coding use the helper macro provided by the ASoC core.

---

No changes since v1.

 sound/soc/codecs/wsa881x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/codecs/wsa881x.c +2 -7
index dd2d6661adc71..a3999bb6d5e22 100644
@@ -199,13 +199,8 @@
 #define WSA881X_PROBE_TIMEOUT 1000
 
 #define WSA881X_PA_GAIN_TLV(xname, reg, shift, max, invert, tlv_array) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
-		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
-	.tlv.p = (tlv_array), \
-	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
-	.put = wsa881x_put_pa_gain, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
+	SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \
+			   snd_soc_get_volsw, wsa881x_put_pa_gain, tlv_array)
 
 static struct reg_default wsa881x_defaults[] = {
 	{ WSA881X_CHIP_ID0, 0x00 },
Signature · 1 line
2.39.5
#9 lore raw

PATCH v2 9/13 ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() helper macro

In reply to Charles Keepax

The TSE850_DAPM_SINGLE_EXT() macro is an identical duplicate of the core SOC_SINGLE_EXT() marco. Use the macro provided by the core.

---

No changes since v1.

 sound/soc/atmel/tse850-pcm5142.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
sound/soc/atmel/tse850-pcm5142.c +2 -9
index 0a9efd5f28615..2a1d0408a4cf1 100644
@@ -227,16 +227,9 @@ static const struct snd_kcontrol_new mux1 =
 static const struct snd_kcontrol_new mux2 =
 	SOC_DAPM_ENUM_EXT("MUX2", mux_enum, tse850_get_mux2, tse850_put_mux2);
 
-#define TSE850_DAPM_SINGLE_EXT(xname, reg, shift, max, invert, xget, xput) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = xget, \
-	.put = xput, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
-
 static const struct snd_kcontrol_new mix[] = {
-	TSE850_DAPM_SINGLE_EXT("IN Switch", SND_SOC_NOPM, 0, 1, 0,
-			       tse850_get_mix, tse850_put_mix),
+	SOC_SINGLE_EXT("IN Switch", SND_SOC_NOPM, 0, 1, 0,
+		       tse850_get_mix, tse850_put_mix),
 };
 
 static const char * const ana_text[] = {
Signature · 1 line
2.39.5
#10 lore raw

PATCH v2 10/13 ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper

In reply to Charles Keepax

A few drivers are open coding SOC_DAPM_DOUBLE_R_TLV() add a core helper and use that instead.

---

No changes since v1.

 include/sound/soc-dapm.h  |  7 +++++++
 sound/soc/codecs/jz4760.c | 32 ++++---------------------------
 sound/soc/codecs/jz4770.c | 40 ++++++---------------------------------
 3 files changed, 17 insertions(+), 62 deletions(-)
include/sound/soc-dapm.h +7 -0
index 7cf52c8c9cf32..bed1c37529aca 100644
@@ -347,6 +347,13 @@ struct soc_enum;
 	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
 #define SOC_DAPM_SINGLE_VIRT(xname, max) \
 	SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0)
+#define SOC_DAPM_DOUBLE_R_TLV(xname, lreg, rreg, shift, max, invert, tlv_array) \
+{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
+	.info = snd_soc_info_volsw, \
+	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
+	.tlv.p = (tlv_array), \
+	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
+	.private_value = SOC_DOUBLE_R_VALUE(lreg, rreg, shift, max, invert) }
 #define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
sound/soc/codecs/jz4760.c +4 -28
index 6217e611259fe..e04af1b9ace86 100644
@@ -314,37 +314,13 @@ static const struct snd_kcontrol_new jz4760_codec_snd_controls[] = {
 };
 
 static const struct snd_kcontrol_new jz4760_codec_pcm_playback_controls[] = {
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Volume",
-		.info = snd_soc_info_volsw,
-		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
-			| SNDRV_CTL_ELEM_ACCESS_READWRITE,
-		.tlv.p = dac_tlv,
-		.get = snd_soc_dapm_get_volsw,
-		.put = snd_soc_dapm_put_volsw,
-		.private_value = SOC_DOUBLE_R_VALUE(JZ4760_CODEC_REG_GCR6,
-						    JZ4760_CODEC_REG_GCR5,
-						    REG_GCR_GAIN_OFFSET,
-						    REG_GCR_GAIN_MAX, 1),
-	},
+	SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4760_CODEC_REG_GCR6, JZ4760_CODEC_REG_GCR5,
+			      REG_GCR_GAIN_OFFSET, REG_GCR_GAIN_MAX, 1, dac_tlv),
 };
 
 static const struct snd_kcontrol_new jz4760_codec_hp_playback_controls[] = {
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Volume",
-		.info = snd_soc_info_volsw,
-		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
-			| SNDRV_CTL_ELEM_ACCESS_READWRITE,
-		.tlv.p = out_tlv,
-		.get = snd_soc_dapm_get_volsw,
-		.put = snd_soc_dapm_put_volsw,
-		.private_value = SOC_DOUBLE_R_VALUE(JZ4760_CODEC_REG_GCR2,
-						    JZ4760_CODEC_REG_GCR1,
-						    REG_GCR_GAIN_OFFSET,
-						    REG_GCR_GAIN_MAX, 1),
-	},
+	SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4760_CODEC_REG_GCR2, JZ4760_CODEC_REG_GCR1,
+			      REG_GCR_GAIN_OFFSET, REG_GCR_GAIN_MAX, 1, out_tlv),
 };
 
 static int hpout_event(struct snd_soc_dapm_widget *w,
sound/soc/codecs/jz4770.c +6 -34
index acb9eaa7ea1c5..312202ab5ceae 100644
@@ -331,43 +331,15 @@ static const struct snd_kcontrol_new jz4770_codec_snd_controls[] = {
 };
 
 static const struct snd_kcontrol_new jz4770_codec_pcm_playback_controls[] = {
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Volume",
-		.info = snd_soc_info_volsw,
-		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
-			| SNDRV_CTL_ELEM_ACCESS_READWRITE,
-		.tlv.p = dac_tlv,
-		.get = snd_soc_dapm_get_volsw,
-		.put = snd_soc_dapm_put_volsw,
-		/*
-		 * NOTE: DACR/DACL are inversed; the gain value written to DACR
-		 * seems to affect the left channel, and the gain value written
-		 * to DACL seems to affect the right channel.
-		 */
-		.private_value = SOC_DOUBLE_R_VALUE(JZ4770_CODEC_REG_GCR_DACR,
-						    JZ4770_CODEC_REG_GCR_DACL,
-						    REG_GCR_GAIN_OFFSET,
-						    REG_GCR_GAIN_MAX, 1),
-	},
+	SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4770_CODEC_REG_GCR_DACR,
+			      JZ4770_CODEC_REG_GCR_DACL, REG_GCR_GAIN_OFFSET,
+			      REG_GCR_GAIN_MAX, 1, dac_tlv),
 };
 
 static const struct snd_kcontrol_new jz4770_codec_hp_playback_controls[] = {
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Volume",
-		.info = snd_soc_info_volsw,
-		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
-			| SNDRV_CTL_ELEM_ACCESS_READWRITE,
-		.tlv.p = out_tlv,
-		.get = snd_soc_dapm_get_volsw,
-		.put = snd_soc_dapm_put_volsw,
-		/* HPR/HPL inversed for the same reason as above */
-		.private_value = SOC_DOUBLE_R_VALUE(JZ4770_CODEC_REG_GCR_HPR,
-						    JZ4770_CODEC_REG_GCR_HPL,
-						    REG_GCR_GAIN_OFFSET,
-						    REG_GCR_GAIN_MAX, 1),
-	},
+	SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4770_CODEC_REG_GCR_HPR,
+			      JZ4770_CODEC_REG_GCR_HPL, REG_GCR_GAIN_OFFSET,
+			      REG_GCR_GAIN_MAX, 1, out_tlv),
 };
 
 static int hpout_event(struct snd_soc_dapm_widget *w,
Signature · 1 line
2.39.5
#11 lore raw

PATCH v2 11/13 ASoC: dapm: Use ASoC control macros where possible

In reply to Charles Keepax

Update the DAPM kcontrol creation macros to use the ASoC macros where a helpful version exists. One minor fixup is required in adau17x1, the compiler doesn't like the extra level of macro indirection coupled with the inline struct definition. Make the struct definition explicit.

---

No changes since v1.

 include/sound/soc-dapm.h    | 62 +++++++++++++------------------------
 sound/soc/codecs/adau17x1.c | 10 +++---
 2 files changed, 28 insertions(+), 44 deletions(-)
include/sound/soc-dapm.h +22 -40
index bed1c37529aca..4b8ef5b8a391e 100644
@@ -326,41 +326,37 @@ struct soc_enum;
 
 /* dapm kcontrol types */
 #define SOC_DAPM_DOUBLE(xname, reg, lshift, rshift, max, invert) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_DOUBLE_VALUE(reg, lshift, rshift, max, invert, 0) }
+	SOC_DOUBLE_EXT(xname, reg, lshift, rshift, max, invert, \
+		       snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw)
 #define SOC_DAPM_DOUBLE_R(xname, lreg, rreg, shift, max, invert) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_DOUBLE_R_VALUE(lreg, rreg, shift, max, invert) }
+	SOC_DOUBLE_R_EXT(xname, lreg, rreg, shift, max, invert, \
+			 snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw)
 #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
-#define SOC_DAPM_SINGLE_AUTODISABLE(xname, reg, shift, max, invert) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
+	SOC_SINGLE_EXT(xname, reg, shift, max, invert, \
+		       snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw)
 #define SOC_DAPM_SINGLE_VIRT(xname, max) \
 	SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0)
 #define SOC_DAPM_DOUBLE_R_TLV(xname, lreg, rreg, shift, max, invert, tlv_array) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_volsw, \
-	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
-	.tlv.p = (tlv_array), \
-	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_DOUBLE_R_VALUE(lreg, rreg, shift, max, invert) }
+	SOC_DOUBLE_R_EXT_TLV(xname, lreg, rreg, shift, max, invert, \
+			     snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw, \
+			     tlv_array)
 #define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
+	SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \
+			   snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw, \
+			   tlv_array)
+#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \
+	SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)
+#define SOC_DAPM_ENUM(xname, xenum) \
+	SOC_ENUM_EXT(xname, xenum, snd_soc_dapm_get_enum_double, \
+		     snd_soc_dapm_put_enum_double)
+#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
+	SOC_ENUM_EXT(xname, xenum, xget, xput)
+
+#define SOC_DAPM_SINGLE_AUTODISABLE(xname, reg, shift, max, invert) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
-	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
-	.tlv.p = (tlv_array), \
 	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
+	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
 #define SOC_DAPM_SINGLE_TLV_AUTODISABLE(xname, reg, shift, max, invert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
@@ -368,20 +364,6 @@ struct soc_enum;
 	.tlv.p = (tlv_array), \
 	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
 	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
-#define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \
-	SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array)
-#define SOC_DAPM_ENUM(xname, xenum) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_enum_double, \
- 	.get = snd_soc_dapm_get_enum_double, \
- 	.put = snd_soc_dapm_put_enum_double, \
-  	.private_value = (unsigned long)&xenum }
-#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
-{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-	.info = snd_soc_info_enum_double, \
-	.get = xget, \
-	.put = xput, \
-	.private_value = (unsigned long)&xenum }
 #define SOC_DAPM_PIN_SWITCH(xname) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
 	.info = snd_soc_dapm_info_pin_switch, \
sound/soc/codecs/adau17x1.c +6 -4
index 4dcc984761e0a..2ebb5c90bdd91 100644
@@ -254,11 +254,13 @@ static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol,
 }
 
 #define DECLARE_ADAU17X1_DSP_MUX_CTRL(_name, _label, _stream, _text) \
-	const struct snd_kcontrol_new _name = \
-		SOC_DAPM_ENUM_EXT(_label, (const struct soc_enum)\
+	const struct soc_enum _name##_enum = \
 			SOC_ENUM_SINGLE(SND_SOC_NOPM, _stream, \
-				ARRAY_SIZE(_text), _text), \
-			adau17x1_dsp_mux_enum_get, adau17x1_dsp_mux_enum_put)
+					ARRAY_SIZE(_text), _text); \
+	const struct snd_kcontrol_new _name = \
+		SOC_DAPM_ENUM_EXT(_label, _name##_enum, \
+				  adau17x1_dsp_mux_enum_get, \
+				  adau17x1_dsp_mux_enum_put)
 
 static const char * const adau17x1_dac_mux_text[] = {
 	"DSP",
Signature · 1 line
2.39.5
#12 lore raw

PATCH v2 12/13 ASoC: Tidy up SOC_DOUBLE_R_* helpers

In reply to Charles Keepax

Re-implement SOC_DOUBLE_R_VALUE() in terms of SOC_DOUBLE_R_S_VALUE(). SOC_DOUBLE_R_S_VALUE() already had a minimum value so add this to SOC_DOUBLE_R_VALUE() as well, which makes SOC_DOUBLE_R_RANGE_VALUE() redundant, so its usage is replaced.

---

No changes since v1.

 include/sound/soc.h | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)
include/sound/soc.h +10 -18
index 01151a6ada350..390e08ba4dd45 100644
@@ -51,19 +51,14 @@ struct platform_device;
 	.sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
 	SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
-#define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \
-	((unsigned long)&(struct soc_mixer_control) \
-	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
-	.max = xmax, .invert = xinvert})
 #define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
 	((unsigned long)&(struct soc_mixer_control) \
 	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
 	.max = xmax, .min = xmin, .sign_bit = xsign_bit, \
 	.invert = xinvert})
-#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
-	((unsigned long)&(struct soc_mixer_control) \
-	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
-	.min = xmin, .max = xmax, .invert = xinvert})
+#define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
+	SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, 0, xinvert)
+
 #define SOC_SINGLE(xname, reg, shift, max, invert) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
@@ -127,13 +122,13 @@ struct platform_device;
 	.info = snd_soc_info_volsw, \
 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
+					    0, xmax, xinvert) }
 #define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \
 			   xmax, xinvert)		\
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 	.info = snd_soc_info_volsw_range, \
 	.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
-	.private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \
+	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
 					    xshift, xmin, xmax, xinvert) }
 #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
@@ -176,7 +171,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw, \
 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
+					    0, xmax, xinvert) }
 #define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \
 			       xmax, xinvert, tlv_array)		\
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
@@ -185,7 +180,7 @@ struct platform_device;
 	.tlv.p = (tlv_array), \
 	.info = snd_soc_info_volsw_range, \
 	.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
-	.private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \
+	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
 					    xshift, xmin, xmax, xinvert) }
 #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -195,10 +190,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw_sx, \
 	.get = snd_soc_get_volsw_sx, \
 	.put = snd_soc_put_volsw_sx, \
-	.private_value = (unsigned long)&(struct soc_mixer_control) \
-		{.reg = xreg, .rreg = xrreg, \
-		.shift = xshift, .rshift = xshift, \
-		.max = xmax, .min = xmin} }
+	.private_value = SOC_DOUBLE_R_VALUE(xreg, xrreg, xshift, xmin, xmax, 0) }
 #define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -272,7 +264,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw, \
 	.get = xhandler_get, .put = xhandler_put, \
 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
+					    0, xmax, xinvert) }
 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
 	 xhandler_get, xhandler_put, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -313,7 +305,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw, \
 	.get = xhandler_get, .put = xhandler_put, \
 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
-					    xmax, xinvert) }
+					    0, xmax, xinvert) }
 #define SOC_DOUBLE_R_S_EXT_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, \
 			       xsign_bit, xinvert, xhandler_get, xhandler_put, \
 			       tlv_array) \
Signature · 1 line
2.39.5
#13 lore raw

PATCH v2 13/13 ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers

In reply to Charles Keepax

Re-implement SOC_DOUBLE_VALUE() in terms of SOC_DOUBLE_S_VALUE(). SOC_DOUBLE_S_VALUE() already had a minimum value so add this to SOC_DOUBLE_VALUE as well, this allows replacement of several hard coded value entries. Likewise update SOC_SINGLE_VALUE to match, which allows replacement of even more hard coded values.

---

No changes since v1.

 include/sound/soc-dapm.h |  4 +--
 include/sound/soc.h      | 65 +++++++++++++++-------------------------
 2 files changed, 26 insertions(+), 43 deletions(-)
include/sound/soc-dapm.h +2 -2
index 4b8ef5b8a391e..af802ef536e73 100644
@@ -356,14 +356,14 @@ struct soc_enum;
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
 	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
+	.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 1) }
 #define SOC_DAPM_SINGLE_TLV_AUTODISABLE(xname, reg, shift, max, invert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
 	.tlv.p = (tlv_array), \
 	.get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) }
+	.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 1) }
 #define SOC_DAPM_PIN_SWITCH(xname) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
 	.info = snd_soc_dapm_info_pin_switch, \
include/sound/soc.h +24 -41

162 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer
#14 lore raw

Re: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers

Quoted 5 lines · Charles Keepax

Re-implement SOC_DOUBLE_VALUE() in terms of SOC_DOUBLE_S_VALUE(). SOC_DOUBLE_S_VALUE() already had a minimum value so add this to SOC_DOUBLE_VALUE as well, this allows replacement of several hard coded value entries. Likewise update SOC_SINGLE_VALUE to match, which allows replacement of even more hard coded values.

This breaks an arm64 defconfig build:

In file included from /build/stage/linux/sound/soc/codecs/rk3308_codec.c:24:
/build/stage/linux/include/sound/soc.h:150:49: error: ‘shift_left’ undeclared here (not in a function)
150 | .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
| ^~~~~~~~~~
/build/stage/linux/include/sound/soc.h:45:46: note: in definition of macro ‘SOC_DOUBLE_S_VALUE’
45 | {.reg = xreg, .rreg = xreg, .shift = shift_left, \
| ^~~~~~~~~~
/build/stage/linux/include/sound/soc.h:150:26: note: in expansion of macro ‘SOC_DOUBLE_VALUE’

  150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
      |                          ^~~~~~~~~~~~~~~~
/build/stage/linux/sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro ‘SOC_DOUBLE_RANGE_TLV’
  171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
      |         ^~~~~~~~~~~~~~~~~~~~

/build/stage/linux/include/sound/soc.h:150:61: error: ‘shift_right’ undeclared here (not in a function)
150 | .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
| ^~~~~~~~~~~
/build/stage/linux/include/sound/soc.h:46:19: note: in definition of macro ‘SOC_DOUBLE_S_VALUE’

   46 |         .rshift = shift_right, .min = xmin, .max = xmax, \
      |                   ^~~~~~~~~~~
/build/stage/linux/include/sound/soc.h:150:26: note: in expansion of macro ‘SOC_DOUBLE_VALUE’
  150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
      |                          ^~~~~~~~~~~~~~~~
/build/stage/linux/sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro ‘SOC_DOUBLE_RANGE_TLV’
  171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
      |         ^~~~~~~~~~~~~~~~~~~~
#15 lore raw

Re: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers

Quoted 26 lines · Mark Brown
Quoted 5 lines · Charles Keepax

Re-implement SOC_DOUBLE_VALUE() in terms of SOC_DOUBLE_S_VALUE(). SOC_DOUBLE_S_VALUE() already had a minimum value so add this to SOC_DOUBLE_VALUE as well, this allows replacement of several hard coded value entries. Likewise update SOC_SINGLE_VALUE to match, which allows replacement of even more hard coded values.

This breaks an arm64 defconfig build:

In file included from /build/stage/linux/sound/soc/codecs/rk3308_codec.c:24:
/build/stage/linux/include/sound/soc.h:150:49: error: ‘shift_left’ undeclared here (not in a function)
150 | .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
| ^~~~~~~~~~
/build/stage/linux/include/sound/soc.h:45:46: note: in definition of macro ‘SOC_DOUBLE_S_VALUE’
45 | {.reg = xreg, .rreg = xreg, .shift = shift_left, \
| ^~~~~~~~~~
/build/stage/linux/include/sound/soc.h:150:26: note: in expansion of macro ‘SOC_DOUBLE_VALUE’

  150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
      |                          ^~~~~~~~~~~~~~~~
/build/stage/linux/sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro ‘SOC_DOUBLE_RANGE_TLV’
  171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
      |         ^~~~~~~~~~~~~~~~~~~~

/build/stage/linux/include/sound/soc.h:150:61: error: ‘shift_right’ undeclared here (not in a function)
150 | .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
| ^~~~~~~~~~~
/build/stage/linux/include/sound/soc.h:46:19: note: in definition of macro ‘SOC_DOUBLE_S_VALUE’

Quoted 9 lines
   46 |         .rshift = shift_right, .min = xmin, .max = xmax, \
      |                   ^~~~~~~~~~~
/build/stage/linux/include/sound/soc.h:150:26: note: in expansion of macro ‘SOC_DOUBLE_VALUE’
  150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
      |                          ^~~~~~~~~~~~~~~~
/build/stage/linux/sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro ‘SOC_DOUBLE_RANGE_TLV’
  171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
      |         ^~~~~~~~~~~~~~~~~~~~

Apologies I will check that out and resend.

Thanks,
Charles

#16 lore raw

Re: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers

In reply to Charles Keepax
kernel test robot noticed the following build errors:

Hi Charles,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.14-rc5 next-20250304] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Charles-Keepax/ASoC-Remove-unused-helper-macro/20250304-015303
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20250303171424.444556-14-ckeepax%40opensource.cirrus.com
patch subject: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers
config: x86_64-buildonly-randconfig-005-20250304 (https://download.01.org/0day-ci/archive/20250304/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250304/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from sound/soc/codecs/rk3308_codec.c:24:

>> include/sound/soc.h:150:49: error: 'shift_left' undeclared here (not in a function)
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                                                 ^~~~~~~~~~
   include/sound/soc.h:45:46: note: in definition of macro 'SOC_DOUBLE_S_VALUE'
      45 |         {.reg = xreg, .rreg = xreg, .shift = shift_left, \
         |                                              ^~~~~~~~~~
   include/sound/soc.h:150:26: note: in expansion of macro 'SOC_DOUBLE_VALUE'
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                          ^~~~~~~~~~~~~~~~
   sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro 'SOC_DOUBLE_RANGE_TLV'
     171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
         |         ^~~~~~~~~~~~~~~~~~~~
>> include/sound/soc.h:150:61: error: 'shift_right' undeclared here (not in a function)
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                                                             ^~~~~~~~~~~
   include/sound/soc.h:46:19: note: in definition of macro 'SOC_DOUBLE_S_VALUE'
      46 |         .rshift = shift_right, .min = xmin, .max = xmax, \
         |                   ^~~~~~~~~~~
   include/sound/soc.h:150:26: note: in expansion of macro 'SOC_DOUBLE_VALUE'
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                          ^~~~~~~~~~~~~~~~
   sound/soc/codecs/rk3308_codec.c:171:9: note: in expansion of macro 'SOC_DOUBLE_RANGE_TLV'
     171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
         |         ^~~~~~~~~~~~~~~~~~~~
--
   In file included from rk3308_codec.c:24:
>> include/sound/soc.h:150:49: error: 'shift_left' undeclared here (not in a function)
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                                                 ^~~~~~~~~~
   include/sound/soc.h:45:46: note: in definition of macro 'SOC_DOUBLE_S_VALUE'
      45 |         {.reg = xreg, .rreg = xreg, .shift = shift_left, \
         |                                              ^~~~~~~~~~
   include/sound/soc.h:150:26: note: in expansion of macro 'SOC_DOUBLE_VALUE'
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                          ^~~~~~~~~~~~~~~~
   rk3308_codec.c:171:9: note: in expansion of macro 'SOC_DOUBLE_RANGE_TLV'
     171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
         |         ^~~~~~~~~~~~~~~~~~~~
>> include/sound/soc.h:150:61: error: 'shift_right' undeclared here (not in a function)
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                                                             ^~~~~~~~~~~
   include/sound/soc.h:46:19: note: in definition of macro 'SOC_DOUBLE_S_VALUE'
      46 |         .rshift = shift_right, .min = xmin, .max = xmax, \
         |                   ^~~~~~~~~~~
   include/sound/soc.h:150:26: note: in expansion of macro 'SOC_DOUBLE_VALUE'
     150 |         .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
         |                          ^~~~~~~~~~~~~~~~
   rk3308_codec.c:171:9: note: in expansion of macro 'SOC_DOUBLE_RANGE_TLV'
     171 |         SOC_DOUBLE_RANGE_TLV("DAC HPMIX Playback Volume",
         |         ^~~~~~~~~~~~~~~~~~~~

vim +/shift_left +150 include/sound/soc.h

    38	
    39	/*
    40	 * Convenience kcontrol builders
    41	 */
    42	#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, \
    43				   xinvert, xautodisable) \
    44		((unsigned long)&(struct soc_mixer_control) \
  > 45		{.reg = xreg, .rreg = xreg, .shift = shift_left, \
    46		.rshift = shift_right, .min = xmin, .max = xmax, \
    47		.sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
    48	#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmin, xmax, xinvert, xautodisable) \
    49		SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, 0, xinvert, \
    50				   xautodisable)
    51	#define SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, xautodisable) \
    52		SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmin, xmax, xinvert, xautodisable)
    53	#define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
    54		((unsigned long)&(struct soc_mixer_control) \
    55		{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
    56		.max = xmax, .min = xmin, .sign_bit = xsign_bit, \
    57		.invert = xinvert})
    58	#define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
    59		SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, 0, xinvert)
    60	
    61	#define SOC_SINGLE(xname, reg, shift, max, invert) \
    62	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
    63		.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
    64		.put = snd_soc_put_volsw, \
    65		.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
    66	#define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
    67	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
    68		.info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
    69		.put = snd_soc_put_volsw_range, \
    70		.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
    71	#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
    72	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
    73		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
    74			 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
    75		.tlv.p = (tlv_array), \
    76		.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
    77		.put = snd_soc_put_volsw, \
    78		.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
    79	#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
    80	{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
    81		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
    82		SNDRV_CTL_ELEM_ACCESS_READWRITE, \
    83		.tlv.p  = (tlv_array),\
    84		.info = snd_soc_info_volsw_sx, \
    85		.get = snd_soc_get_volsw_sx,\
    86		.put = snd_soc_put_volsw_sx, \
    87		.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, 0, 0) }
    88	#define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \
    89	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
    90		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
    91			 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
    92		.tlv.p = (tlv_array), \
    93		.info = snd_soc_info_volsw_range, \
    94		.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
    95		.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
    96	#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
    97	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
    98		.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
    99		.put = snd_soc_put_volsw, \
   100		.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
   101						  0, max, invert, 0) }
   102	#define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
   103	{									\
   104		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),		\
   105		.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,		\
   106		.access = SNDRV_CTL_ELEM_ACCESS_READ |				\
   107			SNDRV_CTL_ELEM_ACCESS_VOLATILE,				\
   108		.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right,	\
   109						  0, max, invert, 0) }
   110	#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
   111	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
   112		.info = snd_soc_info_volsw, \
   113		.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
   114		.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
   115						    0, xmax, xinvert) }
   116	#define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \
   117				   xmax, xinvert)		\
   118	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
   119		.info = snd_soc_info_volsw_range, \
   120		.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
   121		.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
   122						    xshift, xmin, xmax, xinvert) }
   123	#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
   124	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
   125		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
   126			 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
   127		.tlv.p = (tlv_array), \
   128		.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
   129		.put = snd_soc_put_volsw, \
   130		.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
   131						  0, max, invert, 0) }
   132	#define SOC_DOUBLE_SX_TLV(xname, xreg, shift_left, shift_right, xmin, xmax, tlv_array) \
   133	{       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
   134		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
   135		SNDRV_CTL_ELEM_ACCESS_READWRITE, \
   136		.tlv.p  = (tlv_array), \
   137		.info = snd_soc_info_volsw_sx, \
   138		.get = snd_soc_get_volsw_sx, \
   139		.put = snd_soc_put_volsw_sx, \
   140		.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
   141						  xmin, xmax, 0, 0) }
   142	#define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \
   143				     xinvert, tlv_array) \
   144	{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
   145		.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
   146			  SNDRV_CTL_ELEM_ACCESS_READWRITE,\
   147		.tlv.p = (tlv_array), \
   148		.info = snd_soc_info_volsw, \
   149		.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
 > 150		.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \

151 xmin, xmax, xinvert, 0) }
152 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
153 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
154 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
155 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
156 .tlv.p = (tlv_array), \
157 .info = snd_soc_info_volsw, \
158 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
159 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
160 0, xmax, xinvert) }
161 #define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \
162 xmax, xinvert, tlv_array) \
163 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
164 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
165 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
166 .tlv.p = (tlv_array), \
167 .info = snd_soc_info_volsw_range, \
168 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
169 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, \
170 xshift, xmin, xmax, xinvert) }
171 #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
172 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
173 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
174 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
175 .tlv.p = (tlv_array), \
176 .info = snd_soc_info_volsw_sx, \
177 .get = snd_soc_get_volsw_sx, \
178 .put = snd_soc_put_volsw_sx, \
179 .private_value = SOC_DOUBLE_R_VALUE(xreg, xrreg, xshift, xmin, xmax, 0) }
180 #define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
181 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
182 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
183 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
184 .tlv.p = (tlv_array), \
185 .info = snd_soc_info_volsw, \
186 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
187 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
188 xmin, xmax, xsign_bit, xinvert) }
189 #define SOC_SINGLE_S_TLV(xname, xreg, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
190 SOC_DOUBLE_R_S_TLV(xname, xreg, xreg, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array)
191 #define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
192 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
193 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
194 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
195 .tlv.p = (tlv_array), \
196 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
197 .put = snd_soc_put_volsw, \
198 .private_value = (unsigned long)&(struct soc_mixer_control) \
199 {.reg = xreg, .rreg = xreg, \
200 .min = xmin, .max = xmax, \
201 .sign_bit = 7,} }
202 #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
203 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
204 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
205 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
206 .tlv.p = (tlv_array), \
207 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
208 .put = snd_soc_put_volsw, \
209 .private_value = SOC_DOUBLE_S_VALUE(xreg, 0, 8, xmin, xmax, 7, 0, 0) }
210 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
211 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
212 .items = xitems, .texts = xtexts, \
213 .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
214 #define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
215 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
216 #define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
217 { .items = xitems, .texts = xtexts }
218 #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
219 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
220 .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
221 #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
222 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues)
223 #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
224 { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \
225 .mask = xmask, .items = xitems, .texts = xtexts, \
226 .values = xvalues, .autodisable = 1}
227 #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
228 SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
229 #define SOC_ENUM(xname, xenum) \
230 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
231 .info = snd_soc_info_enum_double, \
232 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
233 .private_value = (unsigned long)&xenum }
234 #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
235 xhandler_get, xhandler_put) \
236 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
237 .info = snd_soc_info_volsw, \
238 .get = xhandler_get, .put = xhandler_put, \
239 .private_value = SOC_SINGLE_VALUE(xreg, xshift, 0, xmax, xinvert, 0) }
240 #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
241 xhandler_get, xhandler_put) \
242 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
243 .info = snd_soc_info_volsw, \
244 .get = xhandler_get, .put = xhandler_put, \
245 .private_value = \
246 SOC_DOUBLE_VALUE(reg, shift_left, shift_right, 0, max, invert, 0) }
247 #define SOC_DOUBLE_R_EXT(xname, reg_left, reg_right, xshift, xmax, xinvert,\
248 xhandler_get, xhandler_put) \
249 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
250 .info = snd_soc_info_volsw, \
251 .get = xhandler_get, .put = xhandler_put, \
252 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
253 0, xmax, xinvert) }
254 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
255 xhandler_get, xhandler_put, tlv_array) \
256 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
257 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
258 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
259 .tlv.p = (tlv_array), \
260 .info = snd_soc_info_volsw, \
261 .get = xhandler_get, .put = xhandler_put, \
262 .private_value = SOC_SINGLE_VALUE(xreg, xshift, 0, xmax, xinvert, 0) }
263 #define SOC_SINGLE_RANGE_EXT_TLV(xname, xreg, xshift, xmin, xmax, xinvert, \
264 xhandler_get, xhandler_put, tlv_array) \
265 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
266 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
267 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
268 .tlv.p = (tlv_array), \
269 .info = snd_soc_info_volsw_range, \
270 .get = xhandler_get, .put = xhandler_put, \
271 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
272 #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
273 xhandler_get, xhandler_put, tlv_array) \
274 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
275 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
276 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
277 .tlv.p = (tlv_array), \
278 .info = snd_soc_info_volsw, \
279 .get = xhandler_get, .put = xhandler_put, \
280 .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
281 0, xmax, xinvert, 0) }
282 #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
283 xhandler_get, xhandler_put, tlv_array) \
284 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
285 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
286 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
287 .tlv.p = (tlv_array), \
288 .info = snd_soc_info_volsw, \
289 .get = xhandler_get, .put = xhandler_put, \
290 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
291 0, xmax, xinvert) }
292 #define SOC_DOUBLE_R_S_EXT_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, \
293 xsign_bit, xinvert, xhandler_get, xhandler_put, \
294 tlv_array) \
295 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
296 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
297 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
298 .tlv.p = (tlv_array), \
299 .info = snd_soc_info_volsw, \
300 .get = xhandler_get, .put = xhandler_put, \
301 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
302 xmin, xmax, xsign_bit, xinvert) }
303 #define SOC_SINGLE_S_EXT_TLV(xname, xreg, xshift, xmin, xmax, \
304 xsign_bit, xinvert, xhandler_get, xhandler_put, \
305 tlv_array) \
306 SOC_DOUBLE_R_S_EXT_TLV(xname, xreg, xreg, xshift, xmin, xmax, \
307 xsign_bit, xinvert, xhandler_get, xhandler_put, \
308 tlv_array)
309 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
310 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
311 .info = snd_soc_info_bool_ext, \
312 .get = xhandler_get, .put = xhandler_put, \
313 .private_value = xdata }
314 #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
315 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
316 .info = snd_soc_info_enum_double, \
317 .get = xhandler_get, .put = xhandler_put, \
318 .private_value = (unsigned long)&xenum }
319 #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
320 SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
321

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#17 lore raw
In reply to Charles Keepax
Quoted 10 lines · Charles Keepax

Tidy up the ASoC control value macros. Fix some drivers that should be using core macros that aren't, combine the existing core macros to be a little more consistent in style, and update the core macros to use each other where possible.

Changes since v1:
- Add the missing first patch that I managed to forget in v1. This was stopping the series applying, as it was only in my tree.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/13] ASoC: Remove unused helper macro

        commit: c01a74844b74c584160d5253f794bbd2af015bec
[02/13] ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() helper macro
        commit: b2b6913394488e031ee3d726f247b1c967057b40
[03/13] ASoC: sma1307: Use SOC_SINGLE_EXT() helper macro
        commit: 17ec58ac3c08c5c43bbdf5b08020fa4188a3009a
[04/13] ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() helper macro
        commit: aecdaa84adafb086b5b2939898d781bd63d6fe2e
[05/13] ASoC: wcd938x: Use SOC_SINGLE_EXT_TLV() helper macro
        commit: 9bb7d7452363fc470b76766b0a6356807e752795
[06/13] ASoC: wm9712: Use SOC_SINGLE_EXT() helper macro
        commit: bf19467b8512f855bdfae59ae78d326b1f434443
[07/13] ASoC: wm9713: Use SOC_DOUBLE_EXT() helper macro
        commit: 516493232a9b80dd4f4f6b078541cfad00973dbb
[08/13] ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() helper macro
        commit: 98413be56faa1c12494f43e7f77746763fa41c4a
[09/13] ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() helper macro
        commit: 7c5b07b497eab8eba75cf5da00cba493216dfc12
[10/13] ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper
        commit: 9e6e7e088cb78ce58ea442106b1f29cd7b6ff76e
[11/13] ASoC: dapm: Use ASoC control macros where possible
        commit: c951b20766f019a263b3547b07627be52fff87b4
[12/13] ASoC: Tidy up SOC_DOUBLE_R_* helpers
        commit: 1743dbb45b2cbe5500068900794a355a7e0dd853

[13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers
(no commit info)

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark