Commit 5f194bf4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull regulator updates from Mark Brown:
 "A very quiet release for regulator, there's some new device support in
  existing drivers here and a few fixes but nothing in the core.

  Summary:

   - New device support for Allwinner AXP813, Dialog DA223/4/5 and
     Qualcomm PMI8994"

* tag 'regulator-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: tps65218: remove unused tps_info structure
  regulator: tps65218: Fix strobe assignment
  regulator: qcom_spmi: Include offset when translating voltages
  regulator: qcom_spmi: Add support for pmi8994
  regulator: da9211: update for supporting da9223/4/5
  ASoC: pfuze100: Remove leading zero from '@08' notation
  regulator: axp20x: Simplify axp20x_is_polyphase_slave implementation
  regulator: axp20x: Add support for AXP813 regulators
parents 1e19bded 50b7baef
Loading
Loading
Loading
Loading
+75 −7
Original line number Diff line number Diff line
* Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 Voltage Regulator
* Dialog Semiconductor DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
 Voltage Regulator

Required properties:
- compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213"
  or "dlg,da9214" or "dlg,da9215"
- compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213" or "dlg,da9223"
  or "dlg,da9214" or "dlg,da9224" or "dlg,da9215" or "dlg,da9225"
- reg: I2C slave address, usually 0x68.
- interrupts: the interrupt outputs of the controller
- regulators: A node that houses a sub-node for each regulator within the
@@ -16,7 +17,6 @@ Optional properties:
- Any optional property defined in regulator.txt

Example 1) DA9211

	pmic: da9211@68 {
		compatible = "dlg,da9211";
		reg = <0x68>;
@@ -35,7 +35,6 @@ Example 1) DA9211
	};

Example 2) DA9212

	pmic: da9212@68 {
		compatible = "dlg,da9212";
		reg = <0x68>;
@@ -79,7 +78,25 @@ Example 3) DA9213
		};
	};

Example 4) DA9214
Example 4) DA9223
	pmic: da9223@68 {
		compatible = "dlg,da9223";
		reg = <0x68>;
		interrupts = <3 27>;

		regulators {
			BUCKA {
				regulator-name = "VBUCKA";
				regulator-min-microvolt = < 300000>;
				regulator-max-microvolt = <1570000>;
				regulator-min-microamp 	= <3000000>;
				regulator-max-microamp 	= <6000000>;
				enable-gpios = <&gpio 27 0>;
			};
		};
	};

Example 5) DA9214
	pmic: da9214@68 {
		compatible = "dlg,da9214";
		reg = <0x68>;
@@ -105,7 +122,33 @@ Example 4) DA9214
		};
	};

Example 5) DA9215
Example 6) DA9224
	pmic: da9224@68 {
		compatible = "dlg,da9224";
		reg = <0x68>;
		interrupts = <3 27>;

		regulators {
			BUCKA {
				regulator-name = "VBUCKA";
				regulator-min-microvolt = < 300000>;
				regulator-max-microvolt = <1570000>;
				regulator-min-microamp 	= <3000000>;
				regulator-max-microamp 	= <6000000>;
				enable-gpios = <&gpio 27 0>;
			};
			BUCKB {
				regulator-name = "VBUCKB";
				regulator-min-microvolt = < 300000>;
				regulator-max-microvolt = <1570000>;
				regulator-min-microamp 	= <3000000>;
				regulator-max-microamp 	= <6000000>;
				enable-gpios = <&gpio 17 0>;
			};
		};
	};

Example 7) DA9215
	pmic: da9215@68 {
		compatible = "dlg,da9215";
		reg = <0x68>;
@@ -131,3 +174,28 @@ Example 5) DA9215
		};
	};

Example 8) DA9225
	pmic: da9225@68 {
		compatible = "dlg,da9225";
		reg = <0x68>;
		interrupts = <3 27>;

		regulators {
			BUCKA {
				regulator-name = "VBUCKA";
				regulator-min-microvolt = < 300000>;
				regulator-max-microvolt = <1570000>;
				regulator-min-microamp 	= <4000000>;
				regulator-max-microamp 	= <7000000>;
				enable-gpios = <&gpio 27 0>;
			};
			BUCKB {
				regulator-name = "VBUCKB";
				regulator-min-microvolt = < 300000>;
				regulator-max-microvolt = <1570000>;
				regulator-min-microamp 	= <4000000>;
				regulator-max-microamp 	= <7000000>;
				enable-gpios = <&gpio 17 0>;
			};
		};
	};
+3 −3
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ Each regulator is defined using the standard binding for regulators.

Example 1: PFUZE100

	pmic: pfuze100@08 {
	pmic: pfuze100@8 {
		compatible = "fsl,pfuze100";
		reg = <0x08>;

@@ -122,7 +122,7 @@ Example 1: PFUZE100

Example 2: PFUZE200

	pmic: pfuze200@08 {
	pmic: pfuze200@8 {
		compatible = "fsl,pfuze200";
		reg = <0x08>;

@@ -216,7 +216,7 @@ Example 2: PFUZE200

Example 3: PFUZE3000

	pmic: pfuze3000@08 {
	pmic: pfuze3000@8 {
		compatible = "fsl,pfuze3000";
		reg = <0x08>;

+13 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ Qualcomm SPMI Regulators
			"qcom,pm8916-regulators"
			"qcom,pm8941-regulators"
			"qcom,pm8994-regulators"
			"qcom,pmi8994-regulators"

- interrupts:
	Usage: optional
@@ -100,6 +101,15 @@ Qualcomm SPMI Regulators
	Definition: Reference to regulator supplying the input pin, as
		    described in the data sheet.

- vdd_s1-supply:
- vdd_s2-supply:
- vdd_s3-supply:
- vdd_l1-supply:
	Usage: optional (pmi8994 only)
	Value type: <phandle>
	Definition: Reference to regulator supplying the input pin, as
		    described in the data sheet.


The regulator node houses sub-nodes for each regulator within the device. Each
sub-node is identified using the node's name, with valid values listed for each
@@ -122,6 +132,9 @@ pm8994:
	l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20,
	l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, lvs1, lvs2

pmi8994:
	s1, s2, s3, l1

The content of each sub-node is defined by the standard binding for regulators -
see regulator.txt - with additional custom properties described below:

+1 −1
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ config REGULATOR_DA9210
	  interface.

config REGULATOR_DA9211
	tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator"
	tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225 regulator"
	depends on I2C
	select REGMAP_I2C
	help
+88 −4
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
	.ops		= &axp20x_ops_sw,
};

/* DCDC ranges shared with AXP813 */
static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
	REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
	REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
@@ -426,6 +427,69 @@ static const struct regulator_desc axp809_regulators[] = {
	AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
};

static const struct regulator_desc axp813_regulators[] = {
	AXP_DESC(AXP813, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
		 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
	AXP_DESC_RANGES(AXP813, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
			76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(1)),
	AXP_DESC_RANGES(AXP813, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
			76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(2)),
	AXP_DESC_RANGES(AXP813, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
			76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(3)),
	AXP_DESC_RANGES(AXP813, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
			68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(4)),
	AXP_DESC_RANGES(AXP813, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
			72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(5)),
	AXP_DESC_RANGES(AXP813, DCDC7, "dcdc7", "vin7", axp803_dcdc6_ranges,
			72, AXP813_DCDC7_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
			BIT(6)),
	AXP_DESC(AXP813, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
	AXP_DESC(AXP813, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
	AXP_DESC(AXP813, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
	AXP_DESC(AXP813, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
	AXP_DESC_RANGES(AXP813, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
			32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
			BIT(4)),
	AXP_DESC(AXP813, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
	AXP_DESC(AXP813, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
	AXP_DESC(AXP813, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
	AXP_DESC(AXP813, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
	AXP_DESC(AXP813, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
	/* to do / check ... */
	AXP_DESC(AXP813, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
		 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
	AXP_DESC(AXP813, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
		 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
	/*
	 * TODO: FLDO3 = {DCDC5, FLDOIN} / 2
	 *
	 * This means FLDO3 effectively switches supplies at runtime,
	 * something the regulator subsystem does not support.
	 */
	AXP_DESC_FIXED(AXP813, RTC_LDO, "rtc-ldo", "ips", 1800),
	AXP_DESC_IO(AXP813, LDO_IO0, "ldo-io0", "ips", 700, 3300, 100,
		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
	AXP_DESC_IO(AXP813, LDO_IO1, "ldo-io1", "ips", 700, 3300, 100,
		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
	AXP_DESC_SW(AXP813, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(7)),
};

static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
{
	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
@@ -441,9 +505,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
		step = 75;
		break;
	case AXP803_ID:
	case AXP813_ID:
		/*
		 * AXP803 DCDC work frequency setting has the same range and
		 * step as AXP22X, but at a different register.
		 * AXP803/AXP813 DCDC work frequency setting has the same
		 * range and step as AXP22X, but at a different register.
		 * Fall through to the check below.
		 * (See include/linux/mfd/axp20x.h)
		 */
@@ -561,6 +626,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
		workmode <<= id - AXP803_DCDC1;
		break;

	case AXP813_ID:
		if (id < AXP813_DCDC1 || id > AXP813_DCDC7)
			return -EINVAL;

		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP813_DCDC1);
		workmode <<= id - AXP813_DCDC1;
		break;

	default:
		/* should not happen */
		WARN_ON(1);
@@ -579,11 +652,12 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
	u32 reg = 0;

	/*
	 * Currently in our supported AXP variants, only AXP803 and AXP806
	 * have polyphase regulators.
	 * Currently in our supported AXP variants, only AXP803, AXP806,
	 * and AXP813 have polyphase regulators.
	 */
	switch (axp20x->variant) {
	case AXP803_ID:
	case AXP813_ID:
		regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);

		switch (id) {
@@ -656,6 +730,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
		regulators = axp809_regulators;
		nregulators = AXP809_REG_ID_MAX;
		break;
	case AXP813_ID:
		regulators = axp813_regulators;
		nregulators = AXP813_REG_ID_MAX;
		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
						  "x-powers,drive-vbus-en");
		break;
	default:
		dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
			axp20x->variant);
@@ -677,6 +757,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
		if (axp20x_is_polyphase_slave(axp20x, i))
			continue;

		/* Support for AXP813's FLDO3 is not implemented */
		if (axp20x->variant == AXP813_ID && i == AXP813_FLDO3)
			continue;

		/*
		 * Regulators DC1SW and DC5LDO are connected internally,
		 * so we have to handle their supply names separately.
Loading