kernel: bump 5.4 to 5.4.106
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0763-snd_bcm2835-disable-HDMI-audio-when-vc4-is-used-3640.patch
1 From 744543757bef8621f7791e28ecb894b2627cb449 Mon Sep 17 00:00:00 2001
2 From: Hristo Venev <hristo@venev.name>
3 Date: Fri, 5 Jun 2020 09:22:49 +0000
4 Subject: [PATCH] snd_bcm2835: disable HDMI audio when vc4 is used
5 (#3640)
6
7 Things don't work too well when both the vc4 driver and the firmware
8 driver are trying to control the same audio output:
9
10 [ 763.569406] bcm2835_audio bcm2835_audio: vchi message timeout, msg=5
11
12 Hence, when the vc4 HDMI driver is used, let it control audio. This is done
13 by introducing a new device tree property to the audio node, and
14 extending the vc4-kms-v3d overlays to set it appropriately.
15
16 Signed-off-by: Hristo Venev <hristo@venev.name>
17 ---
18 arch/arm/boot/dts/overlays/README | 2 ++
19 arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts | 10 +++++++++-
20 arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts | 8 ++++++++
21 drivers/staging/vc04_services/bcm2835-audio/bcm2835.c | 4 +++-
22 4 files changed, 22 insertions(+), 2 deletions(-)
23
24 --- a/arch/arm/boot/dts/overlays/README
25 +++ b/arch/arm/boot/dts/overlays/README
26 @@ -2745,6 +2745,7 @@ Params: cma-256 CMA is 2
27 cma-size CMA size in bytes, 4MB aligned
28 cma-default Use upstream's default value
29 audio Enable or disable audio over HDMI (default "on")
30 + noaudio Disable all HDMI audio (default "off")
31
32
33 Name: vc4-kms-v3d-pi4
34 @@ -2761,6 +2762,7 @@ Params: cma-256 CMA is 2
35 "on")
36 audio1 Enable or disable audio over HDMI1 (default
37 "on")
38 + noaudio Disable all HDMI audio (default "off")
39
40
41 Name: vga666
42 --- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
43 +++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-overlay.dts
44 @@ -108,7 +108,15 @@
45 };
46 };
47
48 + fragment@14 {
49 + target = <&audio>;
50 + __overlay__ {
51 + brcm,disable-hdmi;
52 + };
53 + };
54 +
55 __overrides__ {
56 - audio = <0>,"!13";
57 + audio = <0>,"!13", <0>,"=14";
58 + noaudio = <0>,"=13", <0>,"!14";
59 };
60 };
61 --- a/arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts
62 +++ b/arch/arm/boot/dts/overlays/vc4-kms-v3d-pi4-overlay.dts
63 @@ -138,8 +138,16 @@
64 };
65 };
66
67 + fragment@19 {
68 + target = <&audio>;
69 + __overlay__ {
70 + brcm,disable-hdmi;
71 + };
72 + };
73 +
74 __overrides__ {
75 audio = <0>,"!17";
76 audio1 = <0>,"!18";
77 + noaudio = <0>,"=17", <0>,"=18", <0>,"!19";
78 };
79 };
80 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
81 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
82 @@ -381,7 +381,9 @@ static int snd_bcm2835_alsa_probe(struct
83 }
84
85 if (!enable_compat_alsa) {
86 - set_hdmi_enables(dev);
87 + if (!of_property_read_bool(dev->of_node, "brcm,disable-hdmi"))
88 + set_hdmi_enables(dev);
89 +
90 // In this mode, always enable analog output
91 enable_headphones = true;
92 } else {