[alsa-devel] soc.h macros

Jon Smirl jonsmirl at gmail.com
Sat Jul 26 06:26:13 CEST 2008


Can you help me document these macros?

For example what does TLV stand for? I know it supplies a decibel range.
R really mean two registers. What does EXT do?
How about S8?

#define SOC_SINGLE(xname, reg, shift, max, invert)
#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array)
#define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert)
#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert)
#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax,
xinvert, tlv_array)
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax,
xinvert, tlv_array)
#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array)
#define SOC_ENUM(xname, xenum)
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,
xhandler_get, xhandler_put)
#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,
xhandler_get, xhandler_put, tlv_array)
#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put)
#define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)

SOC_ENUM("3D Function", wm8753_enum[5]),
SOC_ENUM seems really inefficient tracking those enum numbers.
Could you declare the enum in place?

#define SOC_ENUM_SINGLE(xname, xreg, xshift, xmax, xtexts) \
{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
	.info = snd_soc_info_enum_double, \
	.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
	.private_value = (unsigned long) &(struct soc_enum) \
	.reg = xreg, .shift_l = xshift, .shift_r = xshift, \
	.max = xmax, .texts = xtexts }

Is it possible to turn all of these macros into inline functions? Can
an inline initialize a structure? Making them inlines would get us
syntax checking without expansion.

I'm having some success getting 32b wide controls working.

-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list