mbox series

[v3,0/6] add support for pf1550 PMIC MFD-based drivers

Message ID 20250527-pf1550-v3-0-45f69453cd51@savoirfairelinux.com
Headers show
Series add support for pf1550 PMIC MFD-based drivers | expand

Message

Samuel Kayode via B4 Relay May 27, 2025, 10:25 p.m. UTC
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.

Patch 1 adds the DT binding document for the PMIC. Patches 2-5 adds the
pertinent drivers. Last patch adds a MAINTAINERS entry for the drivers.

Changes since v1:
   - DT bindings for all devices included
   - Add onkey driver
   - Add driver for the regulators
   - Ensure charger is activated as some variants have it off by default
   - Update mfd and charger driver per feedback from eballetbo@gmail.com
   - Add myself as maintainer for these drivers
   - Link to v1: https://lore.kernel.org/1523974819-8711-1-git-send-email-abel.vesa@nxp.com/

Changes since v2:
   - Rebase on recent mainline kernel v6.15
   - Single yaml file containing dt bindings for all pf1550 devices
   - irq mapping done in MFD driver as suggested by Dmitry Torokhov
   - Drop unnecessary includes in drivers
   - Replace dev_err with dev_err_probe in probe method of drivers
   - Drop compatible string from drivers of the sub-devices
   - Remove dependency on OF from drivers of the sub-devices
   - onkey: move driver from input/keyboard into input/misc
   - onkey: remove dependency on OF
   - onkey: use onkey virqs instead of central irq
   - onkey: fix integer overflow for regmap_write when unmasking
     interrupts during pf1550_onkey_resume
   - charger: add support for monitored-battery which is used in setting
     a constant voltage for the charger.
   - Address other feedback from Dmitry Torokhov and Krzysztof Kozlowski
   - Link to v2: https://lore.kernel.org/cover.1747409892.git.samuel.kayode@savoirfairelinux.com/

Signed-off-by: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
---
Samuel Kayode (6):
      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

 Documentation/devicetree/bindings/mfd/pf1550.yaml | 139 +++++
 MAINTAINERS                                       |  10 +
 drivers/input/misc/Kconfig                        |  11 +
 drivers/input/misc/Makefile                       |   1 +
 drivers/input/misc/pf1550-onkey.c                 | 202 +++++++
 drivers/mfd/Kconfig                               |  14 +
 drivers/mfd/Makefile                              |   2 +
 drivers/mfd/pf1550.c                              | 277 ++++++++++
 drivers/power/supply/Kconfig                      |  11 +
 drivers/power/supply/Makefile                     |   1 +
 drivers/power/supply/pf1550-charger.c             | 639 ++++++++++++++++++++++
 drivers/regulator/Kconfig                         |   9 +
 drivers/regulator/Makefile                        |   1 +
 drivers/regulator/pf1550-regulator.c              | 353 ++++++++++++
 include/linux/mfd/pf1550.h                        | 241 ++++++++
 15 files changed, 1911 insertions(+)
---
base-commit: 0a4b866d08c6adaea2f4592d31edac6deeb4dcbd
change-id: 20250527-pf1550-d401f0d07b80

Best regards,

Comments

Krzysztof Kozlowski May 28, 2025, 6:08 a.m. UTC | #1
On 28/05/2025 00:25, Samuel Kayode via B4 Relay wrote:
> From: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
> 
> Add a DT binding document for pf1550 PMIC. This describes the core mfd
> device along with its children: regulators, charger and onkey.
> 
> Signed-off-by: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
> ---
> v3:
>  - Address Krzysztof's feedback:
>    - Fold charger and onkey objects
>    - Drop compatible for sub-devices: onkey, charger and regulator.
>    - Drop constant voltage property already included in
>      monitored-battery
>    - Fix whitespace warnings
>    - Fix license
> v2:
>  - Add yamls for the PMIC and the sub-devices
> ---
>  Documentation/devicetree/bindings/mfd/pf1550.yaml | 139 ++++++++++++++++++++++

Filename: nothing improved.


>  1 file changed, 139 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/pf1550.yaml b/Documentation/devicetree/bindings/mfd/pf1550.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..7f22cb91eb5542c8aa616525ed1e78efa2a863d3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/pf1550.yaml


...

> +
> +    patternProperties:
> +      "^(ldo[1-3]|sw[1-3]|vrefddr)$":
> +        type: object
> +        $ref: /schemas/regulator/regulator.yaml
> +        description:
> +          regulator configuration for ldo1-3, buck converters(sw1-3)
> +          and DDR termination reference voltage (vrefddr)
> +        unevaluatedProperties: false
> +
> +    additionalProperties: false
> +
> +  monitored-battery:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description: |
> +      A phandle to a monitored battery node that contains a valid value
> +      for:
> +      constant-charge-voltage-max-microvolt.
> +
> +  fsl,thermal-regulation:

-celsius or whatever is in standard suffixes:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml

> +    $ref: /schemas/types.yaml#/definitions/uint32

Drop

> +    description:
> +      Temperature threshold for thermal regulation of charger in celsius.

But this now makes me wonder whether this should be just part of thermal
zone and get the threshold from there. I assume this is temperature of
CHARGER, not the battery. If battery, you have such properties in
battery.yaml (monitored-batter).

@Sebastian,
Are there existing bindings or devices which regulate temperature based
on thermal-zones in DT?



> +    enum: [ 60, 75, 90, 105 ]
> +
> +  fsl,min-system-microvolt:
> +    description:
> +      System specific lower limit voltage.
> +    enum: [ 3500000, 3700000, 4300000 ]
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    battery: battery-cell {
> +        compatible = "simple-battery";
> +        constant-charge-voltage-max-microvolt = <4400000>;
> +        operating-range-celsius = <0 75>;

So this looks like duplicating thermal-regulation property.

> +    };

Blank line

> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/input/linux-event-codes.h>

Includes go before battery-cell.

> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +



Best regards,
Krzysztof
Krzysztof Kozlowski May 28, 2025, 6:10 a.m. UTC | #2
On 28/05/2025 00:25, Samuel Kayode via B4 Relay wrote:
> From: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
> 
> Add MAINTAINERS entry for pf1550 PMIC.
> 
> Signed-off-by: Samuel Kayode <samuel.kayode@savoirfairelinux.com>
> ---
>  MAINTAINERS | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 830ef5f9d86487a599236a2392e422f0e424a313..2be65383c3c7b1c1487577d23bff483aa437c4c8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -17688,6 +17688,16 @@ F:	Documentation/devicetree/bindings/clock/imx*
>  F:	drivers/clk/imx/
>  F:	include/dt-bindings/clock/imx*
>  
> +NXP PF1550 PMIC MFD DRIVER

You call the entry here NXP, so maybe you "nxp" prefixes in the binding
for compatible, properties and filename?

This itself is fine.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
Samuel Kayode May 28, 2025, 5:48 p.m. UTC | #3
On Wed, May 28, 2025 at 08:08:17AM +0200, Krzysztof Kozlowski wrote:
> > +    description:
> > +      Temperature threshold for thermal regulation of charger in celsius.
> 
> But this now makes me wonder whether this should be just part of thermal
> zone and get the threshold from there. I assume this is temperature of
> CHARGER, not the battery. If battery, you have such properties in
> battery.yaml (monitored-batter).
Yes, it is the charger junction temperature.
> 
> @Sebastian,
> Are there existing bindings or devices which regulate temperature based
> on thermal-zones in DT?
> > +examples:
> > +  - |
> > +    battery: battery-cell {
> > +        compatible = "simple-battery";
> > +        constant-charge-voltage-max-microvolt = <4400000>;
> > +        operating-range-celsius = <0 75>;
> 
> So this looks like duplicating thermal-regulation property.
Yes, thermal-regulation should suffice.

Thanks,
Sam