Skip to content

ASoC: bcm: hifiberry_dacplus: add optional DSP add-on capture path - #7814

Open
xc0f0c0bx wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
xc0f0c0bx:hifiberry-amp100-dsp-capture
Open

xc0f0c0bx wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
xc0f0c0bx:hifiberry-amp100-dsp-capture

Conversation

@xc0f0c0bx

@xc0f0c0bx xc0f0c0bx commented Nov 30, 2026 •

Copy link
Copy Markdown

A HiFiBerry DSP add-on stacked between the Pi and a DAC+/Amp100 can send audio back to the Pi on the I2S data-in line (GPIO20), for example the signal on its S/PDIF input. The DAC+ machine driver only registers a playback codec, so that audio cannot be captured.

This adds an opt-in dsp_capture parameter to the hifiberry-amp100 overlay:

dtoverlay=hifiberry-amp100,dsp_capture
  • New DT property hifiberry-dacplus,dsp_capture. When set, the DAI link gets a second codec: the existing hifiberry,dacplusdsp dummy codec, which provides the capture DAI.
  • The PCM512x stays codec 0 and keeps playback, clocking and all controls. Card name, playback device and mixer controls are unchanged; without the parameter nothing changes.
  • startup/shutdown return early for capture streams, so opening or closing a capture stream never toggles the LEDs or the amplifier mute GPIO.
  • Capture runs at the playback rate (one shared I2S link).
  • The overlay README documents the parameter.

The DSP side (routing the S/PDIF receiver to SDATA_OUT3 through a spare ASRC, register-only) and a matching DSP program are documented at https://github.com/xc0f0c0bx/hifiberry-dsp-spdif-capture, and proposed for hifiberry/dspprofiles in hifiberry/dspprofiles#5.

Testing

  • This patch: compile-tested against rpi-6.18.y on a Raspberry Pi 4; checkpatch.pl --strict: 0 errors, 0 warnings (one alignment CHECK that matches the neighbouring of_property_read_bool lines).
  • The same change, built out of tree as a separate module with its own compatible string, runs on a Raspberry Pi 4 with an Amp100 and a DSP add-on: playback unchanged, the optical input is captured and recorded through PipeWire.

🤖 Generated with Claude Code

A HiFiBerry DSP add-on sits between the Pi and a DAC+/Amp100 and can send
audio back to the Pi on the I2S data-in line (GPIO20), for example the
signal on its S/PDIF input. The DAC+ machine driver only registers a
playback codec, so that audio cannot be captured.

Add a "hifiberry-dacplus,dsp_capture" DT property. When it is set, the
DAI link gets a second codec, the existing "hifiberry,dacplusdsp" dummy
codec, which provides the capture DAI. The PCM512x stays codec 0 and
keeps handling playback, clocking and the mixer controls, so the card
name, the playback device and the controls are unchanged. Capture runs
at the playback sample rate, as both directions share one I2S link.

startup/shutdown now return early for capture streams, so opening or
closing a capture stream never toggles the LEDs or the amplifier mute
GPIO.

hifiberry-amp100-overlay gains a dsp_capture parameter that enables the
dummy codec node (dormant fragment) and sets the property.

Compile-tested against rpi-6.18.y on a Raspberry Pi 4 (no warnings).
The same change, built out of tree as a separate module with its own
compatible string, runs on a Raspberry Pi 4 with an Amp100 and a DSP
add-on whose program routes its S/PDIF receiver to SDATA_OUT3: playback
is unchanged and the optical input is captured and recorded.

Signed-off-by: cxfxcxcb <72253403+xc0f0c0bx@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant