linux-stable/sound/soc
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
..
adi ASoC: adi: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:44 +00:00
amd ASoC: amd: renoir: Remove redundant assignment to pdm_ctrl and pdm_enable and pdm_dma_enable 2021-05-10 13:05:32 +01:00
atmel ASoC: atmel: atmel-i2s: remove useless initialization 2021-03-31 18:03:16 +01:00
au1x ASoC: au1x: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:46 +00:00
bcm Merge remote-tracking branch 'asoc/for-5.13' into asoc-next 2021-04-23 19:01:02 +01:00
cirrus ASoC: cirrus: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:48 +00:00
codecs ASoC: codecs: Add driver for NXP/Goodix TFA989x (TFA1) amplifiers 2021-05-24 09:51:32 +01:00
dwc ASoC: dwc: Fix -Wmissing-prototypes warnings 2021-03-29 17:28:13 +01:00
fsl ASoC: imx-card: Add imx-card machine driver 2021-05-20 17:57:30 +01:00
generic ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2 2021-04-23 18:13:32 +01:00
hisilicon ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup() 2021-05-18 14:04:32 +01:00
img
intel ASoC: Intel: sof_sdw: add quirk support for Brya and BT-offload 2021-05-21 18:40:45 +01:00
jz4740 ASoC: jz4740-i2s: fix function name 2021-05-10 17:06:04 +01:00
kirkwood
mediatek ASoC: mediatek: mt8192: Delete a redundant condition branch 2021-05-10 13:05:33 +01:00
meson ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC 2021-05-19 14:19:05 +01:00
mxs ASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata 2021-03-10 13:07:06 +00:00
pxa ASoC: pxa: remove useless assignment 2021-03-31 18:03:19 +01:00
qcom ASoC: q6dsp: Undo buggy warning fix 2021-05-12 13:02:52 +01:00
rockchip ASoC: rockchip: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:50 +00:00
samsung ASoC: samsung: tm2_wm5110: remove shadowed variable 2021-03-12 20:45:41 +00:00
sh ASoC: rsnd: add usage for SRC 2021-04-14 15:24:14 +01:00
sof ASoC: SOF: Intel: hda: Remove conditions against CONFIG_PCI 2021-05-21 13:13:41 +01:00
spear
sprd
sti ASoC: sti: sti_uniperif: add missing MODULE_DEVICE_TABLE 2021-04-13 12:33:45 +01:00
stm ASoC: stm32: do not request a new clock consummer reference 2021-04-28 16:34:53 +01:00
sunxi Merge remote-tracking branch 'asoc/for-5.13' into asoc-next 2021-04-23 19:01:02 +01:00
tegra ASoC: tegra: mark runtime-pm functions as __maybe_unused 2021-04-22 16:27:37 +01:00
ti sound updates for 5.13 2021-04-30 12:48:14 -07:00
uniphier ASoC: uniphier: Simplify the return expression of uniphier_aio_startup 2021-03-10 13:07:15 +00:00
ux500 ASoC: ux500: mop500: align function prototype 2021-03-31 18:03:28 +01:00
xilinx
xtensa
Kconfig ASoC: topology: adhere to KUNIT formatting standard 2021-04-14 15:26:24 +01:00
Makefile ASoC: topology: adhere to KUNIT formatting standard 2021-04-14 15:26:24 +01:00
soc-ac97.c
soc-acpi.c ASoC: soc-acpi: remove useless initialization 2021-04-19 14:03:29 +01:00
soc-card.c
soc-component.c ASoC: soc-component: Add snd_soc_pcm_component_ack 2021-03-25 13:58:06 +00:00
soc-compress.c ASoC: soc-compress: lock pcm_mutex to resolve lockdep error 2021-04-09 13:39:44 +01:00
soc-core.c ASoC: soc-core: use DEVICE_ATTR_RO macro 2021-05-18 14:04:31 +01:00
soc-dai.c ASoC: soc-dai: fix up hw params only if it is needed 2021-05-19 14:19:08 +01:00
soc-dapm.c ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx() 2021-03-19 12:24:04 +00:00
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-jack.c
soc-link.c
soc-ops.c ASoC: soc-ops: remove useless assignment 2021-03-10 13:06:53 +00:00
soc-pcm.c ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry() 2021-04-16 14:34:13 +01:00
soc-topology-test.c ASoC: topology: KUnit: Convert from cpu to data format 2021-02-02 17:08:21 +00:00
soc-topology.c ASoC: topology: Fix using uninitialized pointer 2021-05-20 17:57:28 +01:00
soc-utils.c ASoC: soc-utils: add snd_soc_component_is_dummy() 2021-04-16 14:34:12 +01:00