[alsa-devel] ASoC: Defining "signed integer" mixer controls?

Stuart Longland redhatter at gentoo.org
Thu Jun 3 12:33:22 CEST 2010


On Thu, Jun 03, 2010 at 10:25:16AM +0200, Clemens Ladisch wrote:
> Stuart Longland wrote:
> > /* ADC PGA gain volumes. From 0 to 59.5 dB in 0.5 dB steps */
> > static DECLARE_TLV_DB_MINMAX(adc_tlv, 0, 0);
> 
> The comment is wrong, this control goes from 0 to 0 dB.
> 
> > 	SOC_DOUBLE_R_TLV("PCM Playback Volume",
> > 			 AIC3204_LDACVOL, AIC3204_RDACVOL,
> > 			 0, 127, 0, dac_tlv),
> > 
> > However; it treats the bitfield as unsigned, which is wrong in this
> > case.  The bitfield is a signed integer in two's complement format.  How
> > do I convince ALSA that these integers have a sign bit?
> 
> ALSA's controls use signed values, it's the SOC_ macros that assume
> bitfields.  You should be able to define a control with your own
> callbacks like in a non-ASoC driver.

Ahh okay... makes sense... I'll have a closer look; perhaps some
additional macros could be written to allow use of signed integer
bitfields as well.  I'm sure the TLV320AIC3204 is not the only CODEC
that uses such beasts.
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.


More information about the Alsa-devel mailing list