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

From: Takashi Iwai
Date: Fri Jul 07 2023 - 09:30:59 EST


On Fri, 07 Jul 2023 15:22:45 +0200,
Mark Brown wrote:
>
> On Fri, Jul 07, 2023 at 03:20:10PM +0200, Takashi Iwai wrote:
> > Srinivas Kandagatla wrote:
>
> > > yes, the highest value corresponds to lowest dB which is why its inverted.
>
> > Ouch, that's a bad design choice...
>
> 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.


Takashi