Skip to content

Commit 131a975

Browse files
Stanislav Jakubeklag-linaro
authored andcommitted
dt-bindings: mfd: sprd,sc2731: Convert to YAML
Convert the Spreadtrum SC27xx PMIC bindings to DT schema. Adjust the filename to match the compatible of the only in-tree user, SC2731. Change #interrupt-cells value to 1, as according to [1] that is the correct value. Move partial examples of child nodes in the child node schemas to this new MFD schema to have one complete example. [1] https://lore.kernel.org/lkml/b6a32917d1e231277d240a4084bebb6ad91247e3.1550060544.git.baolin.wang@linaro.org/ Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com> Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Link: https://lore.kernel.org/r/efd200c3b5b75405e4e450d064b026f10ae2f8e0.1730709384.git.stano.jakubek@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 0d3f073 commit 131a975

File tree

8 files changed

+254
-182
lines changed

8 files changed

+254
-182
lines changed

Documentation/devicetree/bindings/iio/adc/sprd,sc2720-adc.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,6 @@ required:
8080
additionalProperties: false
8181

8282
examples:
83-
- |
84-
#include <dt-bindings/interrupt-controller/irq.h>
85-
pmic {
86-
#address-cells = <1>;
87-
#size-cells = <0>;
88-
adc@480 {
89-
compatible = "sprd,sc2731-adc";
90-
reg = <0x480>;
91-
interrupt-parent = <&sc2731_pmic>;
92-
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
93-
#io-channel-cells = <1>;
94-
hwlocks = <&hwlock 4>;
95-
nvmem-cells = <&adc_big_scale>, <&adc_small_scale>;
96-
nvmem-cell-names = "big_scale_calib", "small_scale_calib";
97-
};
98-
};
99-
10083
- |
10184
#include <dt-bindings/interrupt-controller/irq.h>
10285
pmic {

Documentation/devicetree/bindings/leds/sprd,sc2731-bltc.yaml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,4 @@ required:
5050
- '#size-cells'
5151

5252
additionalProperties: false
53-
54-
examples:
55-
- |
56-
#include <dt-bindings/leds/common.h>
57-
58-
pmic {
59-
#address-cells = <1>;
60-
#size-cells = <0>;
61-
62-
led-controller@200 {
63-
compatible = "sprd,sc2731-bltc";
64-
reg = <0x200>;
65-
#address-cells = <1>;
66-
#size-cells = <0>;
67-
68-
led@0 {
69-
reg = <0x0>;
70-
color = <LED_COLOR_ID_RED>;
71-
};
72-
73-
led@1 {
74-
reg = <0x1>;
75-
color = <LED_COLOR_ID_GREEN>;
76-
};
77-
78-
led@2 {
79-
reg = <0x2>;
80-
color = <LED_COLOR_ID_BLUE>;
81-
};
82-
};
83-
};
8453
...
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mfd/sprd,sc2731.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Spreadtrum SC27xx PMIC
8+
9+
maintainers:
10+
- Orson Zhai <orsonzhai@gmail.com>
11+
- Baolin Wang <baolin.wang7@gmail.com>
12+
- Chunyan Zhang <zhang.lyra@gmail.com>
13+
14+
description: |
15+
Spreadtrum PMICs belonging to the SC27xx series integrate all mobile handset
16+
power management, audio codec, battery management and user interface support
17+
functions in a single chip. They have 6 major functional blocks:
18+
- DCDCs to support CPU, memory
19+
- LDOs to support both internal and external requirements
20+
- Battery management system, such as charger, fuel gauge
21+
- Audio codec
22+
- User interface functions, such as indicator, flash LED and so on
23+
- IC level interface, such as power on/off control, RTC, typec and so on
24+
25+
properties:
26+
$nodename:
27+
pattern: '^pmic@[0-9a-f]+$'
28+
29+
compatible:
30+
enum:
31+
- sprd,sc2720
32+
- sprd,sc2721
33+
- sprd,sc2723
34+
- sprd,sc2730
35+
- sprd,sc2731
36+
37+
reg:
38+
maxItems: 1
39+
40+
interrupts:
41+
maxItems: 1
42+
43+
interrupt-controller: true
44+
spi-max-frequency: true
45+
46+
'#address-cells':
47+
const: 1
48+
49+
'#interrupt-cells':
50+
const: 1
51+
52+
'#size-cells':
53+
const: 0
54+
55+
regulators:
56+
type: object
57+
$ref: /schemas/regulator/sprd,sc2731-regulator.yaml#
58+
59+
patternProperties:
60+
"^adc@[0-9a-f]+$":
61+
type: object
62+
$ref: /schemas/iio/adc/sprd,sc2720-adc.yaml#
63+
64+
"^charger@[0-9a-f]+$":
65+
type: object
66+
$ref: /schemas/power/supply/sc2731-charger.yaml#
67+
68+
"^efuse@[0-9a-f]+$":
69+
type: object
70+
additionalProperties: true
71+
properties:
72+
compatible:
73+
enum:
74+
- sprd,sc2720-efuse
75+
- sprd,sc2721-efuse
76+
- sprd,sc2723-efuse
77+
- sprd,sc2730-efuse
78+
- sprd,sc2731-efuse
79+
80+
"^fuel-gauge@[0-9a-f]+$":
81+
type: object
82+
$ref: /schemas/power/supply/sc27xx-fg.yaml#
83+
84+
"^gpio@[0-9a-f]+$":
85+
type: object
86+
$ref: /schemas/gpio/sprd,gpio-eic.yaml#
87+
88+
"^led-controller@[0-9a-f]+$":
89+
type: object
90+
$ref: /schemas/leds/sprd,sc2731-bltc.yaml#
91+
92+
"^rtc@[0-9a-f]+$":
93+
type: object
94+
$ref: /schemas/rtc/sprd,sc2731-rtc.yaml#
95+
96+
"^vibrator@[0-9a-f]+$":
97+
type: object
98+
$ref: /schemas/input/sprd,sc27xx-vibrator.yaml#
99+
100+
required:
101+
- compatible
102+
- reg
103+
- interrupts
104+
- interrupt-controller
105+
- spi-max-frequency
106+
- '#address-cells'
107+
- '#interrupt-cells'
108+
- '#size-cells'
109+
110+
additionalProperties: false
111+
112+
examples:
113+
- |
114+
#include <dt-bindings/gpio/gpio.h>
115+
#include <dt-bindings/interrupt-controller/arm-gic.h>
116+
#include <dt-bindings/interrupt-controller/irq.h>
117+
#include <dt-bindings/leds/common.h>
118+
119+
spi {
120+
#address-cells = <1>;
121+
#size-cells = <0>;
122+
123+
sc2731_pmic: pmic@0 {
124+
compatible = "sprd,sc2731";
125+
reg = <0>;
126+
interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
127+
interrupt-controller;
128+
spi-max-frequency = <26000000>;
129+
#address-cells = <1>;
130+
#interrupt-cells = <1>;
131+
#size-cells = <0>;
132+
133+
charger@0 {
134+
compatible = "sprd,sc2731-charger";
135+
reg = <0x0>;
136+
phys = <&ssphy>;
137+
monitored-battery = <&bat>;
138+
};
139+
140+
led-controller@200 {
141+
compatible = "sprd,sc2731-bltc";
142+
reg = <0x200>;
143+
#address-cells = <1>;
144+
#size-cells = <0>;
145+
146+
led@0 {
147+
reg = <0x0>;
148+
color = <LED_COLOR_ID_RED>;
149+
};
150+
151+
led@1 {
152+
reg = <0x1>;
153+
color = <LED_COLOR_ID_GREEN>;
154+
};
155+
156+
led@2 {
157+
reg = <0x2>;
158+
color = <LED_COLOR_ID_BLUE>;
159+
};
160+
};
161+
162+
rtc@280 {
163+
compatible = "sprd,sc2731-rtc";
164+
reg = <0x280>;
165+
interrupt-parent = <&sc2731_pmic>;
166+
interrupts = <2>;
167+
};
168+
169+
pmic_eic: gpio@300 {
170+
compatible = "sprd,sc2731-eic";
171+
reg = <0x300>;
172+
interrupt-parent = <&sc2731_pmic>;
173+
interrupts = <5>;
174+
gpio-controller;
175+
#gpio-cells = <2>;
176+
interrupt-controller;
177+
#interrupt-cells = <2>;
178+
};
179+
180+
efuse@380 {
181+
compatible = "sprd,sc2731-efuse";
182+
reg = <0x380>;
183+
hwlocks = <&hwlock 12>;
184+
#address-cells = <1>;
185+
#size-cells = <1>;
186+
187+
/* Data cells */
188+
fgu_calib: calib@6 {
189+
reg = <0x6 0x2>;
190+
bits = <0 9>;
191+
};
192+
193+
adc_big_scale: calib@24 {
194+
reg = <0x24 0x2>;
195+
};
196+
197+
adc_small_scale: calib@26 {
198+
reg = <0x26 0x2>;
199+
};
200+
};
201+
202+
adc@480 {
203+
compatible = "sprd,sc2731-adc";
204+
reg = <0x480>;
205+
interrupt-parent = <&sc2731_pmic>;
206+
interrupts = <0>;
207+
#io-channel-cells = <1>;
208+
hwlocks = <&hwlock 4>;
209+
nvmem-cells = <&adc_big_scale>, <&adc_small_scale>;
210+
nvmem-cell-names = "big_scale_calib", "small_scale_calib";
211+
};
212+
213+
fuel-gauge@a00 {
214+
compatible = "sprd,sc2731-fgu";
215+
reg = <0xa00>;
216+
battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>;
217+
interrupt-parent = <&sc2731_pmic>;
218+
interrupts = <4>;
219+
io-channels = <&pmic_adc 5>, <&pmic_adc 14>;
220+
io-channel-names = "bat-temp", "charge-vol";
221+
nvmem-cells = <&fgu_calib>;
222+
nvmem-cell-names = "fgu_calib";
223+
monitored-battery = <&bat>;
224+
sprd,calib-resistance-micro-ohms = <21500>;
225+
};
226+
227+
vibrator@ec8 {
228+
compatible = "sprd,sc2731-vibrator";
229+
reg = <0xec8>;
230+
};
231+
232+
regulators {
233+
compatible = "sprd,sc2731-regulator";
234+
235+
BUCK_CPU0 {
236+
regulator-name = "vddarm0";
237+
regulator-min-microvolt = <400000>;
238+
regulator-max-microvolt = <1996875>;
239+
regulator-ramp-delay = <25000>;
240+
regulator-always-on;
241+
};
242+
243+
LDO_CAMA0 {
244+
regulator-name = "vddcama0";
245+
regulator-min-microvolt = <1200000>;
246+
regulator-max-microvolt = <3750000>;
247+
regulator-enable-ramp-delay = <100>;
248+
};
249+
};
250+
};
251+
};
252+
...

Documentation/devicetree/bindings/mfd/sprd,sc27xx-pmic.txt

Lines changed: 0 additions & 40 deletions
This file was deleted.

Documentation/devicetree/bindings/power/supply/sc2731-charger.yaml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,4 @@ properties:
3030
- constant-charge-voltage-max-microvolt: maximum constant input voltage.
3131
3232
additionalProperties: false
33-
34-
examples:
35-
- |
36-
bat: battery {
37-
compatible = "simple-battery";
38-
charge-term-current-microamp = <120000>;
39-
constant-charge-voltage-max-microvolt = <4350000>;
40-
};
41-
42-
pmic {
43-
#address-cells = <1>;
44-
#size-cells = <0>;
45-
46-
battery@a00 {
47-
compatible = "sprd,sc2731-charger";
48-
reg = <0x0>;
49-
phys = <&ssphy>;
50-
monitored-battery = <&bat>;
51-
};
52-
};
33+
...

0 commit comments

Comments
 (0)