mfd: max597x: Add support for max597x
Subsystems (2)
v5 cover mfd: max597x: Add support for max597x
max597x is multifunction device with hot swap controller, fault protection & upto four indication leds.
max5978 has single hot swap controller whereas max5970 has two hot swap controllers.
Changes in V5:
- Fix dt schema error
Changes in V4:
- Add NULL entry for of_device_id
- Memory allocation check
Changes in V3:
- Address code review comment
Changes in V2:
- Update depends in Kconfig.
Marcello Sylvester Bauer (1):
dt-bindings: mfd: Add bindings for MAX5970 and MAX5978
Patrick Rudolph (1):
mfd: max597x: Add support for MAX5970 and MAX5978
.../devicetree/bindings/mfd/max5970.yaml | 164 ++++++++++++++++++ drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 1 + drivers/mfd/max597x.c | 92 ++++++++++ include/linux/mfd/max597x.h | 103 +++++++++++ 5 files changed, 372 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/max5970.yaml create mode 100644 drivers/mfd/max597x.c create mode 100644 include/linux/mfd/max597x.h
base-commit: 6b780408be034213edfb5946889882cb29f8f159
Signature · 1 line
2.37.3
PATCH v5 1/2 dt-bindings: mfd: Add bindings for MAX5970 and MAX5978
From: Marcello Sylvester Bauer <[email protected]>
The MAX597x is a hot swap controller with configurable fault protection. It also has 10bit ADC for current & voltage measurements.
--- .../devicetree/bindings/mfd/max5970.yaml | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/max5970.yaml
Documentation/devicetree/bindings/mfd/max5970.yaml new file +164 -0
@@ -0,0 +1,164 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/max5970.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Regulator driver for MAX5970 smart switch from Maxim Integrated. + +maintainers: + - Patrick Rudolph <[email protected]> + +description: | + The smart switch provides no output regulation, but independent fault protection + and voltage and current sensing. + Programming is done through I2C bus. + + Datasheets: + https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf + https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf + +properties: + compatible: + enum: + - maxim,max5970 + - maxim,max5978 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + leds: + type: object + description: + Properties for single channel. + + patternProperties: + "^led@[0-3]$": + $ref: /schemas/leds/common.yaml# + type: object + + additionalProperties: true + + vss1-supply: + description: Supply of the first channel. + + vss2-supply: + description: Supply of the first channel. + + "#io-channel-cells": + const: 1 + + regulators: + type: object + description: + Properties for single channel. + + patternProperties: + "^(sw[0-1])$": + $ref: /schemas/regulator/regulator.yaml# + type: object + + shunt-resistor-micro-ohms: + description: | + The value of curent sense resistor in microohms. + Must be specified for each channel. + + additionalProperties: true + +required: + - compatible + - reg + - regulators + - vss1-supply + + +allOf: + - if: + properties: + compatible: + enum: + - maxim,max5970 + then: + properties: + io-channels: + items: + - description: voltage first channel + - description: current first channel + - description: voltage second channel + - description: current second channel + description: | + Voltage and current for first and second channel. + required: + - vss2-supply + else: + properties: + io-channels: + items: + - description: voltage first channel + - description: current first channel + description: | + Voltage and current for first channel. + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + regulator@3a { + reg = <0x3a>; + vss1-supply = <&p3v3>; + compatible = "maxim,max5978"; + + regulators { + sw0_ref_0: SW0 { + regulator-compatible = "SW0"; + shunt-resistor-micro-ohms = <12000>; + }; + }; + + leds { + #address-cells = <1>; + #size-cells = <0>; + led@0 { + reg = <0>; + label = "led0"; + default-state = "on"; + }; + led@1 { + reg = <1>; + label = "led1"; + default-state = "on"; + }; + }; + }; + }; + + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + regulator@3a { + reg = <0x3a>; + vss1-supply = <&p3v3>; + vss2-supply = <&p5v>; + compatible = "maxim,max5970"; + + regulators { + sw0_ref_1: SW0 { + regulator-compatible = "SW0"; + shunt-resistor-micro-ohms = <12000>; + }; + sw1_ref_1: SW1 { + regulator-compatible = "SW1"; + shunt-resistor-micro-ohms = <10000>; + }; + }; + }; + }; +...
Signature · 1 line
2.37.3
Re: [PATCH v5 1/2] dt-bindings: mfd: Add bindings for MAX5970 and MAX5978
Quoted 5 lines · Naresh Solanki
From: Marcello Sylvester Bauer <[email protected]>
The MAX597x is a hot swap controller with configurable fault protection. It also has 10bit ADC for current & voltage measurements.
Quoted 8 lines
Signed-off-by Patrick Rudolph <[email protected]>Signed-off-by Marcello Sylvester Bauer <[email protected]>Signed-off-by Naresh Solanki <[email protected]>--- .../devicetree/bindings/mfd/max5970.yaml | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/max5970.yaml
It seems I reviewed v4. Apply my comments from that one.
Best regards,
Krzysztof
PATCH v5 2/2 mfd: max597x: Add support for MAX5970 and MAX5978
In reply to Naresh SolankiFrom: Patrick Rudolph <[email protected]>
Implement a regulator driver with IRQ support for fault management. Written against documentation [1] and [2] and tested on real hardware.
Every channel has its own regulator supplies nammed 'vss1-supply' and 'vss2-supply'. The regulator supply is used to determine the output voltage, as the smart switch provides no output regulation. The driver requires the 'shunt-resistor-micro-ohms' property to be present in Device Tree to properly calculate current related values.
Datasheet links:
1: https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf
2: https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf
--- drivers/mfd/Kconfig | 12 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/max597x.c | 92 ++++++++++++++++++++++++++++++++ include/linux/mfd/max597x.h | 103 ++++++++++++++++++++++++++++++++++++ 4 files changed, 208 insertions(+) create mode 100644 drivers/mfd/max597x.c create mode 100644 include/linux/mfd/max597x.h
drivers/mfd/Kconfig +12 -0
@@ -253,6 +253,18 @@ config MFD_MADERA_SPI Support for the Cirrus Logic Madera platform audio SoC core functionality controlled via SPI. +config MFD_MAX597X + tristate "Maxim 597x Power Switch and Monitor" + depends on I2C + depends on OF + select MFD_CORE + select REGMAP_I2C + help + This driver controls a Maxim 5970/5978 switch via I2C bus. + The MAX5970/5978 is a smart switch with no output regulation, but + fault protection and voltage and current monitoring capabilities. + Also it supports upto 4 indication LEDs. + config MFD_CS47L15 bool "Cirrus Logic CS47L15" select PINCTRL_CS47L15
drivers/mfd/Makefile +1 -0
@@ -161,6 +161,7 @@ obj-$(CONFIG_MFD_DA9063) += da9063.o obj-$(CONFIG_MFD_DA9150) += da9150-core.o obj-$(CONFIG_MFD_MAX14577) += max14577.o +obj-$(CONFIG_MFD_MAX597X) += max597x.o obj-$(CONFIG_MFD_MAX77620) += max77620.o obj-$(CONFIG_MFD_MAX77650) += max77650.o obj-$(CONFIG_MFD_MAX77686) += max77686.o
drivers/mfd/max597x.c new file +92 -0
92 lines not on this page · raw message
include/linux/mfd/max597x.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.37.3