b1aa05f90ef1ceda098d2d0919ccb294581b4590
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0562-Pisound-dynamic-overlay-1760.patch
1 From cdf6acdd6a6270538b0fdd08e79986d4a553062a 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 diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts
15 index 7cdfc29..5197e65 100644
16 --- a/arch/arm/boot/dts/overlays/pisound-overlay.dts
17 +++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts
18 @@ -26,6 +26,54 @@
19 compatible = "brcm,bcm2708";
20
21 fragment@0 {
22 + target = <&spi0>;
23 + __overlay__ {
24 + status = "okay";
25 + };
26 + };
27 +
28 + fragment@1 {
29 + target = <&spidev0>;
30 + __overlay__ {
31 + status = "disabled";
32 + };
33 + };
34 +
35 + fragment@2 {
36 + target = <&spidev1>;
37 + __overlay__ {
38 + status = "okay";
39 + };
40 + };
41 +
42 + fragment@3 {
43 + target = <&spi0>;
44 + __overlay__ {
45 + #address-cells = <1>;
46 + #size-cells = <0>;
47 +
48 + pisound_spi: pisound_spi@0{
49 + compatible = "blokaslabs,pisound-spi";
50 + reg = <0>;
51 + pinctrl-names = "default";
52 + pinctrl-0 = <&spi0_pins>;
53 + spi-max-frequency = <1000000>;
54 + };
55 + };
56 + };
57 +
58 + fragment@4 {
59 + target-path = "/";
60 + __overlay__ {
61 + pcm5102a-codec {
62 + #sound-dai-cells = <0>;
63 + compatible = "ti,pcm5102a";
64 + status = "okay";
65 + };
66 + };
67 + };
68 +
69 + fragment@5 {
70 target = <&sound>;
71 __overlay__ {
72 compatible = "blokaslabs,pisound";
73 @@ -49,7 +97,7 @@
74 };
75 };
76
77 - fragment@1 {
78 + fragment@6 {
79 target = <&gpio>;
80 __overlay__ {
81 pinctrl-names = "default";
82 @@ -63,52 +111,10 @@
83 };
84 };
85
86 - fragment@2 {
87 + fragment@7 {
88 target = <&i2s>;
89 __overlay__ {
90 status = "okay";
91 };
92 };
93 -
94 - fragment@3 {
95 - target-path = "/";
96 - __overlay__ {
97 - pcm5102a-codec {
98 - #sound-dai-cells = <0>;
99 - compatible = "ti,pcm5102a";
100 - status = "okay";
101 - };
102 - };
103 - };
104 -
105 - fragment@4 {
106 - target = <&spi0>;
107 - __overlay__ {
108 - status = "okay";
109 -
110 - spidev@0{
111 - status = "disabled";
112 - };
113 -
114 - spidev@1{
115 - status = "okay";
116 - };
117 - };
118 - };
119 -
120 - fragment@5 {
121 - target = <&spi0>;
122 - __overlay__ {
123 - #address-cells = <1>;
124 - #size-cells = <0>;
125 -
126 - pisound_spi: pisound_spi@0{
127 - compatible = "blokaslabs,pisound-spi";
128 - reg = <0>;
129 - pinctrl-names = "default";
130 - pinctrl-0 = <&spi0_pins>;
131 - spi-max-frequency = <1000000>;
132 - };
133 - };
134 - };
135 };
136 diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c
137 index a3cd089..30903fcf 100644
138 --- a/sound/soc/bcm/pisound.c
139 +++ b/sound/soc/bcm/pisound.c
140 @@ -954,6 +954,8 @@ static int pisnd_probe(struct platform_device *pdev)
141
142 static int pisnd_remove(struct platform_device *pdev)
143 {
144 + printi("Unloading.\n");
145 +
146 if (pisnd_kobj) {
147 kobject_put(pisnd_kobj);
148 pisnd_kobj = NULL;
149 --
150 2.1.4
151