Skip to contentSkip to conversation

ASoC: codecs: Add support for FourSemi FS2104/5S

PATCH Superseded Nick 2 participants 8 messages Jul 23, 2025 – Aug 12, 2025

Subsystems (4)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Nick

author maintainer
#0 lore raw

v5 cover ASoC: codecs: Add support for FourSemi FS2104/5S

The FS2104/5S are Inductor-Less, Stereo, Closed-Loop, Digital Input Class-D Power Amplifiers with Enhanced Signal Processing FS2104 can deliver 2x15W into 4ohm BTL speaker loads, FS2105S can deliver 2x30W into 8ohm BTL speaker loads.

Most functions have been built and tested on EVB boards:
ARMv8-A, Linux version 6.16.0-rc6-v8

v4 -> v5:
* patch#0
- Update change logs of the cover letter
Add the related reviewers after the change items
* patch#2
- Add supplies(pvdd&dvdd) to section: required (Krzysztof)
* patch#5
- Update MAINTAINERS for new files

v3 -> v4:
* patch#1
- add reviewed-by Krzysztof
* patch#2
- add reviewed-by Rob Herring
* patch#4
- Fix warnings reported by clang-20(W=1): (kernel test robot)
warnings: variable 'ret' is used uninitialized

v2 -> v3:
.../foursemi,fs2105s.yaml(patch 0002)
- Drop "schema for " in the patch subject (Krzysztof)
- Delete the description of the property reg (Krzysztof)
- Restore the property clocks to v1 (Krzysztof)
- Keep the same order as in list of properties (Krzysztof)

.../Kconfig(patch 0004)
- Fix warning reported by running checkpatch.pl (Krzysztof) Write the help of config symbol with at least 4 lines

.../fs210x.c/h(patch 0004)
- Update entries comment to C++ style (Mark Brown)
- Use linux/gpio/consumer.h instead of linux/of_gpio.h (Krzysztof)
- Use a private lock instead of a global one (Krzysztof)
- Delete driver version and log (Mark Brown)
- Drop checking of pval in fs210x_reg_read (Mark Brown)
- Drop most of the debug logs and unused codes (Mark Brown&Krzysztof)
- Drop registers dumping in monitor (Mark Brown)
- Use fsleep instead of usleep_range (Mark Brown)
- Update mixer to a standard control: (Mark Brown)
PCM Playback Volume
- Add 2 new standard controls: (Mark Brown)
DAC Mute Switch: Mute/Unmute
DAC Fade Switch: Fade enable/disable
- Fix errors reported by mixer-test in mixer: (Mark Brown)
Effect Scene
- Integrate the operation of reset(sdz) pin into chip init/reset (Mark Brown)
- Add DAPM event for playback: (Mark Brown)
Start/stop device in DAPM instead of mute_stream
Start/stop delay works in mute_stream only
- Drop use_pmdown_time in component driver for DAPM event
- Add dai ops startup: (Mark Brown)
Report format&sample rates in constraints
- Add dai ops trigger: (Mark Brown)
Start device in trigger when we can't obtain/control the bclk clock
- Use description words: PROVIDER, consumer (Mark Brown)
- Add a sysfs node for monitor period(fs210x->check_interval_ms) (Mark Brown)
- Do the initialisations of delayed works and clock in i2c probe (Mark Brown)
- Prevent new work after the device is suspended (Mark Brown)
- Update regmap cache type to MAPLE (Mark Brown)
Define volatile registers
- Simplify the logic of getting and setting clock (Krzysztof)
- Simplify the logic of getting and setting reset gpio (Krzysztof)
- Use dev_err_probe for error logs (Krzysztof)
- Drop fs210x_parse_platdata and use fs210x_parse_dts in fs210x_init (Krzysztof)
- Drop null checking for regmap in i2c probe (Krzysztof)
- Drop the lock in i2c probe (Krzysztof)
- Add a suffix(instances id) to dai name
- Drop compatible of "foursemi,fs2104" (Krzysztof)
- Drop ifdef CONFIG_OF and of_match_ptr (Krzysztof)

v1 -> v2:
- Adjust the order of patches according to the dependency relationship (Krzysztof)
- Rename yaml file to foursemi,fs2105s.yaml (Krzysztof)
- Fix some properties and wrong definitions in foursemi,fs2105s.yaml: (Krzysztof) sdz-gpios -> reset->gpios
fs,fwm-name -> firmware-name
Delete fs,dai-name
- Drop "dt-bindings for" from subject (Krzysztof)
- Update the driver code according to the update of DT schema (Krzysztof)
- Fix warnings/errors reported by running checkpatch.pl --strict (Krzysztof)
- Fix warnings/errors reported by running make dt_bindings_check (Rob Herring)

Nick Li (4):
dt-bindings: vendor-prefixes: Add Shanghai FourSemi Semiconductor

    Co.,Ltd

ASoC: dt-bindings: Add FS2104/5S audio amplifiers
ASoC: codecs: Add library for FourSemi audio amplifiers
ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver

 .../bindings/sound/foursemi,fs2105s.yaml      |   99 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 sound/soc/codecs/Kconfig                      |   16 +
 sound/soc/codecs/Makefile                     |    4 +
 sound/soc/codecs/fs-amp-lib.c                 |  265 +++
 sound/soc/codecs/fs-amp-lib.h                 |  150 ++
 sound/soc/codecs/fs210x.c                     | 1583 +++++++++++++++++
 sound/soc/codecs/fs210x.h                     |   75 +
 8 files changed, 2194 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/foursemi,fs2105s.yaml
 create mode 100644 sound/soc/codecs/fs-amp-lib.c
 create mode 100644 sound/soc/codecs/fs-amp-lib.h
 create mode 100644 sound/soc/codecs/fs210x.c
 create mode 100644 sound/soc/codecs/fs210x.h

base-commit: ed73a24357531e1747a6e140c329015da6429629 --
2.39.5

author maintainer
#1 lore raw

PATCH v5 1/5 dt-bindings: vendor-prefixes: Add Shanghai FourSemi Semiconductor Co.,Ltd

From: Nick Li <[email protected]>

Add vendor prefix for Shanghai FourSemi Semiconductor Co.,Ltd

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 99e86271c..f692e3b29 100644
@@ -547,6 +547,8 @@ patternProperties:
     description: FocalTech Systems Co.,Ltd
   "^forlinx,.*":
     description: Baoding Forlinx Embedded Technology Co., Ltd.
+  "^foursemi,.*":
+    description: Shanghai FourSemi Semiconductor Co.,Ltd.
   "^freebox,.*":
     description: Freebox SAS
   "^freecom,.*":
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH v5 2/5 ASoC: dt-bindings: Add FS2104/5S audio amplifiers

In reply to Nick

From: Nick Li <[email protected]>

Add a DT schema for describing FourSemi FS2104/5S audio amplifiers which support both I2S and I2C interface.

---
 .../bindings/sound/foursemi,fs2105s.yaml      | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/foursemi,fs2105s.yaml
Documentation/devicetree/bindings/sound/foursemi,fs2105s.yaml new file +101 -0
new file mode 100644
index 000000000..4da735317
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/foursemi,fs2105s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: FourSemi FS2104/5S Digital Audio Amplifier
+
+maintainers:
+  - Nick Li <[email protected]>
+
+description:
+  The FS2104 is a 15W Inductor-Less, Stereo, Closed-Loop,
+  Digital Input Class-D Power Amplifier with Enhanced Signal Processing.
+  The FS2105S is a 30W Inductor-Less, Stereo, Closed-Loop,
+  Digital Input Class-D Power Amplifier with Enhanced Signal Processing.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - foursemi,fs2104
+          - const: foursemi,fs2105s
+      - enum:
+          - foursemi,fs2105s
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: The clock of I2S BCLK
+
+  clock-names:
+    items:
+      - const: bclk
+
+  interrupts:
+    maxItems: 1
+
+  '#sound-dai-cells':
+    const: 0
+
+  pvdd-supply:
+    description:
+      Regulator for power supply(PVDD in datasheet).
+
+  dvdd-supply:
+    description:
+      Regulator for digital supply(DVDD in datasheet).
+
+  reset-gpios:
+    maxItems: 1
+    description:
+      It's the SDZ pin in datasheet, the pin is active low,
+      it will power down and reset the chip to shut down state.
+
+  firmware-name:
+    maxItems: 1
+    description: |
+      The firmware(*.bin) contains:
+      a. Register initialization settings
+      b. DSP effect parameters
+      c. Multi-scene sound effect configurations(optional)
+      It's gernerated by FourSemi's tuning tool.
+
+required:
+  - compatible
+  - reg
+  - '#sound-dai-cells'
+  - pvdd-supply
+  - dvdd-supply
+  - reset-gpios
+  - firmware-name
+
+allOf:
+  - $ref: dai-common.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        audio-codec@68 {
+            compatible = "foursemi,fs2105s";
+            reg = <0x68>;
+            clocks = <&clocks 18>;
+            clock-names = "bclk";
+            #sound-dai-cells = <0>;
+            pvdd-supply = <&pvdd_supply>;
+            dvdd-supply = <&dvdd_supply>;
+            reset-gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+            firmware-name = "fs2105s-btl-2p0-0s.bin";
+            pinctrl-names = "default";
+            pinctrl-0 = <&fs210x_pins_default>;
+        };
+    };
Signature · 1 line
2.39.5
author maintainer
#3 lore raw

PATCH v5 3/5 ASoC: codecs: Add library for FourSemi audio amplifiers

In reply to Nick

From: Nick Li <[email protected]>

This patch adds firmware loading and parsing support for FourSemi audio amplifiers. The library handles firmware file (*.bin) generated by the FourSemi tuning tool, which contains:
- Register initialization settings
- DSP effect parameters
- Multi-scene sound effect switching configurations(optional)

The firmware is required for proper initialization and configuration of FourSemi amplifier devices.

---
 sound/soc/codecs/Kconfig      |   3 +
 sound/soc/codecs/Makefile     |   2 +
 sound/soc/codecs/fs-amp-lib.c | 265 ++++++++++++++++++++++++++++++++++
 sound/soc/codecs/fs-amp-lib.h | 150 +++++++++++++++++++
 4 files changed, 420 insertions(+)
 create mode 100644 sound/soc/codecs/fs-amp-lib.c
 create mode 100644 sound/soc/codecs/fs-amp-lib.h
sound/soc/codecs/Kconfig +3 -0
index 4494e7cd6..6265cc897 100644
@@ -1238,6 +1238,9 @@ config SND_SOC_FRAMER
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-soc-framer.
 
+config SND_SOC_FS_AMP_LIB
+	select CRC16
+	tristate
 
 config SND_SOC_GTM601
 	tristate 'GTM601 UMTS modem audio codec'
sound/soc/codecs/Makefile +2 -0
index c497d343d..9afce9aa6 100644
@@ -137,6 +137,7 @@ snd-soc-es8328-spi-y := es8328-spi.o
 snd-soc-es8375-y := es8375.o
 snd-soc-es8389-y := es8389.o
 snd-soc-framer-y := framer-codec.o
+snd-soc-fs-amp-lib-y := fs-amp-lib.o
 snd-soc-gtm601-y := gtm601.o
 snd-soc-hdac-hdmi-y := hdac_hdmi.o
 snd-soc-hdac-hda-y := hdac_hda.o
@@ -561,6 +562,7 @@ obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
 obj-$(CONFIG_SND_SOC_ES8375)    += snd-soc-es8375.o
 obj-$(CONFIG_SND_SOC_ES8389)    += snd-soc-es8389.o
 obj-$(CONFIG_SND_SOC_FRAMER)	+= snd-soc-framer.o
+obj-$(CONFIG_SND_SOC_FS_AMP_LIB)+= snd-soc-fs-amp-lib.o
 obj-$(CONFIG_SND_SOC_GTM601)    += snd-soc-gtm601.o
 obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
 obj-$(CONFIG_SND_SOC_HDAC_HDA) += snd-soc-hdac-hda.o
sound/soc/codecs/fs-amp-lib.c new file +265 -0

265 lines not on this page · raw message

sound/soc/codecs/fs-amp-lib.h new file +150 -0

150 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#4 lore raw

PATCH v5 4/5 ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver

In reply to Nick

From: Nick Li <[email protected]>

The FS2104/5S are FourSemi digital audio amplifiers
with I2C control. They are Inductor-Less, Stereo, Closed-Loop, Digital Input Class-D Power Amplifiers with Enhanced Signal Processing.

---
 sound/soc/codecs/Kconfig  |   13 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/fs210x.c | 1583 +++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/fs210x.h |   75 ++
 4 files changed, 1673 insertions(+)
 create mode 100644 sound/soc/codecs/fs210x.c
 create mode 100644 sound/soc/codecs/fs210x.h
sound/soc/codecs/Kconfig +13 -0
index 6265cc897..8c85f3dbb 100644
@@ -125,6 +125,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_ES7134
 	imply SND_SOC_ES7241
 	imply SND_SOC_FRAMER
+	imply SND_SOC_FS210X
 	imply SND_SOC_GTM601
 	imply SND_SOC_HDAC_HDMI
 	imply SND_SOC_HDAC_HDA
@@ -1242,6 +1243,18 @@ config SND_SOC_FS_AMP_LIB
 	select CRC16
 	tristate
 
+config SND_SOC_FS210X
+	tristate 'FourSemi FS2104/5S digital audio amplifier'
+	depends on I2C
+	select GPIOLIB
+	select REGMAP_I2C
+	select SND_SOC_FS_AMP_LIB
+	help
+	  Enable support for FourSemi FS2104/5S digital audio amplifier.
+	  The FS2104/5S are Inductor-Less, Stereo, Closed-Loop,
+	  Digital Input Class-D Power Amplifiers with Enhanced Signal Processing.
+	  The amplifiers support I2C and I2S/TDM.
+
 config SND_SOC_GTM601
 	tristate 'GTM601 UMTS modem audio codec'
 
sound/soc/codecs/Makefile +2 -0
index 9afce9aa6..967e939a4 100644
@@ -138,6 +138,7 @@ snd-soc-es8375-y := es8375.o
 snd-soc-es8389-y := es8389.o
 snd-soc-framer-y := framer-codec.o
 snd-soc-fs-amp-lib-y := fs-amp-lib.o
+snd-soc-fs210x-y := fs210x.o
 snd-soc-gtm601-y := gtm601.o
 snd-soc-hdac-hdmi-y := hdac_hdmi.o
 snd-soc-hdac-hda-y := hdac_hda.o
@@ -563,6 +564,7 @@ obj-$(CONFIG_SND_SOC_ES8375)    += snd-soc-es8375.o
 obj-$(CONFIG_SND_SOC_ES8389)    += snd-soc-es8389.o
 obj-$(CONFIG_SND_SOC_FRAMER)	+= snd-soc-framer.o
 obj-$(CONFIG_SND_SOC_FS_AMP_LIB)+= snd-soc-fs-amp-lib.o
+obj-$(CONFIG_SND_SOC_FS210X)	+= snd-soc-fs210x.o
 obj-$(CONFIG_SND_SOC_GTM601)    += snd-soc-gtm601.o
 obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
 obj-$(CONFIG_SND_SOC_HDAC_HDA) += snd-soc-hdac-hda.o
sound/soc/codecs/fs210x.c new file +1583 -0

1,583 lines not on this page · raw message

sound/soc/codecs/fs210x.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.39.5
author maintainer
#5 lore raw

PATCH v5 5/5 MAINTAINERS: Add entry for FourSemi audio amplifiers

In reply to Nick

Add entry for FourSemi maintainer and related files

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 62d51c5a0..88354cd80 100644
@@ -9455,6 +9455,14 @@ F:	lib/tests/memcpy_kunit.c
 K:	\bunsafe_memcpy\b
 K:	\b__NO_FORTIFY\b
 
+FOURSEMI AUDIO AMPLIFIER DRIVER
+M:	Nick Li <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/sound/foursemi,fs2105s.yaml
+F:	sound/soc/codecs/fs-amp-lib.*
+F:	sound/soc/codecs/fs210x.*
+
 FPGA DFL DRIVERS
 M:	Wu Hao <[email protected]>
 R:	Tom Rix <[email protected]>
Signature · 1 line
2.39.5
maintainer
#6 lore raw

Re: [PATCH v5 5/5] MAINTAINERS: Add entry for FourSemi audio amplifiers

Quoted 1 line · Nick

Add entry for FourSemi maintainer and related files

This doesn't apply against current code, please check and resend.

maintainer
#7 lore raw
In reply to Nick
Quoted 9 lines · Nick

The FS2104/5S are Inductor-Less, Stereo, Closed-Loop, Digital Input Class-D Power Amplifiers with Enhanced Signal Processing FS2104 can deliver 2x15W into 4ohm BTL speaker loads, FS2105S can deliver 2x30W into 8ohm BTL speaker loads.

Most functions have been built and tested on EVB boards:
ARMv8-A, Linux version 6.16.0-rc6-v8

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/5] dt-bindings: vendor-prefixes: Add Shanghai FourSemi Semiconductor Co.,Ltd

      commit: 243167e96939630b7d0d7f61be926d327e14a017
[2/5] ASoC: dt-bindings: Add FS2104/5S audio amplifiers
      commit: fd90680da7e2d92e50ad72dfd4ea601098ab3493
[3/5] ASoC: codecs: Add library for FourSemi audio amplifiers
      commit: e0bbbcaceba1cf47751f264d0dbe36206eab0ef0
[4/5] ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver
      commit: 75611770177965ae902c87c96eace07542beff07
[5/5] MAINTAINERS: Add entry for FourSemi audio amplifiers
      commit: 2291a2186305faaf8525d57849d8ba12ad63f5e7

All 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