linux-stable/sound
Stephan Gerhold af00978a0a
ASoC: codecs: Add driver for NXP/Goodix TFA989x (TFA1) amplifiers
NXP's TFA98xx (now part of Goodix) are fairly popular speaker amplifiers
used in many smartphones and tablets. Most of them are sold as "smart
amplifiers" with built-in "CoolFlux DSP" that is used for volume control,
plus a "sophisticated speaker-boost and protection algorithm".

Unfortunately, they are also almost entirely undocumented. The short
datasheets (e.g. [1] for TFA9897) describe the available features,
but do not provide any information about the registers or how to use
the "CoolFlux DSP".

The amplifiers are most often configured through proprietary userspace
libraries. There are also some (rather complex) kernel drivers (e.g. [2])
but even those rely on obscure firmware blobs for configuration (so-called
"containers"). They seem to contain different "profiles" with tuned speaker
settings, sample rates and volume steps (which would be better exposed
as separate ALSA mixers).

The format of the firmware files seems to have changed a lot over the time,
so it's not even possible to simply re-use the firmware originally provided
by the vendor.

Overall, it seems close to impossible to develop a proper mainline driver
for these amplifiers that could make proper use of the built-in DSP.

This commit implements a compromise: At least the TFA1 family of the
TFA98xx amplifiers (usually called TFA989x) provide a way to *bypass*
the DSP using a special register sequence. The register sequence can be
found in similar variations in the kernel drivers from lots of vendors
e.g. in [3] and was probably mainly used for factory testing.

With the DSP bypassed, the amplifier acts mostly like a dumb standard
speaker amplifier, without (hardware) volume control. However, the setup
is much simpler and it works without any obscure firmware.

This driver implements the DSP bypass combined with chip-specific
initialization sequences adapted from [2]. Only TFA9895 is supported in
this initial commit. Except for the lack of volume control I can not hear
any difference with or without the DSP, it works just fine.

This driver allows the speaker to work on mainline Linux running on the
Samsung Galaxy A3/A5 (2015) [TFA9895] and Alcatel Idol 3 [TFA9897].
TFA9897 support will be added in separate patch set later.

[1]: https://product.goodix.com/en/docview/TFA9897%20SDS_Rev.3.1?objectId=47&objectType=document&version=78
[2]: https://source.codeaurora.org/external/mas/tfa98xx
[3]: 57b5050e34/sound/soc/codecs/tfa98xx.c (L1422-L1462)

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210513104129.36583-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-24 09:51:32 +01:00
..
ac97 ALSA: ac97: Constify static struct attribute_group 2021-01-31 09:49:58 +01:00
aoa ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
arm ARM updates for 5.12-rc1: 2021-02-22 14:27:07 -08:00
atmel
core ALSA: control: Fix racy management of user ctl memory size account 2021-04-16 09:57:49 +02:00
drivers Merge branch 'for-linus' into for-next 2021-04-09 09:57:03 +02:00
firewire ALSA: control - add generic LED API 2021-03-30 17:42:40 +02:00
hda ALSA: control - add generic LED API 2021-03-30 17:42:40 +02:00
i2c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
isa ALSA: sb: Fix two use after free in snd_sb_qsound_build 2021-04-26 18:01:07 +02:00
mips module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
oss ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
parisc
pci ALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP 2021-05-06 10:46:36 +02:00
pcmcia module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ppc ALSA: control - add generic LED API 2021-03-30 17:42:40 +02:00
sh module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
soc ASoC: codecs: Add driver for NXP/Goodix TFA989x (TFA1) amplifiers 2021-05-24 09:51:32 +01:00
sparc module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
spi
synth
usb ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8 2021-05-03 13:35:58 +02:00
virtio ALSA: virtio: fix kernel-doc 2021-04-27 08:39:39 +02:00
x86 module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
xen module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
ac97_bus.c
Kconfig ALSA: virtio: add virtio sound driver 2021-03-07 09:07:16 +01:00
last.c
Makefile ALSA: virtio: add virtio sound driver 2021-03-07 09:07:16 +01:00
sound_core.c