Skip to content

Staging/max77840 device driver #2815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions Documentation/devicetree/bindings/mfd/maxim,max77840.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/maxim,max77840.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX77840 PMIC

maintainers:
- Joan Na <joan.na@analog.com>


properties:
compatible:
const: maxim,max77840

reg:
maxItems: 1

interrupts:
maxItems: 1

regulator:
type: object
$ref: ../regulator/maxim,max77840-regulator.yaml#

charger:
type: object
$ref: ../power/supply/maxim,max77840-charger.yaml#

fuelgauge:
type: object
$ref: ../power/supply/maxim,max77840-fuelgauge.yaml#

charger-detect:
type: object
properties:
compatible:
const: maxim,max77840-charger-detect

additionalProperties: false

required:
- compatible
- reg

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>

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

max77840@66 {
compatible = "maxim,max77840";
reg = <0x66>;
interrupt-parent = <&gpio>;
interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
status = "okay";

regulator {
SAFEOUT1 {
regulator-boot-on;
regulator-always-on;
};
};

charger {
compatible = "maxim,max77840-charger";
fast_charge_timer = <0>; // disable
fast_charge_current = <1500>; // mA
charge_termination_voltage = <4350>; // mV
topoff_timer = <30>; // min
topoff_current = <150>; // mA
restart_threshold = <150>; // mV
input_current_limit = <500>; // mA
};

charger-detect {
compatible = "maxim,max77840-charger-detect";
};

fuelgauge {
compatible = "maxim,max77840-fuelgauge";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/maxim,max77840-charger-detect.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX77840 Charger Detect

maintainers:
- Joan Na <joan.na@analog.com>

properties:
compatible:
const: maxim,max77840-charger-detect

required:
- compatible

additionalProperties: false

examples:
- |
charger {
compatible = "maxim,max77840-charger-detect";
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/maxim,max77840-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX77840 Charger

maintainers:
- Joan Na <joan.na@analog.com>

properties:
compatible:
const: maxim,max77840-charger

fast_charge_timer:
description: Fast charge timer in hours
$ref: /schemas/types.yaml#/definitions/uint32

fast_charge_current:
description: Fast charge current in milliamps
$ref: /schemas/types.yaml#/definitions/uint32

charge_termination_voltage:
description: Charge termination (CV) voltage in millivolts
$ref: /schemas/types.yaml#/definitions/uint32

topoff_timer:
description: Top-off timer in minutes
$ref: /schemas/types.yaml#/definitions/uint32

topoff_current:
description: Top-off current in milliamps (mA)
$ref: /schemas/types.yaml#/definitions/uint32

restart_threshold:
description: Restart threshold in millivolts (mV)
$ref: /schemas/types.yaml#/definitions/uint32

input_current_limit:
description: Input current limit in milliamps (mA)
$ref: /schemas/types.yaml#/definitions/uint32

required:
- compatible

additionalProperties: false

examples:
- |
charger {
compatible = "maxim,max77840-charger";
fast_charge_timer = <5>;
fast_charge_current = <1500>;
charge_termination_voltage = <4200>;
topoff_timer = <20>;
topoff_current = <100>;
restart_threshold = <100>;
input_current_limit = <500>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/maxim,max77840-fuelgauge.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX77840 Fuel Gauge

maintainers:
- Joan Na <joan.na@analog.com>

properties:
compatible:
const: maxim,max77840-fuelgauge

required:
- compatible

additionalProperties: false

examples:
- |
fuelgauge {
compatible = "maxim,max77840-fuelgauge";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/maxim,max77840-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX77840 Regulator

maintainers:
- Joan Na <joan.na@analog.com>

properties:
compatible:
const: maxim,max77840-regulator

reg:
maxItems: 1

regulators:
type: object

properties:
SAFEOUT1:
$ref: regulator.yaml#

additionalProperties: false

required:
- compatible
- reg
- regulators

additionalProperties: false

examples:
- |

regulators {
SAFEOUT1 {
regulator-name = "SAFEOUT1";
regulator-boot-on;
regulator-always-on;
};
};

3 changes: 3 additions & 0 deletions Kconfig.adi
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ config KERNEL_ALL_ADI_DRIVERS
imply REGULATOR_MAX77857
imply REGULATOR_MAX77541
imply MFD_MAX77541
imply REGULATOR_MAX77840
imply CHARGER_MAX77840
imply MFD_MAX77840
imply REGULATOR_ADP5055

source "drivers/clk/Kconfig.adi"
Expand Down
13 changes: 13 additions & 0 deletions drivers/mfd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,19 @@ config MFD_MAX77714
drivers must be enabled in order to use each functionality of the
device.

config MFD_MAX77840
tristate "Maxim Integrated MAX77840 Charger Support"
depends on I2C
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
help
Say yes here to add support for Maxim Integrated MAX77840.
This is a 3A Switch Mode Charger with Fuel Gauge.
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_MAX77843
bool "Maxim Semiconductor MAX77843 PMIC Support"
depends on I2C=y
Expand Down
1 change: 1 addition & 0 deletions drivers/mfd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ obj-$(CONFIG_MFD_MAX77650) += max77650.o
obj-$(CONFIG_MFD_MAX77686) += max77686.o
obj-$(CONFIG_MFD_MAX77693) += max77693.o
obj-$(CONFIG_MFD_MAX77714) += max77714.o
obj-$(CONFIG_MFD_MAX77840) += max77840.o
obj-$(CONFIG_MFD_MAX77843) += max77843.o
obj-$(CONFIG_MFD_MAX8907) += max8907.o
max8925-objs := max8925-core.o max8925-i2c.o
Expand Down
Loading
Loading