Skip to content

Commit c67bb84

Browse files
committed
regulator: Use container_of_const() when all types are
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>: Use container_of_const(), which is preferred over container_of(), when the argument 'ptr' and returned pointer are already const, for better code safety and readability. Some drivers already have const everywhere, so container_of_const can be directly used. In few other drivers, the final pointer can be constified that way.
2 parents fba27fe + 6341646 commit c67bb84

27 files changed

Lines changed: 2168 additions & 35 deletions
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mfd/nxp,pf1550.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: NXP PF1550 Power Management IC
8+
9+
maintainers:
10+
- Samuel Kayode <samuel.kayode@savoirfairelinux.com>
11+
12+
description:
13+
PF1550 PMIC provides battery charging and power supply for low power IoT and
14+
wearable applications. This device consists of an i2c controlled MFD that
15+
includes regulators, battery charging and an onkey/power button.
16+
17+
$ref: /schemas/power/supply/power-supply.yaml
18+
19+
properties:
20+
compatible:
21+
const: nxp,pf1550
22+
23+
reg:
24+
maxItems: 1
25+
26+
interrupts:
27+
maxItems: 1
28+
29+
wakeup-source: true
30+
31+
regulators:
32+
type: object
33+
additionalProperties: false
34+
35+
patternProperties:
36+
"^(ldo[1-3]|sw[1-3]|vrefddr)$":
37+
type: object
38+
$ref: /schemas/regulator/regulator.yaml
39+
description:
40+
regulator configuration for ldo1-3, buck converters(sw1-3)
41+
and DDR termination reference voltage (vrefddr)
42+
unevaluatedProperties: false
43+
44+
monitored-battery:
45+
description: |
46+
A phandle to a monitored battery node that contains a valid value
47+
for:
48+
constant-charge-voltage-max-microvolt.
49+
50+
nxp,thermal-regulation-celsius:
51+
description:
52+
Temperature threshold for thermal regulation of charger in celsius.
53+
enum: [ 80, 95, 110, 125 ]
54+
55+
nxp,min-system-microvolt:
56+
description:
57+
System specific lower limit voltage.
58+
enum: [ 3500000, 3700000, 4300000 ]
59+
60+
nxp,disable-key-power:
61+
type: boolean
62+
description:
63+
Disable power-down using a long key-press. The onkey driver will remove
64+
support for the KEY_POWER key press when triggered using a long press of
65+
the onkey.
66+
67+
required:
68+
- compatible
69+
- reg
70+
- interrupts
71+
72+
unevaluatedProperties: false
73+
74+
examples:
75+
- |
76+
#include <dt-bindings/interrupt-controller/irq.h>
77+
#include <dt-bindings/input/linux-event-codes.h>
78+
79+
battery: battery-cell {
80+
compatible = "simple-battery";
81+
constant-charge-voltage-max-microvolt = <4400000>;
82+
};
83+
84+
i2c {
85+
#address-cells = <1>;
86+
#size-cells = <0>;
87+
88+
pmic@8 {
89+
compatible = "nxp,pf1550";
90+
reg = <0x8>;
91+
92+
interrupt-parent = <&gpio1>;
93+
interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
94+
wakeup-source;
95+
monitored-battery = <&battery>;
96+
nxp,min-system-microvolt = <4300000>;
97+
nxp,thermal-regulation-celsius = <80>;
98+
99+
regulators {
100+
sw1_reg: sw1 {
101+
regulator-name = "sw1";
102+
regulator-min-microvolt = <600000>;
103+
regulator-max-microvolt = <1387500>;
104+
regulator-always-on;
105+
regulator-ramp-delay = <6250>;
106+
107+
regulator-state-mem {
108+
regulator-on-in-suspend;
109+
regulator-suspend-min-microvolt = <1270000>;
110+
};
111+
};
112+
113+
sw2_reg: sw2 {
114+
regulator-name = "sw2";
115+
regulator-min-microvolt = <600000>;
116+
regulator-max-microvolt = <1387500>;
117+
regulator-always-on;
118+
119+
regulator-state-mem {
120+
regulator-on-in-suspend;
121+
};
122+
};
123+
124+
sw3_reg: sw3 {
125+
regulator-name = "sw3";
126+
regulator-min-microvolt = <1800000>;
127+
regulator-max-microvolt = <3300000>;
128+
regulator-always-on;
129+
130+
regulator-state-mem {
131+
regulator-on-in-suspend;
132+
};
133+
};
134+
135+
vldo1_reg: ldo1 {
136+
regulator-name = "ldo1";
137+
regulator-min-microvolt = <750000>;
138+
regulator-max-microvolt = <3300000>;
139+
regulator-always-on;
140+
141+
regulator-state-mem {
142+
regulator-off-in-suspend;
143+
};
144+
};
145+
146+
vldo2_reg: ldo2 {
147+
regulator-name = "ldo2";
148+
regulator-min-microvolt = <1800000>;
149+
regulator-max-microvolt = <3300000>;
150+
regulator-always-on;
151+
};
152+
153+
vldo3_reg: ldo3 {
154+
regulator-name = "ldo3";
155+
regulator-min-microvolt = <750000>;
156+
regulator-max-microvolt = <3300000>;
157+
regulator-always-on;
158+
};
159+
};
160+
};
161+
};

MAINTAINERS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18636,6 +18636,17 @@ S: Maintained
1863618636
F: Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml
1863718637
F: drivers/regulator/pf530x-regulator.c
1863818638

18639+
NXP PF1550 PMIC MFD DRIVER
18640+
M: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
18641+
L: imx@lists.linux.dev
18642+
S: Maintained
18643+
F: Documentation/devicetree/bindings/mfd/nxp,pf1550.yaml
18644+
F: drivers/input/misc/pf1550-onkey.c
18645+
F: drivers/mfd/pf1550.c
18646+
F: drivers/power/supply/pf1550-charger.c
18647+
F: drivers/regulator/pf1550-regulator.c
18648+
F: include/linux/mfd/pfd1550.h
18649+
1863918650
NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER
1864018651
M: Jagan Teki <jagan@amarulasolutions.com>
1864118652
S: Maintained

drivers/input/misc/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ config INPUT_PCSPKR
190190
To compile this driver as a module, choose M here: the
191191
module will be called pcspkr.
192192

193+
config INPUT_PF1550_ONKEY
194+
tristate "NXP PF1550 Onkey support"
195+
depends on MFD_PF1550
196+
help
197+
Say Y here if you want support for PF1550 PMIC. Onkey can trigger
198+
release and 1s(push hold), 2s, 3s, 4s, 8s interrupt for long press
199+
detect.
200+
201+
To compile this driver as a module, choose M here. The module will be
202+
called pf1550-onkey.
203+
193204
config INPUT_PM8941_PWRKEY
194205
tristate "Qualcomm PM8941 power key support"
195206
depends on MFD_SPMI_PMIC

drivers/input/misc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ obj-$(CONFIG_INPUT_PALMAS_PWRBUTTON) += palmas-pwrbutton.o
6363
obj-$(CONFIG_INPUT_PCAP) += pcap_keys.o
6464
obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o
6565
obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
66+
obj-$(CONFIG_INPUT_PF1550_ONKEY) += pf1550-onkey.o
6667
obj-$(CONFIG_INPUT_PM8941_PWRKEY) += pm8941-pwrkey.o
6768
obj-$(CONFIG_INPUT_PM8XXX_VIBRATOR) += pm8xxx-vibrator.o
6869
obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o

0 commit comments

Comments
 (0)