7acf5b2c6c2a23ec4196782dcb92cf83dbfb76c3
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0562-Pisound-dynamic-overlay-1760.patch
1 From 27b7e48055d8d31d8a03dbe7d8d4fccbc3ad7f31 Mon Sep 17 00:00:00 2001
2 From: gtrainavicius <gtrainavicius@users.noreply.github.com>
3 Date: Sat, 10 Dec 2016 16:05:25 +0200
4 Subject: [PATCH] Pisound dynamic overlay (#1760)
5
6 Restructuring pisound-overlay.dts, so it can be loaded and unloaded dynamically using dtoverlay.
7
8 Print a logline when the kernel module is removed.
9 ---
10 arch/arm/boot/dts/overlays/pisound-overlay.dts | 94 ++++++++++++++------------
11 sound/soc/bcm/pisound.c | 2 +
12 2 files changed, 52 insertions(+), 44 deletions(-)
13
14 --- a/arch/arm/boot/dts/overlays/pisound-overlay.dts
15 +++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts
16 @@ -26,6 +26,54 @@
17 compatible = "brcm,bcm2708";
18
19 fragment@0 {
20 + target = <&spi0>;
21 + __overlay__ {
22 + status = "okay";
23 + };
24 + };
25 +
26 + fragment@1 {
27 + target = <&spidev0>;
28 + __overlay__ {
29 + status = "disabled";
30 + };
31 + };
32 +
33 + fragment@2 {
34 + target = <&spidev1>;
35 + __overlay__ {
36 + status = "okay";
37 + };
38 + };
39 +
40 + fragment@3 {
41 + target = <&spi0>;
42 + __overlay__ {
43 + #address-cells = <1>;
44 + #size-cells = <0>;
45 +
46 + pisound_spi: pisound_spi@0{
47 + compatible = "blokaslabs,pisound-spi";
48 + reg = <0>;
49 + pinctrl-names = "default";
50 + pinctrl-0 = <&spi0_pins>;
51 + spi-max-frequency = <1000000>;
52 + };
53 + };
54 + };
55 +
56 + fragment@4 {
57 + target-path = "/";
58 + __overlay__ {
59 + pcm5102a-codec {
60 + #sound-dai-cells = <0>;
61 + compatible = "ti,pcm5102a";
62 + status = "okay";
63 + };
64 + };
65 + };
66 +
67 + fragment@5 {
68 target = <&sound>;
69 __overlay__ {
70 compatible = "blokaslabs,pisound";
71 @@ -49,7 +97,7 @@
72 };
73 };
74
75 - fragment@1 {
76 + fragment@6 {
77 target = <&gpio>;
78 __overlay__ {
79 pinctrl-names = "default";
80 @@ -63,52 +111,10 @@
81 };
82 };
83
84 - fragment@2 {
85 + fragment@7 {
86 target = <&i2s>;
87 __overlay__ {
88 status = "okay";
89 };
90 };
91 -
92 - fragment@3 {
93 - target-path = "/";
94 - __overlay__ {
95 - pcm5102a-codec {
96 - #sound-dai-cells = <0>;
97 - compatible = "ti,pcm5102a";
98 - status = "okay";
99 - };
100 - };
101 - };
102 -
103 - fragment@4 {
104 - target = <&spi0>;
105 - __overlay__ {
106 - status = "okay";
107 -
108 - spidev@0{
109 - status = "disabled";
110 - };
111 -
112 - spidev@1{
113 - status = "okay";
114 - };
115 - };
116 - };
117 -
118 - fragment@5 {
119 - target = <&spi0>;
120 - __overlay__ {
121 - #address-cells = <1>;
122 - #size-cells = <0>;
123 -
124 - pisound_spi: pisound_spi@0{
125 - compatible = "blokaslabs,pisound-spi";
126 - reg = <0>;
127 - pinctrl-names = "default";
128 - pinctrl-0 = <&spi0_pins>;
129 - spi-max-frequency = <1000000>;
130 - };
131 - };
132 - };
133 };
134 --- a/sound/soc/bcm/pisound.c
135 +++ b/sound/soc/bcm/pisound.c
136 @@ -954,6 +954,8 @@ static int pisnd_probe(struct platform_d
137
138 static int pisnd_remove(struct platform_device *pdev)
139 {
140 + printi("Unloading.\n");
141 +
142 if (pisnd_kobj) {
143 kobject_put(pisnd_kobj);
144 pisnd_kobj = NULL;