All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: Defining "signed integer" mixer controls?
@ 2010-06-03  1:07 Stuart Longland
  2010-06-03  7:09 ` James Courtier-Dutton
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stuart Longland @ 2010-06-03  1:07 UTC (permalink / raw)
  To: alsa-devel

Hi all...

I'm posting this via GMane since my server at home seems to be down, 
hopefully it gets through.  I hope to put a version of the TLV320AIC3204 
driver that I've been working on up there -- I did try posting it to the 
list, but I suspect it's either been left in the moderation queue or 
silently dropped.  In short, I got the sound working; just testing 
playback for now... Recording should work, once I get the mixer set up.

My query though; the mixer on this CODEC provides gain settings, 
helpfully scaled in dB, as signed integers.  For instance; the four line 
level output drivers: Headphone left/right,and Line Out left/right, can 
all be adjusted in gain from -6dB through to +29dB.

These are set in individual registers as the lower 6 bits; so:
	-6 dB is represented as 111010 (0x3a)
	29 dB is represented as 011101 (0x1d)

At the moment, things "half work" with the following code:
/*
  * DAC digital volumes. From -63.5 to +24 dB in 0.5 dB steps
  */
static DECLARE_TLV_DB_MINMAX(dac_tlv, -6350, 2400);
/* ADC PGA gain volumes. From 0 to 59.5 dB in 0.5 dB steps */
static DECLARE_TLV_DB_MINMAX(adc_tlv, 0, 0);
/*
  * Output driver stage volumes; -6dB through to +29dB
  */
static DECLARE_TLV_DB_MINMAX(output_stage_tlv, -600, 2900);

static const struct snd_kcontrol_new aic3204_snd_controls[] = {
	/* Output */
	SOC_DOUBLE_R_TLV("Headphone Output Volume",
			 AIC3204_HPLGAIN, AIC3204_HPRGAIN,
			 0, 29, 0, output_stage_tlv),
	SOC_DOUBLE_R_TLV("Line Output Volume",
			 AIC3204_LOLGAIN, AIC3204_LORGAIN,
			 0, 29, 0, output_stage_tlv),
	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?

Regards,
Stuart Longland

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-06-04 11:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03  1:07 ASoC: Defining "signed integer" mixer controls? Stuart Longland
2010-06-03  7:09 ` James Courtier-Dutton
2010-06-03 11:21   ` Mark Brown
2010-06-03 12:09     ` James Courtier-Dutton
2010-06-03  8:25 ` Clemens Ladisch
2010-06-03 10:33   ` Stuart Longland
2010-06-03 15:52     ` James Courtier-Dutton
2010-06-03 11:20 ` Mark Brown
2010-06-04  9:27   ` Stuart Longland
2010-06-04 11:28     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.