Headphone volume adjustment

James Cameron quozl at laptop.org
Fri Jul 5 19:47:33 EDT 2013

On Fri, Jul 05, 2013 at 09:48:05AM -0600, Daniel Drake wrote:
> Hi,
> On Fri, Jul 5, 2013 at 12:40 AM, James Cameron <quozl at laptop.org> wrote:
> > Fixed for XO-4 in:
> >
> > http://dev.laptop.org/git/olpc-kernel/commit/?h=arm-3.5&id=e77de3d4ec7589af2e88014018c69528ceab3293
> Thanks for looking at this.
> I'm trying to review the change. I am a bit stuck though, because I
> still don't understand the answer to the opening question on this
> thread: is this a bug or by design?

Yes, both a bug always there and a bug introduced by a design change.

I wasn't directly involved at the time, but from memory of work by
Saadia and Mitch the audio did not work well until a major rework to
reduce the control set and routes (arm-3.5 7632883).

The bug was made obvious at that point, because the maximum
attenuation when using headphones was changed from -96.625 dB to
-46.5 dB, a 50.125 dB boost.

> Do I gather correctly from your initial response that it is by
> design that the headphone volume slider does not cover the full
> range offered by the hardware? That is, if I use alsamixer to set
> the volume as low as it will go, the value programmed to the
> hardware is not the lowest that the hardware can go? If that is the
> case, why?

Briefly: Yes.  Yes.  Because the DAC does not provide infinite
attenuation at the minimum setting.


An analog volume control you may be familiar with is a centre tapped
variable resistor, with the signal coming in on one end of the
resistor, the signal leaving from the wiper, and the other end of the
resistor grounded.  When the wiper is at minimum setting, the output
signal is grounded, and no sound is heard.  This can be thought of as
infinite attenuation.

The codec we are using has three digital "volume" controls pertinent
to this discussion:

- the DAC,

- the headphones,

- the speaker amplifier.

On XO-1.75 we preset the latter two and vary the first, calling the
first Master and exporting three controls to user space.

On XO-4 we preset the first and vary the latter two, exporting one
Master control to user space which controls both.

Each control is a variable attenuator or amplifier, specified to
provide an attenuation or amplification in dB.  The low end of the
scale does not reach infinite attenuation.

The DAC volume control has the greatest range, all the way down to
-96.625 dB, which coupled to our XO-1.75 hardware is effectively
silent, but not guaranteed to be.  You can see the details of this
control in the XO-1.75 and XO-4 source ... search for dac_vol_tlv.

The speaker amplifier control has a range of 58.5 dB.  With this set
to minimum on our XO-4 hardware it is also effectively silent but not
guaranteed to be.

The headphones control has the least range, of down to -46.5 dB.  With
our XO-4 hardware and typical headphones, and sufficiently loud audio
data, it is certainly not silent.

Each of the paths also has a mute, which can be considered infinite

On Fri, Jul 05, 2013 at 05:54:44PM +0200, Jon Nettleton wrote:
> Is this a by-product of a different design decision.  I think it was
> for the xo-1.75 that we implemented a feature that limited the max
> volume of the headphone jack.  This is actually a requirement for EU
> sales.  Is it a possibility that the range got shifted in the wrong
> direction?

XO-1.75 is less "safe" than XO-4, since on XO-1.75 user space has
controls that allow too wide a range of amplification.  We don't
expose these controls in Sugar or GNOME.

I don't recall any design decision like that.  As far as I can tell we
ended up with a different control set and routes because the previous
control set and routes couldn't be made to work reliably with the new
kernel in the time available.

(And now that I've begun to understand the complexity of this codec, I
can appreciate the problems that Saadia and Mitch had with it!)

James Cameron

More information about the Devel mailing list