Skip to content
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

Add support for LTC7871 #2690

Open
wants to merge 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright (c) 2025 Analog Devices, Inc.
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/adi,ltc7871-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices LTC7871 Buck-Boost Voltage Regulator
maintainers:
- Celine Joy Capua <celinejoy.capua@analog.com>

description:
The LTC7871 is a high performance bidirectional buck or boost switching
regulator controller that operates in either buck or boost mode on demand.
It regulates in buck mode from VHIGH-to-VLOW and boost mode from
VLOW-to-VHIGH depending on a control signal, making it ideal for 48V/12V
automotive dual battery systems
properties:
compatible:
enum:
- adi,ltc7871
- adi,ltc7872

reg:
maxItems: 1

adi,enable-chip-ctrl-wp:
description: If present, this indicates the use of regulator's
internal write protection.
type: boolean
adiceline marked this conversation as resolved.
Show resolved Hide resolved

adi,ra-external-ohms:
description: External Resistor used to compute the value of
programmable VLOW in buck mode.
default: 10000

adi,rb-external-ohms:
description: External Resistor used to compute the value of
programmable VLOW in buck mode.
default: 107000

adi,rc-external-ohms:
description: External Resistor used to compute the value of
programmable VHIGH in boost mode.
default: 12700

adi,rd-external-ohms:
description: External Resistor used to compute the value of
programmable VHIGH in boost mode.
default: 499000

adi,idac-setcur-microamp:
description: Adjusts the IDAC_SETCUR to program SETCUR
pin's sourcing current.
minimum: -63
maximum: 64
default: 0

adi,freq-spread-percentage:
description: Sets the range of modulation with respect to the
switching frequency.
enum: [+-12%, +-15%, +-10%, +-8%]
default: +-12%

adi,switching-freq-divider:
description: The factor at which the switching frequency is
divided to get the modulation frequency.
$ref: /schemas/types.yaml#/definitions/uint32
enum: [512, 1024, 2048, 4096, 256, 128, 64]
default: 512
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we somehow express this in frequency and do the math in the driver to get the actual divider?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switching frequency is set via another external resistor which is arbitrary which means that the modulation frequency cannot be computed without prior knowledge of this resistor. Thus, we cannot directly use the modulation frequency as a property because it doesn't have fixed values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative would be to make the user input an integer for the modulation frequency, do the math in the driver, then round to the nearest valid value for the divisor. However, if we do this, the user will not be able to readback the actual value of the modulation frequency.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, if we do this, the user will not be able to readback the actual value of the modulation frequency.

Why not? But for the above to work you would need to know the controller switching frequency so that you would need another resistor property right? I mean, if an external clock is used on the SYNC pin, it would be trivial to get the frequency but if you have the resistor on the FREQ pin, you would need to know it in order to do the math. Maybe let's go with the divider and see if upstream accepts it. Divider properties are not that uncommon after all.

But one thing though... you're missing an optional clock property for the SYNC pin when an external clock is used (should also be enabled in the driver). You could also add some regulator properties for the chip supplies.


required:
- compatible
- reg

allOf:
- $ref: regulator.yaml#
- $ref: /schemas/spi/spi-peripheral-props.yaml#

unevaluatedProperties: false

examples:
- |
spi {
#address-cells = <1>;
#size-cells = <0>;
regulator@0 {
compatible = "adi,ltc7871";
reg = <0>;
adi,ra-external-ohm = <10000>;
adi,rb-external-ohm = <107000>;
adi,rc-external-ohm = <12700>;
adi,rd-external-ohm = <499000>;
adi,idac-setcur-microamp = <0>;
adi,freq-spread-percentage = "+-12%";
adi,switching-freq-divider = <512>;
};
};
1 change: 1 addition & 0 deletions Kconfig.adi
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ config KERNEL_ALL_ADI_DRIVERS
imply REGULATOR_MAX77857
imply REGULATOR_MAX77541
imply MFD_MAX77541
imply REGULATOR_LTC7871

source "drivers/clk/Kconfig.adi"
source "drivers/hwmon/Kconfig.adi"
Expand Down
11 changes: 11 additions & 0 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,17 @@ config REGULATOR_LTC3676
This enables support for the LTC3676
8-output regulators controlled via I2C.

config REGULATOR_LTC7871
tristate "LTC7871 six-phase buck-boost voltage regulator driver with SPI"
depends on SPI && OF
help
This driver controls an Analog Devices LTC7871 high performance
bidirectional buck or boost switching regulator controller
that operates in either buck or boost mode on demand.

Say M here if you want to include support for the regulator as a
module.

config REGULATOR_MAX14577
tristate "Maxim 14577/77836 regulator"
depends on MFD_MAX14577
Expand Down
1 change: 1 addition & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ obj-$(CONFIG_REGULATOR_LP8788) += lp8788-buck.o
obj-$(CONFIG_REGULATOR_LP8788) += lp8788-ldo.o
obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o
obj-$(CONFIG_REGULATOR_LTC7871) += ltc7871-regulator.o
obj-$(CONFIG_REGULATOR_LTC3676) += ltc3676.o
obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
Expand Down
Loading