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