Skip to contentSkip to conversation

ASoC: Add NTP8918 and NTP8835 codecs support

PATCH Superseded Igor Prusov 3 participants 13 messages Jul 9, 2024 – Jul 12, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: Add NTP8918 and NTP8835 codecs support

This series adds support for two NeoFidelity amplifiers. For both amplifiers vendor provides software for equalizer and filters configuration, which generates firmware files with registers values. Since in both cases those files have same encoding, a common helper module is added to get firmware via request_firmware() API and set registers values.

V1: https://lore.kernel.org/all/[email protected]/

V1 -> V2:
- Fix dt_binding_check errors

Igor Prusov (6):
dt-bindings: vendor-prefixes: Add NeoFidelity, Inc
ASoC: codecs: Add NeoFidelity Firmware helpers
ASoC: dt-bindings: Add bindings for NeoFidelity NTP8918
ASoC: codecs: Add NeoFidelity NTP8918 codec
ASoC: dt-bindings: Add bindings for NeoFidelity NTP8835
ASoC: codecs: Add NeoFidelity NTP8835 codec

 .../bindings/sound/neofidelity,ntp8835.yaml   |  64 +++
 .../bindings/sound/neofidelity,ntp8918.yaml   |  62 +++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 sound/soc/codecs/Kconfig                      |  13 +
 sound/soc/codecs/Makefile                     |   6 +
 sound/soc/codecs/ntp8835.c                    | 432 ++++++++++++++++++
 sound/soc/codecs/ntp8918.c                    | 356 +++++++++++++++
 sound/soc/codecs/ntpfw.c                      | 137 ++++++
 sound/soc/codecs/ntpfw.h                      |  23 +
 9 files changed, 1095 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/neofidelity,ntp8835.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/neofidelity,ntp8918.yaml
 create mode 100644 sound/soc/codecs/ntp8835.c
 create mode 100644 sound/soc/codecs/ntp8918.c
 create mode 100644 sound/soc/codecs/ntpfw.c
 create mode 100644 sound/soc/codecs/ntpfw.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/6 dt-bindings: vendor-prefixes: Add NeoFidelity, Inc

Add vendor prefix for NeoFidelity, Inc

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index fbf47f0bacf1..be62a59788b5 100644
@@ -997,6 +997,8 @@ patternProperties:
     description: National Semiconductor
   "^nec,.*":
     description: NEC LCD Technologies, Ltd.
+  "^neofidelity,.*":
+    description: Neofidelity Inc.
   "^neonode,.*":
     description: Neonode Inc.
   "^netgear,.*":
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/6] dt-bindings: vendor-prefixes: Add NeoFidelity, Inc

Quoted 3 lines · Igor Prusov

Add vendor prefix for NeoFidelity, Inc

Did you just ignored every response?

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions, under or above your Signed-off-by tag. Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 1/6] dt-bindings: vendor-prefixes: Add NeoFidelity, Inc

Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Igor Prusov

Add vendor prefix for NeoFidelity, Inc

Did you just ignored every response?

Hello, Krzysztof,

Sorry about that, I sent v2 right away after Rob's bot comment. I'll make sure to wait for more replies in the future and will address all comments in v3.

Quoted 22 lines

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions, under or above your Signed-off-by tag. Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

Signature · 2 lines
Best Regards,
Igor Prusov
#4 lore raw

PATCH v2 2/6 ASoC: codecs: Add NeoFidelity Firmware helpers

In reply to Igor Prusov

Add support for loading firmware for NeoFidelity amplifiers.

---
 sound/soc/codecs/Kconfig  |   3 +
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/ntpfw.c  | 137 ++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/ntpfw.h  |  23 +++++++
 4 files changed, 165 insertions(+)
 create mode 100644 sound/soc/codecs/ntpfw.c
 create mode 100644 sound/soc/codecs/ntpfw.h
sound/soc/codecs/Kconfig +3 -0
index 4afc43d3f71f..9583243f1966 100644
@@ -2492,6 +2492,9 @@ config SND_SOC_NAU8825
 	tristate
 	depends on I2C
 
+config SND_SOC_NTPFW
+	tristate
+
 config SND_SOC_TPA6130A2
 	tristate "Texas Instruments TPA6130A2 headphone amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index b4df22186e25..eae4ab047c72 100644
@@ -183,6 +183,7 @@ snd-soc-nau8821-y := nau8821.o
 snd-soc-nau8822-y := nau8822.o
 snd-soc-nau8824-y := nau8824.o
 snd-soc-nau8825-y := nau8825.o
+snd-soc-ntpfw-y := ntpfw.o
 snd-soc-hdmi-codec-y := hdmi-codec.o
 snd-soc-pcm1681-y := pcm1681.o
 snd-soc-pcm1789-codec-y := pcm1789.o
@@ -575,6 +576,7 @@ obj-$(CONFIG_SND_SOC_NAU8821)   += snd-soc-nau8821.o
 obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
+obj-$(CONFIG_SND_SOC_NTPFW)	+= snd-soc-ntpfw.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
 obj-$(CONFIG_SND_SOC_PCM1681)	+= snd-soc-pcm1681.o
 obj-$(CONFIG_SND_SOC_PCM179X)	+= snd-soc-pcm179x-codec.o
sound/soc/codecs/ntpfw.c new file +137 -0

137 lines not on this page · raw message

sound/soc/codecs/ntpfw.h new file +23 -0
new file mode 100644
index 000000000000..1cf10d5480ee
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/**
+ * ntpfw.h - Firmware helper functions for Neofidelity codecs
+ *
+ * Copyright (c) 2024, SaluteDevices. All Rights Reserved.
+ */
+
+#ifndef __NTPFW_H__
+#define __NTPFW_H__
+#include <linux/i2c.h>
+#include <linux/firmware.h>
+
+/**
+ * ntpfw_load - load firmware to amplifier over i2c interface.
+ *
+ * @i2c		Pointer to amplifier's I2C client.
+ * @name	Firmware file name.
+ * @magic	Magic number to validate firmware.
+ * @return	0 or error code upon error.
+ */
+int ntpfw_load(struct i2c_client *i2c, const char *name, const u32 magic);
+
+#endif /* __NTPFW_H__ */
Signature · 1 line
2.34.1
#5 lore raw

PATCH v2 3/6 ASoC: dt-bindings: Add bindings for NeoFidelity NTP8918

In reply to Igor Prusov

Add dt-bindings for NeoFidelity NTP8918 Amplifier

---
 .../bindings/sound/neofidelity,ntp8918.yaml   | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/neofidelity,ntp8918.yaml
Documentation/devicetree/bindings/sound/neofidelity,ntp8918.yaml new file +62 -0
new file mode 100644
index 000000000000..506b1e4b8e39
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/neofidelity,ntp8918.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NeoFidelity NTP8918 Amplifier
+
+maintainers:
+  - Igor Prusov <[email protected]>
+
+description: |
+  The NTP8918 is a single chip full digital audio amplifier
+  including power stage for stereo amplifier system.
+  The NTP8918 is integrated with versatile digital audio signal
+  processing functions, high-performance, high-fidelity fully
+  digital PWM modulator and two high-power full-bridge MOSFET
+  power stages.
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - neofidelity,ntp8918
+
+  reg:
+    enum:
+      - 0x2a
+      - 0x2b
+      - 0x2c
+      - 0x2d
+    description: |
+      I2C address of the device.
+
+  reset-gpios:
+    maxItems: 1
+    description: GPIO used to control the state of the device.
+
+  '#sound-dai-cells':
+    enum: [0]
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+   #include <dt-bindings/gpio/gpio.h>
+   i2c {
+     #address-cells = <1>;
+     #size-cells = <0>;
+     ntp8918@2a {
+       compatible = "neofidelity,ntp8918";
+       #sound-dai-cells = <0>;
+       reg = <0x2a>;
+       reset-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+    };
+   };
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v2 3/6] ASoC: dt-bindings: Add bindings for NeoFidelity NTP8918

Quoted 4 lines · Igor Prusov

Add dt-bindings for NeoFidelity NTP8918 Amplifier

---

NAK, respond to review first.

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

#7 lore raw

PATCH v2 4/6 ASoC: codecs: Add NeoFidelity NTP8918 codec

In reply to Igor Prusov

The NeoFidelity NTP8918 is a two channel amplifier with mixer and biquad filters.

Datasheet: https://datasheetspdf.com/pdf-down/N/T/P/NTP8918-NeoFidelity.pdf

---
 sound/soc/codecs/Kconfig   |   5 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/ntp8918.c | 356 +++++++++++++++++++++++++++++++++++++
 3 files changed, 363 insertions(+)
 create mode 100644 sound/soc/codecs/ntp8918.c
sound/soc/codecs/Kconfig +5 -0
index 9583243f1966..d16c983fcb7a 100644
@@ -2495,6 +2495,11 @@ config SND_SOC_NAU8825
 config SND_SOC_NTPFW
 	tristate
 
+config SND_SOC_NTP8918
+	select SND_SOC_NTPFW
+	tristate "NeoFidelity NTP8918 amplifier"
+	depends on I2C
+
 config SND_SOC_TPA6130A2
 	tristate "Texas Instruments TPA6130A2 headphone amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index eae4ab047c72..a49ab11a98ec 100644
@@ -183,6 +183,7 @@ snd-soc-nau8821-y := nau8821.o
 snd-soc-nau8822-y := nau8822.o
 snd-soc-nau8824-y := nau8824.o
 snd-soc-nau8825-y := nau8825.o
+snd-soc-ntp8918-y := ntp8918.o
 snd-soc-ntpfw-y := ntpfw.o
 snd-soc-hdmi-codec-y := hdmi-codec.o
 snd-soc-pcm1681-y := pcm1681.o
@@ -576,6 +577,7 @@ obj-$(CONFIG_SND_SOC_NAU8821)   += snd-soc-nau8821.o
 obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
+obj-$(CONFIG_SND_SOC_NTP8918)	+= snd-soc-ntp8918.o
 obj-$(CONFIG_SND_SOC_NTPFW)	+= snd-soc-ntpfw.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
 obj-$(CONFIG_SND_SOC_PCM1681)	+= snd-soc-pcm1681.o
sound/soc/codecs/ntp8918.c new file +356 -0

356 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 5/6 ASoC: dt-bindings: Add bindings for NeoFidelity NTP8835

In reply to Igor Prusov

Add dt-bindings for NeoFidelity NTP8835C/NTP8835C Amplifiers

---
 .../bindings/sound/neofidelity,ntp8835.yaml   | 64 +++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/neofidelity,ntp8835.yaml
Documentation/devicetree/bindings/sound/neofidelity,ntp8835.yaml new file +64 -0
new file mode 100644
index 000000000000..cbd2254d4efa
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/neofidelity,ntp8835.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NeoFidelity NTP8835/NTP8835C Amplifiers
+
+maintainers:
+  - Igor Prusov <[email protected]>
+
+description: |
+  The NTP8835 is a single chip full digital audio amplifier
+  including power stages for stereo amplifier systems.
+  NTP8835 is integrated with versatile digital audio signal
+  processing functions, high-performance, high-fidelity fully
+  digital PWM modulator and two high-power full-bridge MOSFET
+  power stages. NTP8835C has identical programming interface,
+  but has different output signal characteristics.
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - neofidelity,ntp8835
+      - neofidelity,ntp8835c
+
+  reg:
+    enum:
+      - 0x2a
+      - 0x2b
+      - 0x2c
+      - 0x2d
+    description: |
+      I2C address of the device.
+
+  reset-gpios:
+    maxItems: 1
+    description: GPIO used to control the state of the device.
+
+  '#sound-dai-cells':
+    enum: [0]
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+   #include <dt-bindings/gpio/gpio.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      ntp8835@2b {
+        compatible = "neofidelity,ntp8835";
+        #sound-dai-cells = <0>;
+        reg = <0x2b>;
+        reset-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+      };
+    };
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v2 5/6] ASoC: dt-bindings: Add bindings for NeoFidelity NTP8835

Quoted 3 lines · Igor Prusov

Add dt-bindings for NeoFidelity NTP8835C/NTP8835C Amplifiers

<form letter>
This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.
</form letter>

Best regards,
Krzysztof

#10 lore raw

PATCH v2 6/6 ASoC: codecs: Add NeoFidelity NTP8835 codec

In reply to Igor Prusov

The NeoFidelity NTP8835 adn NTP8835C are 2.1 channel amplifiers with mixer and biquad filters. Both amplifiers have identical programming interfaces but differ in output signal characteristics.

Datasheet: https://www.cpbay.com/Uploads/20210225/6037116a3ea91.pdf
Datasheet: https://www.cpbay.com/Uploads/20210918/61458b2f2631e.pdf

---
 sound/soc/codecs/Kconfig   |   5 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/ntp8835.c | 432 +++++++++++++++++++++++++++++++++++++
 3 files changed, 439 insertions(+)
 create mode 100644 sound/soc/codecs/ntp8835.c
sound/soc/codecs/Kconfig +5 -0
index d16c983fcb7a..2235727f0d41 100644
@@ -2500,6 +2500,11 @@ config SND_SOC_NTP8918
 	tristate "NeoFidelity NTP8918 amplifier"
 	depends on I2C
 
+config SND_SOC_NTP8835
+	select SND_SOC_NTPFW
+	tristate "NeoFidelity NTP8835 and NTP8835C amplifiers"
+	depends on I2C
+
 config SND_SOC_TPA6130A2
 	tristate "Texas Instruments TPA6130A2 headphone amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index a49ab11a98ec..49fc78bc631e 100644
@@ -183,6 +183,7 @@ snd-soc-nau8821-y := nau8821.o
 snd-soc-nau8822-y := nau8822.o
 snd-soc-nau8824-y := nau8824.o
 snd-soc-nau8825-y := nau8825.o
+snd-soc-ntp8835-y := ntp8835.o
 snd-soc-ntp8918-y := ntp8918.o
 snd-soc-ntpfw-y := ntpfw.o
 snd-soc-hdmi-codec-y := hdmi-codec.o
@@ -577,6 +578,7 @@ obj-$(CONFIG_SND_SOC_NAU8821)   += snd-soc-nau8821.o
 obj-$(CONFIG_SND_SOC_NAU8822)   += snd-soc-nau8822.o
 obj-$(CONFIG_SND_SOC_NAU8824)   += snd-soc-nau8824.o
 obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
+obj-$(CONFIG_SND_SOC_NTP8835)	+= snd-soc-ntp8835.o
 obj-$(CONFIG_SND_SOC_NTP8918)	+= snd-soc-ntp8918.o
 obj-$(CONFIG_SND_SOC_NTPFW)	+= snd-soc-ntpfw.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC)	+= snd-soc-hdmi-codec.o
sound/soc/codecs/ntp8835.c new file +432 -0

432 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#11 lore raw
In reply to Igor Prusov
Quoted 11 lines · Igor Prusov

This series adds support for two NeoFidelity amplifiers. For both amplifiers vendor provides software for equalizer and filters configuration, which generates firmware files with registers values. Since in both cases those files have same encoding, a common helper module is added to get firmware via request_firmware() API and set registers values.

V1: https://lore.kernel.org/all/[email protected]/

V1 -> V2:
- Fix dt_binding_check errors

Please implement the comments on v1. Please don't send new versions right away and give people time to review. We're not all on the same timezone, get busy on other tasks, take vacation, etc.

Rob

#12 lore raw
Quoted 8 lines · Rob Herring
Quoted 7 lines · Igor Prusov

This series adds support for two NeoFidelity amplifiers. For both amplifiers vendor provides software for equalizer and filters configuration, which generates firmware files with registers values. Since in both cases those files have same encoding, a common helper module is added to get firmware via request_firmware() API and set registers values.

Quoted 8 lines
Quoted 4 lines

V1: https://lore.kernel.org/all/[email protected]/

V1 -> V2:
- Fix dt_binding_check errors

Please implement the comments on v1. Please don't send new versions right away and give people time to review. We're not all on the same timezone, get busy on other tasks, take vacation, etc.

Hello, Rob,

Sorry, I' ve sent v2 before getting all comments on v1, I'll make sure not to rush with new versions in the future.

Quoted 2 lines

Rob

Signature · 2 lines
Best Regards,
Igor Prusov