[Letux-kernel] Audio Offset for handsfree speakers

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


> 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:


> If not, is it hard to implement?

Some definitions are also there:


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:


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


More information about the Letux-kernel mailing list