Skip to contentSkip to conversation

ASoC: codecs: Add Awinic AW8738 audio amplifier driver

PATCH In review Stephan Gerhold 2 participants 4 messages Mar 4, 2022 – Mar 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: codecs: Add Awinic AW8738 audio amplifier driver

This series adds a simple driver and DT schema for the Awinic AW8738 audio amplifier. It's fairly simple - the main difference to simple-amplifier is that there is a "one-wire pulse control" that allows configuring the amplifier to one of a few pre-defined modes. This can be used to configure the speaker-guard function (primarily the power limit for the amplifier).

Jonathan Albrieux (1):
ASoC: codecs: Add Awinic AW8738 audio amplifier driver

Stephan Gerhold (1):
ASoC: dt-bindings: Add schema for "awinic,aw8738"

 .../bindings/sound/awinic,aw8738.yaml         |  54 +++++++++
 sound/soc/codecs/Kconfig                      |  10 ++
 sound/soc/codecs/Makefile                     |   2 +
 sound/soc/codecs/aw8738.c                     | 104 ++++++++++++++++++
 4 files changed, 170 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/awinic,aw8738.yaml
 create mode 100644 sound/soc/codecs/aw8738.c
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/2 ASoC: dt-bindings: Add schema for "awinic,aw8738"

Add a DT schema for describing Awinic AW8738 audio amplifiers. They are fairly simple and controlled using a single GPIO. The number of pulses during power up selects one of a few pre-defined operation modes. This can be used to configure the speaker-guard function (primarily the power limit for the amplifier).

---
Changes in v2:
- Rename "enable-gpios" -> "mode-gpios" as an attempt to better reflect its true purpose. Add description to prevent confusion.
- Rewrite all descriptions to be more clear about the purpose of the amplifier operation modes.
- Add maximum for "awinic,mode"

---
 .../bindings/sound/awinic,aw8738.yaml         | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/awinic,aw8738.yaml
Documentation/devicetree/bindings/sound/awinic,aw8738.yaml new file +54 -0
new file mode 100644
index 000000000000..dce86dafe382
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/awinic,aw8738.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Awinic AW8738 Audio Amplifier
+
+maintainers:
+  - Stephan Gerhold <[email protected]>
+
+description:
+  The Awinic AW8738 is a simple audio amplifier with different operation modes
+  (set using one-wire pulse control). The mode configures the speaker-guard
+  function (primarily the power limit for the amplifier).
+
+allOf:
+  - $ref: name-prefix.yaml#
+
+properties:
+  compatible:
+    const: awinic,aw8738
+
+  mode-gpios:
+    description:
+      GPIO used for one-wire pulse control. The pin is typically called SHDN
+      (active-low), but this is misleading since it is actually more than
+      just a simple shutdown/enable control.
+    maxItems: 1
+
+  awinic,mode:
+    description: Operation mode (number of pulses for one-wire pulse control)
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 7
+
+  sound-name-prefix: true
+
+required:
+  - compatible
+  - mode-gpios
+  - awinic,mode
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    audio-amplifier {
+        compatible = "awinic,aw8738";
+        mode-gpios = <&msmgpio 114 GPIO_ACTIVE_HIGH>;
+        awinic,mode = <5>;
+        sound-name-prefix = "Speaker Amp";
+    };
Signature · 1 line
2.35.1
#2 lore raw

PATCH v2 2/2 ASoC: codecs: Add Awinic AW8738 audio amplifier driver

In reply to Stephan Gerhold

From: Jonathan Albrieux <[email protected]>

The Awinic AW8738 is a simple audio amplifier using a single GPIO. The main difference to simple-amplifier is that there is a "one-wire pulse control" that allows configuring the amplifier to one of a few pre-defined modes. This can be used to configure the speaker-guard function (primarily the power limit for the amplifier).

Add a simple driver that allows setting it up in the device tree with a specified mode number.

---
Changes in v2:
- Clarify purpose of operation modes in commit message.
- Rename "enable" GPIO -> "mode" GPIO to better reflect its true purpose.

---
 sound/soc/codecs/Kconfig  |  10 ++++
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/aw8738.c | 104 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+)
 create mode 100644 sound/soc/codecs/aw8738.c
sound/soc/codecs/Kconfig +10 -0
index 4de029ae377c..f46a22660103 100644
@@ -53,6 +53,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_AK5558
 	imply SND_SOC_ALC5623
 	imply SND_SOC_ALC5632
+	imply SND_SOC_AW8738
 	imply SND_SOC_BT_SCO
 	imply SND_SOC_BD28623
 	imply SND_SOC_CQ0093VC
@@ -579,6 +580,15 @@ config SND_SOC_ALC5632
 	tristate
 	depends on I2C
 
+config SND_SOC_AW8738
+	tristate "Awinic AW8738 Audio Amplifier"
+	select GPIOLIB
+	help
+	  Enable support for the Awinic AW8738 audio amplifier (or similar).
+	  The driver supports simple audio amplifiers similar to
+	  SND_SOC_SIMPLE_AMPLIFIER, but additionally allows setting the
+	  operation mode using the Awinic-specific one-wire pulse control.
+
 config SND_SOC_BD28623
 	tristate "ROHM BD28623 CODEC"
 	help
sound/soc/codecs/Makefile +2 -0
index c3c6059a5f8a..8637e9e869e3 100644
@@ -45,6 +45,7 @@ snd-soc-ak4671-objs := ak4671.o
 snd-soc-ak5386-objs := ak5386.o
 snd-soc-ak5558-objs := ak5558.o
 snd-soc-arizona-objs := arizona.o arizona-jack.o
+snd-soc-aw8738-objs := aw8738.o
 snd-soc-bd28623-objs := bd28623.o
 snd-soc-bt-sco-objs := bt-sco.o
 snd-soc-cpcap-objs := cpcap.o
@@ -388,6 +389,7 @@ obj-$(CONFIG_SND_SOC_AK5558)	+= snd-soc-ak5558.o
 obj-$(CONFIG_SND_SOC_ALC5623)    += snd-soc-alc5623.o
 obj-$(CONFIG_SND_SOC_ALC5632)	+= snd-soc-alc5632.o
 obj-$(CONFIG_SND_SOC_ARIZONA)	+= snd-soc-arizona.o
+obj-$(CONFIG_SND_SOC_AW8738)	+= snd-soc-aw8738.o
 obj-$(CONFIG_SND_SOC_BD28623)	+= snd-soc-bd28623.o
 obj-$(CONFIG_SND_SOC_BT_SCO)	+= snd-soc-bt-sco.o
 obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
sound/soc/codecs/aw8738.c new file +104 -0

104 lines not on this page · raw message

Signature · 1 line
2.35.1
maintainer
#3 lore raw
In reply to Stephan Gerhold
Quoted 8 lines · Stephan Gerhold

This series adds a simple driver and DT schema for the Awinic AW8738 audio amplifier. It's fairly simple - the main difference to simple-amplifier is that there is a "one-wire pulse control" that allows configuring the amplifier to one of a few pre-defined modes. This can be used to configure the speaker-guard function (primarily the power limit for the amplifier).

[...]

Applied to

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

Thanks!

[1/2] ASoC: dt-bindings: Add schema for "awinic,aw8738"

      commit: b3284430615c27ca441967f99fbde957b434e092
[2/2] ASoC: codecs: Add Awinic AW8738 audio amplifier driver
      commit: fc14fac286a05d36202f8114d00a9935ca2e0756

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