bcm27xx: import latest patches from the RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-1039-overlays-add-wm8960-soundcard-overlay.patch
1 From 4b26aad69c65e141e7ad5187c558d20304eb4bd8 Mon Sep 17 00:00:00 2001
2 From: Aaron Shaw <shawaj@gmail.com>
3 Date: Sat, 2 Jan 2021 02:34:03 +0000
4 Subject: [PATCH] overlays: add wm8960-soundcard overlay
5
6 add overlay for waveshare wm8960 simple-audio-card
7
8 Change-type: patch
9 Signed-off-by: Aaron Shaw <shawaj@gmail.com>
10 ---
11 arch/arm/boot/dts/overlays/Makefile | 3 +-
12 arch/arm/boot/dts/overlays/README | 7 ++
13 .../dts/overlays/wm8960-soundcard-overlay.dts | 82 +++++++++++++++++++
14 3 files changed, 91 insertions(+), 1 deletion(-)
15 create mode 100644 arch/arm/boot/dts/overlays/wm8960-soundcard-overlay.dts
16
17 --- a/arch/arm/boot/dts/overlays/Makefile
18 +++ b/arch/arm/boot/dts/overlays/Makefile
19 @@ -210,7 +210,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
20 w1-gpio.dtbo \
21 w1-gpio-pullup.dtbo \
22 w5500.dtbo \
23 - wittypi.dtbo
24 + wittypi.dtbo \
25 + wm8960-soundcard.dtbo
26
27 targets += dtbs dtbs_install
28 targets += $(dtbo-y)
29 --- a/arch/arm/boot/dts/overlays/README
30 +++ b/arch/arm/boot/dts/overlays/README
31 @@ -3073,6 +3073,13 @@ Params: led_gpio GPIO for
32 "default-on")
33
34
35 +Name: wm8960-soundcard
36 +Info: Overlay for the Waveshare wm8960 soundcard
37 +Load: dtoverlay=wm8960-soundcard,<param>=<val>
38 +Params: alsaname Changes the card name in ALSA
39 + compatible Changes the codec compatibility
40 +
41 +
42 Troubleshooting
43 ===============
44
45 --- /dev/null
46 +++ b/arch/arm/boot/dts/overlays/wm8960-soundcard-overlay.dts
47 @@ -0,0 +1,82 @@
48 +// Definitions for Waveshare WM8960 https://github.com/waveshare/WM8960-Audio-HAT
49 +/dts-v1/;
50 +/plugin/;
51 +
52 +/ {
53 + compatible = "brcm,bcm2835";
54 +
55 + fragment@0 {
56 + target = <&i2s>;
57 + __overlay__ {
58 + status = "okay";
59 + };
60 + };
61 +
62 + fragment@1 {
63 + target-path="/";
64 + __overlay__ {
65 + wm8960_mclk: wm8960_mclk {
66 + compatible = "fixed-clock";
67 + #clock-cells = <0>;
68 + clock-frequency = <12288000>;
69 + };
70 + };
71 + };
72 + fragment@2 {
73 + target = <&i2c1>;
74 + __overlay__ {
75 + #address-cells = <1>;
76 + #size-cells = <0>;
77 + status = "okay";
78 +
79 + wm8960: wm8960 {
80 + compatible = "wlf,wm8960";
81 + reg = <0x1a>;
82 + #sound-dai-cells = <0>;
83 + AVDD-supply = <&vdd_5v0_reg>;
84 + DVDD-supply = <&vdd_3v3_reg>;
85 + };
86 + };
87 + };
88 +
89 +
90 + fragment@3 {
91 + target = <&sound>;
92 + slave_overlay: __overlay__ {
93 + compatible = "simple-audio-card";
94 + simple-audio-card,format = "i2s";
95 + simple-audio-card,name = "wm8960-soundcard";
96 + status = "okay";
97 +
98 + simple-audio-card,widgets =
99 + "Microphone", "Mic Jack",
100 + "Line", "Line In",
101 + "Line", "Line Out",
102 + "Speaker", "Speaker",
103 + "Headphone", "Headphone Jack";
104 + simple-audio-card,routing =
105 + "Headphone Jack", "HP_L",
106 + "Headphone Jack", "HP_R",
107 + "Speaker", "SPK_LP",
108 + "Speaker", "SPK_LN",
109 + "LINPUT1", "Mic Jack",
110 + "LINPUT3", "Mic Jack",
111 + "RINPUT1", "Mic Jack",
112 + "RINPUT2", "Mic Jack";
113 +
114 + simple-audio-card,cpu {
115 + sound-dai = <&i2s>;
116 + };
117 + dailink0_slave: simple-audio-card,codec {
118 + sound-dai = <&wm8960>;
119 + clocks = <&wm8960_mclk>;
120 + clock-names = "mclk";
121 + };
122 + };
123 + };
124 +
125 + __overrides__ {
126 + alsaname = <&slave_overlay>,"simple-audio-card,name";
127 + compatible = <&wm8960>,"compatible";
128 + };
129 +};