[alsa-devel] "Negative" volume settings in a kcontrol
mike.looijmans at topic.nl
Tue May 28 13:46:15 CEST 2013
On 05/06/2013 03:22 PM, Clemens Ladisch wrote:
> Mike Looijmans wrote:
>> Some codec registers need negative values. For example,
>> sound/soc/codecs/tlv320aic32x4.c specifies this:
>> 78 SOC_DOUBLE_R_TLV("PCM Playback Volume", AIC32X4_LDACVOL,
>> 79 AIC32X4_RDACVOL, 0, 0x30, 0, tlv_step_0_5),
>> It's incomplete. The actual range is from -63.5dB to +24dB in 0.5 dB steps.
>> The 8-bit value is interpreted as a signed 8-bit integer, so to get -3dB
>> the register value must be -6 or 0xFA.
>> How do I explain that to Alsa?
> There are some ASoC helper macros that handle signed register fields, such
> as SOC_DOUBLE_S8_TLV and SOC_SINGLE_XR_SX. If those don't do what you want,
> you have to write your own.
SOC_DOUBLE_S8_TLV seems to be a misnamed hardware-specific macro. It
provides no way to specify the location of the left/right bits so the
macro name is misleading.
SOC_SINGLE_XR_SX is too new for my kernel. And from what I gather, I
cannot use it anyway for my purposes. So the solution turns out to be
"write my own". The SOC_DOUBLE_S8_TLV macro did provide a very nice
starting point though.
Thanks for the pointer though, it turned out to be the key to a solution.
>> (and on a side note "amixer" doesn't accept negative values either)
> A workaround would be to set the control value first to 0 and then to
> the desired negative value ... but this bug needs fixing.
I have no idea what you meant here.
More information about the Alsa-devel