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