[RFC PATCH v5 0/8] ALSA: usb: add RME Babyface Pro driver (proprietary mode)

Ismaïl Bahloul <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound,org.kernel.vger.linux-usb
Message-ID <[email protected]>
Hi Takashi,

This is v5, re-split per your v4 review: still too coarse, start with
a minimalistic core (probe/disconnect/PCM only), add mixers
piece-by-piece, suspend/resume near the end, and add proper "big
picture" documentation for human reviewers.

Beyond the restructuring, this revision also folds in three
hardware-verified fixes found by a contributor (David Fredman,
credited per-patch via Co-developed-by/Signed-off-by) since v4 went
out:

 - The sample rate is now set through the family register the
   firmware actually keys off, rather than the previous approach,
   which could leave the device on the wrong rate after certain
   family transitions. A running stream also now locks the rate: a
   second client asking for a conflicting rate is refused at
   hw_params rather than silently retuning a live stream out from
   under it (patches 1, 2, 4).

 - The front-panel OUT selector's base-mode decode (Ch 1/2 vs Phones
   vs Opt) was wrong on selector values 0/1/2, corrected against the
   physical LEDs on both a non-FS unit and the Pro FS (patch 6).

 - Turning the front-panel wheel with OUT selected produced audible
   zipper noise: the firmware moves the analog output level itself on
   each click with its own ~12 ms smoothing, and the driver was also
   writing the analog (8-bit) master on every poll from a flat
   1 dB/click count, fighting the firmware's own move each time. The
   driver now writes only the digital (16-bit) master during the
   gesture, follows the firmware's actual level- and speed-dependent
   step size, and reconciles the real master once the wheel is at
   rest, the way TotalMix does (patch 6).

Every patch was built in-tree on its own against next-20260911 and is
checkpatch --strict clean of errors; five WARNING-level notices remain
across the series when checkpatch is run against the patch files
themselves (the same two `ang` "misspellings" in the EQ patch noted in
v4, plus one new `retuned` "misspelling" from the rate fix above -
all three are correctly spelled, BIT() is separately declined as a
CHECK in the EQ patch because it returns unsigned long, wrong for that
file's signed Q27 fixed-point math - and two routine "does MAINTAINERS
need updating?" reminders on the patches that add files, answered
once in patch 1's
MAINTAINERS entry for the whole series).

How this v5 is split, and why:

 1. Core: probe, disconnect, PCM stream only. No mixer, no front
    panel, no DSP EQ, no suspend/resume. This alone is a working
    (if silent, no routing yet) capture/playback driver.

 2. Output masters + the crosspoint routing matrix, together: a
    driver with masters but no routing would still be silent, since
    the factory-default routing this patch also adds is what actually
    connects a source to an output. This is the first patch that
    produces controllable, audible output.

 3. Mic preamp: phantom power, pad, instrument ref level, the four
    gains, plus phase/stereo-split/trim (input-strip controls layered
    on the crosspoint registers the previous patch introduced).

 4. Routing flags and varispeed pitch, together: loopback, AN 1>2,
    sample clock source, AN1/2 link, MS processor, DIM, width, FX
    send, and pitch. These started life as one function registering
    all of them in a single pass; splitting pitch out on its own would
    have meant an artificial function split with no real benefit.

 5. S3 suspend/resume.

 6. The front-panel poll and controls (buttons, wheel, IN/OUT/SELECT,
    MIX, DIM) plus the host-side emulation of TotalMix's own role for
    the wheel/button behaviour.

 7. The hardware 3-band + low-cut DSP EQ.

 8. A new documentation patch (Documentation/sound/cards/
    babyface-pro.rst): why the proprietary mode needs a standalone
    driver, the vendor protocol's write-only/no-readback shape, the
    asynchronous stream model, why mixer state has to be cached and
    replayed, and why the driver emulates TotalMix for the front
    panel. This is meant to give a reviewer the big picture before
    reading patches 1-7, not to restate what their own commit messages
    and code comments already cover.

Two places needed real judgement calls rather than a mechanical split
along control names, both explained above and in the affected patches'
own commit messages: masters+crosspoint (patch 2) and flags+pitch
(patch 4) are each one patch instead of further split, because the
underlying code was never separable along those lines without
inventing an artificial seam - the same reasoning v4's own cover
letter gave for not re-splitting the core+mixer patch further at the
time.

Known limitations, unchanged from v4:

 - USB autosuspend is not supported, explicitly disabled at probe.
   S3 suspend/resume works and is tested.

 - A few protocol details remain open (documented, not blocking): the
   preamp readback index semantics, a width strip-ownership edge case,
   whether DIM's scope is reassignable with TotalMix's Main Out
   setting, and the exact high-frequency warping of the EQ
   coefficients against the vendor curve.

 - The latency profile (frames_per_urb, nurbs) is a module parameter,
   not runtime-reconfigurable.

Validation: the same full-duplex rate x period sweep, start/stop
stress, mixer-restore-across-unbind/rebind and mid-stream-disconnect
regression suite as v4, run against the final tree - 40 of 40. Each of
the 8 patches was additionally checked out on its own and built
in-tree, to confirm the split itself introduces no broken intermediate
state. The three fixes above were separately hardware-verified: all
nine rate/family combinations plus varispeed and the rate-lock
refusal (patches 1/2/4); LED-correlated captures of the OUT selector
across both a non-FS unit and the Pro FS (patch 6); and zipper-noise-
free wheel turns against a looped-back level measurement (patch 6) -
each detailed in the affected patch's own commit message.

Disclosure: as with previous versions, the reverse-engineering and
substantial portions of the kernel implementation were written with
heavy assistance from AI coding assistants. All of it was verified by
hand on real hardware; the human authors remain responsible for the
result via Signed-off-by.

Thanks for reading,
Ismaïl

Ismaïl Bahloul (8):
  ALSA: usb: add RME Babyface Pro driver core (probe, PCM stream)
  ALSA: usb: babyfacepro: add output masters and crosspoint routing
  ALSA: usb: babyfacepro: add mic preamp, phantom/pad and input trim
  ALSA: usb: babyfacepro: add routing flags and varispeed pitch
  ALSA: usb: babyfacepro: add S3 suspend/resume
  ALSA: usb: babyfacepro: add the front-panel poll and controls
  ALSA: usb: babyfacepro: add the hardware DSP EQ
  Documentation: sound: add the Babyface Pro proprietary-mode design doc

 Documentation/sound/cards/babyface-pro.rst |  163 +
 Documentation/sound/cards/index.rst        |    1 +
 MAINTAINERS                                |    6 +
 sound/usb/Kconfig                          |   20 +
 sound/usb/Makefile                         |    2 +-
 sound/usb/babyfacepro/Makefile             |    4 +
 sound/usb/babyfacepro/babyfacepro-ctl.c    | 3775 ++++++++++++++++++++
 sound/usb/babyfacepro/babyfacepro.c        | 1700 +++++++++
 sound/usb/babyfacepro/babyfacepro.h        |  522 +++
 9 files changed, 6192 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/sound/cards/babyface-pro.rst
 create mode 100644 sound/usb/babyfacepro/Makefile
 create mode 100644 sound/usb/babyfacepro/babyfacepro-ctl.c
 create mode 100644 sound/usb/babyfacepro/babyfacepro.c
 create mode 100644 sound/usb/babyfacepro/babyfacepro.h

--
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.