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