Skip to contentSkip to conversation

ASoC: Add macros for signed TLV controls with callbacks

PATCH Superseded Richard Fitzgerald 2 participants 5 messages Apr 22, 2022 – Apr 25, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ASoC: Add macros for signed TLV controls with callbacks

This adds SOC_DOUBLE_R_S_EXT_TLV and SOC_SINGLE_S_EXT_TLV macros for signed TLV controls that need custom get/put callbacks. These will be needed by future Cirrus codec drivers, but are not particularly exotic so could be useful for others.

Richard Fitzgerald (1):
ASoC: soc.h: Add SOC_SINGLE_S_EXT_TLV macro

Simon Trimmer (1):
ASoC: soc.h: Introduce SOC_DOUBLE_R_S_EXT_TLV() macro

 include/sound/soc.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 ASoC: soc.h: Introduce SOC_DOUBLE_R_S_EXT_TLV() macro

From: Simon Trimmer <[email protected]>

A straightforward extension of the SOC_DOUBLE_R_S_TLV() macro that allows the get and put functions to be customised.

---
 include/sound/soc.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/sound/soc.h +11 -0
index 2d3261799d2c..8368b69dfef8 100644
@@ -282,6 +282,17 @@
 	.get = xhandler_get, .put = xhandler_put, \
 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
 					    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) \
+{	.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 = xhandler_get, .put = xhandler_put, \
+	.private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
+					      xmin, xmax, xsign_bit, xinvert) }
 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_bool_ext, \
Signature · 1 line
2.30.2
maintainer
#2 lore raw

Re: [PATCH 1/2] ASoC: soc.h: Introduce SOC_DOUBLE_R_S_EXT_TLV() macro

Quoted 7 lines · Richard Fitzgerald

From: Simon Trimmer <[email protected]>

A straightforward extension of the SOC_DOUBLE_R_S_TLV() macro that allows the get and put functions to be customised.

---

You've not provided a Signed-off-by for this so I can't do anything with it, please see Documentation/process/submitting-patches.rst for details on what this is and why it's important.

#3 lore raw

Re: [PATCH 1/2] ASoC: soc.h: Introduce SOC_DOUBLE_R_S_EXT_TLV() macro

Quoted 6 lines · Mark Brown
Quoted 5 lines · Richard Fitzgerald

From: Simon Trimmer <[email protected]>

A straightforward extension of the SOC_DOUBLE_R_S_TLV() macro that allows the get and put functions to be customised.

Quoted 7 lines
Quoted 2 lines

---

You've not provided a Signed-off-by for this so I can't do anything with it, please see Documentation/process/submitting-patches.rst for details on what this is and why it's important.

Damn, sorry. Would be nice if checkpatch warned about that.

#4 lore raw

PATCH 2/2 ASoC: soc.h: Add SOC_SINGLE_S_EXT_TLV macro

In reply to Richard Fitzgerald

Add a SOC_SINGLE_S_EXT_TLV macro as a convenience wrapper around SOC_DOUBLE_R_S_EXT_TLV for mono volume controls.

---
 include/sound/soc.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/sound/soc.h +6 -0
index 8368b69dfef8..f906e5a70830 100644
@@ -293,6 +293,12 @@
 	.get = xhandler_get, .put = xhandler_put, \
 	.private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
 					      xmin, xmax, xsign_bit, xinvert) }
+#define SOC_SINGLE_S_EXT_TLV(xname, xreg, xshift, xmin, xmax, \
+			     xsign_bit, xinvert, xhandler_get, xhandler_put, \
+			     tlv_array) \
+	SOC_DOUBLE_R_S_EXT_TLV(xname, xreg, xreg, xshift, xmin, xmax, \
+			       xsign_bit, xinvert, xhandler_get, xhandler_put, \
+			       tlv_array)
 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
 {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
 	.info = snd_soc_info_bool_ext, \
Signature · 1 line
2.30.2