GNU Linux-libre 5.19-rc6-gnu
[releases.git] / Documentation / devicetree / bindings / display / solomon,ssd1307fb.yaml
1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/display/solomon,ssd1307fb.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: Solomon SSD1307 OLED Controller Framebuffer
8
9 maintainers:
10   - Maxime Ripard <mripard@kernel.org>
11   - Javier Martinez Canillas <javierm@redhat.com>
12
13 properties:
14   compatible:
15     oneOf:
16       # Deprecated compatible strings
17       - items:
18           - enum:
19               - solomon,ssd1305fb-i2c
20               - solomon,ssd1306fb-i2c
21               - solomon,ssd1307fb-i2c
22               - solomon,ssd1309fb-i2c
23         deprecated: true
24       - items:
25           - enum:
26               - sinowealth,sh1106
27               - solomon,ssd1305
28               - solomon,ssd1306
29               - solomon,ssd1307
30               - solomon,ssd1309
31
32   reg:
33     maxItems: 1
34
35   pwms:
36     maxItems: 1
37
38   reset-gpios:
39     maxItems: 1
40
41   # Only required for SPI
42   dc-gpios:
43     description:
44       GPIO connected to the controller's D/C# (Data/Command) pin,
45       that is needed for 4-wire SPI to tell the controller if the
46       data sent is for a command register or the display data RAM
47     maxItems: 1
48
49   vbat-supply:
50     description: The supply for VBAT
51
52   # Only required for SPI
53   spi-max-frequency: true
54
55   solomon,height:
56     $ref: /schemas/types.yaml#/definitions/uint32
57     default: 16
58     description:
59       Height in pixel of the screen driven by the controller
60
61   solomon,width:
62     $ref: /schemas/types.yaml#/definitions/uint32
63     default: 96
64     description:
65       Width in pixel of the screen driven by the controller
66
67   solomon,page-offset:
68     $ref: /schemas/types.yaml#/definitions/uint32
69     default: 1
70     description:
71       Offset of pages (band of 8 pixels) that the screen is mapped to
72
73   solomon,segment-no-remap:
74     type: boolean
75     description:
76       Display needs normal (non-inverted) data column to segment mapping
77
78   solomon,col-offset:
79     $ref: /schemas/types.yaml#/definitions/uint32
80     default: 0
81     description:
82       Offset of columns (COL/SEG) that the screen is mapped to
83
84   solomon,com-seq:
85     type: boolean
86     description:
87       Display uses sequential COM pin configuration
88
89   solomon,com-lrremap:
90     type: boolean
91     description:
92       Display uses left-right COM pin remap
93
94   solomon,com-invdir:
95     type: boolean
96     description:
97       Display uses inverted COM pin scan direction
98
99   solomon,com-offset:
100     $ref: /schemas/types.yaml#/definitions/uint32
101     default: 0
102     description:
103       Number of the COM pin wired to the first display line
104
105   solomon,prechargep1:
106     $ref: /schemas/types.yaml#/definitions/uint32
107     default: 2
108     description:
109       Length of deselect period (phase 1) in clock cycles
110
111   solomon,prechargep2:
112     $ref: /schemas/types.yaml#/definitions/uint32
113     default: 2
114     description:
115       Length of precharge period (phase 2) in clock cycles.  This needs to be
116       the higher, the higher the capacitance of the OLED's pixels is.
117
118   solomon,dclk-div:
119     $ref: /schemas/types.yaml#/definitions/uint32
120     minimum: 1
121     maximum: 16
122     description:
123       Clock divisor. The default value is controller-dependent.
124
125   solomon,dclk-frq:
126     $ref: /schemas/types.yaml#/definitions/uint32
127     minimum: 0
128     maximum: 15
129     description:
130       Clock frequency, higher value means higher frequency.
131       The default value is controller-dependent.
132
133   solomon,lookup-table:
134     $ref: /schemas/types.yaml#/definitions/uint8-array
135     maxItems: 4
136     description:
137       8 bit value array of current drive pulse widths for BANK0, and colors A,
138       B, and C. Each value in range of 31 to 63 for pulse widths of 32 to 64.
139       Color D is always width 64.
140
141   solomon,area-color-enable:
142     type: boolean
143     description:
144       Display uses color mode
145
146   solomon,low-power:
147     type: boolean
148     description:
149       Display runs in low power mode
150
151 required:
152   - compatible
153   - reg
154
155 allOf:
156   - if:
157       properties:
158         compatible:
159           contains:
160             const: sinowealth,sh1106
161     then:
162       properties:
163         solomon,dclk-div:
164           default: 1
165         solomon,dclk-frq:
166           default: 5
167
168   - if:
169       properties:
170         compatible:
171           contains:
172             enum:
173               - solomon,ssd1305-i2c
174               - solomon,ssd1305
175     then:
176       properties:
177         solomon,dclk-div:
178           default: 1
179         solomon,dclk-frq:
180           default: 7
181
182   - if:
183       properties:
184         compatible:
185           contains:
186             enum:
187               - solomon,ssd1306-i2c
188               - solomon,ssd1306
189     then:
190       properties:
191         solomon,dclk-div:
192           default: 1
193         solomon,dclk-frq:
194           default: 8
195
196   - if:
197       properties:
198         compatible:
199           contains:
200             enum:
201               - solomon,ssd1307-i2c
202               - solomon,ssd1307
203     then:
204       properties:
205         solomon,dclk-div:
206           default: 2
207         solomon,dclk-frq:
208           default: 12
209       required:
210         - pwms
211
212   - if:
213       properties:
214         compatible:
215           contains:
216             enum:
217               - solomon,ssd1309-i2c
218               - solomon,ssd1309
219     then:
220       properties:
221         solomon,dclk-div:
222           default: 1
223         solomon,dclk-frq:
224           default: 10
225
226 additionalProperties: false
227
228 examples:
229   - |
230     i2c1 {
231             #address-cells = <1>;
232             #size-cells = <0>;
233
234             ssd1307_i2c: oled@3c {
235                     compatible = "solomon,ssd1307";
236                     reg = <0x3c>;
237                     pwms = <&pwm 4 3000>;
238                     reset-gpios = <&gpio2 7>;
239             };
240
241             ssd1306_i2c: oled@3d {
242                     compatible = "solomon,ssd1306";
243                     reg = <0x3c>;
244                     pwms = <&pwm 4 3000>;
245                     reset-gpios = <&gpio2 7>;
246                     solomon,com-lrremap;
247                     solomon,com-invdir;
248                     solomon,com-offset = <32>;
249                     solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
250             };
251     };
252   - |
253     spi {
254             #address-cells = <1>;
255             #size-cells = <0>;
256
257             ssd1307_spi: oled@0 {
258                     compatible = "solomon,ssd1307";
259                     reg = <0x0>;
260                     pwms = <&pwm 4 3000>;
261                     reset-gpios = <&gpio2 7>;
262                     dc-gpios = <&gpio2 8>;
263                     spi-max-frequency = <10000000>;
264             };
265
266             ssd1306_spi: oled@1 {
267                     compatible = "solomon,ssd1306";
268                     reg = <0x1>;
269                     pwms = <&pwm 4 3000>;
270                     reset-gpios = <&gpio2 7>;
271                     dc-gpios = <&gpio2 8>;
272                     spi-max-frequency = <10000000>;
273                     solomon,com-lrremap;
274                     solomon,com-invdir;
275                     solomon,com-offset = <32>;
276                     solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
277             };
278     };