mbox series

[v4,0/5] ASoC: wm8904: Add DMIC and DRC support

Message ID 20250319142059.46692-1-francesco@dolcini.it (mailing list archive)
Headers show
Series ASoC: wm8904: Add DMIC and DRC support | expand

Message

Francesco Dolcini March 19, 2025, 2:20 p.m. UTC
From: Francesco Dolcini <francesco.dolcini@toradex.com>

This patch series adds DMIC and DRC support to the WM8904 driver, a new
of_ helper is added to simplify the driver code.

DRC functionality is added in the same patch series to provide the
necessary dynamic range control to make DMIC support useful.

The WM8904 supports digital microphones on two of its inputs:
IN1L/DMICDAT1 and IN1R/DMICDAT2. These two inputs can either be
connected to an ADC or to the DMIC system. There is an ADC for each
line, and only one DMIC block. This DMIC block is either connected to
DMICDAT1 or to DMICDAT2. One DMIC data line supports two digital
microphones via time multiplexing.

The pin's functionality is decided during hardware design (IN1L vs
DMICDAT1 and IN1R vs DMICDAT2). This is reflected in the Device Tree.

If one line is analog and one is DMIC, we need to be able to switch
between ADC and DMIC at runtime. The DMIC source is known from the
Device Tree. If both are DMIC inputs, we need to be able to switch the
DMIC source. There is no need to switch between ADC and DMIC at runtime.

Therefore, kcontrols are dynamically added by the driver depending on
its Device Tree configuration.

This is a heavy rework of a previous patch series provided by Alifer
Moraes and Pierluigi Passaro,
https://lore.kernel.org/lkml/20220307141041.27538-1-alifer.m@variscite.com.

v4:
 * Renamed "wlf,mic-cfg" to "wlf,micbias-cfg" to be more in line with the
   wm8994 binding.
 * Changed type of "wlf,drc-cfg-regs" and "wlf,retune-mobile-cfg-regs" to
   "uint16-matrix" instead of "uint16-array". Also edited the example to
   properly itemize the "wlf,retune-mobile-cfg-regs" matrix according to the
   style guide.
 * Itemized "wlf,gpio-cfg" and "wlf,retune-mobile-cfg-hz" properly in the
   example.
 * Expanded the commit message of "ASoC: dt-bindings: wm8904: Add DMIC, GPIO,
   MIC and EQ support" to clarify some things.

v3: https://lore.kernel.org/all/20250307135244.100443-1-francesco@dolcini.it/
 * Fixed DT binding to conform to the DT schema properly.
 * Renamed "wlf,retune-mobile-cfg-rates" to "wlf,retune-mobile-cfg-hz", it is now a standard unit suffix property.

v2: https://lore.kernel.org/all/20250224155500.52462-1-francesco@dolcini.it/
 * Fixed a bug in wm8904_parse_retune_cfg_from_of()
 * Added full usage example of the three ReTune Mobile config properties in the
   DT binding.
 * Improved the DAPM routing:
   * Only add IN1L/IN1R routes to ADCL/ADCR conditionally depending on which
     DMIC is in use.
   * Do not connect PGAs to ADC when they are not needed.
   * Keep the mux between ADC/DMIC even when two DMICs are used, as the IN1
     pins share a mux with IN2 and IN3 and the ADC could still be used for
     them.

v1: https://lore.kernel.org/all/20250206163152.423199-1-francesco@dolcini.it/

Ernest Van Hoecke (5):
  of: Add of_property_read_u16_index
  ASoC: wm8904: Don't touch GPIO configs set to 0xFFFF
  ASoC: dt-bindings: wm8904: Add DMIC, GPIO, MIC and EQ support
  ASoC: wm8904: get platform data from DT
  ASoC: wm8904: add DMIC support

 .../devicetree/bindings/sound/wlf,wm8904.yaml | 129 +++++++
 drivers/of/property.c                         |  33 ++
 include/linux/of.h                            |   9 +
 include/sound/wm8904.h                        |   3 +
 sound/soc/codecs/wm8904.c                     | 317 +++++++++++++++++-
 5 files changed, 484 insertions(+), 7 deletions(-)

Comments

Mark Brown March 20, 2025, 6:45 p.m. UTC | #1
On Wed, 19 Mar 2025 15:20:54 +0100, Francesco Dolcini wrote:
> This patch series adds DMIC and DRC support to the WM8904 driver, a new
> of_ helper is added to simplify the driver code.
> 
> DRC functionality is added in the same patch series to provide the
> necessary dynamic range control to make DMIC support useful.
> 
> The WM8904 supports digital microphones on two of its inputs:
> IN1L/DMICDAT1 and IN1R/DMICDAT2. These two inputs can either be
> connected to an ADC or to the DMIC system. There is an ADC for each
> line, and only one DMIC block. This DMIC block is either connected to
> DMICDAT1 or to DMICDAT2. One DMIC data line supports two digital
> microphones via time multiplexing.
> 
> [...]

Applied to

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

Thanks!

[1/5] of: Add of_property_read_u16_index
      commit: fd9582998b9a82ef53a34756de8a1fb86abac972
[2/5] ASoC: wm8904: Don't touch GPIO configs set to 0xFFFF
      commit: 2aa853248b6b6c76b9dd82353e45a4283f9c53ec
[3/5] ASoC: dt-bindings: wm8904: Add DMIC, GPIO, MIC and EQ support
      commit: bd552e937fc80faa70007f7a4cbbf7edd5a6629a
[4/5] ASoC: wm8904: get platform data from DT
      commit: afe66ef965317381fd2894c2eba144b38b791910
[5/5] ASoC: wm8904: add DMIC support
      commit: b6612c8fc3a2c279196050ecc13c77a7863d83eb

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