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

From: Takashi Iwai
Date: Fri Jul 07 2023 - 09:48:03 EST


On Fri, 07 Jul 2023 15:35:29 +0200,
Mark Brown wrote:
>
> 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?

I believe yes. Though, I'm still not sure how we can improve the
mismatch of dB min/max. The dB values of those inverted controls
reflect the result of subtraction, no?


Takashi