Skip to content

ASoC: Add support for GPIOs driven amplifiers

Herve Codina linux-devicetree linux-gpio linux-sound lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest17 patches 1 replyIn review
  2. v217 patches 3 repliesSuperseded
  3. v14 patches 15 repliesSuperseded

Changes in v3 from the cover letter

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17of: Introduce of_property_read_s32_index()include/linux/of.h+7 -00 replies
2/17ASoC: dt-bindings: Add support for the GPIOs driven amplifierDocumentation/devicetree/bindings/sound/gpio-audio-amp.yaml+270 -00 replies
3/17ASoC: simple-amplifier: Remove DRV_NAME defined valuesound/soc/codecs/simple-amplifier.c+1 -30 replies
4/17ASoC: simple-amplifier: Add missing headerssound/soc/codecs/simple-amplifier.c+2 -00 replies
5/17ASoC: simple-amplifier: Remove CONFIG_OF flag and of_match_ptr()sound/soc/codecs/simple-amplifier.c+1 -30 replies
6/17ASoC: simple-amplifier: Rename drv_event() functionsound/soc/codecs/simple-amplifier.c+3 -30 replies
7/17ASoC: simple-amplifier: Use 'simple_amp' variable name instead of 'priv'sound/soc/codecs/simple-amplifier.c+10 -100 replies
8/17ASoC: simple-amplifier: Remove DAPM widgets and routes from the ASoC component driversound/soc/codecs/simple-amplifier.c+53 -60 replies
9/17ASoC: simple-amplifier: Introduce support for gpio-audio-ampsound/soc/codecs/simple-amplifier.c+54 -00 replies
10/17ASoC: simple-amplifier: gpio-audio-amp: Add support for extra power suppliessound/soc/codecs/simple-amplifier.c+82 -30 replies
11/17ASoC: simple-amplifier: gpio-audio-amp: Add support for mute gpiosound/soc/codecs/simple-amplifier.c+125 -20 replies
12/17ASoC: simple-amplifier: gpio-audio-amp: Add support for bypass gpiosound/soc/codecs/simple-amplifier.c+19 -20 replies
13/17ASoC: simple-amplifier: gpio-audio-amp: Add support for basic gainsound/soc/codecs/simple-amplifier.c+125 -00 replies
14/17ASoC: simple-amplifier: gpio-audio-amp: Add support for gain-rangessound/soc/codecs/simple-amplifier.c+312 -50 replies
15/17ASoC: simple-amplifier: gpio-audio-amp: Add support for gain-labelssound/soc/codecs/simple-amplifier.c+113 -30 replies
16/17ASoC: simple-amplifier: Update author and copyrightsound/soc/codecs/simple-amplifier.c+8 -20 replies
17/17MAINTAINERS: Add the ASoC gpio audio amplifier entryMAINTAINERS+7 -00 replies

Reviews trailers per patch

2 of 17 patches have a Reviewed-by or Acked-by.

PatchRob Herring (Arm)
1/17A-b
2/17R-b
3/17
4/17
5/17
6/17
7/17
8/17
9/17
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/17] ASoC: Add support for GPIOs driven amplifiers

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.

Compared to previous iteration, this v3 series takes into account feedback received from Mark and also some comments from Shashiko.

In order to ease the review, I choose to split modifications related to the merge of the gpio-audio-amp part into the simple-amplfier driver in several commits.

Best regards,
Hervé

---
Changes v2 -> v3
v2: https://lore.kernel.org/all/[email protected]/

Patch 2:
- Fix a typo s/rignt/right/ (Sashiko)
- Use the 'int32-matrix' type for gain-ranges property. Indeed the gain value can be a negative value (Sashiko).
- Add 'Reviewed-by: Rob Herring'

Patch 8:
- Fix error message

Patch 11:
- Clamp the value received in simple_amp_single_kctrl_put() in order to have a more robust code (Sashiko)

Patch 14:
- Return 'unsigned int *' in simple_amp_alloc_tlv_ranges()
- Check for existing ranges entirely inside the new one in simple_amp_check_new_range().
- Don't allow an empty ranges array. nb_ranges cannot be set to 0 anymore (Sahiko).

Patch 15:
- Don't allow an empty labels array. nb_labels cannot be set to 0 anymore (Sahiko).

Other patches:
No changes

Changes v1 -> v2
v1: https://lore.kernel.org/all/[email protected]/

Rebase on top of v7.1-rc1.

Patch 1:
- Add 'Acked-by: Rob Herring'

Patch 2:
- Use gpio-audio-amp-* instead of audio-gpio-amp
- Introduce mono/stereo channel distinction with gpio-audio-amp-mono and gpio-audio-amp-stereo compatible strings (needed if the "simple-amplifier" compatible string is deprecated in the near future).
- Reduce the maximum numbers of gpios used for gain setting to 16.
- Use amplifier-N instead of amplifierN in examples
- Introduce gpio-ranges property and remove the no more needed gpio-points and gpio-range properties

Other patches (full rework):
- Merge the new audio-gpio-amp driver provided in v1 into the existing simple-amplifier driver.
- Slit modification in several commits.
- Reduce the maximum number of gpios used for gain setting to 16.
- Fix a memory leak in case of error in simple_amp_multi_add_kcontrol() (Reported by Shahiko).
- Handle the new gpio-ranges property and drop the support for the no more needed properties (gpio-points and gpio-range).
- Update author and copyright.

Herve Codina (17):
of: Introduce of_property_read_s32_index()
ASoC: dt-bindings: Add support for the GPIOs driven amplifier
ASoC: simple-amplifier: Remove DRV_NAME defined value
ASoC: simple-amplifier: Add missing headers
ASoC: simple-amplifier: Remove CONFIG_OF flag and of_match_ptr()
ASoC: simple-amplifier: Rename drv_event() function
ASoC: simple-amplifier: Use 'simple_amp' variable name instead of

    'priv'

ASoC: simple-amplifier: Remove DAPM widgets and routes from the ASoC
component driver
ASoC: simple-amplifier: Introduce support for gpio-audio-amp
ASoC: simple-amplifier: gpio-audio-amp: Add support for extra power
supplies
ASoC: simple-amplifier: gpio-audio-amp: Add support for mute gpio
ASoC: simple-amplifier: gpio-audio-amp: Add support for bypass gpio
ASoC: simple-amplifier: gpio-audio-amp: Add support for basic gain
ASoC: simple-amplifier: gpio-audio-amp: Add support for gain-ranges
ASoC: simple-amplifier: gpio-audio-amp: Add support for gain-labels
ASoC: simple-amplifier: Update author and copyright
MAINTAINERS: Add the ASoC gpio audio amplifier entry

 .../bindings/sound/gpio-audio-amp.yaml        | 270 ++++++
 MAINTAINERS                                   |   7 +
 include/linux/of.h                            |   7 +
 sound/soc/codecs/simple-amplifier.c           | 918 +++++++++++++++++-
 4 files changed, 1176 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/gpio-audio-amp.yaml
Signature · 1 line
2.54.0