linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC
@ 2016-02-02 10:27 Chen-Yu Tsai
  2016-02-02 10:27 ` [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers Chen-Yu Tsai
                   ` (10 more replies)
  0 siblings, 11 replies; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-02 10:27 UTC (permalink / raw)
  To: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

Hi everyone,

This series adds support for X-Powers' AXP809 PMIC. This is the primary
PMIC accompanying Allwinner's A80 SoC. For now, only the power button
(PEK) and regulators are supported. These are supported using existing
axp20x drivers. This is based on the AXP223 series v7.

Patch 1 adds a MAINTAINERS entry for the X-Powers AXP PMICs. I list
myself as the maintainer.

Patch 2 adds AXP809 to the axp20x bindings.

Patch 3 adds AXP809 support to the axp20x mfd driver.

Patch 4 removes voltage readout for switch outputs.

Patch 5 converts AXP20X LDO4 from using voltage tables to linear voltage
ranges. Either one works, but regulators found on later PMICs match up
with linear ranges better.

Patch 6 adds AXP809 support to the axp20x regulator driver. This patch
depends on the previous 3 patches. It's probably easier to apply them
together.

Patch 7 adds a dtsi file for AXP809.

Patch 8 enables AXP809 support on the A80 Optimus board.

Patch 9 enables AXP809 support on the Cubieboard 4.

Patch 10 disables the dummy regulators from sunxi-common-regulators.dtsi
on the A80 Optimus board. These aren't used in the board DTS anymore.

Patch 11 disables the dummy regulators from sunxi-common-regulators.dtsi,
on the Cubieboard4. These aren't used in the board DTS anymore.


Regards
ChenYu


Chen-Yu Tsai (11):
  MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  mfd: axp20x: Add bindings for AXP809 PMIC
  mfd: axp20x: Add support for AXP809 PMIC
  regulator: axp20x: Remove voltage readout support for switch
    regulators
  regulator: axp20x: Use linear voltage ranges for AXP20X LDO4
  regulator: axp20x: support AXP809 variant
  ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  ARM: dts: sun9i: a80-optimus: Add AXP809 PMIC device node and
    regulators
  ARM: dts: sun9i: cubieboard4: Add AXP809 PMIC device node and
    regulators
  ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3,
    vcc5v0
  ARM: dts: sun9i: cubieboard4: Disable dummy regulators vcc3v0, vcc3v3,
    vcc5v0

 Documentation/devicetree/bindings/mfd/axp20x.txt   |  31 +++-
 MAINTAINERS                                        |   6 +
 .../dts/{sun9i-a80-cubieboard4.dts => axp809.dtsi} | 151 ++++++++++---------
 arch/arm/boot/dts/sun9i-a80-cubieboard4.dts        | 133 ++++++++++++++++-
 arch/arm/boot/dts/sun9i-a80-optimus.dts            | 133 ++++++++++++++++-
 drivers/mfd/axp20x-rsb.c                           |   1 +
 drivers/mfd/axp20x.c                               |  79 ++++++++++
 drivers/regulator/axp20x-regulator.c               | 165 ++++++++++++++-------
 include/linux/mfd/axp20x.h                         |  59 ++++++++
 9 files changed, 623 insertions(+), 135 deletions(-)
 copy arch/arm/boot/dts/{sun9i-a80-cubieboard4.dts => axp809.dtsi} (53%)

-- 
2.7.0

^ permalink raw reply	[flat|nested] 37+ messages in thread
* Applied "regulator: axp20x: support AXP809 variant" to the regulator tree
@ 2016-03-29 16:55 Mark Brown
  2016-03-29 17:19 ` kbuild test robot
  2016-03-29 19:09 ` kbuild test robot
  0 siblings, 2 replies; 37+ messages in thread
From: Mark Brown @ 2016-03-29 16:55 UTC (permalink / raw)
  To: Chen-Yu Tsai, Mark Brown; +Cc: linux-kernel

The patch

   regulator: axp20x: support AXP809 variant

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6387990e059d2a30b2c668bfa7e06f8922cf7483 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Tue, 29 Mar 2016 17:22:27 +0800
Subject: [PATCH] regulator: axp20x: support AXP809 variant

The X-Powers AXP809 PMIC has a similar set of regulators as the AXP221,
though a few LDOs were removed, and a new switch output added. Like the
AXP221, AXP809 also has DC1SW and DC5LDO, which are internally chained
to DCDC1 and DCDC5, respectively.

Add support for this new variant. Also remove the "axp22x_" prefix from
DC1SW/DC5LDO supply handling code, as the AXP809 uses it as well.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/axp20x-regulator.c | 119 ++++++++++++++++++++++++++---------
 1 file changed, 90 insertions(+), 29 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 40cd894e4df5..6a601f377019 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -224,6 +224,61 @@ static const struct regulator_desc axp22x_regulators[] = {
 	AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
 };
 
+static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
+	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
+	REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
+};
+
+static const struct regulator_linear_range axp809_dldo1_ranges[] = {
+	REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
+	REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
+};
+
+static const struct regulator_desc axp809_regulators[] = {
+	AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
+		 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)),
+	AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
+		 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)),
+	AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
+		 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
+	AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
+			57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1,
+			BIT(4)),
+	AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
+		 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
+	/* secondary switchable output of DCDC1 */
+	AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
+	/* LDO regulator internally chained to DCDC5 */
+	AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
+		 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
+	AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
+	AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
+	AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
+		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
+	AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
+			32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
+			BIT(3)),
+	AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
+		 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)),
+	AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
+		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
+	AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
+		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
+	AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
+		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
+	AXP_DESC_IO(AXP809, 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(AXP809, 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_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
+	AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
+};
+
 static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 {
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
@@ -239,6 +294,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		break;
 	case AXP221_ID:
 	case AXP223_ID:
+	case AXP809_ID:
 		min = 1800;
 		max = 4050;
 		def = 3000;
@@ -318,6 +374,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 
 	case AXP221_ID:
 	case AXP223_ID:
+	case AXP809_ID:
 		if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
 			return -EINVAL;
 
@@ -346,8 +403,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 	};
 	int ret, i, nregulators;
 	u32 workmode;
-	const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name;
-	const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name;
+	const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
+	const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
 
 	switch (axp20x->variant) {
 	case AXP202_ID:
@@ -360,6 +417,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		regulators = axp22x_regulators;
 		nregulators = AXP22X_REG_ID_MAX;
 		break;
+	case AXP809_ID:
+		regulators = axp809_regulators;
+		nregulators = AXP809_REG_ID_MAX;
+		break;
 	default:
 		dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
 			axp20x->variant);
@@ -382,22 +443,22 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		 * part of this loop to see where we save the DT defined
 		 * name.
 		 */
-		if (regulators == axp22x_regulators) {
-			if (i == AXP22X_DC1SW) {
-				new_desc = devm_kzalloc(&pdev->dev,
-							sizeof(*desc),
-							GFP_KERNEL);
-				*new_desc = regulators[i];
-				new_desc->supply_name = axp22x_dc1_name;
-				desc = new_desc;
-			} else if (i == AXP22X_DC5LDO) {
-				new_desc = devm_kzalloc(&pdev->dev,
-							sizeof(*desc),
-							GFP_KERNEL);
-				*new_desc = regulators[i];
-				new_desc->supply_name = axp22x_dc5_name;
-				desc = new_desc;
-			}
+		if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
+		    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
+			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
+						GFP_KERNEL);
+			*new_desc = regulators[i];
+			new_desc->supply_name = dcdc1_name;
+			desc = new_desc;
+		}
+
+		if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
+		    (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
+			new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
+						GFP_KERNEL);
+			*new_desc = regulators[i];
+			new_desc->supply_name = dcdc5_name;
+			desc = new_desc;
 		}
 
 		rdev = devm_regulator_register(&pdev->dev, desc, &config);
@@ -420,17 +481,17 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		/*
 		 * Save AXP22X DCDC1 / DCDC5 regulator names for later.
 		 */
-		if (regulators == axp22x_regulators) {
-			/* Can we use rdev->constraints->name instead? */
-			if (i == AXP22X_DCDC1)
-				of_property_read_string(rdev->dev.of_node,
-							"regulator-name",
-							&axp22x_dc1_name);
-			else if (i == AXP22X_DCDC5)
-				of_property_read_string(rdev->dev.of_node,
-							"regulator-name",
-							&axp22x_dc5_name);
-		}
+		if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) ||
+		    (regulators == axp809_regulators && i == AXP809_DCDC1))
+			of_property_read_string(rdev->dev.of_node,
+						"regulator-name",
+						&dcdc1_name);
+
+		if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) ||
+		    (regulators == axp809_regulators && i == AXP809_DCDC5))
+			of_property_read_string(rdev->dev.of_node,
+						"regulator-name",
+						&dcdc5_name);
 	}
 
 	return 0;
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2016-05-31 17:46 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
2016-02-02 10:27 ` [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers Chen-Yu Tsai
2016-02-02 13:27   ` Maxime Ripard
2016-02-03  0:19   ` [linux-sunxi] " Julian Calaby
2016-02-03  1:28     ` Joe Perches
2016-02-03  1:30       ` Julian Calaby
2016-02-03  6:49       ` Chen-Yu Tsai
2016-02-02 10:27 ` [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC Chen-Yu Tsai
2016-02-02 22:43   ` Rob Herring
2016-02-09 10:18     ` Lee Jones
2016-02-02 10:27 ` [PATCH 03/11] mfd: axp20x: Add support " Chen-Yu Tsai
2016-02-02 10:27 ` [PATCH 04/11] regulator: axp20x: Remove voltage readout support for switch regulators Chen-Yu Tsai
2016-02-03 18:11   ` Applied "regulator: axp20x: Remove voltage readout support for switch regulators" to the regulator tree Mark Brown
2016-02-02 10:27 ` [PATCH 05/11] regulator: axp20x: Use linear voltage ranges for AXP20X LDO4 Chen-Yu Tsai
2016-02-03 18:11   ` Applied "regulator: axp20x: Use linear voltage ranges for AXP20X LDO4" to the regulator tree Mark Brown
2016-02-02 10:27 ` [PATCH 06/11] regulator: axp20x: support AXP809 variant Chen-Yu Tsai
2016-02-03 17:15   ` Mark Brown
2016-05-31 17:46   ` Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown
2016-02-02 10:27 ` [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC Chen-Yu Tsai
2016-02-02 12:17   ` Mark Brown
2016-02-06 12:42     ` Chen-Yu Tsai
2016-02-08 14:53       ` Mark Brown
2016-02-08 14:56         ` Chen-Yu Tsai
2016-02-08 16:22           ` Mark Brown
2016-02-09  5:41             ` Chen-Yu Tsai
2016-02-09 11:32               ` Mark Brown
2016-02-02 10:27 ` [PATCH 08/11] ARM: dts: sun9i: a80-optimus: Add AXP809 PMIC device node and regulators Chen-Yu Tsai
2016-02-02 10:27 ` [PATCH 09/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
2016-02-02 10:27 ` [PATCH 10/11] ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0 Chen-Yu Tsai
2016-02-02 16:21   ` Maxime Ripard
2016-02-02 16:41     ` Chen-Yu Tsai
2016-02-04 16:44       ` Maxime Ripard
2016-02-02 10:27 ` [PATCH 11/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
2016-03-29 16:55 Applied "regulator: axp20x: support AXP809 variant" to the regulator tree Mark Brown
2016-03-29 17:19 ` kbuild test robot
2016-03-29 17:24   ` Mark Brown
2016-03-29 19:09 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).