Skip to content

Commit

Permalink
dts: overlays: Enable RP1 Audio Out using audremap-pi5-overlay
Browse files Browse the repository at this point in the history
Since RP1 Audio Out can only work on GPIOs 12, 13 which would
previously have needed dtoverlay=audremap, overload it both to
enable and pin-map the block (do not enable for other pinouts).

At the same time, generate a default "codec" and "sound card".

Signed-off-by: Nick Hollinghurst <[email protected]>
  • Loading branch information
njhollinghurst committed Feb 19, 2025
1 parent 5c070cf commit 37d7eca
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
audioinjector-wm8731-audio.dtbo \
audiosense-pi.dtbo \
audremap.dtbo \
audremap-pi5.dtbo \
balena-fin.dtbo \
bcm2712d0.dtbo \
camera-mux-2port.dtbo \
Expand Down
11 changes: 11 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,17 @@ Params: swap_lr Reverse the channel allocation, which will also
pins are on different controllers)


Name: audremap-pi5
Info: On Raspberry Pi 5 / 500 /CM5, enable digital audio output
and route it to GPIOs 12 & 13 on the 40-pin header
Load: dtoverlay=audremap,<param>=<val>
Params: swap_lr Reverse the channel allocation (default off)
pins_12_13 Select GPIOs 12 & 13 (default)
pins_18_19 Not available; this will not enable audio out
pins_40_41 Not available; this will not enable audio out
pins_40_45 Not available; this will not enable audio out


Name: balena-fin
Info: Overlay that enables WLAN, Bluetooth and the GPIO expander on the
balenaFin carrier board for the Raspberry Pi Compute Module 3/3+ Lite.
Expand Down
65 changes: 65 additions & 0 deletions arch/arm/boot/dts/overlays/audremap-pi5-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/dts-v1/;
/plugin/;

/*
* Raspberry Pi 5 has a different Audio Out hardware from earlier Raspberry Pis.
* It can output only to GPIOs 12 and 13. We therefore enable it *only* when
* that particular GPIO mapping is requested here. To make it work with ASOC
* we must also define a "dummy" codec and a generic audio card.
*/

/ {
compatible = "brcm,bcm2712";

fragment@0 {
target = <&rp1_audio_out>;
frag0: __overlay__ {
pinctrl-0 = <&rp1_audio_out_12_13>;
pinctrl-names = "default";
status = "ok";
};
};

fragment@1 {
target-path = "/";
__overlay__ {

simple_audio_codec: simple-audio-codec {
compatible = "linux,spdif-dit";
#sound-dai-cells = <0>;
status = "ok";
};

audio_out_card {
compatible = "simple-audio-card";
simple-audio-card,name = "RP1-Audio-Out";
#address-cells = <1>;
#size-cells = <0>;
status = "ok";

simple-audio-card,dai-link@0 {
reg = <0>;
format = "left_j";
bitclock-master = <&sndcpu0>;
frame-master = <&sndcpu0>;

sndcpu0: cpu {
sound-dai = <&rp1_audio_out>;
};

codec {
sound-dai = <&simple_audio_codec>;
};
};
};
};
};

__overrides__ {
swap_lr = <&frag0>, "swap_lr?";
pins_12_13 = <0>, "+0+1"; /* this is the default */
pins_18_19 = <0>, "-0-1"; /* sorry not supported */
pins_40_41 = <0>, "-0-1"; /* sorry not supported */
pins_40_45 = <0>, "-0-1"; /* sorry not supported */
};
};
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/overlay_map.dts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
audremap {
bcm2835;
bcm2711;
bcm2712 = "audremap-pi5";
};

balena-fin {
Expand Down

0 comments on commit 37d7eca

Please sign in to comment.