0511-Add-Adafruit-pitft35-touchscreen-support-1657.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. From 877d2ad66da4c7aba2db0ecb394a07a19ac2e374 Mon Sep 17 00:00:00 2001
  2. From: Scott Ellis <scott@jumpnowtek.com>
  3. Date: Tue, 27 Sep 2016 04:29:00 -0400
  4. Subject: [PATCH] Add Adafruit pitft35 touchscreen support (#1657)
  5. The dts comes from the Adafruit repository
  6. https://github.com/adafruit/Adafruit-Pi-Kernel-o-Matic/blob/pitft/pitft35r-overlay.dts
  7. Reformatted slightly to match conventions in the pitft28-resistive-overlay.
  8. Signed-off-by: Scott Ellis <scott@jumpnowtek.com>
  9. ---
  10. arch/arm/boot/dts/overlays/Makefile | 1 +
  11. arch/arm/boot/dts/overlays/README | 12 ++
  12. .../dts/overlays/pitft35-resistive-overlay.dts | 121 +++++++++++++++++++++
  13. arch/arm/configs/bcm2709_defconfig | 1 +
  14. arch/arm/configs/bcmrpi_defconfig | 1 +
  15. 5 files changed, 136 insertions(+)
  16. create mode 100644 arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts
  17. --- a/arch/arm/boot/dts/overlays/Makefile
  18. +++ b/arch/arm/boot/dts/overlays/Makefile
  19. @@ -65,6 +65,7 @@ dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dt
  20. dtbo-$(RPI_DT_OVERLAYS) += pitft22.dtbo
  21. dtbo-$(RPI_DT_OVERLAYS) += pitft28-capacitive.dtbo
  22. dtbo-$(RPI_DT_OVERLAYS) += pitft28-resistive.dtbo
  23. +dtbo-$(RPI_DT_OVERLAYS) += pitft35-resistive.dtbo
  24. dtbo-$(RPI_DT_OVERLAYS) += pps-gpio.dtbo
  25. dtbo-$(RPI_DT_OVERLAYS) += pwm.dtbo
  26. dtbo-$(RPI_DT_OVERLAYS) += pwm-2chan.dtbo
  27. --- a/arch/arm/boot/dts/overlays/README
  28. +++ b/arch/arm/boot/dts/overlays/README
  29. @@ -854,6 +854,18 @@ Params: speed Display
  30. debug Debug output level {0-7}
  31. +Name: pitft35-resistive
  32. +Info: Adafruit PiTFT 3.5" resistive touch screen
  33. +Load: dtoverlay=pitft35-resistive,<param>=<val>
  34. +Params: speed Display SPI bus speed
  35. +
  36. + rotate Display rotation {0,90,180,270}
  37. +
  38. + fps Delay between frame updates
  39. +
  40. + debug Debug output level {0-7}
  41. +
  42. +
  43. Name: pps-gpio
  44. Info: Configures the pps-gpio (pulse-per-second time signal via GPIO).
  45. Load: dtoverlay=pps-gpio,<param>=<val>
  46. --- /dev/null
  47. +++ b/arch/arm/boot/dts/overlays/pitft35-resistive-overlay.dts
  48. @@ -0,0 +1,121 @@
  49. +/*
  50. + * Device Tree overlay for Adafruit PiTFT 3.5" resistive touch screen
  51. + *
  52. + */
  53. +
  54. +/dts-v1/;
  55. +/plugin/;
  56. +
  57. +/ {
  58. + compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
  59. +
  60. + fragment@0 {
  61. + target = <&spi0>;
  62. + __overlay__ {
  63. + status = "okay";
  64. + };
  65. + };
  66. +
  67. + fragment@1 {
  68. + target = <&spidev0>;
  69. + __overlay__ {
  70. + status = "disabled";
  71. + };
  72. + };
  73. +
  74. + fragment@2 {
  75. + target = <&spidev1>;
  76. + __overlay__ {
  77. + status = "disabled";
  78. + };
  79. + };
  80. +
  81. + fragment@3 {
  82. + target = <&gpio>;
  83. + __overlay__ {
  84. + pitft_pins: pitft_pins {
  85. + brcm,pins = <24 25>;
  86. + brcm,function = <0 1>; /* in out */
  87. + brcm,pull = <2 0>; /* pullup none */
  88. + };
  89. + };
  90. + };
  91. +
  92. + fragment@4 {
  93. + target = <&spi0>;
  94. + __overlay__ {
  95. + /* needed to avoid dtc warning */
  96. + #address-cells = <1>;
  97. + #size-cells = <0>;
  98. +
  99. + pitft: pitft@0{
  100. + compatible = "himax,hx8357d";
  101. + reg = <0>;
  102. + pinctrl-names = "default";
  103. + pinctrl-0 = <&pitft_pins>;
  104. +
  105. + spi-max-frequency = <32000000>;
  106. + rotate = <90>;
  107. + fps = <25>;
  108. + bgr;
  109. + buswidth = <8>;
  110. + dc-gpios = <&gpio 25 0>;
  111. + debug = <0>;
  112. + };
  113. +
  114. + pitft_ts@1 {
  115. + #address-cells = <1>;
  116. + #size-cells = <0>;
  117. + compatible = "st,stmpe610";
  118. + reg = <1>;
  119. +
  120. + spi-max-frequency = <500000>;
  121. + irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */
  122. + interrupts = <24 2>; /* high-to-low edge triggered */
  123. + interrupt-parent = <&gpio>;
  124. + interrupt-controller;
  125. +
  126. + stmpe_touchscreen {
  127. + compatible = "st,stmpe-ts";
  128. + st,sample-time = <4>;
  129. + st,mod-12b = <1>;
  130. + st,ref-sel = <0>;
  131. + st,adc-freq = <2>;
  132. + st,ave-ctrl = <3>;
  133. + st,touch-det-delay = <4>;
  134. + st,settling = <2>;
  135. + st,fraction-z = <7>;
  136. + st,i-drive = <0>;
  137. + };
  138. +
  139. + stmpe_gpio: stmpe_gpio {
  140. + #gpio-cells = <2>;
  141. + compatible = "st,stmpe-gpio";
  142. + /*
  143. + * only GPIO2 is wired/available
  144. + * and it is wired to the backlight
  145. + */
  146. + st,norequest-mask = <0x7b>;
  147. + };
  148. + };
  149. + };
  150. + };
  151. +
  152. + fragment@5 {
  153. + target-path = "/soc";
  154. + __overlay__ {
  155. + backlight {
  156. + compatible = "gpio-backlight";
  157. + gpios = <&stmpe_gpio 2 0>;
  158. + default-on;
  159. + };
  160. + };
  161. + };
  162. +
  163. + __overrides__ {
  164. + speed = <&pitft>,"spi-max-frequency:0";
  165. + rotate = <&pitft>,"rotate:0";
  166. + fps = <&pitft>,"fps:0";
  167. + debug = <&pitft>,"debug:0";
  168. + };
  169. +};
  170. --- a/arch/arm/configs/bcm2709_defconfig
  171. +++ b/arch/arm/configs/bcm2709_defconfig
  172. @@ -1116,6 +1116,7 @@ CONFIG_FB_TFT_BD663474=m
  173. CONFIG_FB_TFT_HX8340BN=m
  174. CONFIG_FB_TFT_HX8347D=m
  175. CONFIG_FB_TFT_HX8353D=m
  176. +CONFIG_FB_TFT_HX8357D=m
  177. CONFIG_FB_TFT_ILI9163=m
  178. CONFIG_FB_TFT_ILI9320=m
  179. CONFIG_FB_TFT_ILI9325=m
  180. --- a/arch/arm/configs/bcmrpi_defconfig
  181. +++ b/arch/arm/configs/bcmrpi_defconfig
  182. @@ -1123,6 +1123,7 @@ CONFIG_FB_TFT_BD663474=m
  183. CONFIG_FB_TFT_HX8340BN=m
  184. CONFIG_FB_TFT_HX8347D=m
  185. CONFIG_FB_TFT_HX8353D=m
  186. +CONFIG_FB_TFT_HX8357D=m
  187. CONFIG_FB_TFT_ILI9163=m
  188. CONFIG_FB_TFT_ILI9320=m
  189. CONFIG_FB_TFT_ILI9325=m