Skip to contentSkip to conversation

add support for pf1550 PMIC MFD-based drivers

PATCH Superseded Samuel Kayode 4 participants 23 messages May 16, 2025 – May 21, 2025

Subsystems (7)

v2 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v2 cover add support for pf1550 PMIC MFD-based drivers

This series adds support for pf1550 PMIC. It provides the core mfd driver and a set of three sub-drivers for the regulator, power supply and input subsystems.

Patches 1-4 add the DT binding documents. Patches 5-8 add all drivers. Last patch adds a MAINTAINERS entry for this device.

Changes since v1 [1]:
1. DT bindings for all devices included
2. Add onkey driver
3. Add driver for the regulators
4. Ensure charger is activated as some variants have it off by default
5. Update mfd and charger driver per feedback from [email protected]
6. Add myself as maintainer for these drivers

[1]: v1: https://lore.kernel.org/[email protected]/

Samuel Kayode (9):
dt-bindings: power: supply: add pf1550
dt-bindings: regulator: add pf1550
dt-bindings: input: add pf1550
dt-bindings: mfd: add pf1550
mfd: pf1550: add core mfd driver
regulator: pf1550: add support for regulator
input: pf1550: add onkey support
power: supply: pf1550: add battery charger support
MAINTAINERS: add an entry for pf1550 mfd driver

 .../bindings/input/pf1550_onkey.yaml          |  31 +
 .../devicetree/bindings/mfd/pf1550.yaml       | 122 ++++
 .../bindings/power/supply/pf1550_charger.yaml |  44 ++
 .../devicetree/bindings/regulator/pf1550.yaml |  35 +
 MAINTAINERS                                   |  11 +
 drivers/input/keyboard/Kconfig                |   8 +
 drivers/input/keyboard/Makefile               |   1 +
 drivers/input/keyboard/pf1550_onkey.c         | 200 ++++++
 drivers/mfd/Kconfig                           |  14 +
 drivers/mfd/Makefile                          |   2 +
 drivers/mfd/pf1550.c                          | 254 +++++++
 drivers/power/supply/Kconfig                  |   6 +
 drivers/power/supply/Makefile                 |   1 +
 drivers/power/supply/pf1550_charger.c         | 656 ++++++++++++++++++
 drivers/regulator/Kconfig                     |   7 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/pf1550.c                    | 380 ++++++++++
 include/linux/mfd/pf1550.h                    | 246 +++++++
 18 files changed, 2019 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/pf1550_onkey.yaml
 create mode 100644 Documentation/devicetree/bindings/mfd/pf1550.yaml
 create mode 100644 Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml
 create mode 100644 Documentation/devicetree/bindings/regulator/pf1550.yaml
 create mode 100644 drivers/input/keyboard/pf1550_onkey.c
 create mode 100644 drivers/mfd/pf1550.c
 create mode 100644 drivers/power/supply/pf1550_charger.c
 create mode 100644 drivers/regulator/pf1550.c
 create mode 100644 include/linux/mfd/pf1550.h

base-commit: b1d8766052eb0534b27edda8af1865d53621bd6a

Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/9 dt-bindings: power: supply: add pf1550

Add the DT binding document for the battery charger module of pf1550.

---
 .../bindings/power/supply/pf1550_charger.yaml | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml
Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml new file +44 -0
new file mode 100644
index 000000000000..10fc0b35917c
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/pf1550_charger.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Battery charger driver for PF1550 PMIC from NXP.
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  This module is part of the PF1550 MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/pf1550.yaml.
+
+  The charger is represented as a sub-node of the PMIC node on the device tree.
+
+properties:
+  compatible:
+    const: fsl,pf1550-charger
+
+  fsl,constant-microvolt:
+    description:
+      Constant charge voltage (in microvolts).
+    minimum: 3500000
+    maximum: 4400000
+
+  fsl,min-system-microvolt:
+    description:
+      Minimum charge voltage (in microvolts).
+    enum: [ 3500000, 3700000, 4300000 ]
+
+  fsl,thermal-regulation:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Temperature (in degrees Celsius) threshold past which the charging
+      current is reduced.
+    enum: [ 60, 75, 90, 105 ]
+
+required:
+  - compatible
+additionalProperties: false
+
+...
Signature · 1 line
2.49.0
#3 lore raw

PATCH v2 2/9 dt-bindings: regulator: add pf1550

In reply to Samuel Kayode

Add the DT binding document for pf1550 regulators.

---
 .../devicetree/bindings/regulator/pf1550.yaml | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/pf1550.yaml
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +35 -0
new file mode 100644
index 000000000000..a684ab974496
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/pf1550.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulators for PF1550 PMIC from NXP.
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  This module is part of the PF1550 MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/pf1550.yaml.
+
+  The regulator controller is represented as a sub-node of the PMIC node
+  on the device tree.
+
+  The device has three LDO regulators, three buck converters and a DDR
+  termination reference voltage.
+
+properties:
+  compatible:
+    const: fsl,pf1550-regulator
+
+patternProperties:
+  "^(LDO[1-3]|SW[1-3]|VREFADDR)$":
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+additionalProperties: false
+
+...
Signature · 1 line
2.49.0
#5 lore raw

PATCH v2 3/9 dt-bindings: input: add pf1550

In reply to Samuel Kayode

Add the DT binding document for the onkey module of pf1550.

---
 .../bindings/input/pf1550_onkey.yaml          | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/pf1550_onkey.yaml
Documentation/devicetree/bindings/input/pf1550_onkey.yaml new file +31 -0
new file mode 100644
index 000000000000..7079f5284b73
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/pf1550_onkey.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Onkey for PF1550 PMIC from NXP.
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  This module is part of the pf1550 MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/pf1550.yaml.
+
+allOf:
+  - $ref: input.yaml#
+
+properties:
+  compatible:
+    const: fsl,pf1550-onkey
+
+  linux,keycodes:
+    description: Keycode to emit
+    default: 116  # KEY_POWER
+
+required:
+  - compatible
+additionalProperties: false
+
+...
Signature · 1 line
2.49.0
#7 lore raw

PATCH v2 4/9 dt-bindings: mfd: add pf1550

In reply to Samuel Kayode

Add a DT binding document for pf1550 PMIC. This describes the core mfd device.

---
 .../devicetree/bindings/mfd/pf1550.yaml       | 122 ++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/pf1550.yaml
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +122 -0
new file mode 100644
index 000000000000..461bc13513eb
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/pf1550.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PF1550 low power PMIC from NXP.
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  PF1550 is a low power PMIC providing battery charging and power supply for
+  low power IoT and wearable applications.
+
+  For device-tree bindings of other sub-modules (regulator, power supply and
+  onkey) refer to the binding documents under the respective sub-system
+  directories.
+
+properties:
+  compatible:
+    const: fsl,pf1550
+
+  reg:
+    description:
+      I2C device address.
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    $ref: /schemas/regulator/pf1550.yaml
+
+  charger:
+    $ref: /schemas/power/supply/pf1550_charger.yaml
+
+  onkey:
+    $ref: /schemas/input/pf1550_onkey.yaml
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/input/linux-event-codes.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@8 {
+            compatible = "fsl,pf1550";
+            reg = <0x8>;
+
+            interrupt-parent = <&gpio1>;
+            interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+
+            onkey {
+                compatible = "fsl,pf1550-onkey";
+                linux,keycodes = <KEY_POWER>;
+            };
+
+            charger {
+                compatible = "fsl,pf1550-charger";
+                
+                fsl,min-system-microvolt = <3700000>;
+                fsl,thermal-regulation = <75>;
+            };
+
+            regulators {
+                compatible = "fsl,pf1550-regulator";
+ 
+                sw1_reg: SW1 {
+                    regulator-name = "SW1";
+                    regulator-min-microvolt = <600000>;
+                    regulator-max-microvolt = <1387500>;
+                    regulator-always-on;
+                    regulator-ramp-delay = <6250>;
+                };
+
+                sw2_reg: SW2 {
+                    regulator-name = "SW2";
+                    regulator-min-microvolt = <600000>;
+                    regulator-max-microvolt = <1387500>;
+                    regulator-always-on;
+                };
+
+                sw3_reg: SW3 {
+                    regulator-name = "SW3";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                };
+
+                vldo1_reg: LDO1 {
+                    regulator-name = "LDO1";
+                    regulator-min-microvolt = <750000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                };
+
+                vldo2_reg: LDO2 {
+                    regulator-name = "LDO2";
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                };
+
+                vldo3_reg: LDO3 {
+                    regulator-name = "LDO3";
+                    regulator-min-microvolt = <750000>;
+                    regulator-max-microvolt = <3300000>;
+                    regulator-always-on;
+                };
+            };
+        };
+    };
Signature · 1 line
2.49.0
#11 lore raw

PATCH v2 5/9 mfd: pf1550: add core mfd driver

In reply to Samuel Kayode

Add the core mfd driver for pf1550 PMIC. There are 3 subdevices for which the drivers will be added in subsequent patches.

---
 drivers/mfd/Kconfig        |  14 ++
 drivers/mfd/Makefile       |   2 +
 drivers/mfd/pf1550.c       | 254 +++++++++++++++++++++++++++++++++++++
 include/linux/mfd/pf1550.h | 246 +++++++++++++++++++++++++++++++++++
 4 files changed, 516 insertions(+)
 create mode 100644 drivers/mfd/pf1550.c
 create mode 100644 include/linux/mfd/pf1550.h
drivers/mfd/Kconfig +14 -0
index 22b936310039..e2c2d1d798f3 100644
@@ -558,6 +558,20 @@ config MFD_MX25_TSADC
 	  i.MX25 processors. They consist of a conversion queue for general
 	  purpose ADC and a queue for Touchscreens.
 
+config MFD_PF1550
+	tristate "Freescale Semiconductor PF1550 PMIC Support"
+	depends on I2C=y
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	help
+	  Say yes here to add support for Freescale Semiconductor PF1550.
+	  This is a companion Power Management IC with regulators, ONKEY,
+	  and charger control on chip.
+	  This driver provides common support for accessing the device;
+	  additional drivers must be enabled in order to use the functionality
+	  of the device.
+
 config MFD_HI6421_PMIC
 	tristate "HiSilicon Hi6421 PMU/Codec IC"
 	depends on OF
drivers/mfd/Makefile +2 -0
index 948cbdf42a18..c4f270c5538a 100644
@@ -120,6 +120,8 @@ obj-$(CONFIG_MFD_MC13XXX)	+= mc13xxx-core.o
 obj-$(CONFIG_MFD_MC13XXX_SPI)	+= mc13xxx-spi.o
 obj-$(CONFIG_MFD_MC13XXX_I2C)	+= mc13xxx-i2c.o
 
+obj-$(CONFIG_MFD_PF1550)	+= pf1550.o
+
 obj-$(CONFIG_MFD_CORE)		+= mfd-core.o
 
 ocelot-soc-objs			:= ocelot-core.o ocelot-spi.o
drivers/mfd/pf1550.c new file +254 -0

254 lines not on this page · raw message

include/linux/mfd/pf1550.h new file +246 -0

246 lines not on this page · raw message

Signature · 1 line
2.49.0
#14 lore raw

PATCH v2 6/9 regulator: pf1550: add support for regulator

In reply to Samuel Kayode

Add regulator support for the pf1550 PMIC.

---
 drivers/regulator/Kconfig  |   7 +
 drivers/regulator/Makefile |   1 +
 drivers/regulator/pf1550.c | 380 +++++++++++++++++++++++++++++++++++++
 3 files changed, 388 insertions(+)
 create mode 100644 drivers/regulator/pf1550.c
drivers/regulator/Kconfig +7 -0
index 05e32d764028..cdce1658957f 100644
@@ -1038,6 +1038,13 @@ config REGULATOR_PV88090
 	  Say y here to support the voltage regulators and convertors
 	  on PV88090
 
+config REGULATOR_PF1550
+	tristate "Freescale PF1550 regulator"
+	depends on MFD_PF1550
+	help
+	  This driver controls a PF1550 regulator via I2C bus.
+	  The regulators include three switch and three ldo.
+
 config REGULATOR_PWM
 	tristate "PWM voltage regulator"
 	depends on PWM
drivers/regulator/Makefile +1 -0
index 524e026c0273..2d11c069b0ca 100644
@@ -124,6 +124,7 @@ obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o
 obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
 obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o
 obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o
+obj-$(CONFIG_REGULATOR_PF1550) += pf1550.o
 obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o
 obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
 obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
drivers/regulator/pf1550.c new file +380 -0

380 lines not on this page · raw message

Signature · 1 line
2.49.0
#16 lore raw

PATCH v2 7/9 input: pf1550: add onkey support

In reply to Samuel Kayode

Add support for the onkey of the pf1550 PMIC.

---
 drivers/input/keyboard/Kconfig        |   8 ++
 drivers/input/keyboard/Makefile       |   1 +
 drivers/input/keyboard/pf1550_onkey.c | 200 ++++++++++++++++++++++++++
 3 files changed, 209 insertions(+)
 create mode 100644 drivers/input/keyboard/pf1550_onkey.c
drivers/input/keyboard/Kconfig +8 -0
index 721ab69e84ac..b01decc03ab9 100644
@@ -444,6 +444,14 @@ config KEYBOARD_SNVS_PWRKEY
 	  To compile this driver as a module, choose M here; the
 	  module will be called snvs_pwrkey.
 
+config KEYBOARD_PF1550_ONKEY
+	tristate "PF1550 OnKey Driver"
+	depends on MFD_PF1550
+	depends on OF
+	help
+	  This is onkey driver for PF1550 pmic, onkey can trigger release
+	  and 1s(push hold), 2s, 3s, 4s, 8s interrupt for long press detect
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC || COMPILE_TEST
drivers/input/keyboard/Makefile +1 -0
index 1e0721c30709..8a6feae3ddb1 100644
@@ -59,6 +59,7 @@ obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
+obj-$(CONFIG_KEYBOARD_PF1550_ONKEY)	+= pf1550_onkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
drivers/input/keyboard/pf1550_onkey.c new file +200 -0

200 lines not on this page · raw message

Signature · 1 line
2.49.0
#20 lore raw

PATCH v2 8/9 power: supply: pf1550: add battery charger support

In reply to Samuel Kayode

Add support for the battery charger for pf1550 PMIC.

---
 drivers/power/supply/Kconfig          |   6 +
 drivers/power/supply/Makefile         |   1 +
 drivers/power/supply/pf1550_charger.c | 656 ++++++++++++++++++++++++++
 3 files changed, 663 insertions(+)
 create mode 100644 drivers/power/supply/pf1550_charger.c
drivers/power/supply/Kconfig +6 -0
index 79ddb006e2da..5a2b694561b9 100644
@@ -471,6 +471,12 @@ config CHARGER_88PM860X
 	help
 	  Say Y here to enable charger for Marvell 88PM860x chip.
 
+config CHARGER_PF1550
+	tristate "Freescale PF1550 battery charger driver"
+	depends on MFD_PF1550
+	help
+	 Say Y to enable support for the Freescale PF1550 battery charger.
+
 config BATTERY_RX51
 	tristate "Nokia RX-51 (N900) battery driver"
 	depends on TWL4030_MADC
drivers/power/supply/Makefile +1 -0
index 4f5f8e3507f8..e7dd9fb41d4e 100644
@@ -64,6 +64,7 @@ obj-$(CONFIG_CHARGER_RT9467)	+= rt9467-charger.o
 obj-$(CONFIG_CHARGER_RT9471)	+= rt9471.o
 obj-$(CONFIG_BATTERY_TWL4030_MADC)	+= twl4030_madc_battery.o
 obj-$(CONFIG_CHARGER_88PM860X)	+= 88pm860x_charger.o
+obj-$(CONFIG_CHARGER_PF1550)	+= pf1550_charger.o
 obj-$(CONFIG_BATTERY_RX51)	+= rx51_battery.o
 obj-$(CONFIG_AB8500_BM)		+= ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o
 obj-$(CONFIG_CHARGER_CPCAP)	+= cpcap-charger.o
drivers/power/supply/pf1550_charger.c new file +656 -0

656 lines not on this page · raw message

Signature · 1 line
2.49.0
#22 lore raw

PATCH v2 9/9 MAINTAINERS: add an entry for pf1550 mfd driver

In reply to Samuel Kayode

Add MAINTAINERS entry for pf1550 PMIC.

---
 MAINTAINERS | 11 +++++++++++
 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
index 4084fb7c496b..62d121380f7f 100644
@@ -17477,6 +17477,17 @@ F:	Documentation/devicetree/bindings/clock/imx*
 F:	drivers/clk/imx/
 F:	include/dt-bindings/clock/imx*
 
+NXP PF1550 PMIC MFD DRIVER
+M:	Samuel Kayode <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/*/*pf1550.yaml
+F:	Documentation/devicetree/bindings/*/pf1550*.yaml
+F:	drivers/input/keyboard/pf1550_onkey.c
+F:	drivers/mfd/pf1550.c
+F:	drivers/power/supply/pf1550_charger.c
+F:	drivers/regulator/pf1550_regulator.c
+F:	include/linux/mfd/pfd1550.h
+
 NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER
 M:	Jagan Teki <[email protected]>
 S:	Maintained
Signature · 1 line
2.49.0
maintainer
#17 lore raw

Re: [PATCH v2 7/9] input: pf1550: add onkey support

In reply to Samuel Kayode

Hi Samuel,

Quoted 15 lines · Samuel Kayode

Add support for the onkey of the pf1550 PMIC.

---
 drivers/input/keyboard/Kconfig        |   8 ++
 drivers/input/keyboard/Makefile       |   1 +
 drivers/input/keyboard/pf1550_onkey.c | 200 ++++++++++++++++++++++++++
 3 files changed, 209 insertions(+)
 create mode 100644 drivers/input/keyboard/pf1550_onkey.c
drivers/input/keyboard/Kconfig +0 -0
index 721ab69e84ac..b01decc03ab9 100644

drivers/input/keyboard/Kconfig config KEYBOARD_SNVS_PWRKEY · line 445

Quoted 2 lines
drivers/input/keyboard/Kconfig +0 -0
@@ -444,6 +444,14 @@ config KEYBOARD_SNVS_PWRKEY
 	  To compile this driver as a module, choose M here; the
 	  module will be called snvs_pwrkey.

With the exception of snvs-pwrkey, all other onkey/pwrkey drivers live in drivers/input/misc, please move them there. drivers/input/keyboard is really for real keyboard devices.

drivers/input/keyboard/Kconfig config KEYBOARD_SNVS_PWRKEY · line 450

Quoted 5 lines
drivers/input/keyboard/Kconfig +4 -0
+config KEYBOARD_PF1550_ONKEY
+	tristate "PF1550 OnKey Driver"
+	depends on MFD_PF1550
+	depends on OF

I do not think your driver has any direct dependencies on OF, especially if you switch to using generic device properties (device_property_read_*).

Quoted 27 lines
drivers/input/keyboard/Kconfig +4 -0
+	help
+	  This is onkey driver for PF1550 pmic, onkey can trigger release
+	  and 1s(push hold), 2s, 3s, 4s, 8s interrupt for long press detect
+
 config KEYBOARD_IMX
 	tristate "IMX keypad support"
 	depends on ARCH_MXC || COMPILE_TEST
drivers/input/keyboard/Makefile +1 -0
index 1e0721c30709..8a6feae3ddb1 100644
@@ -59,6 +59,7 @@ obj-$(CONFIG_KEYBOARD_QT2160)		+= qt2160.o
 obj-$(CONFIG_KEYBOARD_SAMSUNG)		+= samsung-keypad.o
 obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_SNVS_PWRKEY)	+= snvs_pwrkey.o
+obj-$(CONFIG_KEYBOARD_PF1550_ONKEY)	+= pf1550_onkey.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
drivers/input/keyboard/pf1550_onkey.c new file +2 -0
new file mode 100644
index 000000000000..b0601acf893d
@@ -0,0 +1,200 @@
+// SPDX-License-Identifier: GPL-2.0
+/*

drivers/input/keyboard/pf1550_onkey.c line 12

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+ * Driver for the PF1550 ON_KEY
+ * Copyright (C) 2016 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>

I don't think you actually need io.h

drivers/input/keyboard/pf1550_onkey.c line 13

Quoted 1 line
drivers/input/keyboard/pf1550_onkey.c new file +1 -0
+#include <linux/jiffies.h>

and neither jiffies.h. Please audit your includes.

Quoted 53 lines
drivers/input/keyboard/pf1550_onkey.c new file +53 -0
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mfd/pf1550.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+struct onkey_drv_data {
+	struct device *dev;
+	struct pf1550_dev *pf1550;
+	int irq;
+	int keycode;
+	int wakeup;
+	struct input_dev *input;
+};
+
+static struct pf1550_irq_info pf1550_onkey_irqs[] = {
+	{ PF1550_ONKEY_IRQ_PUSHI,	"release" },
+	{ PF1550_ONKEY_IRQ_1SI,		"1S" },
+	{ PF1550_ONKEY_IRQ_2SI,		"2S" },
+	{ PF1550_ONKEY_IRQ_3SI,		"3S" },
+	{ PF1550_ONKEY_IRQ_4SI,		"4S" },
+	{ PF1550_ONKEY_IRQ_8SI,		"8S" },
+};
+
+static irqreturn_t pf1550_onkey_irq_handler(int irq, void *data)
+{
+	struct onkey_drv_data *onkey = data;
+	int i, state, irq_type = -1;
+
+	onkey->irq = irq;
+
+	for (i = 0; i < ARRAY_SIZE(pf1550_onkey_irqs); i++)
+		if (onkey->irq == pf1550_onkey_irqs[i].virq)
+			irq_type = pf1550_onkey_irqs[i].irq;
+	switch (irq_type) {
+	case PF1550_ONKEY_IRQ_PUSHI:
+		state = 0;
+		break;
+	case PF1550_ONKEY_IRQ_1SI:
+	case PF1550_ONKEY_IRQ_2SI:
+	case PF1550_ONKEY_IRQ_3SI:
+	case PF1550_ONKEY_IRQ_4SI:
+	case PF1550_ONKEY_IRQ_8SI:
+		state = 1;
+		break;
+	default:
+		dev_err(onkey->dev, "onkey interrupt: irq %d occurred\n",
+			irq_type);
+		return IRQ_HANDLED;
+	}
+

drivers/input/keyboard/pf1550_onkey.c line 76

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+	input_event(onkey->input, EV_KEY, onkey->keycode, state);
+	input_sync(onkey->input);
+
+	return IRQ_HANDLED;
+}
+
+static int pf1550_onkey_probe(struct platform_device *pdev)
+{
+	struct onkey_drv_data *onkey;
+	struct input_dev *input = NULL;

This initialization is not needed.

drivers/input/keyboard/pf1550_onkey.c line 77

Quoted 1 line
drivers/input/keyboard/pf1550_onkey.c new file +1 -0
+	struct device_node *np = pdev->dev.of_node;

Please switch to generic device properties and stop referencing of_node.

drivers/input/keyboard/pf1550_onkey.c line 90

Quoted 13 lines
drivers/input/keyboard/pf1550_onkey.c new file +13 -0
+	struct pf1550_dev *pf1550 = dev_get_drvdata(pdev->dev.parent);
+	int i, error;
+
+	if (!np)
+		return -ENODEV;
+
+	onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
+	if (!onkey)
+		return -ENOMEM;
+
+	if (of_property_read_u32(np, "linux,keycodes", &onkey->keycode)) {
+		onkey->keycode = KEY_POWER;
+		dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");

Maybe make this property mandatory?

Quoted 17 lines
drivers/input/keyboard/pf1550_onkey.c new file +17 -0
+	}
+
+	onkey->wakeup = of_property_read_bool(np, "wakeup-source");
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input) {
+		dev_err(&pdev->dev, "failed to allocate the input device\n");
+		return -ENOMEM;
+	}
+
+	input->name = pdev->name;
+	input->phys = "pf1550-onkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, onkey->keycode);
+
+	for (i = 0; i < ARRAY_SIZE(pf1550_onkey_irqs); i++) {

drivers/input/keyboard/pf1550_onkey.c line 117

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+		struct pf1550_irq_info *onkey_irq =
+						&pf1550_onkey_irqs[i];
+		unsigned int virq = 0;
+
+		virq = regmap_irq_get_virq(pf1550->irq_data_onkey,
+					   onkey_irq->irq);
+		if (!virq)
+			return -EINVAL;
+
+		onkey_irq->virq = virq;

I think this kind of mapping needs to be done in the core part of your driver.

Quoted 5 lines
drivers/input/keyboard/pf1550_onkey.c new file +5 -0
+
+		error = devm_request_threaded_irq(&pdev->dev, virq, NULL,
+						  pf1550_onkey_irq_handler,
+					IRQF_NO_SUSPEND,
+					onkey_irq->name, onkey);

drivers/input/keyboard/pf1550_onkey.c line 132

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+		if (error) {
+			dev_err(&pdev->dev,
+				"failed: irq request (IRQ: %d, error :%d)\n",
+				onkey_irq->irq, error);
+			return error;
+		}
+	}
+
+	error = input_register_device(input);
+	if (error < 0) {

Input API return 0 or negative, so simply "if (error) { ... }"

drivers/input/keyboard/pf1550_onkey.c line 134

Quoted 2 lines
drivers/input/keyboard/pf1550_onkey.c new file +2 -0
+		dev_err(&pdev->dev, "failed to register input device\n");
+		input_free_device(input);

You are using devm, so no need to free it manually.

drivers/input/keyboard/pf1550_onkey.c line 138

Quoted 4 lines
drivers/input/keyboard/pf1550_onkey.c new file +4 -0
+		return error;
+	}
+
+	onkey->input = input;

You are too late. Interrupts are already active and you may dereference onkey->input from your ISR.

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+	onkey->pf1550 = pf1550;
+	platform_set_drvdata(pdev, onkey);
+
+	device_init_wakeup(&pdev->dev, onkey->wakeup);
+
+	return 0;
+}
+
+static int pf1550_onkey_suspend(struct device *dev)
+{

drivers/input/keyboard/pf1550_onkey.c line 158

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+	struct platform_device *pdev = to_platform_device(dev);
+	struct onkey_drv_data *onkey = platform_get_drvdata(pdev);
+
+	if (!device_may_wakeup(&pdev->dev))
+		regmap_write(onkey->pf1550->regmap,
+			     PF1550_PMIC_REG_ONKEY_INT_MASK0,
+			     ONKEY_IRQ_PUSHI | ONKEY_IRQ_1SI | ONKEY_IRQ_2SI |
+			     ONKEY_IRQ_3SI | ONKEY_IRQ_4SI | ONKEY_IRQ_8SI);
+	else
+		enable_irq_wake(onkey->pf1550->irq);

This is suspicious that you need to twiddle the state of the main interrupt line. I'd expect you manipulate your own interrupts and this all cascades up.

Quoted 32 lines
drivers/input/keyboard/pf1550_onkey.c new file +32 -0
+
+	return 0;
+}
+
+static int pf1550_onkey_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct onkey_drv_data *onkey = platform_get_drvdata(pdev);
+
+	if (!device_may_wakeup(&pdev->dev))
+		regmap_write(onkey->pf1550->regmap,
+			     PF1550_PMIC_REG_ONKEY_INT_MASK0,
+			     ~(ONKEY_IRQ_PUSHI | ONKEY_IRQ_1SI | ONKEY_IRQ_2SI |
+			     ONKEY_IRQ_3SI | ONKEY_IRQ_4SI | ONKEY_IRQ_8SI));
+	else
+		disable_irq_wake(onkey->pf1550->irq);
+
+	return 0;
+}
+
+static const struct of_device_id pf1550_onkey_ids[] = {
+	{ .compatible = "fsl,pf1550-onkey" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, pf1550_onkey_ids);
+
+static SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend,
+				pf1550_onkey_resume);
+
+static struct platform_driver pf1550_onkey_driver = {
+	.driver = {
+		.name = "pf1550-onkey",

drivers/input/keyboard/pf1550_onkey.c line 200

Quoted 10 lines
drivers/input/keyboard/pf1550_onkey.c new file +10 -0
+		.pm     = &pf1550_onkey_pm_ops,
+		.of_match_table = pf1550_onkey_ids,
+	},
+	.probe = pf1550_onkey_probe,
+};
+module_platform_driver(pf1550_onkey_driver);
+
+MODULE_AUTHOR("Freescale Semiconductor");
+MODULE_DESCRIPTION("PF1550 onkey Driver");
+MODULE_LICENSE("GPL v2");

Thanks.

Signature · 1 line
Dmitry
#2 lore raw

Re: [PATCH v2 1/9] dt-bindings: power: supply: add pf1550

In reply to Samuel Kayode
Quoted 7 lines · Samuel Kayode

Add the DT binding document for the battery charger module of pf1550.

---
 .../bindings/power/supply/pf1550_charger.yaml | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml

Filename matching compatible.

Quoted 7 lines
Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml new file +0 -0
new file mode 100644
index 000000000000..10fc0b35917c

Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/power/supply/pf1550_charger.yaml new file +7 -0
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/pf1550_charger.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Battery charger driver for PF1550 PMIC from NXP.

Describe hardware, not driver.

Also drop full stop.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v2 2/9] dt-bindings: regulator: add pf1550

In reply to Samuel Kayode
Quoted 14 lines · Samuel Kayode

Add the DT binding document for pf1550 regulators.

---
 .../devicetree/bindings/regulator/pf1550.yaml | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/pf1550.yaml
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +0 -0
new file mode 100644
index 000000000000..a684ab974496

Documentation/devicetree/bindings/regulator/pf1550.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +7 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/pf1550.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulators for PF1550 PMIC from NXP.

Same comments as for other patch.

Quoted 7 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +7 -0
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  This module is part of the PF1550 MFD device. For more details
+  see Documentation/devicetree/bindings/mfd/pf1550.yaml.

Documentation/devicetree/bindings/regulator/pf1550.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +10 -0
+
+  The regulator controller is represented as a sub-node of the PMIC node
+  on the device tree.
+
+  The device has three LDO regulators, three buck converters and a DDR
+  termination reference voltage.
+
+properties:
+  compatible:
+    const: fsl,pf1550-regulator

This looks not needed.

Documentation/devicetree/bindings/regulator/pf1550.yaml line 27

Quoted 3 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +3 -0
+
+patternProperties:
+  "^(LDO[1-3]|SW[1-3]|VREFADDR)$":

Node names are lowercase.

Documentation/devicetree/bindings/regulator/pf1550.yaml line 32

Quoted 5 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +5 -0
+    $ref: regulator.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible

Missing blank line

Documentation/devicetree/bindings/regulator/pf1550.yaml line 35

Quoted 3 lines
Documentation/devicetree/bindings/regulator/pf1550.yaml new file +3 -0
+additionalProperties: false
+
+...

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v2 4/9] dt-bindings: mfd: add pf1550

In reply to Samuel Kayode
Quoted 4 lines · Samuel Kayode

Add a DT binding document for pf1550 PMIC. This describes the core mfd device.

You need to explain the dependencies in the cover letter. There is nothing there but you have clear dependency and all bindings must go via one tree, unless you re-do this to use compatibles.

Quoted 2 lines
---
 .../devicetree/bindings/mfd/pf1550.yaml       | 122 ++++++++++++++++++

Same comments.

Documentation/devicetree/bindings/mfd/pf1550.yaml line 1

Quoted 10 lines
 1 file changed, 122 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/pf1550.yaml
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +1 -0
new file mode 100644
index 000000000000..461bc13513eb
@@ -0,0 +1,122 @@
+# SPDX-License-Identifier: GPL-2.0

No.

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </form letter>

Documentation/devicetree/bindings/mfd/pf1550.yaml line 7

Quoted 6 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +6 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/pf1550.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PF1550 low power PMIC from NXP.

Same comments

Quoted 9 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +9 -0
+
+maintainers:
+  - Samuel Kayode <[email protected]>
+
+description: |
+  PF1550 is a low power PMIC providing battery charging and power supply for
+  low power IoT and wearable applications.
+
+  For device-tree bindings of other sub-modules (regulator, power supply and

Documentation/devicetree/bindings/mfd/pf1550.yaml line 26

Quoted 10 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +10 -0
+  onkey) refer to the binding documents under the respective sub-system
+  directories.
+
+properties:
+  compatible:
+    const: fsl,pf1550
+
+  reg:
+    description:
+      I2C device address.

Drop

Documentation/devicetree/bindings/mfd/pf1550.yaml line 39

Quoted 13 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +13 -0
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    $ref: /schemas/regulator/pf1550.yaml
+
+  charger:
+    $ref: /schemas/power/supply/pf1550_charger.yaml
+
+  onkey:
+    $ref: /schemas/input/pf1550_onkey.yaml

This makes merging via separate trees not possible...

Just fold everything here, drop compatibles and then put binding in the regulator. Unless children are re-usable which would justify compatibles, but then please provide arguments for that.

Best regards,
Krzysztof

#12 lore raw

Re: [PATCH v2 5/9] mfd: pf1550: add core mfd driver

In reply to Samuel Kayode

drivers/mfd/pf1550.c line 137

Quoted 9 lines · Samuel Kayode
drivers/mfd/pf1550.c new file +9 -0
+
+static int pf1550_i2c_probe(struct i2c_client *i2c)
+{
+	struct pf1550_dev *pf1550;
+	unsigned int reg_data = 0;
+	int ret = 0;
+
+	pf1550 = devm_kzalloc(&i2c->dev,
+			      sizeof(struct pf1550_dev), GFP_KERNEL);

sizeof(*)

drivers/mfd/pf1550.c line 150

Quoted 13 lines
drivers/mfd/pf1550.c new file +13 -0
+	if (!pf1550)
+		return -ENOMEM;
+
+	i2c_set_clientdata(i2c, pf1550);
+	pf1550->dev = &i2c->dev;
+	pf1550->i2c = i2c;
+	pf1550->irq = i2c->irq;
+
+	pf1550->regmap = devm_regmap_init_i2c(i2c, &pf1550_regmap_config);
+	if (IS_ERR(pf1550->regmap)) {
+		ret = PTR_ERR(pf1550->regmap);
+		dev_err(pf1550->dev, "failed to allocate register map: %d\n",
+			ret);

Syntax is always: return dev_err_probe

drivers/mfd/pf1550.c line 157

Quoted 7 lines
drivers/mfd/pf1550.c new file +7 -0
+		return ret;
+	}
+
+	ret = regmap_read(pf1550->regmap, PF1550_PMIC_REG_DEVICE_ID, &reg_data);
+	if (ret < 0 || reg_data != PF1550_DEVICE_ID) {
+		dev_err(pf1550->dev, "device not found!\n");
+		return ret;

Syntax is always: return dev_err_probe

drivers/mfd/pf1550.c line 161

Quoted 4 lines
drivers/mfd/pf1550.c new file +4 -0
+	}
+
+	pf1550->type = PF1550;
+	dev_info(pf1550->dev, "pf1550 found.\n");

Drop. Drivers should be silent. This is really useless and just pollutes log. See also coding style.

drivers/mfd/pf1550.c line 171

Quoted 10 lines
drivers/mfd/pf1550.c new file +10 -0
+
+	ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap,
+				       pf1550->irq,
+				IRQF_ONESHOT | IRQF_SHARED |
+				IRQF_TRIGGER_FALLING, 0,
+				&pf1550_regulator_irq_chip,
+				&pf1550->irq_data_regulator);
+	if (ret) {
+		dev_err(pf1550->dev, "failed to add irq1 chip: %d\n", ret);
+		return ret;

Syntax is always: return dev_err_probe

drivers/mfd/pf1550.c line 182

Quoted 11 lines
drivers/mfd/pf1550.c new file +11 -0
+	}
+
+	ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap,
+				       pf1550->irq,
+				IRQF_ONESHOT | IRQF_SHARED |
+				IRQF_TRIGGER_FALLING, 0,
+				&pf1550_onkey_irq_chip,
+				&pf1550->irq_data_onkey);
+	if (ret) {
+		dev_err(pf1550->dev, "failed to add irq3 chip: %d\n", ret);
+		return ret;

Syntax is always: return dev_err_probe

drivers/mfd/pf1550.c line 193

Quoted 11 lines
drivers/mfd/pf1550.c new file +11 -0
+	}
+
+	ret = devm_regmap_add_irq_chip(pf1550->dev, pf1550->regmap,
+				       pf1550->irq,
+				IRQF_ONESHOT | IRQF_SHARED |
+				IRQF_TRIGGER_FALLING, 0,
+				&pf1550_charger_irq_chip,
+				&pf1550->irq_data_charger);
+	if (ret) {
+		dev_err(pf1550->dev, "failed to add irq4 chip: %d\n", ret);
+		return ret;

Syntax is always: return dev_err_probe

drivers/mfd/pf1550.c line 204

Quoted 11 lines
drivers/mfd/pf1550.c new file +11 -0
+	}
+
+	return devm_mfd_add_devices(pf1550->dev, -1, pf1550_devs,
+			      ARRAY_SIZE(pf1550_devs), NULL, 0, NULL);
+}
+
+static const struct i2c_device_id pf1550_i2c_id[] = {
+	{ "pf1550", PF1550 },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(i2c, pf1550_i2c_id);

Table IDs are next to each other.

Quoted 30 lines
drivers/mfd/pf1550.c new file +30 -0
+
+static int pf1550_suspend(struct device *dev)
+{
+	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+	struct pf1550_dev *pf1550 = i2c_get_clientdata(i2c);
+
+	if (device_may_wakeup(dev)) {
+		enable_irq_wake(pf1550->irq);
+		disable_irq(pf1550->irq);
+	}
+
+	return 0;
+}
+
+static int pf1550_resume(struct device *dev)
+{
+	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
+	struct pf1550_dev *pf1550 = i2c_get_clientdata(i2c);
+
+	if (device_may_wakeup(dev)) {
+		disable_irq_wake(pf1550->irq);
+		enable_irq(pf1550->irq);
+	}
+
+	return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(pf1550_pm, pf1550_suspend, pf1550_resume);
+
+static const struct of_device_id pf1550_dt_match[] = {

drivers/mfd/pf1550.c line 244

Quoted 10 lines
drivers/mfd/pf1550.c new file +10 -0
+	{ .compatible = "fsl,pf1550" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, pf1550_dt_match);
+
+static struct i2c_driver pf1550_i2c_driver = {
+	.driver = {
+		   .name = "pf1550",
+		   .pm = pm_sleep_ptr(&pf1550_pm),
+		   .of_match_table = of_match_ptr(pf1550_dt_match),

Drop of_match_ptr, you have warnings here.

drivers/mfd/pf1550.c line 254

Quoted 10 lines
drivers/mfd/pf1550.c new file +10 -0
+	},
+	.probe = pf1550_i2c_probe,
+	.id_table = pf1550_i2c_id,
+};
+
+module_i2c_driver(pf1550_i2c_driver);
+
+MODULE_DESCRIPTION("Freescale PF1550 multi-function core driver");
+MODULE_AUTHOR("Robin Gong <[email protected]>");
+MODULE_LICENSE("GPL v2");

Best regards,
Krzysztof

#21 lore raw

Re: [PATCH v2 8/9] power: supply: pf1550: add battery charger support

In reply to Samuel Kayode

drivers/power/supply/pf1550_charger.c line 622

Quoted 12 lines · Samuel Kayode
drivers/power/supply/pf1550_charger.c new file +12 -0
+
+	chg->psy_desc.name = PF1550_CHARGER_NAME;
+	chg->psy_desc.type = POWER_SUPPLY_TYPE_BATTERY;
+	chg->psy_desc.get_property = pf1550_charger_get_property;
+	chg->psy_desc.properties = pf1550_charger_props;
+	chg->psy_desc.num_properties = ARRAY_SIZE(pf1550_charger_props);
+
+	chg->charger = devm_power_supply_register(&pdev->dev, &chg->psy_desc,
+						  &psy_cfg);
+	if (IS_ERR(chg->charger)) {
+		dev_err(&pdev->dev, "failed: power supply register\n");
+		ret = PTR_ERR(chg->charger);

Same comments as on patches before.

Quoted 18 lines
drivers/power/supply/pf1550_charger.c new file +18 -0
+		return ret;
+	}
+
+	ret = pf1550_reg_init(chg);
+
+	return ret;
+}
+
+static void pf1550_charger_remove(struct platform_device *pdev)
+{
+	struct pf1550_charger *chg = platform_get_drvdata(pdev);
+
+	cancel_delayed_work_sync(&chg->irq_work);
+}
+
+static const struct platform_device_id pf1550_charger_id[] = {
+	{ "pf1550-charger", 0 },
+	{ /* sentinel */ }

drivers/power/supply/pf1550_charger.c line 650

Quoted 10 lines
drivers/power/supply/pf1550_charger.c new file +10 -0
+};
+MODULE_DEVICE_TABLE(platform, pf1550_charger_id);
+
+static struct platform_driver pf1550_charger_driver = {
+	.driver = {
+		.name	= "pf1550-charger",
+	},
+	.probe		= pf1550_charger_probe,
+	.remove		= pf1550_charger_remove,
+	.id_table	= pf1550_charger_id,

And this proves that your compatible in the binding is also useless. Not used in the driver itself

Best regards,
Krzysztof

#15 lore raw

Re: [PATCH v2 6/9] regulator: pf1550: add support for regulator

In reply to Samuel Kayode
kernel test robot noticed the following build warnings:

Hi Samuel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b1d8766052eb0534b27edda8af1865d53621bd6a]

url:    https://github.com/intel-lab-lkp/linux/commits/Samuel-Kayode/dt-bindings-power-supply-add-pf1550/20250517-030259
base:   b1d8766052eb0534b27edda8af1865d53621bd6a
patch link:    https://lore.kernel.org/r/4dd316e06a66634b5af13f1faedc985753b061bc.1747409892.git.samuel.kayode%40savoirfairelinux.com
patch subject: [PATCH v2 6/9] regulator: pf1550: add support for regulator
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

includecheck warnings: (new ones prefixed by >>)

>> drivers/regulator/pf1550.c: linux/regulator/machine.h is included more than once.
>> drivers/regulator/pf1550.c: linux/slab.h is included more than once.

vim +19 drivers/regulator/pf1550.c

  > 19	#include <linux/regulator/machine.h>
    20	#include <linux/regulator/of_regulator.h>
  > 21	#include <linux/regulator/machine.h>

22 #include <linux/platform_device.h>
23

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#19 lore raw

Re: [PATCH v2 7/9] input: pf1550: add onkey support

In reply to Samuel Kayode
kernel test robot noticed the following build warnings:

Hi Samuel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b1d8766052eb0534b27edda8af1865d53621bd6a]

url:    https://github.com/intel-lab-lkp/linux/commits/Samuel-Kayode/dt-bindings-power-supply-add-pf1550/20250517-030259
base:   b1d8766052eb0534b27edda8af1865d53621bd6a
patch link:    https://lore.kernel.org/r/7d80afedf1ad9e98c9739163751bcb2785009e74.1747409892.git.samuel.kayode%40savoirfairelinux.com
patch subject: [PATCH v2 7/9] input: pf1550: add onkey support
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20250518/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250518/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/input/keyboard/pf1550_onkey.c: In function 'pf1550_onkey_resume':

>> drivers/input/keyboard/pf1550_onkey.c:171:30: warning: conversion from 'long unsigned int' to 'unsigned int' changes value from '18446744073709551552' to '4294967232' [-Woverflow]
     171 |                              ~(ONKEY_IRQ_PUSHI | ONKEY_IRQ_1SI | ONKEY_IRQ_2SI |
         |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     172 |                              ONKEY_IRQ_3SI | ONKEY_IRQ_4SI | ONKEY_IRQ_8SI));
         |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +171 drivers/input/keyboard/pf1550_onkey.c

162
163 static int pf1550_onkey_resume(struct device *dev)
164 {
165 struct platform_device *pdev = to_platform_device(dev);
166 struct onkey_drv_data *onkey = platform_get_drvdata(pdev);
167
168 if (!device_may_wakeup(&pdev->dev))
169 regmap_write(onkey->pf1550->regmap,

   170				     PF1550_PMIC_REG_ONKEY_INT_MASK0,
 > 171				     ~(ONKEY_IRQ_PUSHI | ONKEY_IRQ_1SI | ONKEY_IRQ_2SI |
   172				     ONKEY_IRQ_3SI | ONKEY_IRQ_4SI | ONKEY_IRQ_8SI));

173 else
174 disable_irq_wake(onkey->pf1550->irq);
175
176 return 0;
177 }
178

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#13 lore raw

Re: [PATCH v2 5/9] mfd: pf1550: add core mfd driver

In reply to Samuel Kayode
kernel test robot noticed the following build warnings:

Hi Samuel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b1d8766052eb0534b27edda8af1865d53621bd6a]

url:    https://github.com/intel-lab-lkp/linux/commits/Samuel-Kayode/dt-bindings-power-supply-add-pf1550/20250517-030259
base:   b1d8766052eb0534b27edda8af1865d53621bd6a
patch link:    https://lore.kernel.org/r/85004e02a5177aef6334fc30494bb3924a58f1de.1747409892.git.samuel.kayode%40savoirfairelinux.com
patch subject: [PATCH v2 5/9] mfd: pf1550: add core mfd driver
config: i386-randconfig-r072-20250520 (https://download.01.org/0day-ci/archive/20250520/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250520/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/mfd/pf1550.c:234:34: warning: 'pf1550_dt_match' defined but not used [-Wunused-const-variable=]
     234 | static const struct of_device_id pf1550_dt_match[] = {
         |                                  ^~~~~~~~~~~~~~~

vim +/pf1550_dt_match +234 drivers/mfd/pf1550.c

233

 > 234	static const struct of_device_id pf1550_dt_match[] = {

235 { .compatible = "fsl,pf1550" },
236 { /* sentinel */ }
237 };
238 MODULE_DEVICE_TABLE(of, pf1550_dt_match);
239

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

Re: [PATCH v2 4/9] dt-bindings: mfd: add pf1550

In reply to Krzysztof Kozlowski
Quoted 16 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/mfd/pf1550.yaml line 39

Quoted 13 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +13 -0
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    $ref: /schemas/regulator/pf1550.yaml
+
+  charger:
+    $ref: /schemas/power/supply/pf1550_charger.yaml
+
+  onkey:
+    $ref: /schemas/input/pf1550_onkey.yaml

This makes merging via separate trees not possible...

Quoted 3 lines

Just fold everything here, drop compatibles and then put binding in the regulator. Unless children are re-usable which would justify compatibles, but then please provide arguments for that.

Yes, compatibles are not needed for the children. For adding binding to the regulator, did you mean for all children: charger and onkey included? So, replacing the separate yaml for all children with bindings in the mfd yaml?

Thanks,
Sam

#10 lore raw

Re: [PATCH v2 4/9] dt-bindings: mfd: add pf1550

Quoted 17 lines · Samuel Kayode
Quoted 16 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/mfd/pf1550.yaml line 39

Quoted 13 lines
Documentation/devicetree/bindings/mfd/pf1550.yaml new file +13 -0
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  regulators:
+    $ref: /schemas/regulator/pf1550.yaml
+
+  charger:
+    $ref: /schemas/power/supply/pf1550_charger.yaml
+
+  onkey:
+    $ref: /schemas/input/pf1550_onkey.yaml

This makes merging via separate trees not possible...

Quoted 7 lines
Quoted 3 lines

Just fold everything here, drop compatibles and then put binding in the regulator. Unless children are re-usable which would justify compatibles, but then please provide arguments for that.

Yes, compatibles are not needed for the children. For adding binding to the regulator, did you mean for all children: charger and onkey included? So, replacing the separate yaml for all children with bindings in the mfd yaml?

Up to you. Onkey looks small so could be folded for sure, but other bindings are not big either, so I would personally fold everything. Otherwise you will need to be sure MFD is not applied before they reach mainline.

Due to lack of testing I did not review charger patch, but just after quick glance I see already that you miss power supply ref, thus it seems you duplicate some of the existing properties from monitored-battery.

Best regards,
Krzysztof

#18 lore raw

Re: [PATCH v2 7/9] input: pf1550: add onkey support

In reply to Dmitry Torokhov
Quoted 12 lines · Dmitry Torokhov
Quoted 12 lines
drivers/input/keyboard/pf1550_onkey.c new file +12 -0
+	input->name = pdev->name;
+	input->phys = "pf1550-onkey/input0";
+	input->id.bustype = BUS_HOST;
+
+	input_set_capability(input, EV_KEY, onkey->keycode);
+
+	for (i = 0; i < ARRAY_SIZE(pf1550_onkey_irqs); i++) {
+		struct pf1550_irq_info *onkey_irq =
+						&pf1550_onkey_irqs[i];
+		unsigned int virq = 0;
+
+		virq = regmap_irq_get_virq(pf1550->irq_data_onkey,
Quoted 9 lines

drivers/input/keyboard/pf1550_onkey.c line 117

Quoted 5 lines
drivers/input/keyboard/pf1550_onkey.c new file +5 -0
+					   onkey_irq->irq);
+		if (!virq)
+			return -EINVAL;
+
+		onkey_irq->virq = virq;

I think this kind of mapping needs to be done in the core part of your driver.

Without doing the mapping in the MFD children, a list of all virqs for the PMIC would have to be maintained in addition to the (regmap_irq) irqs. Perhaps, there is a better way to implement this?

Quoted 5 lines

drivers/input/keyboard/pf1550_onkey.c line 122

Quoted 5 lines
drivers/input/keyboard/pf1550_onkey.c new file +5 -0
+
+		error = devm_request_threaded_irq(&pdev->dev, virq, NULL,
+						  pf1550_onkey_irq_handler,
+					IRQF_NO_SUSPEND,
+					onkey_irq->name, onkey);

Thanks,
Sam