0562-Pisound-dynamic-overlay-1760.patch 2.7 KB

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