Re: [PATCH] ASoC: codecs: wcd938x: fix dB range for HPHL and HPHR

From: Mark Brown
Date: Fri Jul 07 2023 - 09:35:41 EST


On Fri, Jul 07, 2023 at 03:30:48PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > It's moderately common - typically in these cases the control is
> > described in the datasheet as an attenuation control rather than a gain,
> > and this usually corresponds to the physical implementation being only
> > able to make signals smaller relative to the reference.

> Yeah, I see the use case. The problem is, however, that we're using
> the very same dB info for both gain and attenuation. That means,
> application has no idea how to interpret those dB values -- to be
> added or to be subtracted.

> We should have defined a new TLV type for attenuation to
> differentiate, and define the TLV macro to give proper min/max.

The ASoC generic control stuff supports inverting the value prior to
presentation to userspace so it's masked there (instead of writing the
number userspace sees to the register we subtract the number from the
maximum value and write that to the register), pulling that up further
to the ALSA core might be nice I guess?

Attachment: signature.asc
Description: PGP signature