public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] Tidy up ASoC VALUE control macros
@ 2025-03-03 17:14 Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 01/13] ASoC: Remove unused helper macro Charles Keepax
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2 01/13] ASoC: Remove unused helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 02/13] ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() " Charles Keepax
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

SOC_SINGLE_VALUE_EXT() has no users, so remove it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

New since v1.

 include/sound/soc.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6bb2fca044c5e..01151a6ada350 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -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, \
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 02/13] ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 01/13] ASoC: Remove unused helper macro Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 03/13] ASoC: sma1307: Use SOC_SINGLE_EXT() " Charles Keepax
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/rt715-sdca.c | 8 --------
 sound/soc/codecs/rt715.c      | 8 --------
 2 files changed, 16 deletions(-)

diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
index 7e10fd9138122..7fb02654c16bd 100644
--- a/sound/soc/codecs/rt715-sdca.c
+++ b/sound/soc/codecs/rt715-sdca.c
@@ -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), \
diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c
index 299c9b12377c6..2cf4618520918 100644
--- a/sound/soc/codecs/rt715.c
+++ b/sound/soc/codecs/rt715.c
@@ -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, \
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 03/13] ASoC: sma1307: Use SOC_SINGLE_EXT() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 01/13] ASoC: Remove unused helper macro Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 02/13] ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 04/13] ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/sma1307.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/sma1307.c b/sound/soc/codecs/sma1307.c
index 480bcea48541e..dac17da9ceddd 100644
--- a/sound/soc/codecs/sma1307.c
+++ b/sound/soc/codecs/sma1307.c
@@ -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);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 04/13] ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (2 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 03/13] ASoC: sma1307: Use SOC_SINGLE_EXT() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 05/13] ASoC: wcd938x: " Charles Keepax
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/tas2562.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index fef7ce39f6643..8e00dcc09d0c2 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -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[] = {
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 05/13] ASoC: wcd938x: Use SOC_SINGLE_EXT_TLV() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (3 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 04/13] ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 06/13] ASoC: wm9712: Use SOC_SINGLE_EXT() " Charles Keepax
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/wcd938x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index f2a4f3262bdbc..b536e8bdc5a74 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -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,
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 06/13] ASoC: wm9712: Use SOC_SINGLE_EXT() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (4 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 05/13] ASoC: wcd938x: " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 07/13] ASoC: wm9713: Use SOC_DOUBLE_EXT() " Charles Keepax
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/wm9712.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index e63921de0c37a..8ff4b5f13b3a4 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -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[] = {
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 07/13] ASoC: wm9713: Use SOC_DOUBLE_EXT() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (5 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 06/13] ASoC: wm9712: Use SOC_SINGLE_EXT() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 08/13] ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/wm9713.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 64b69316e4c70..0aa6491f2c842 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -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[] = {
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 08/13] ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (6 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 07/13] ASoC: wm9713: Use SOC_DOUBLE_EXT() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 09/13] ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() " Charles Keepax
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/codecs/wsa881x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index dd2d6661adc71..a3999bb6d5e22 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -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 },
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 09/13] ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() helper macro
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (7 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 08/13] ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 10/13] ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper Charles Keepax
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 sound/soc/atmel/tse850-pcm5142.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sound/soc/atmel/tse850-pcm5142.c b/sound/soc/atmel/tse850-pcm5142.c
index 0a9efd5f28615..2a1d0408a4cf1 100644
--- a/sound/soc/atmel/tse850-pcm5142.c
+++ b/sound/soc/atmel/tse850-pcm5142.c
@@ -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[] = {
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 10/13] ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (8 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 09/13] ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() " Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 11/13] ASoC: dapm: Use ASoC control macros where possible Charles Keepax
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

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(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 7cf52c8c9cf32..bed1c37529aca 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -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, \
diff --git a/sound/soc/codecs/jz4760.c b/sound/soc/codecs/jz4760.c
index 6217e611259fe..e04af1b9ace86 100644
--- a/sound/soc/codecs/jz4760.c
+++ b/sound/soc/codecs/jz4760.c
@@ -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,
diff --git a/sound/soc/codecs/jz4770.c b/sound/soc/codecs/jz4770.c
index acb9eaa7ea1c5..312202ab5ceae 100644
--- a/sound/soc/codecs/jz4770.c
+++ b/sound/soc/codecs/jz4770.c
@@ -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,
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 11/13] ASoC: dapm: Use ASoC control macros where possible
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (9 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 10/13] ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 12/13] ASoC: Tidy up SOC_DOUBLE_R_* helpers Charles Keepax
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 include/sound/soc-dapm.h    | 62 +++++++++++++------------------------
 sound/soc/codecs/adau17x1.c | 10 +++---
 2 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index bed1c37529aca..4b8ef5b8a391e 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -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, \
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
index 4dcc984761e0a..2ebb5c90bdd91 100644
--- a/sound/soc/codecs/adau17x1.c
+++ b/sound/soc/codecs/adau17x1.c
@@ -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",
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 12/13] ASoC: Tidy up SOC_DOUBLE_R_* helpers
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (10 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 11/13] ASoC: dapm: Use ASoC control macros where possible Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 17:14 ` [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers Charles Keepax
  2025-03-04 16:53 ` [PATCH v2 00/13] Tidy up ASoC VALUE control macros Mark Brown
  13 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 include/sound/soc.h | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 01151a6ada350..390e08ba4dd45 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -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) \
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (11 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 12/13] ASoC: Tidy up SOC_DOUBLE_R_* helpers Charles Keepax
@ 2025-03-03 17:14 ` Charles Keepax
  2025-03-03 18:53   ` Mark Brown
  2025-03-04 16:53 ` [PATCH v2 00/13] Tidy up ASoC VALUE control macros Mark Brown
  13 siblings, 1 reply; 17+ messages in thread
From: Charles Keepax @ 2025-03-03 17:14 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v1.

 include/sound/soc-dapm.h |  4 +--
 include/sound/soc.h      | 65 +++++++++++++++-------------------------
 2 files changed, 26 insertions(+), 43 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 4b8ef5b8a391e..af802ef536e73 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -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, \
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 390e08ba4dd45..a42d8d865eb12 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -39,18 +39,17 @@ struct platform_device;
 /*
  * Convenience kcontrol builders
  */
-#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert, xautodisable) \
-	((unsigned long)&(struct soc_mixer_control) \
-	{.reg = xreg, .rreg = xreg, .shift = shift_left, \
-	.rshift = shift_right, .max = xmax, \
-	.invert = xinvert, .autodisable = xautodisable})
-#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \
+#define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, \
+			   xinvert, xautodisable) \
 	((unsigned long)&(struct soc_mixer_control) \
 	{.reg = xreg, .rreg = xreg, .shift = shift_left, \
 	.rshift = shift_right, .min = xmin, .max = xmax, \
 	.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_VALUE(xreg, shift_left, shift_right, xmin, xmax, xinvert, xautodisable) \
+	SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, 0, xinvert, \
+			   xautodisable)
+#define SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, xautodisable) \
+	SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmin, xmax, xinvert, xautodisable)
 #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, \
@@ -63,15 +62,12 @@ struct platform_device;
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
 	.put = snd_soc_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
+	.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
 #define SOC_SINGLE_RANGE(xname, xreg, 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 = (unsigned long)&(struct soc_mixer_control) \
-		{.reg = xreg, .rreg = xreg, .shift = xshift, \
-		 .rshift = xshift,  .min = xmin, .max = xmax, \
-		 .invert = xinvert} }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -79,7 +75,7 @@ struct platform_device;
 	.tlv.p = (tlv_array), \
 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
 	.put = snd_soc_put_volsw, \
-	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
+	.private_value = SOC_SINGLE_VALUE(reg, shift, 0, max, invert, 0) }
 #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -88,10 +84,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 = xreg, \
-		.shift = xshift, .rshift = xshift, \
-		.max = xmax, .min = xmin} }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, 0, 0) }
 #define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -99,16 +92,13 @@ 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 = (unsigned long)&(struct soc_mixer_control) \
-		{.reg = xreg, .rreg = xreg, .shift = xshift, \
-		 .rshift = xshift, .min = xmin, .max = xmax, \
-		 .invert = xinvert} }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
 	.put = snd_soc_put_volsw, \
 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
-					  max, invert, 0) }
+					  0, max, invert, 0) }
 #define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
 {									\
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),		\
@@ -116,7 +106,7 @@ struct platform_device;
 	.access = SNDRV_CTL_ELEM_ACCESS_READ |				\
 		SNDRV_CTL_ELEM_ACCESS_VOLATILE,				\
 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right,	\
-					  max, invert, 0) }
+					  0, max, invert, 0) }
 #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
 	.info = snd_soc_info_volsw, \
@@ -138,7 +128,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
 	.put = snd_soc_put_volsw, \
 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
-					  max, invert, 0) }
+					  0, max, invert, 0) }
 #define SOC_DOUBLE_SX_TLV(xname, xreg, shift_left, shift_right, xmin, xmax, tlv_array) \
 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -147,10 +137,8 @@ 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 = xreg, \
-		.shift = shift_left, .rshift = shift_right, \
-		.max = xmax, .min = xmin} }
+	.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
+					  xmin, xmax, 0, 0) }
 #define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \
 			     xinvert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
@@ -159,10 +147,8 @@ struct platform_device;
 	.tlv.p = (tlv_array), \
 	.info = snd_soc_info_volsw, \
 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
-	.private_value = (unsigned long)&(struct soc_mixer_control) \
-		{.reg = xreg, .rreg = xreg, \
-		 .shift = xshift_left, .rshift = xshift_right, \
-		 .min = xmin, .max = xmax, .invert = xinvert} }
+	.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
+					  xmin, xmax, xinvert, 0) }
 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -250,14 +236,14 @@ struct platform_device;
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_volsw, \
 	.get = xhandler_get, .put = xhandler_put, \
-	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, 0, xmax, xinvert, 0) }
 #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
 	 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_VALUE(reg, shift_left, shift_right, max, invert, 0) }
+		SOC_DOUBLE_VALUE(reg, shift_left, shift_right, 0, max, invert, 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), \
@@ -273,7 +259,7 @@ struct platform_device;
 	.tlv.p = (tlv_array), \
 	.info = snd_soc_info_volsw, \
 	.get = xhandler_get, .put = xhandler_put, \
-	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, 0, xmax, xinvert, 0) }
 #define SOC_SINGLE_RANGE_EXT_TLV(xname, xreg, xshift, xmin, xmax, xinvert, \
 				 xhandler_get, xhandler_put, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
@@ -282,10 +268,7 @@ struct platform_device;
 	.tlv.p = (tlv_array), \
 	.info = snd_soc_info_volsw_range, \
 	.get = xhandler_get, .put = xhandler_put, \
-	.private_value = (unsigned long)&(struct soc_mixer_control) \
-		{.reg = xreg, .rreg = xreg, .shift = xshift, \
-		 .rshift = xshift, .min = xmin, .max = xmax, \
-		 .invert = xinvert} }
+	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmin, xmax, xinvert, 0) }
 #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
 	 xhandler_get, xhandler_put, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -295,7 +278,7 @@ struct platform_device;
 	.info = snd_soc_info_volsw, \
 	.get = xhandler_get, .put = xhandler_put, \
 	.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
-					  xmax, xinvert, 0) }
+					  0, xmax, xinvert, 0) }
 #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
 	 xhandler_get, xhandler_put, tlv_array) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers
  2025-03-03 17:14 ` [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers Charles Keepax
@ 2025-03-03 18:53   ` Mark Brown
  2025-03-04  9:19     ` Charles Keepax
  0 siblings, 1 reply; 17+ messages in thread
From: Mark Brown @ 2025-03-03 18:53 UTC (permalink / raw)
  To: Charles Keepax
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 2402 bytes --]

On Mon, Mar 03, 2025 at 05:14:24PM +0000, Charles Keepax wrote:
> 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",
      |         ^~~~~~~~~~~~~~~~~~~~


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers
  2025-03-03 18:53   ` Mark Brown
@ 2025-03-04  9:19     ` Charles Keepax
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2025-03-04  9:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

On Mon, Mar 03, 2025 at 06:53:08PM +0000, Mark Brown wrote:
> On Mon, Mar 03, 2025 at 05:14:24PM +0000, Charles Keepax wrote:
> > 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",
>       |         ^~~~~~~~~~~~~~~~~~~~
> 

Apologies I will check that out and resend.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2 00/13] Tidy up ASoC VALUE control macros
  2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
                   ` (12 preceding siblings ...)
  2025-03-03 17:14 ` [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers Charles Keepax
@ 2025-03-04 16:53 ` Mark Brown
  13 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2025-03-04 16:53 UTC (permalink / raw)
  To: Charles Keepax
  Cc: lgirdwood, peda, andrei.simion, nuno.sa, paul, oder_chiou,
	kiseok.jo, shenghao-ding, kevin-lu, baojun.xu,
	srinivas.kandagatla, linux-sound, linux-kernel, patches

On Mon, 03 Mar 2025 17:14:11 +0000, Charles Keepax wrote:
> 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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-03-04 16:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-03 17:14 [PATCH v2 00/13] Tidy up ASoC VALUE control macros Charles Keepax
2025-03-03 17:14 ` [PATCH v2 01/13] ASoC: Remove unused helper macro Charles Keepax
2025-03-03 17:14 ` [PATCH v2 02/13] ASoC: rt715: Remove duplicate SOC_DOUBLE_R_EXT() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 03/13] ASoC: sma1307: Use SOC_SINGLE_EXT() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 04/13] ASoC: tas2562: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 05/13] ASoC: wcd938x: " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 06/13] ASoC: wm9712: Use SOC_SINGLE_EXT() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 07/13] ASoC: wm9713: Use SOC_DOUBLE_EXT() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 08/13] ASoC: wsa881x: Use SOC_SINGLE_EXT_TLV() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 09/13] ASoC: atmel: tse850-pcm5142: Use SOC_SINGLE_EXT() " Charles Keepax
2025-03-03 17:14 ` [PATCH v2 10/13] ASoC: dapm: Add missing SOC_DAPM_DOUBLE_R_TLV() helper Charles Keepax
2025-03-03 17:14 ` [PATCH v2 11/13] ASoC: dapm: Use ASoC control macros where possible Charles Keepax
2025-03-03 17:14 ` [PATCH v2 12/13] ASoC: Tidy up SOC_DOUBLE_R_* helpers Charles Keepax
2025-03-03 17:14 ` [PATCH v2 13/13] ASoC: Tidy up SOC_DOUBLE_* and SOC_SINGLE_* helpers Charles Keepax
2025-03-03 18:53   ` Mark Brown
2025-03-04  9:19     ` Charles Keepax
2025-03-04 16:53 ` [PATCH v2 00/13] Tidy up ASoC VALUE control macros Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox