[Letux-kernel] Audio Offset for handsfree speakers

H. Nikolaus Schaller hns at goldelico.com
Wed Dec 1 19:04:33 CET 2021


Hi,

> Am 01.12.2021 um 12:33 schrieb Michael Mrozek <EvilDragon at openpandora.org>:
> 
> Hi,
> 
> I just had a visit from the manufacturers of the speakers we use in my
> office and showed them the finished Pyra.
> 
> As many expected, the distortion we have at higher volumes comes from
> an improper offset / bias.
> 
> You can clearly see that because the speaker moves up as soon as the
> audio stream is enabled but no audio is played yet.
> 
> However, it doesn't only affect the distortion but also the general
> audio quality, as the membrane is not able to move properly for low
> frequencies when it's already close to its limit due to the improper
> offset.
> 
> So I'd like to take another look at the Bias / Offset for the speakers.
> 
> According the TWL6040 datasheet, there is this register:
> Table 4-45: HFOTRIM register 
> 
> It's register 0X2C, it's R/W.
> Bit address 7:4 is for the right speaker and 3:0 for the left one
> 
> The default value is 0x0, and it can be changed up to 0xF to compensate
> for a positive / negative offset.
> 
> Just changing one register does sound easy enough to do - but as a
> non-developer, I need help with that.
> 
> Does the driver already support that?

Well, there is code - but it is not in operation and likely very broken:

https://git.goldelico.com/?p=letux-kernel.git;a=blobdiff;f=sound/soc/ti/omap-abe-twl6040.c;h=18167ae58410accdba6834c1a05805d48ae9cf6d;hp=576215f90ddb4deffa6f65986a780963f7d935ef;hb=5046975492e8cb9d0ba08aa18f4ca68a6e34497e;hpb=6aa328535c43caafa1218b3bef72d72d84293f2c

> If not, is it hard to implement?

Some definitions are also there:

https://git.goldelico.com/?p=letux-kernel.git;a=blob;f=sound/soc/codecs/twl6040.h;h=f4f4b14cc0c4f75463187fa00b7b3e6e33b61608;hb=2f2d34f0d2e2b29e25d45dfc93b7677b10988329

What I am not sure is if this is just code to prepare the aess driver/firmware
to write these registers.

> 
> Can I set the register directly for testing to find the proper value?
> If so, how? (Which command do I need to run to change it?)

Since the chip is connected by i2c you can write registers by i2cset
or probably better is through the debugfs which allows to read/write regmaps.

> Thanks for your help in advance :)

Hope this gives some hints for someone to take a deeper look into
the abe/aess code. The full code branch is here:

https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/aess-v7

And I have added the letuxos list to cc: Maybe someone with ideas
is reading there.

BR,
Nikolaus



More information about the Letux-kernel mailing list