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

From: Charles Keepax
Date: Tue Mar 04 2025 - 04:20:31 EST


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