ASoC: dt-bindings: codecs: Add bindings for nxp,tfa989x
Subsystems (4)
Stephan Gerhold
maintainerRFC PATCH 1/2 ASoC: dt-bindings: codecs: Add bindings for nxp,tfa989x
NXP/Goodix TFA989X (TFA1) amplifiers are controlled via an I2C bus. Add simple device tree bindings that describe how to set them up in the device tree.
Right now only nxp,tfa9895 is supported but this will be extended to at least nxp,tfa9897 in the near future.
--- .../bindings/sound/nxp,tfa989x.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml new file +54 -0
@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nxp,tfa989x.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP/Goodix TFA989X (TFA1) Audio Amplifiers + +maintainers: + - Stephan Gerhold <[email protected]> + +properties: + compatible: + enum: + - nxp,tfa9895 + + reg: + maxItems: 1 + + '#sound-dai-cells': + const: 0 + + sound-name-prefix: + $ref: /schemas/types.yaml#/definitions/string + description: + Used as prefix for sink/source names of the component. Must be a + unique string among multiple instances of the same component. + +required: + - compatible + - reg + - '#sound-dai-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + audio-codec@34 { + compatible = "nxp,tfa9895"; + reg = <0x34>; + sound-name-prefix = "Speaker Left"; + #sound-dai-cells = <0>; + }; + audio-codec@36 { + compatible = "nxp,tfa9895"; + reg = <0x36>; + sound-name-prefix = "Speaker Right"; + #sound-dai-cells = <0>; + }; + };
Signature · 1 line
2.31.1
Stephan Gerhold
maintainerRFC PATCH 2/2 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]: https://github.com/sonyxperiadev/kernel/blob/57b5050e340f40a88e1ddb8d16fd9adb44418923/sound/soc/codecs/tfa98xx.c#L1422-L1462
--- MAINTAINERS | 7 + sound/soc/codecs/Kconfig | 11 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tfa989x.c | 298 +++++++++++++++++++++++++++++++++++++ 4 files changed, 318 insertions(+) create mode 100644 sound/soc/codecs/tfa989x.c
MAINTAINERS +7 -0
@@ -13204,6 +13204,13 @@ S: Maintained F: Documentation/devicetree/bindings/sound/tfa9879.txt F: sound/soc/codecs/tfa9879* +NXP/Goodix TFA989X (TFA1) DRIVER +M: Stephan Gerhold <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml +F: sound/soc/codecs/tfa989x.c + NXP-NCI NFC DRIVER M: Clément Perrochaud <[email protected]> R: Charles Gorand <[email protected]>
sound/soc/codecs/Kconfig +11 -0
@@ -211,6 +211,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_TAS6424 imply SND_SOC_TDA7419 imply SND_SOC_TFA9879 + imply SND_SOC_TFA989X imply SND_SOC_TLV320ADCX140 imply SND_SOC_TLV320AIC23_I2C imply SND_SOC_TLV320AIC23_SPI
@@ -1408,6 +1409,16 @@ config SND_SOC_TFA9879 tristate "NXP Semiconductors TFA9879 amplifier" depends on I2C +config SND_SOC_TFA989X + tristate "NXP/Goodix TFA989X (TFA1) amplifiers" + depends on I2C + select REGMAP_I2C + help + Enable support for NXP (now Goodix) TFA989X (TFA1 family) speaker + amplifiers, e.g. TFA9895. + Note that the driver currently bypasses the built-in "CoolFlux DSP" + and does not support (hardware) volume control. + config SND_SOC_TLV320AIC23 tristate
sound/soc/codecs/Makefile +2 -0
@@ -229,6 +229,7 @@ snd-soc-tas6424-objs := tas6424.o snd-soc-tda7419-objs := tda7419.o snd-soc-tas2770-objs := tas2770.o snd-soc-tfa9879-objs := tfa9879.o +snd-soc-tfa989x-objs := tfa989x.o snd-soc-tlv320aic23-objs := tlv320aic23.o snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
@@ -551,6 +552,7 @@ obj-$(CONFIG_SND_SOC_TAS6424) += snd-soc-tas6424.o obj-$(CONFIG_SND_SOC_TDA7419) += snd-soc-tda7419.o obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o +obj-$(CONFIG_SND_SOC_TFA989X) += snd-soc-tfa989x.o obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
sound/soc/codecs/tfa989x.c new file +298 -0
298 lines not on this page · raw message
Signature · 1 line
2.31.1
Re: [RFC PATCH 1/2] ASoC: dt-bindings: codecs: Add bindings for nxp, tfa989x
In reply to Stephan GerholdQuoted 4 lines · Stephan Gerhold
NXP/Goodix TFA989X (TFA1) amplifiers are controlled via an I2C bus. Add simple device tree bindings that describe how to set them up in the device tree.
Quoted 9 lines
Right now only nxp,tfa9895 is supported but this will be extended to at least nxp,tfa9897 in the near future.
Signed-off-by Stephan Gerhold <[email protected]>--- .../bindings/sound/nxp,tfa989x.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml
Mark Brown
maintainerRe: [PATCH RFC 1/2] ASoC: dt-bindings: codecs: Add bindings for nxp, tfa989x
In reply to Stephan GerholdQuoted 6 lines · Stephan Gerhold
NXP/Goodix TFA989X (TFA1) amplifiers are controlled via an I2C bus. Add simple device tree bindings that describe how to set them up in the device tree.
Right now only nxp,tfa9895 is supported but this will be extended to at least nxp,tfa9897 in the near future.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: dt-bindings: codecs: Add bindings for nxp, tfa989x
commit: 17ba36b704692a433d38cb230e99ec333ecd14a2
[2/2] ASoC: codecs: Add driver for NXP/Goodix TFA989x (TFA1) amplifiers
commit: af00978a0a06bab60bd5adf54a65ea69d19ce35dAll being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark