xref: /freebsd/sys/contrib/device-tree/Bindings/display/solomon,ssd1307fb.yaml (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
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    default: 16
53    description:
54      Height in pixel of the screen driven by the controller
55
56  solomon,width:
57    $ref: /schemas/types.yaml#/definitions/uint32
58    default: 96
59    description:
60      Width in pixel of the screen driven by the controller
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        solomon,dclk-div:
161          default: 1
162        solomon,dclk-frq:
163          default: 5
164
165  - if:
166      properties:
167        compatible:
168          contains:
169            enum:
170              - solomon,ssd1305-i2c
171              - solomon,ssd1305
172    then:
173      properties:
174        solomon,dclk-div:
175          default: 1
176        solomon,dclk-frq:
177          default: 7
178
179  - if:
180      properties:
181        compatible:
182          contains:
183            enum:
184              - solomon,ssd1306-i2c
185              - solomon,ssd1306
186    then:
187      properties:
188        solomon,dclk-div:
189          default: 1
190        solomon,dclk-frq:
191          default: 8
192
193  - if:
194      properties:
195        compatible:
196          contains:
197            enum:
198              - solomon,ssd1307-i2c
199              - solomon,ssd1307
200    then:
201      properties:
202        solomon,dclk-div:
203          default: 2
204        solomon,dclk-frq:
205          default: 12
206      required:
207        - pwms
208
209  - if:
210      properties:
211        compatible:
212          contains:
213            enum:
214              - solomon,ssd1309-i2c
215              - solomon,ssd1309
216    then:
217      properties:
218        solomon,dclk-div:
219          default: 1
220        solomon,dclk-frq:
221          default: 10
222
223unevaluatedProperties: false
224
225examples:
226  - |
227    i2c {
228            #address-cells = <1>;
229            #size-cells = <0>;
230
231            ssd1307_i2c: oled@3c {
232                    compatible = "solomon,ssd1307";
233                    reg = <0x3c>;
234                    pwms = <&pwm 4 3000>;
235                    reset-gpios = <&gpio2 7>;
236            };
237
238            ssd1306_i2c: oled@3d {
239                    compatible = "solomon,ssd1306";
240                    reg = <0x3d>;
241                    pwms = <&pwm 4 3000>;
242                    reset-gpios = <&gpio2 7>;
243                    solomon,com-lrremap;
244                    solomon,com-invdir;
245                    solomon,com-offset = <32>;
246                    solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
247            };
248    };
249  - |
250    spi {
251            #address-cells = <1>;
252            #size-cells = <0>;
253
254            ssd1307_spi: oled@0 {
255                    compatible = "solomon,ssd1307";
256                    reg = <0x0>;
257                    pwms = <&pwm 4 3000>;
258                    reset-gpios = <&gpio2 7>;
259                    dc-gpios = <&gpio2 8>;
260                    spi-max-frequency = <10000000>;
261            };
262
263            ssd1306_spi: oled@1 {
264                    compatible = "solomon,ssd1306";
265                    reg = <0x1>;
266                    pwms = <&pwm 4 3000>;
267                    reset-gpios = <&gpio2 7>;
268                    dc-gpios = <&gpio2 8>;
269                    spi-max-frequency = <10000000>;
270                    solomon,com-lrremap;
271                    solomon,com-invdir;
272                    solomon,com-offset = <32>;
273                    solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
274            };
275    };
276