Skip to content

Commit c76a485

Browse files
njhollinghurstsanderhollaar
authored andcommitted
dts: overlays: Enable RP1 Audio Out using audremap-pi5-overlay
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 <nick.hollinghurst@raspberrypi.com>
1 parent 2dcf7b9 commit c76a485

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
3333
audioinjector-wm8731-audio.dtbo \
3434
audiosense-pi.dtbo \
3535
audremap.dtbo \
36+
audremap-pi5.dtbo \
3637
balena-fin.dtbo \
3738
bcm2712d0.dtbo \
3839
camera-mux-2port.dtbo \

arch/arm/boot/dts/overlays/README

+11
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,17 @@ Params: swap_lr Reverse the channel allocation, which will also
871871
pins are on different controllers)
872872

873873

874+
Name: audremap-pi5
875+
Info: On Raspberry Pi 5 / 500 /CM5, enable digital audio output
876+
and route it to GPIOs 12 & 13 on the 40-pin header
877+
Load: dtoverlay=audremap-pi5,<param>=<val>
878+
Params: swap_lr Reverse the channel allocation (default off)
879+
pins_12_13 Select GPIOs 12 & 13 (default)
880+
pins_18_19 Not available; this will not enable audio out
881+
pins_40_41 Not available; this will not enable audio out
882+
pins_40_45 Not available; this will not enable audio out
883+
884+
874885
Name: balena-fin
875886
Info: Overlay that enables WLAN, Bluetooth and the GPIO expander on the
876887
balenaFin carrier board for the Raspberry Pi Compute Module 3/3+ Lite.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
/*
5+
* Raspberry Pi 5 has a different Audio Out hardware from earlier Raspberry Pis.
6+
* It can output only to GPIOs 12 and 13. We therefore enable it *only* when
7+
* that particular GPIO mapping is requested here. To make it work with ASOC
8+
* we must also define a "dummy" codec and a generic audio card.
9+
*/
10+
11+
/ {
12+
compatible = "brcm,bcm2712";
13+
14+
fragment@0 {
15+
target = <&rp1_audio_out>;
16+
frag0: __overlay__ {
17+
pinctrl-0 = <&rp1_audio_out_12_13>;
18+
pinctrl-names = "default";
19+
status = "ok";
20+
};
21+
};
22+
23+
fragment@1 {
24+
target-path = "/";
25+
__overlay__ {
26+
27+
rp1_audio_out_codec: rp1_audio_out_codec@0 {
28+
compatible = "linux,spdif-dit";
29+
#sound-dai-cells = <0>;
30+
status = "ok";
31+
};
32+
33+
rp1_audio_out_simple_card@0 {
34+
compatible = "simple-audio-card";
35+
simple-audio-card,name = "RP1-Audio-Out";
36+
#address-cells = <1>;
37+
#size-cells = <0>;
38+
status = "ok";
39+
40+
simple-audio-card,dai-link@0 {
41+
reg = <0>;
42+
format = "left_j";
43+
bitclock-master = <&sndcpu0>;
44+
frame-master = <&sndcpu0>;
45+
46+
sndcpu0: cpu {
47+
sound-dai = <&rp1_audio_out>;
48+
};
49+
50+
codec {
51+
sound-dai = <&rp1_audio_out_codec>;
52+
};
53+
};
54+
};
55+
};
56+
};
57+
58+
__overrides__ {
59+
swap_lr = <&frag0>, "swap_lr?";
60+
pins_12_13 = <0>, "+0+1"; /* this is the default */
61+
pins_18_19 = <0>, "-0-1"; /* sorry not supported */
62+
pins_40_41 = <0>, "-0-1"; /* sorry not supported */
63+
pins_40_45 = <0>, "-0-1"; /* sorry not supported */
64+
};
65+
};

arch/arm/boot/dts/overlays/overlay_map.dts

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
audremap {
55
bcm2835;
66
bcm2711;
7+
bcm2712 = "audremap-pi5";
8+
};
9+
10+
audremap-pi5 {
11+
bcm2712;
712
};
813

914
balena-fin {

0 commit comments

Comments
 (0)