[PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers

Herve Codina posted 4 patches 2 days, 19 hours ago
.../bindings/sound/audio-gpio-amp.yaml        | 309 +++++++
MAINTAINERS                                   |   7 +
include/linux/of.h                            |   7 +
sound/soc/codecs/Kconfig                      |  12 +
sound/soc/codecs/Makefile                     |   2 +
sound/soc/codecs/audio-gpio-amp.c             | 765 ++++++++++++++++++
6 files changed, 1102 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/audio-gpio-amp.yaml
create mode 100644 sound/soc/codecs/audio-gpio-amp.c
[PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers
Posted by Herve Codina 2 days, 19 hours ago
On some embedded system boards, audio amplifiers are designed using
discrete components such as op-amp, several resistors and switches to
either adjust the gain (switching resistors) or fully switch the
audio signal path (mute and/or bypass features).

Those switches are usually driven by simple GPIOs.

This kind of amplifiers are not handled in ASoC and the fallback is to
let the user-space handle those GPIOs out of the ALSA world.

In order to have those kind of amplifiers fully integrated in the audio
stack, this series introduces the audio-gpio-amp to handle them.

This new ASoC component allows to have the amplifiers seen as ASoC
auxiliarty devices and so it allows to control them through audio mixer
controls.

Best regards,
Hervé

Herve Codina (4):
  of: Introduce of_property_read_s32_index()
  ASoC: dt-bindings: Add support for the GPIOs driven amplifier
  ASoC: codecs: Add support for the GPIOs driven amplifier
  MAINTAINERS: Add the ASoC gpio amplifier entry

 .../bindings/sound/audio-gpio-amp.yaml        | 309 +++++++
 MAINTAINERS                                   |   7 +
 include/linux/of.h                            |   7 +
 sound/soc/codecs/Kconfig                      |  12 +
 sound/soc/codecs/Makefile                     |   2 +
 sound/soc/codecs/audio-gpio-amp.c             | 765 ++++++++++++++++++
 6 files changed, 1102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/audio-gpio-amp.yaml
 create mode 100644 sound/soc/codecs/audio-gpio-amp.c

-- 
2.53.0

Re: [PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers
Posted by Mark Brown 2 days, 14 hours ago
On Mon, Mar 30, 2026 at 12:16:04PM +0200, Herve Codina wrote:
> On some embedded system boards, audio amplifiers are designed using
> discrete components such as op-amp, several resistors and switches to
> either adjust the gain (switching resistors) or fully switch the
> audio signal path (mute and/or bypass features).
> 
> Those switches are usually driven by simple GPIOs.

This sounds a lot like simple-amplifier.c?
Re: [PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers
Posted by Herve Codina 2 days, 14 hours ago
On Mon, 30 Mar 2026 16:08:47 +0100
Mark Brown <broonie@kernel.org> wrote:

> On Mon, Mar 30, 2026 at 12:16:04PM +0200, Herve Codina wrote:
> > On some embedded system boards, audio amplifiers are designed using
> > discrete components such as op-amp, several resistors and switches to
> > either adjust the gain (switching resistors) or fully switch the
> > audio signal path (mute and/or bypass features).
> > 
> > Those switches are usually driven by simple GPIOs.  
> 
> This sounds a lot like simple-amplifier.c?

simple-amplifier.c doesn't handle amplifier driven by GPIOs.
The only used GPIO in simple-amplifier.c is used to handle the
enable pin the component.

simple-amplifier.c handles component such as dio2125 alone.

Here, we have op-amp but also several components around such as
switches.

The gpio driven amplifier proposed is more generic and can handle
more complex design. I.e. op-amp + resistor and/or line (mute,
bypass) switching. Hardwares handled by this driver are a superset
of just dio2125 and so simple-amplifier.c.

IMHO, it makes sense to have a specific driver for those kind
of hardware design.

Best regards,
Hervé
Re: [PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers
Posted by Mark Brown 2 days, 14 hours ago
On Mon, Mar 30, 2026 at 05:39:44PM +0200, Herve Codina wrote:
> Mark Brown <broonie@kernel.org> wrote:

> > This sounds a lot like simple-amplifier.c?

> The gpio driven amplifier proposed is more generic and can handle
> more complex design. I.e. op-amp + resistor and/or line (mute,
> bypass) switching. Hardwares handled by this driver are a superset
> of just dio2125 and so simple-amplifier.c.

> IMHO, it makes sense to have a specific driver for those kind
> of hardware design.

Right, and if it's a superset it feels like it should all be one driver
rather than two separate ones.
Re: [PATCH 0/4] ASoC: Add support for GPIOs driven amplifiers
Posted by Herve Codina 2 days, 13 hours ago
On Mon, 30 Mar 2026 16:48:54 +0100
Mark Brown <broonie@kernel.org> wrote:

> On Mon, Mar 30, 2026 at 05:39:44PM +0200, Herve Codina wrote:
> > Mark Brown <broonie@kernel.org> wrote:  
> 
> > > This sounds a lot like simple-amplifier.c?  
> 
> > The gpio driven amplifier proposed is more generic and can handle
> > more complex design. I.e. op-amp + resistor and/or line (mute,
> > bypass) switching. Hardwares handled by this driver are a superset
> > of just dio2125 and so simple-amplifier.c.  
> 
> > IMHO, it makes sense to have a specific driver for those kind
> > of hardware design.  
> 
> Right, and if it's a superset it feels like it should all be one driver
> rather than two separate ones.

Also, it is worth noting that simple-amplifier.c considered a stereo
amplifier (left + right).

Considering the two op-amp available in dio2125 as just two op-amp used
in two separated mono channel with additional component to switch related
to resistors (independant switching for each channel) means that almost
everything proposed in audio-gpio-amp have to be duplicated (gain, mute,
bypass per channel) instead of just instantiate two audio-gpio-amps.

On the other hand, there is no reason to handle a stereo component in
audio-gpio-amp. Further more with the hardware I have handling a stereo
component doesn't make sense. Indeed, I only have independent mono lines
with their own resistor switched amplification circuitry.

I could merge everything in one .c file but only a few part of source code
will be common to simple-amplifier and audio-gpio-amp. IMHO the resulting
merged code will look like two different drivers merged in one .c file.

Best regards,
Hervé