difos/target/linux/bcm27xx/patches-6.12/950-0810-dts-overlays-Enable-RP1-Audio-Out-using-audremap-pi5.patch
Álvaro Fernández Rojas 8f9e91ad03 bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-05-21 11:32:18 +02:00

133 lines
4 KiB
Diff

From 77ec286b2ccf5fa7c27205113a91997d37a475f9 Mon Sep 17 00:00:00 2001
From: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Date: Thu, 20 Feb 2025 19:24:59 +0000
Subject: [PATCH] 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>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 11 ++++
.../dts/overlays/audremap-pi5-overlay.dts | 65 +++++++++++++++++++
arch/arm/boot/dts/overlays/overlay_map.dts | 5 ++
4 files changed, 82 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/audremap-pi5-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -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 \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -871,6 +871,17 @@ Params: swap_lr Reverse
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-pi5,<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.
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/audremap-pi5-overlay.dts
@@ -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__ {
+
+ rp1_audio_out_codec: rp1_audio_out_codec@0 {
+ compatible = "linux,spdif-dit";
+ #sound-dai-cells = <0>;
+ status = "ok";
+ };
+
+ rp1_audio_out_simple_card@0 {
+ 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 = <&rp1_audio_out_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 */
+ };
+};
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -4,6 +4,11 @@
audremap {
bcm2835;
bcm2711;
+ bcm2712 = "audremap-pi5";
+ };
+
+ audremap-pi5 {
+ bcm2712;
};
balena-fin {