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

* [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
@ 2016-02-02 10:27 ` Chen-Yu Tsai
  2016-02-02 13:27   ` Maxime Ripard
  2016-02-03  0:19   ` [linux-sunxi] " Julian Calaby
  2016-02-02 10:27 ` [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC Chen-Yu Tsai
                   ` (9 subsequent siblings)
  10 siblings, 2 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, Carlo Caione, Ramakrishna Pallala, Todd Brandt,
	Jacob Pan

Add an entry for X-Powers AXP family PMIC drivers and list myself
as maintainer.

Cc: Carlo Caione <carlo@caione.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Cc: Todd Brandt <todd.e.brandt@linux.intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f678c37107f5..7ea4e54f566a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11941,6 +11941,12 @@ F:	include/linux/workqueue.h
 F:	kernel/workqueue.c
 F:	Documentation/workqueue.txt
 
+X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
+M:	Chen-Yu Tsai <wens@csie.org>
+L:	linux-kernel@vger.kernel.org
+S:	Maintained
+N:	axp[128]
+
 X.25 NETWORK LAYER
 M:	Andrew Hendry <andrew.hendry@gmail.com>
 L:	linux-x25@vger.kernel.org
-- 
2.7.0

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

* [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC
  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 10:27 ` Chen-Yu Tsai
  2016-02-02 22:43   ` Rob Herring
  2016-02-02 10:27 ` [PATCH 03/11] mfd: axp20x: Add support " Chen-Yu Tsai
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 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

This patch adds the basic and regulator bindings for the X-Powers AXP809
PMIC.

Also update the DC-DC converter operating frequency for AXP22X/AXP80X.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 31 ++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index fd39fa54571b..d20b1034e967 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -6,10 +6,11 @@ axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 axp223 (X-Powers)
+axp809 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221", "x-powers,axp223"
+	      "x-powers,axp221", "x-powers,axp223", "x-powers,axp809"
 - reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
@@ -18,7 +19,9 @@ Required properties:
 
 Optional properties:
 - x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
-		      (range: 750-1875). Default: 1.5MHz
+		      AXP152/20X: range:  750-1875, Default: 1.5 MHz
+		      AXP22X/80X: range: 1800-4050, Default: 3   MHz
+
 - <input>-supply: a phandle to the regulator supply node. May be omitted if
 		  inputs are unregulated, such as using the IPSOUT output
 		  from the PMIC.
@@ -77,6 +80,30 @@ LDO_IO0		: LDO		: ips-supply		: GPIO 0
 LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
 
+AXP809 regulators, type, and corresponding input supply names:
+
+Regulator	  Type		  Supply Name		  Notes
+---------	  ----		  -----------		  -----
+DCDC1		: DC-DC buck	: vin1-supply
+DCDC2		: DC-DC buck	: vin2-supply
+DCDC3		: DC-DC	buck	: vin3-supply
+DCDC4		: DC-DC	buck	: vin4-supply
+DCDC5		: DC-DC	buck	: vin5-supply
+DC1SW		: On/Off Switch	:			: DCDC1 secondary output
+DC5LDO		: LDO		:			: input from DCDC5
+ALDO1		: LDO		: aldoin-supply		: shared supply
+ALDO2		: LDO		: aldoin-supply		: shared supply
+ALDO3		: LDO		: aldoin-supply		: shared supply
+DLDO1		: LDO		: dldoin-supply		: shared supply
+DLDO2		: LDO		: dldoin-supply		: shared supply
+ELDO1		: LDO		: eldoin-supply		: shared supply
+ELDO2		: LDO		: eldoin-supply		: shared supply
+ELDO3		: LDO		: eldoin-supply		: shared supply
+LDO_IO0		: LDO		: ips-supply		: GPIO 0
+LDO_IO1		: LDO		: ips-supply		: GPIO 1
+RTC_LDO		: LDO		: ips-supply		: always on
+SW		: On/Off Switch : swin-supply
+
 Example:
 
 axp209: pmic@34 {
-- 
2.7.0

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

* [PATCH 03/11] mfd: axp20x: Add support for AXP809 PMIC
  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 10:27 ` [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC Chen-Yu Tsai
@ 2016-02-02 10:27 ` Chen-Yu Tsai
  2016-02-02 10:27 ` [PATCH 04/11] regulator: axp20x: Remove voltage readout support for switch regulators Chen-Yu Tsai
                   ` (7 subsequent siblings)
  10 siblings, 0 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

The X-Powers AXP809 is a new PMIC that is paired with Allwinner's A80
SoC, along with a slave AXP806 PMIC.

This PMIC is quite similar to the earlier AXP223, though the interrupts
and regulator have changed a bit.

This patch adds support for the interrupts and power button of the PMIC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/mfd/axp20x-rsb.c   |  1 +
 drivers/mfd/axp20x.c       | 79 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 59 ++++++++++++++++++++++++++++++++++
 3 files changed, 139 insertions(+)

diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
index 28c20247c112..a407527bcd09 100644
--- a/drivers/mfd/axp20x-rsb.c
+++ b/drivers/mfd/axp20x-rsb.c
@@ -61,6 +61,7 @@ static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev)
 
 static const struct of_device_id axp20x_rsb_of_match[] = {
 	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ .compatible = "x-powers,axp809", .data = (void *)AXP809_ID },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index a57d6e940610..1ce923277cc8 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -37,6 +37,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP221",
 	"AXP223",
 	"AXP288",
+	"AXP809",
 };
 
 static const struct regmap_range axp152_writeable_ranges[] = {
@@ -85,6 +86,7 @@ static const struct regmap_access_table axp20x_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp20x_volatile_ranges),
 };
 
+/* AXP22x ranges are shared with the AXP809, as they cover the same range */
 static const struct regmap_range axp22x_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
@@ -211,6 +213,20 @@ static struct resource axp288_fuel_gauge_resources[] = {
 	},
 };
 
+static struct resource axp809_pek_resources[] = {
+	{
+		.name   = "PEK_DBR",
+		.start  = AXP809_IRQ_PEK_RIS_EDGE,
+		.end    = AXP809_IRQ_PEK_RIS_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	}, {
+		.name   = "PEK_DBF",
+		.start  = AXP809_IRQ_PEK_FAL_EDGE,
+		.end    = AXP809_IRQ_PEK_FAL_EDGE,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
 static const struct regmap_config axp152_regmap_config = {
 	.reg_bits	= 8,
 	.val_bits	= 8,
@@ -378,6 +394,41 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
+static const struct regmap_irq axp809_regmap_irqs[] = {
+	INIT_REGMAP_IRQ(AXP809, ACIN_OVER_V,		0, 7),
+	INIT_REGMAP_IRQ(AXP809, ACIN_PLUGIN,		0, 6),
+	INIT_REGMAP_IRQ(AXP809, ACIN_REMOVAL,	        0, 5),
+	INIT_REGMAP_IRQ(AXP809, VBUS_OVER_V,		0, 4),
+	INIT_REGMAP_IRQ(AXP809, VBUS_PLUGIN,		0, 3),
+	INIT_REGMAP_IRQ(AXP809, VBUS_REMOVAL,	        0, 2),
+	INIT_REGMAP_IRQ(AXP809, VBUS_V_LOW,		0, 1),
+	INIT_REGMAP_IRQ(AXP809, BATT_PLUGIN,		1, 7),
+	INIT_REGMAP_IRQ(AXP809, BATT_REMOVAL,	        1, 6),
+	INIT_REGMAP_IRQ(AXP809, BATT_ENT_ACT_MODE,	1, 5),
+	INIT_REGMAP_IRQ(AXP809, BATT_EXIT_ACT_MODE,	1, 4),
+	INIT_REGMAP_IRQ(AXP809, CHARG,		        1, 3),
+	INIT_REGMAP_IRQ(AXP809, CHARG_DONE,		1, 2),
+	INIT_REGMAP_IRQ(AXP809, BATT_CHG_TEMP_HIGH,	2, 7),
+	INIT_REGMAP_IRQ(AXP809, BATT_CHG_TEMP_HIGH_END,	2, 6),
+	INIT_REGMAP_IRQ(AXP809, BATT_CHG_TEMP_LOW,	2, 5),
+	INIT_REGMAP_IRQ(AXP809, BATT_CHG_TEMP_LOW_END,	2, 4),
+	INIT_REGMAP_IRQ(AXP809, BATT_ACT_TEMP_HIGH,	2, 3),
+	INIT_REGMAP_IRQ(AXP809, BATT_ACT_TEMP_HIGH_END,	2, 2),
+	INIT_REGMAP_IRQ(AXP809, BATT_ACT_TEMP_LOW,	2, 1),
+	INIT_REGMAP_IRQ(AXP809, BATT_ACT_TEMP_LOW_END,	2, 0),
+	INIT_REGMAP_IRQ(AXP809, DIE_TEMP_HIGH,	        3, 7),
+	INIT_REGMAP_IRQ(AXP809, LOW_PWR_LVL1,	        3, 1),
+	INIT_REGMAP_IRQ(AXP809, LOW_PWR_LVL2,	        3, 0),
+	INIT_REGMAP_IRQ(AXP809, TIMER,		        4, 7),
+	INIT_REGMAP_IRQ(AXP809, PEK_RIS_EDGE,	        4, 6),
+	INIT_REGMAP_IRQ(AXP809, PEK_FAL_EDGE,	        4, 5),
+	INIT_REGMAP_IRQ(AXP809, PEK_SHORT,		4, 4),
+	INIT_REGMAP_IRQ(AXP809, PEK_LONG,		4, 3),
+	INIT_REGMAP_IRQ(AXP809, PEK_OVER_OFF,		4, 2),
+	INIT_REGMAP_IRQ(AXP809, GPIO1_INPUT,		4, 1),
+	INIT_REGMAP_IRQ(AXP809, GPIO0_INPUT,		4, 0),
+};
+
 static const struct regmap_irq_chip axp152_regmap_irq_chip = {
 	.name			= "axp152_irq_chip",
 	.status_base		= AXP152_IRQ1_STATE,
@@ -428,6 +479,18 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 };
 
+static const struct regmap_irq_chip axp809_regmap_irq_chip = {
+	.name			= "axp809",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+	.irqs			= axp809_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp809_regmap_irqs),
+	.num_regs		= 5,
+};
+
 static struct mfd_cell axp20x_cells[] = {
 	{
 		.name		= "axp20x-pek",
@@ -572,6 +635,16 @@ static struct mfd_cell axp288_cells[] = {
 	},
 };
 
+static struct mfd_cell axp809_cells[] = {
+	{
+		.name			= "axp20x-pek",
+		.num_resources		= ARRAY_SIZE(axp809_pek_resources),
+		.resources		= axp809_pek_resources,
+	}, {
+		.name			= "axp20x-regulator",
+	},
+};
+
 static struct axp20x_dev *axp20x_pm_power_off;
 static void axp20x_power_off(void)
 {
@@ -631,6 +704,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_cfg = &axp288_regmap_config;
 		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
 		break;
+	case AXP809_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
+		axp20x->cells = axp809_cells;
+		axp20x->regmap_cfg = &axp22x_regmap_config;
+		axp20x->regmap_irq_chip = &axp809_regmap_irq_chip;
+		break;
 	default:
 		dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
 		return -EINVAL;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index d82e7d51372b..0be4982f08fe 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -20,6 +20,7 @@ enum {
 	AXP221_ID,
 	AXP223_ID,
 	AXP288_ID,
+	AXP809_ID,
 	NR_AXP20X_VARIANTS,
 };
 
@@ -264,6 +265,29 @@ enum {
 	AXP22X_REG_ID_MAX,
 };
 
+enum {
+	AXP809_DCDC1 = 0,
+	AXP809_DCDC2,
+	AXP809_DCDC3,
+	AXP809_DCDC4,
+	AXP809_DCDC5,
+	AXP809_DC1SW,
+	AXP809_DC5LDO,
+	AXP809_ALDO1,
+	AXP809_ALDO2,
+	AXP809_ALDO3,
+	AXP809_ELDO1,
+	AXP809_ELDO2,
+	AXP809_ELDO3,
+	AXP809_DLDO1,
+	AXP809_DLDO2,
+	AXP809_RTC_LDO,
+	AXP809_LDO_IO0,
+	AXP809_LDO_IO1,
+	AXP809_SW,
+	AXP809_REG_ID_MAX,
+};
+
 /* IRQs */
 enum {
 	AXP152_IRQ_LDO0IN_CONNECT = 1,
@@ -390,6 +414,41 @@ enum axp288_irqs {
 	AXP288_IRQ_BC_USB_CHNG,
 };
 
+enum axp809_irqs {
+	AXP809_IRQ_ACIN_OVER_V = 1,
+	AXP809_IRQ_ACIN_PLUGIN,
+	AXP809_IRQ_ACIN_REMOVAL,
+	AXP809_IRQ_VBUS_OVER_V,
+	AXP809_IRQ_VBUS_PLUGIN,
+	AXP809_IRQ_VBUS_REMOVAL,
+	AXP809_IRQ_VBUS_V_LOW,
+	AXP809_IRQ_BATT_PLUGIN,
+	AXP809_IRQ_BATT_REMOVAL,
+	AXP809_IRQ_BATT_ENT_ACT_MODE,
+	AXP809_IRQ_BATT_EXIT_ACT_MODE,
+	AXP809_IRQ_CHARG,
+	AXP809_IRQ_CHARG_DONE,
+	AXP809_IRQ_BATT_CHG_TEMP_HIGH,
+	AXP809_IRQ_BATT_CHG_TEMP_HIGH_END,
+	AXP809_IRQ_BATT_CHG_TEMP_LOW,
+	AXP809_IRQ_BATT_CHG_TEMP_LOW_END,
+	AXP809_IRQ_BATT_ACT_TEMP_HIGH,
+	AXP809_IRQ_BATT_ACT_TEMP_HIGH_END,
+	AXP809_IRQ_BATT_ACT_TEMP_LOW,
+	AXP809_IRQ_BATT_ACT_TEMP_LOW_END,
+	AXP809_IRQ_DIE_TEMP_HIGH,
+	AXP809_IRQ_LOW_PWR_LVL1,
+	AXP809_IRQ_LOW_PWR_LVL2,
+	AXP809_IRQ_TIMER,
+	AXP809_IRQ_PEK_RIS_EDGE,
+	AXP809_IRQ_PEK_FAL_EDGE,
+	AXP809_IRQ_PEK_SHORT,
+	AXP809_IRQ_PEK_LONG,
+	AXP809_IRQ_PEK_OVER_OFF,
+	AXP809_IRQ_GPIO1_INPUT,
+	AXP809_IRQ_GPIO0_INPUT,
+};
+
 #define AXP288_TS_ADC_H		0x58
 #define AXP288_TS_ADC_L		0x59
 #define AXP288_GP_ADC_H		0x5a
-- 
2.7.0

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

* [PATCH 04/11] regulator: axp20x: Remove voltage readout support for switch regulators
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 03/11] mfd: axp20x: Add support " Chen-Yu Tsai
@ 2016-02-02 10:27 ` 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
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 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

Switch-type regulators, such as DC1SW on AXP22X, are a secondary output
from DCDC1. They are just an on/off switch, and the driver should not
try to read its voltage directly from the DCDC1 control registers.

Instead, the core will pass down the voltage from the regulator supply
chain.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/regulator/axp20x-regulator.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index e86d1fc2d80b..f31d238e85e8 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -78,8 +78,7 @@
 		.ops		= &axp20x_ops,					\
 	}
 
-#define AXP_DESC_SW(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
-		    _vmask, _ereg, _emask) 					\
+#define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)		\
 	[_family##_##_id] = {							\
 		.name		= #_id,						\
 		.supply_name	= (_supply),					\
@@ -87,12 +86,7 @@
 		.regulators_node = of_match_ptr("regulators"),			\
 		.type		= REGULATOR_VOLTAGE,				\
 		.id		= _family##_##_id,				\
-		.n_voltages	= (((_max) - (_min)) / (_step) + 1),		\
 		.owner		= THIS_MODULE,					\
-		.min_uV		= (_min) * 1000,				\
-		.uV_step	= (_step) * 1000,				\
-		.vsel_reg	= (_vreg),					\
-		.vsel_mask	= (_vmask),					\
 		.enable_reg	= (_ereg),					\
 		.enable_mask	= (_emask),					\
 		.ops		= &axp20x_ops_sw,				\
@@ -160,8 +154,6 @@ static struct regulator_ops axp20x_ops = {
 };
 
 static struct regulator_ops axp20x_ops_sw = {
-	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
-	.list_voltage		= regulator_list_voltage_linear,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.is_enabled		= regulator_is_enabled_regmap,
@@ -196,8 +188,8 @@ static const struct regulator_desc axp22x_regulators[] = {
 	AXP_DESC(AXP22X, 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(AXP22X, DC1SW, "dc1sw", NULL, 1600, 3400, 100,
-		    AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
+	AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
 	/* LDO regulator internally chained to DCDC5 */
 	AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
 		 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
-- 
2.7.0

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

* [PATCH 05/11] regulator: axp20x: Use linear voltage ranges for AXP20X LDO4
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 04/11] regulator: axp20x: Remove voltage readout support for switch regulators Chen-Yu Tsai
@ 2016-02-02 10:27 ` 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
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 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

AXP20X datasheet lists the possible voltage settings for LDO4, so
it was implemented using a voltage table. Upon closer examination,
the valid voltages can be mapped into 3 linear ranges.

Move AXP20X LDO4 to use linear ranges. The supporting code can be
reused with later AXP8xx PMICs, which have a number of regulators
that have 2 linear ranges.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/regulator/axp20x-regulator.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index f31d238e85e8..81f25383f2d5 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -106,8 +106,8 @@
 		.ops		= &axp20x_ops_fixed				\
 	}
 
-#define AXP_DESC_TABLE(_family, _id, _match, _supply, _table, _vreg, _vmask,	\
-		       _ereg, _emask)						\
+#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,	\
+			_vreg, _vmask, _ereg, _emask)				\
 	[_family##_##_id] = {							\
 		.name		= #_id,						\
 		.supply_name	= (_supply),					\
@@ -115,30 +115,25 @@
 		.regulators_node = of_match_ptr("regulators"),			\
 		.type		= REGULATOR_VOLTAGE,				\
 		.id		= _family##_##_id,				\
-		.n_voltages	= ARRAY_SIZE(_table),				\
+		.n_voltages	= (_n_voltages),				\
 		.owner		= THIS_MODULE,					\
 		.vsel_reg	= (_vreg),					\
 		.vsel_mask	= (_vmask),					\
 		.enable_reg	= (_ereg),					\
 		.enable_mask	= (_emask),					\
-		.volt_table	= (_table),					\
-		.ops		= &axp20x_ops_table,				\
+		.linear_ranges	= (_ranges),					\
+		.n_linear_ranges = ARRAY_SIZE(_ranges),				\
+		.ops		= &axp20x_ops_range,				\
 	}
 
-static const int axp20x_ldo4_data[] = { 1250000, 1300000, 1400000, 1500000, 1600000,
-					1700000, 1800000, 1900000, 2000000, 2500000,
-					2700000, 2800000, 3000000, 3100000, 3200000,
-					3300000 };
-
 static struct regulator_ops axp20x_ops_fixed = {
 	.list_voltage		= regulator_list_voltage_linear,
 };
 
-static struct regulator_ops axp20x_ops_table = {
+static struct regulator_ops axp20x_ops_range = {
 	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
 	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
-	.list_voltage		= regulator_list_voltage_table,
-	.map_voltage		= regulator_map_voltage_ascend,
+	.list_voltage		= regulator_list_voltage_linear_range,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.is_enabled		= regulator_is_enabled_regmap,
@@ -159,6 +154,12 @@ static struct regulator_ops axp20x_ops_sw = {
 	.is_enabled		= regulator_is_enabled_regmap,
 };
 
+static const struct regulator_linear_range axp20x_ldo4_ranges[] = {
+	REGULATOR_LINEAR_RANGE(1250000, 0x0, 0x0, 0),
+	REGULATOR_LINEAR_RANGE(1300000, 0x1, 0x8, 100000),
+	REGULATOR_LINEAR_RANGE(2500000, 0x9, 0xf, 100000),
+};
+
 static const struct regulator_desc axp20x_regulators[] = {
 	AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
 		 AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
@@ -169,8 +170,9 @@ static const struct regulator_desc axp20x_regulators[] = {
 		 AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
 	AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
 		 AXP20X_LDO3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
-	AXP_DESC_TABLE(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_data,
-		       AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL, 0x08),
+	AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_ranges,
+			16, AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL,
+			0x08),
 	AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
 		    AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
 		    AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
-- 
2.7.0

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

* [PATCH 06/11] regulator: axp20x: support AXP809 variant
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 05/11] regulator: axp20x: Use linear voltage ranges for AXP20X LDO4 Chen-Yu Tsai
@ 2016-02-02 10:27 ` 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
                   ` (4 subsequent siblings)
  10 siblings, 2 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

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>
---
 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 81f25383f2d5..c9f2084659e4 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.7.0

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

* [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (5 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 06/11] regulator: axp20x: support AXP809 variant Chen-Yu Tsai
@ 2016-02-02 10:27 ` Chen-Yu Tsai
  2016-02-02 12:17   ` 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
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 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

The AXP809 PMIC is used with the Allwinner A80 SoC, along with
an AXP806 PMIC as a slave.

This patch adds a dtsi file for all the common bindings and default
values unrelated to board design. Currently this is just listing all
the regulator nodes. The regulators are initialized based on their
device node names.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/axp809.dtsi | 138 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp809.dtsi

diff --git a/arch/arm/boot/dts/axp809.dtsi b/arch/arm/boot/dts/axp809.dtsi
new file mode 100644
index 000000000000..17769923f9c3
--- /dev/null
+++ b/arch/arm/boot/dts/axp809.dtsi
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2015 Chen-Yu Tsai
+ *
+ * Chen-Yu Tsai <wens@csie.org>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * AXP809 Integrated Power Management Chip
+ */
+
+&axp809 {
+	compatible = "x-powers,axp809";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		/* Default work frequency for buck regulators */
+		x-powers,dcdc-freq = <3000>;
+
+		reg_dcdc1: dcdc1 {
+			regulator-name = "dcdc1";
+		};
+
+		reg_dcdc2: dcdc2 {
+			regulator-name = "dcdc2";
+		};
+
+		reg_dcdc3: dcdc3 {
+			regulator-name = "dcdc3";
+		};
+
+		reg_dcdc4: dcdc4 {
+			regulator-name = "dcdc4";
+		};
+
+		reg_dcdc5: dcdc5 {
+			regulator-name = "dcdc5";
+		};
+
+		reg_dc1sw: dc1sw {
+			regulator-name = "dc1sw";
+		};
+
+		reg_dc5ldo: dc5ldo {
+			regulator-name = "dc5ldo";
+		};
+
+		reg_aldo1: aldo1 {
+			regulator-name = "aldo1";
+		};
+
+		reg_aldo2: aldo2 {
+			regulator-name = "aldo2";
+		};
+
+		reg_aldo3: aldo3 {
+			regulator-name = "aldo3";
+		};
+
+		reg_dldo1: dldo1 {
+			regulator-name = "dldo1";
+		};
+
+		reg_dldo2: dldo2 {
+			regulator-name = "dldo2";
+		};
+
+		reg_eldo1: eldo1 {
+			regulator-name = "eldo1";
+		};
+
+		reg_eldo2: eldo2 {
+			regulator-name = "eldo2";
+		};
+
+		reg_eldo3: eldo3 {
+			regulator-name = "eldo3";
+		};
+
+		reg_ldo_io0: ldo_io0 {
+			regulator-name = "ldo_io0";
+		};
+
+		reg_ldo_io1: ldo_io1 {
+			regulator-name = "ldo_io1";
+		};
+
+		reg_rtc_ldo: rtc_ldo {
+			/* RTC_LDO is a fixed, always-on regulator */
+			regulator-always-on;
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-name = "rtc_ldo";
+		};
+
+		reg_sw: sw {
+			regulator-name = "sw";
+		};
+	};
+};
-- 
2.7.0

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

* [PATCH 08/11] ARM: dts: sun9i: a80-optimus: Add AXP809 PMIC device node and regulators
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (6 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC Chen-Yu Tsai
@ 2016-02-02 10:27 ` Chen-Yu Tsai
  2016-02-02 10:27 ` [PATCH 09/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
                   ` (2 subsequent siblings)
  10 siblings, 0 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

The AXP809 PMIC is the primary PMIC. It provides various supply voltages
for the SoC and other peripherals. The PMIC's interrupt line is
connected to NMI pin of the SoC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80-optimus.dts | 121 +++++++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts
index 958160e40fd0..7f6bf6138966 100644
--- a/arch/arm/boot/dts/sun9i-a80-optimus.dts
+++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts
@@ -161,7 +161,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin_optimus>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 7 18 GPIO_ACTIVE_HIGH>; /* PH8 */
 	cd-inverted;
@@ -171,7 +171,7 @@
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
@@ -204,6 +204,123 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp809: pmic@3a3 {
+		reg = <0x3a3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
+#include "axp809.dtsi"
+
+&reg_aldo1 {
+	/* TODO: This should be handled by the USB PHY driver */
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc33-usbh";
+};
+
+&reg_aldo2 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vcc-pb-io-cam";
+};
+
+&reg_dc5ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpus-09-usbh";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-3v";
+};
+
+&reg_dcdc2 {
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-gpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpua";
+};
+
+&reg_dcdc4 {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-sys-usb0-hdmi";
+};
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1425000>;
+	regulator-max-microvolt = <1575000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_dldo1 {
+	/*
+	 * The WiFi chip supports a wide range (3.0 ~ 4.8V) of voltages,
+	 * and so does this regulator (3.0 ~ 4.2V), but Allwinner SDK
+	 * always sets it to 3.3V.
+	 */
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
+
+&reg_dldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pl";
+};
+
+&reg_eldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "vcc-dvdd-cam";
+};
+
+&reg_eldo2 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vcc-pe";
+};
+
+&reg_eldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pm-codec-io1";
+};
+
+&reg_ldo_io0 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pg";
+};
+
+&reg_ldo_io1 {
+	regulator-min-microvolt = <2500000>;
+	regulator-max-microvolt = <2500000>;
+	regulator-name = "vcc-pa-gmac-2v5";
+};
+
+&reg_rtc_ldo {
+	regulator-name = "vcc-rtc-vdd1v8-io";
 };
 
 &uart0 {
-- 
2.7.0

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

* [PATCH 09/11] ARM: dts: sun9i: cubieboard4: Add AXP809 PMIC device node and regulators
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (7 preceding siblings ...)
  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 ` 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 10:27 ` [PATCH 11/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
  10 siblings, 0 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

The AXP809 PMIC is the primary PMIC. It provides various supply voltages
for the SoC and other peripherals. The PMIC's interrupt line is connected
to NMI pin of the SoC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80-cubieboard4.dts | 121 +++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
index eb2ccd0a3bd5..4d56dc69713c 100644
--- a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
+++ b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
@@ -98,7 +98,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin_cubieboard4>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 7 18 GPIO_ACTIVE_HIGH>; /* PH18 */
 	cd-inverted;
@@ -108,7 +108,7 @@
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
@@ -126,6 +126,123 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp809: pmic@3a3 {
+		reg = <0x3a3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+};
+
+#include "axp809.dtsi"
+
+&reg_aldo1 {
+	/* TODO: This should be handled by the USB PHY driver */
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc33-usbh";
+};
+
+&reg_aldo2 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vcc-pb-io-cam";
+};
+
+&reg_dc5ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpus-09-usbh";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-3v";
+};
+
+&reg_dcdc2 {
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-gpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-cpua";
+};
+
+&reg_dcdc4 {
+	regulator-always-on;
+	regulator-min-microvolt = <800000>;
+	regulator-max-microvolt = <1100000>;
+	regulator-name = "vdd-sys-usb0-hdmi";
+};
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1425000>;
+	regulator-max-microvolt = <1575000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_dldo1 {
+	/*
+	 * The WiFi chip supports a wide range (3.0 ~ 4.8V) of voltages,
+	 * and so does this regulator (3.0 ~ 4.2V), but Allwinner SDK
+	 * always sets it to 3.3V.
+	 */
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
+
+&reg_dldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pl";
+};
+
+&reg_eldo1 {
+	regulator-min-microvolt = <1200000>;
+	regulator-max-microvolt = <1200000>;
+	regulator-name = "vcc-dvdd-cam";
+};
+
+&reg_eldo2 {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-name = "vcc-pe";
+};
+
+&reg_eldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pm-codec-io1";
+};
+
+&reg_ldo_io0 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-pg";
+};
+
+&reg_ldo_io1 {
+	regulator-min-microvolt = <2500000>;
+	regulator-max-microvolt = <2500000>;
+	regulator-name = "vcc-pa-gmac-2v5";
+};
+
+&reg_rtc_ldo {
+	regulator-name = "vcc-rtc-vdd1v8-io";
 };
 
 &uart0 {
-- 
2.7.0

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

* [PATCH 10/11] ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (8 preceding siblings ...)
  2016-02-02 10:27 ` [PATCH 09/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
@ 2016-02-02 10:27 ` Chen-Yu Tsai
  2016-02-02 16:21   ` Maxime Ripard
  2016-02-02 10:27 ` [PATCH 11/11] ARM: dts: sun9i: cubieboard4: " Chen-Yu Tsai
  10 siblings, 1 reply; 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

These 3 regulators are provided in sunxi-common-regulators.dtsi.
3.0V/3.3V and 5.0V are commonly used voltages in Allwinner devices.
These dummy regulators provide a stand-in when bindings that require
one, but the real regulator is not supported yet.

Since these are no longer needed, we can disable them.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80-optimus.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun9i-a80-optimus.dts b/arch/arm/boot/dts/sun9i-a80-optimus.dts
index 7f6bf6138966..b447360d93e8 100644
--- a/arch/arm/boot/dts/sun9i-a80-optimus.dts
+++ b/arch/arm/boot/dts/sun9i-a80-optimus.dts
@@ -323,6 +323,18 @@
 	regulator-name = "vcc-rtc-vdd1v8-io";
 };
 
+&reg_vcc3v0 {
+	status = "disabled";
+};
+
+&reg_vcc3v3 {
+	status = "disabled";
+};
+
+&reg_vcc5v0 {
+	status = "disabled";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.7.0

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

* [PATCH 11/11] ARM: dts: sun9i: cubieboard4: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0
  2016-02-02 10:27 [PATCH 00/11] mfd: axp20x: Add support for AXP809 PMIC Chen-Yu Tsai
                   ` (9 preceding siblings ...)
  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 10:27 ` Chen-Yu Tsai
  10 siblings, 0 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

These 3 regulators are provided in sunxi-common-regulators.dtsi.
3.0V/3.3V and 5.0V are commonly used voltages in Allwinner devices.
These dummy regulators provide a stand-in when bindings that require
one, but the real regulator is not supported yet.

Since these are no longer needed, we can disable them.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun9i-a80-cubieboard4.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
index 4d56dc69713c..98d9dc2d5259 100644
--- a/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
+++ b/arch/arm/boot/dts/sun9i-a80-cubieboard4.dts
@@ -245,6 +245,18 @@
 	regulator-name = "vcc-rtc-vdd1v8-io";
 };
 
+&reg_vcc3v0 {
+	status = "disabled";
+};
+
+&reg_vcc3v3 {
+	status = "disabled";
+};
+
+&reg_vcc5v0 {
+	status = "disabled";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
-- 
2.7.0

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  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
  0 siblings, 1 reply; 37+ messages in thread
From: Mark Brown @ 2016-02-02 12:17 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

On Tue, Feb 02, 2016 at 06:27:40PM +0800, Chen-Yu Tsai wrote:

> +		reg_dcdc1: dcdc1 {
> +			regulator-name = "dcdc1";
> +		};

Why is this generic DTS include specifying regulator names?

> +		reg_rtc_ldo: rtc_ldo {
> +			/* RTC_LDO is a fixed, always-on regulator */
> +			regulator-always-on;
> +			regulator-min-microvolt = <1800000>;
> +			regulator-max-microvolt = <1800000>;

If the regulator itself is limited in this way there is no need to
specify this in the DTS.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  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
  1 sibling, 0 replies; 37+ messages in thread
From: Maxime Ripard @ 2016-02-02 13:27 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi, Carlo Caione,
	Ramakrishna Pallala, Todd Brandt, Jacob Pan

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Tue, Feb 02, 2016 at 06:27:34PM +0800, Chen-Yu Tsai wrote:
> Add an entry for X-Powers AXP family PMIC drivers and list myself
> as maintainer.
> 
> Cc: Carlo Caione <carlo@caione.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
> Cc: Todd Brandt <todd.e.brandt@linux.intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 10/11] ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0
  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
  0 siblings, 1 reply; 37+ messages in thread
From: Maxime Ripard @ 2016-02-02 16:21 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

Hi,

On Tue, Feb 02, 2016 at 06:27:43PM +0800, Chen-Yu Tsai wrote:
> These 3 regulators are provided in sunxi-common-regulators.dtsi.
> 3.0V/3.3V and 5.0V are commonly used voltages in Allwinner devices.
> These dummy regulators provide a stand-in when bindings that require
> one, but the real regulator is not supported yet.
> 
> Since these are no longer needed, we can disable them.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Why not remove the include entirely then?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 10/11] ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0
  2016-02-02 16:21   ` Maxime Ripard
@ 2016-02-02 16:41     ` Chen-Yu Tsai
  2016-02-04 16:44       ` Maxime Ripard
  0 siblings, 1 reply; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-02 16:41 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

On Wed, Feb 3, 2016 at 12:21 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Tue, Feb 02, 2016 at 06:27:43PM +0800, Chen-Yu Tsai wrote:
>> These 3 regulators are provided in sunxi-common-regulators.dtsi.
>> 3.0V/3.3V and 5.0V are commonly used voltages in Allwinner devices.
>> These dummy regulators provide a stand-in when bindings that require
>> one, but the real regulator is not supported yet.
>>
>> Since these are no longer needed, we can disable them.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>
> Why not remove the include entirely then?

reg_vbus* are still used. Or should we move them as well?

ChenYu

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

* Re: [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC
  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
  0 siblings, 1 reply; 37+ messages in thread
From: Rob Herring @ 2016-02-02 22:43 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

On Tue, Feb 02, 2016 at 06:27:35PM +0800, Chen-Yu Tsai wrote:
> This patch adds the basic and regulator bindings for the X-Powers AXP809
> PMIC.
> 
> Also update the DC-DC converter operating frequency for AXP22X/AXP80X.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt | 31 ++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [linux-sunxi] [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  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   ` Julian Calaby
  2016-02-03  1:28     ` Joe Perches
  1 sibling, 1 reply; 37+ messages in thread
From: Julian Calaby @ 2016-02-03  0:19 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, Mailing List, Arm, linux-kernel, linux-sunxi,
	Carlo Caione, Ramakrishna Pallala, Todd Brandt, Jacob Pan

Hi Chen-Yu,

On Tue, Feb 2, 2016 at 9:27 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> Add an entry for X-Powers AXP family PMIC drivers and list myself
> as maintainer.
>
> Cc: Carlo Caione <carlo@caione.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
> Cc: Todd Brandt <todd.e.brandt@linux.intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  MAINTAINERS | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f678c37107f5..7ea4e54f566a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11941,6 +11941,12 @@ F:     include/linux/workqueue.h
>  F:     kernel/workqueue.c
>  F:     Documentation/workqueue.txt
>
> +X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
> +M:     Chen-Yu Tsai <wens@csie.org>
> +L:     linux-kernel@vger.kernel.org
> +S:     Maintained
> +N:     axp[128]

Should you list the files maintained and this list also?

> +
>  X.25 NETWORK LAYER
>  M:     Andrew Hendry <andrew.hendry@gmail.com>
>  L:     linux-x25@vger.kernel.org

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [linux-sunxi] [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  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
  0 siblings, 2 replies; 37+ messages in thread
From: Joe Perches @ 2016-02-03  1:28 UTC (permalink / raw)
  To: Julian Calaby, Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, Mailing List, Arm, linux-kernel, linux-sunxi,
	Carlo Caione, Ramakrishna Pallala, Todd Brandt, Jacob Pan

On Wed, 2016-02-03 at 11:19 +1100, Julian Calaby wrote:
> On Tue, Feb 2, 2016 at 9:27 PM, Chen-Yu Tsai <wens@csie.org> wrote:
> > Add an entry for X-Powers AXP family PMIC drivers and list myself
> > as maintainer.
[]
> > diff --git a/MAINTAINERS b/MAINTAINERS
[]
> > @@ -11941,6 +11941,12 @@ F:     include/linux/workqueue.h
> >  F:     kernel/workqueue.c
> >  F:     Documentation/workqueue.txt
> > 
> > +X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
> > +M:     Chen-Yu Tsai <wens@csie.org>
> > +L:     linux-kernel@vger.kernel.org
> > +S:     Maintained
> > +N:     axp[128]
> 
> Should you list the files maintained and this list also?

This "N:" pattern is kind of a wildcard.

The difference between F: and N: is that git history
is also used by default for files that match.

There are no files in -next today that match "*axp8*"
Dunno if this patchset added any.

This matches:

    $ git ls-files | grep "axp[128]"
    Documentation/devicetree/bindings/mfd/axp20x.txt
    Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
    arch/arm/boot/dts/axp152.dtsi
    arch/arm/boot/dts/axp209.dtsi
    arch/arm/boot/dts/axp22x.dtsi
    drivers/extcon/extcon-axp288.c
    drivers/iio/adc/axp288_adc.c
    drivers/input/misc/axp20x-pek.c
    drivers/mfd/axp20x.c
    drivers/power/axp20x_usb_power.c
    drivers/power/axp288_charger.c
    drivers/power/axp288_fuel_gauge.c
    drivers/regulator/axp20x-regulator.c
    include/linux/mfd/axp20x.h

Are all these files appropriate?

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

* Re: [linux-sunxi] [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  2016-02-03  1:28     ` Joe Perches
@ 2016-02-03  1:30       ` Julian Calaby
  2016-02-03  6:49       ` Chen-Yu Tsai
  1 sibling, 0 replies; 37+ messages in thread
From: Julian Calaby @ 2016-02-03  1:30 UTC (permalink / raw)
  To: Joe Perches
  Cc: Chen-Yu Tsai, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Maxime Ripard, devicetree, Mailing List, Arm, linux-kernel,
	linux-sunxi, Carlo Caione, Ramakrishna Pallala, Todd Brandt,
	Jacob Pan

Hi Joe,

On Wed, Feb 3, 2016 at 12:28 PM, Joe Perches <joe@perches.com> wrote:
> On Wed, 2016-02-03 at 11:19 +1100, Julian Calaby wrote:
>> On Tue, Feb 2, 2016 at 9:27 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>> > Add an entry for X-Powers AXP family PMIC drivers and list myself
>> > as maintainer.
> []
>> > diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> > @@ -11941,6 +11941,12 @@ F:     include/linux/workqueue.h
>> >  F:     kernel/workqueue.c
>> >  F:     Documentation/workqueue.txt
>> >
>> > +X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
>> > +M:     Chen-Yu Tsai <wens@csie.org>
>> > +L:     linux-kernel@vger.kernel.org
>> > +S:     Maintained
>> > +N:     axp[128]
>>
>> Should you list the files maintained and this list also?
>
> This "N:" pattern is kind of a wildcard.
>
> The difference between F: and N: is that git history
> is also used by default for files that match.
>
> There are no files in -next today that match "*axp8*"
> Dunno if this patchset added any.
>
> This matches:
>
>     $ git ls-files | grep "axp[128]"
>     Documentation/devicetree/bindings/mfd/axp20x.txt
>     Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
>     arch/arm/boot/dts/axp152.dtsi
>     arch/arm/boot/dts/axp209.dtsi
>     arch/arm/boot/dts/axp22x.dtsi
>     drivers/extcon/extcon-axp288.c
>     drivers/iio/adc/axp288_adc.c
>     drivers/input/misc/axp20x-pek.c
>     drivers/mfd/axp20x.c
>     drivers/power/axp20x_usb_power.c
>     drivers/power/axp288_charger.c
>     drivers/power/axp288_fuel_gauge.c
>     drivers/regulator/axp20x-regulator.c
>     include/linux/mfd/axp20x.h
>
> Are all these files appropriate?
>

I didn't know about the "N:" tag, and consequently I retract my comment.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [linux-sunxi] [PATCH 01/11] MAINTAINERS: Add entry for X-Powers AXP family PMIC drivers
  2016-02-03  1:28     ` Joe Perches
  2016-02-03  1:30       ` Julian Calaby
@ 2016-02-03  6:49       ` Chen-Yu Tsai
  1 sibling, 0 replies; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-03  6:49 UTC (permalink / raw)
  To: Joe Perches
  Cc: Julian Calaby, Chen-Yu Tsai, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Maxime Ripard, devicetree, Mailing List, Arm,
	linux-kernel, linux-sunxi, Carlo Caione, Ramakrishna Pallala,
	Todd Brandt, Jacob Pan

On Wed, Feb 3, 2016 at 9:28 AM, Joe Perches <joe@perches.com> wrote:
> On Wed, 2016-02-03 at 11:19 +1100, Julian Calaby wrote:
>> On Tue, Feb 2, 2016 at 9:27 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>> > Add an entry for X-Powers AXP family PMIC drivers and list myself
>> > as maintainer.
> []
>> > diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> > @@ -11941,6 +11941,12 @@ F:     include/linux/workqueue.h
>> >  F:     kernel/workqueue.c
>> >  F:     Documentation/workqueue.txt
>> >
>> > +X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS
>> > +M:     Chen-Yu Tsai <wens@csie.org>
>> > +L:     linux-kernel@vger.kernel.org
>> > +S:     Maintained
>> > +N:     axp[128]
>>
>> Should you list the files maintained and this list also?
>
> This "N:" pattern is kind of a wildcard.
>
> The difference between F: and N: is that git history
> is also used by default for files that match.
>
> There are no files in -next today that match "*axp8*"
> Dunno if this patchset added any.

This set adds a "axp809.dtsi". A subsequent set will add "axp806.dtsi".

> This matches:
>
>     $ git ls-files | grep "axp[128]"
>     Documentation/devicetree/bindings/mfd/axp20x.txt
>     Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
>     arch/arm/boot/dts/axp152.dtsi
>     arch/arm/boot/dts/axp209.dtsi
>     arch/arm/boot/dts/axp22x.dtsi
>     drivers/extcon/extcon-axp288.c
>     drivers/iio/adc/axp288_adc.c
>     drivers/input/misc/axp20x-pek.c
>     drivers/mfd/axp20x.c
>     drivers/power/axp20x_usb_power.c
>     drivers/power/axp288_charger.c
>     drivers/power/axp288_fuel_gauge.c
>     drivers/regulator/axp20x-regulator.c
>     include/linux/mfd/axp20x.h
>
> Are all these files appropriate?
>

Yes.

ChenYu

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

* Re: [PATCH 06/11] regulator: axp20x: support AXP809 variant
  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
  1 sibling, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-02-03 17:15 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

On Tue, Feb 02, 2016 at 06:27:39PM +0800, Chen-Yu Tsai wrote:
> 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.

This looks OK to me.  Will there be a branch with the new IDs in it that
I can pull in to apply it?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Applied "regulator: axp20x: Use linear voltage ranges for AXP20X LDO4" to the regulator tree
  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   ` Mark Brown
  0 siblings, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-02-03 18:11 UTC (permalink / raw)
  To: Chen-Yu Tsai, Mark Brown; +Cc: linux-kernel

The patch

   regulator: axp20x: Use linear voltage ranges for AXP20X LDO4

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 13d57e64352a5d3457d7782bc2f8b576e12b05f3 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Tue, 2 Feb 2016 18:27:38 +0800
Subject: [PATCH] regulator: axp20x: Use linear voltage ranges for AXP20X LDO4

AXP20X datasheet lists the possible voltage settings for LDO4, so
it was implemented using a voltage table. Upon closer examination,
the valid voltages can be mapped into 3 linear ranges.

Move AXP20X LDO4 to use linear ranges. The supporting code can be
reused with later AXP8xx PMICs, which have a number of regulators
that have 2 linear ranges.

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

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index fafaaa8eb8b3..7d29893f833c 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -106,8 +106,8 @@
 		.ops		= &axp20x_ops_fixed				\
 	}
 
-#define AXP_DESC_TABLE(_family, _id, _match, _supply, _table, _vreg, _vmask,	\
-		       _ereg, _emask)						\
+#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,	\
+			_vreg, _vmask, _ereg, _emask)				\
 	[_family##_##_id] = {							\
 		.name		= #_id,						\
 		.supply_name	= (_supply),					\
@@ -115,30 +115,25 @@
 		.regulators_node = of_match_ptr("regulators"),			\
 		.type		= REGULATOR_VOLTAGE,				\
 		.id		= _family##_##_id,				\
-		.n_voltages	= ARRAY_SIZE(_table),				\
+		.n_voltages	= (_n_voltages),				\
 		.owner		= THIS_MODULE,					\
 		.vsel_reg	= (_vreg),					\
 		.vsel_mask	= (_vmask),					\
 		.enable_reg	= (_ereg),					\
 		.enable_mask	= (_emask),					\
-		.volt_table	= (_table),					\
-		.ops		= &axp20x_ops_table,				\
+		.linear_ranges	= (_ranges),					\
+		.n_linear_ranges = ARRAY_SIZE(_ranges),				\
+		.ops		= &axp20x_ops_range,				\
 	}
 
-static const int axp20x_ldo4_data[] = { 1250000, 1300000, 1400000, 1500000, 1600000,
-					1700000, 1800000, 1900000, 2000000, 2500000,
-					2700000, 2800000, 3000000, 3100000, 3200000,
-					3300000 };
-
 static struct regulator_ops axp20x_ops_fixed = {
 	.list_voltage		= regulator_list_voltage_linear,
 };
 
-static struct regulator_ops axp20x_ops_table = {
+static struct regulator_ops axp20x_ops_range = {
 	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
 	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
-	.list_voltage		= regulator_list_voltage_table,
-	.map_voltage		= regulator_map_voltage_ascend,
+	.list_voltage		= regulator_list_voltage_linear_range,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.is_enabled		= regulator_is_enabled_regmap,
@@ -159,6 +154,12 @@ static struct regulator_ops axp20x_ops_sw = {
 	.is_enabled		= regulator_is_enabled_regmap,
 };
 
+static const struct regulator_linear_range axp20x_ldo4_ranges[] = {
+	REGULATOR_LINEAR_RANGE(1250000, 0x0, 0x0, 0),
+	REGULATOR_LINEAR_RANGE(1300000, 0x1, 0x8, 100000),
+	REGULATOR_LINEAR_RANGE(2500000, 0x9, 0xf, 100000),
+};
+
 static const struct regulator_desc axp20x_regulators[] = {
 	AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
 		 AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
@@ -169,8 +170,9 @@ static const struct regulator_desc axp20x_regulators[] = {
 		 AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
 	AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
 		 AXP20X_LDO3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
-	AXP_DESC_TABLE(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_data,
-		       AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL, 0x08),
+	AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_ranges,
+			16, AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL,
+			0x08),
 	AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
 		    AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
 		    AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
-- 
2.7.0.rc3

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

* Applied "regulator: axp20x: Remove voltage readout support for switch regulators" to the regulator tree
  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   ` Mark Brown
  0 siblings, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-02-03 18:11 UTC (permalink / raw)
  To: Chen-Yu Tsai, Mark Brown; +Cc: linux-kernel

The patch

   regulator: axp20x: Remove voltage readout support for switch regulators

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 94c39041ae0c0e83d10bc1a56974a2eefd9386c8 Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Tue, 2 Feb 2016 18:27:37 +0800
Subject: [PATCH] regulator: axp20x: Remove voltage readout support for switch
 regulators

Switch-type regulators, such as DC1SW on AXP22X, are a secondary output
from DCDC1. They are just an on/off switch, and the driver should not
try to read its voltage directly from the DCDC1 control registers.

Instead, the core will pass down the voltage from the regulator supply
chain.

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

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index f2e1a39ce0f3..fafaaa8eb8b3 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -78,8 +78,7 @@
 		.ops		= &axp20x_ops,					\
 	}
 
-#define AXP_DESC_SW(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
-		    _vmask, _ereg, _emask) 					\
+#define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)		\
 	[_family##_##_id] = {							\
 		.name		= #_id,						\
 		.supply_name	= (_supply),					\
@@ -87,12 +86,7 @@
 		.regulators_node = of_match_ptr("regulators"),			\
 		.type		= REGULATOR_VOLTAGE,				\
 		.id		= _family##_##_id,				\
-		.n_voltages	= (((_max) - (_min)) / (_step) + 1),		\
 		.owner		= THIS_MODULE,					\
-		.min_uV		= (_min) * 1000,				\
-		.uV_step	= (_step) * 1000,				\
-		.vsel_reg	= (_vreg),					\
-		.vsel_mask	= (_vmask),					\
 		.enable_reg	= (_ereg),					\
 		.enable_mask	= (_emask),					\
 		.ops		= &axp20x_ops_sw,				\
@@ -160,8 +154,6 @@ static struct regulator_ops axp20x_ops = {
 };
 
 static struct regulator_ops axp20x_ops_sw = {
-	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
-	.list_voltage		= regulator_list_voltage_linear,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.is_enabled		= regulator_is_enabled_regmap,
@@ -196,8 +188,8 @@ static const struct regulator_desc axp22x_regulators[] = {
 	AXP_DESC(AXP22X, 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(AXP22X, DC1SW, "dc1sw", NULL, 1600, 3400, 100,
-		    AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
+	AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
+		    BIT(7)),
 	/* LDO regulator internally chained to DCDC5 */
 	AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
 		 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
-- 
2.7.0.rc3

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

* Re: [PATCH 10/11] ARM: dts: sun9i: a80-optimus: Disable dummy regulators vcc3v0, vcc3v3, vcc5v0
  2016-02-02 16:41     ` Chen-Yu Tsai
@ 2016-02-04 16:44       ` Maxime Ripard
  0 siblings, 0 replies; 37+ messages in thread
From: Maxime Ripard @ 2016-02-04 16:44 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

On Wed, Feb 03, 2016 at 12:41:37AM +0800, Chen-Yu Tsai wrote:
> On Wed, Feb 3, 2016 at 12:21 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Hi,
> >
> > On Tue, Feb 02, 2016 at 06:27:43PM +0800, Chen-Yu Tsai wrote:
> >> These 3 regulators are provided in sunxi-common-regulators.dtsi.
> >> 3.0V/3.3V and 5.0V are commonly used voltages in Allwinner devices.
> >> These dummy regulators provide a stand-in when bindings that require
> >> one, but the real regulator is not supported yet.
> >>
> >> Since these are no longer needed, we can disable them.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >
> > Why not remove the include entirely then?
> 
> reg_vbus* are still used. Or should we move them as well?

I think so yeah. It's totally fine to disable per-boards regulators.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-02 12:17   ` Mark Brown
@ 2016-02-06 12:42     ` Chen-Yu Tsai
  2016-02-08 14:53       ` Mark Brown
  0 siblings, 1 reply; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-06 12:42 UTC (permalink / raw)
  To: Mark Brown
  Cc: Chen-Yu Tsai, Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

On Tue, Feb 2, 2016 at 8:17 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Feb 02, 2016 at 06:27:40PM +0800, Chen-Yu Tsai wrote:
>
>> +             reg_dcdc1: dcdc1 {
>> +                     regulator-name = "dcdc1";
>> +             };
>
> Why is this generic DTS include specifying regulator names?

My intent is to provide better looking names by default.
I just realized I could do this in the driver by replacing
a few fields.

But I still might need to do this for the AXP806, which
is a slave PMIC also used with A80 SoCs. The names overlap
with the AXP809. Allwinner gets around this by adding a
"s_" prefix to them. I suppose that works too.

Mark, may I assume you are OK with this DTS include listing
the regulators, even if their sections are empty?

>
>> +             reg_rtc_ldo: rtc_ldo {
>> +                     /* RTC_LDO is a fixed, always-on regulator */
>> +                     regulator-always-on;
>> +                     regulator-min-microvolt = <1800000>;
>> +                     regulator-max-microvolt = <1800000>;
>
> If the regulator itself is limited in this way there is no need to
> specify this in the DTS.

Will remove.

Thanks
ChenYu

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-06 12:42     ` Chen-Yu Tsai
@ 2016-02-08 14:53       ` Mark Brown
  2016-02-08 14:56         ` Chen-Yu Tsai
  0 siblings, 1 reply; 37+ messages in thread
From: Mark Brown @ 2016-02-08 14:53 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

On Sat, Feb 06, 2016 at 08:42:24PM +0800, Chen-Yu Tsai wrote:

> Mark, may I assume you are OK with this DTS include listing
> the regulators, even if their sections are empty?

If it has no content why have it?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-08 14:53       ` Mark Brown
@ 2016-02-08 14:56         ` Chen-Yu Tsai
  2016-02-08 16:22           ` Mark Brown
  0 siblings, 1 reply; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-08 14:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: Chen-Yu Tsai, Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

On Mon, Feb 8, 2016 at 10:53 PM, Mark Brown <broonie@kernel.org> wrote:
> On Sat, Feb 06, 2016 at 08:42:24PM +0800, Chen-Yu Tsai wrote:
>
>> Mark, may I assume you are OK with this DTS include listing
>> the regulators, even if their sections are empty?
>
> If it has no content why have it?

I'd like the regulator core to disable any unused ones. The core
considers regulators that don't have nodes as not having constraints,
and won't touch them.

Any other ways to do this? Or am I going about this the wrong way?

Thanks
ChenYu

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-08 14:56         ` Chen-Yu Tsai
@ 2016-02-08 16:22           ` Mark Brown
  2016-02-09  5:41             ` Chen-Yu Tsai
  0 siblings, 1 reply; 37+ messages in thread
From: Mark Brown @ 2016-02-08 16:22 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

On Mon, Feb 08, 2016 at 10:56:05PM +0800, Chen-Yu Tsai wrote:
> On Mon, Feb 8, 2016 at 10:53 PM, Mark Brown <broonie@kernel.org> wrote:
> > On Sat, Feb 06, 2016 at 08:42:24PM +0800, Chen-Yu Tsai wrote:

> >> Mark, may I assume you are OK with this DTS include listing
> >> the regulators, even if their sections are empty?

> > If it has no content why have it?

> I'd like the regulator core to disable any unused ones. The core
> considers regulators that don't have nodes as not having constraints,
> and won't touch them.

> Any other ways to do this? Or am I going about this the wrong way?

The whole point with constraints is that they describe what is safe on a
given board.  This includes powering off unused regulators - it should
be something that the system integrator configures, not something that
they get as default.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-08 16:22           ` Mark Brown
@ 2016-02-09  5:41             ` Chen-Yu Tsai
  2016-02-09 11:32               ` Mark Brown
  0 siblings, 1 reply; 37+ messages in thread
From: Chen-Yu Tsai @ 2016-02-09  5:41 UTC (permalink / raw)
  To: Mark Brown
  Cc: Chen-Yu Tsai, Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

On Tue, Feb 9, 2016 at 12:22 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Feb 08, 2016 at 10:56:05PM +0800, Chen-Yu Tsai wrote:
>> On Mon, Feb 8, 2016 at 10:53 PM, Mark Brown <broonie@kernel.org> wrote:
>> > On Sat, Feb 06, 2016 at 08:42:24PM +0800, Chen-Yu Tsai wrote:
>
>> >> Mark, may I assume you are OK with this DTS include listing
>> >> the regulators, even if their sections are empty?
>
>> > If it has no content why have it?
>
>> I'd like the regulator core to disable any unused ones. The core
>> considers regulators that don't have nodes as not having constraints,
>> and won't touch them.
>
>> Any other ways to do this? Or am I going about this the wrong way?
>
> The whole point with constraints is that they describe what is safe on a
> given board.  This includes powering off unused regulators - it should
> be something that the system integrator configures, not something that
> they get as default.

OK. So how should one describe a regulator as unused? Just leave it out
since it's not wired to anything? Or have an empty node at the board
level? One of the regulators involved on my board is by (hardware)
default on.

Thanks
ChenYu

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

* Re: [PATCH 02/11] mfd: axp20x: Add bindings for AXP809 PMIC
  2016-02-02 22:43   ` Rob Herring
@ 2016-02-09 10:18     ` Lee Jones
  0 siblings, 0 replies; 37+ messages in thread
From: Lee Jones @ 2016-02-09 10:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: Chen-Yu Tsai, Liam Girdwood, Mark Brown, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Maxime Ripard,
	devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

On Tue, 02 Feb 2016, Rob Herring wrote:

> On Tue, Feb 02, 2016 at 06:27:35PM +0800, Chen-Yu Tsai wrote:
> > This patch adds the basic and regulator bindings for the X-Powers AXP809
> > PMIC.
> > 
> > Also update the DC-DC converter operating frequency for AXP22X/AXP80X.
> > 
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> > ---
> >  Documentation/devicetree/bindings/mfd/axp20x.txt | 31 ++++++++++++++++++++++--
> >  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> Acked-by: Rob Herring <robh@kernel.org>

No idea what's going on here.  Somehow I must have been in the
Reply-To, but never actually sent the patches initially.  So I have
people's replies, but not the original submission.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 07/11] ARM: dts: sunxi: Add dtsi file for AXP809 PMIC
  2016-02-09  5:41             ` Chen-Yu Tsai
@ 2016-02-09 11:32               ` Mark Brown
  0 siblings, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-02-09 11:32 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Liam Girdwood, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Maxime Ripard, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

On Tue, Feb 09, 2016 at 01:41:37PM +0800, Chen-Yu Tsai wrote:
> On Tue, Feb 9, 2016 at 12:22 AM, Mark Brown <broonie@kernel.org> wrote:

> > The whole point with constraints is that they describe what is safe on a
> > given board.  This includes powering off unused regulators - it should
> > be something that the system integrator configures, not something that
> > they get as default.

> OK. So how should one describe a regulator as unused? Just leave it out
> since it's not wired to anything? Or have an empty node at the board
> level? One of the regulators involved on my board is by (hardware)
> default on.

Like I say do it at the board level, you know it's not connected on that
board but another board may use it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Applied "regulator: axp20x: support AXP809 variant" to the regulator tree
  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   ` Mark Brown
  1 sibling, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-05-31 17:46 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Mark Brown, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi

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 a51f9f4622a34eb19b5658c08b083345d763657b Mon Sep 17 00:00:00 2001
From: Chen-Yu Tsai <wens@csie.org>
Date: Wed, 1 Jun 2016 00:23:19 +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 514a5e8fdbab..728be64e817a 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -230,6 +230,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);
@@ -245,6 +300,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;
@@ -324,6 +380,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;
 
@@ -352,8 +409,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:
@@ -366,6 +423,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);
@@ -388,22 +449,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);
@@ -426,17 +487,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.1

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

* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree
  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 19:09 ` kbuild test robot
  1 sibling, 0 replies; 37+ messages in thread
From: kbuild test robot @ 2016-03-29 19:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: kbuild-all, Chen-Yu Tsai, Mark Brown, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 13383 bytes --]

Hi Mark,

[auto build test WARNING on regulator/for-next]
[also build test WARNING on v4.6-rc1 next-20160329]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Mark-Brown/Applied-regulator-axp20x-support-AXP809-variant-to-the-regulator-tree/20160330-005751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: x86_64-randconfig-n0-03300206 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

      ^
   drivers/regulator/axp20x-regulator.c:272:14: error: 'AXP809_LDO_IO0' undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:272:14: error: array index in initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:272:14: note: (near initialization for 'axp809_regulators')
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:275:14: error: 'AXP809_LDO_IO1' undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:275:14: error: array index in initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:275:14: note: (near initialization for 'axp809_regulators')
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:278:17: error: 'AXP809_RTC_LDO' undeclared here (not in a function)
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
                    ^
   drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:278:17: error: array index in initializer not of integer type
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
                    ^
   drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:278:17: note: (near initialization for 'axp809_regulators')
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
                    ^
   drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:279:14: error: 'AXP809_SW' undeclared here (not in a function)
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:279:14: error: array index in initializer not of integer type
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:279:14: note: (near initialization for 'axp809_regulators')
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_freq':
   drivers/regulator/axp20x-regulator.c:297:7: error: 'AXP809_ID' undeclared (first use in this function)
     case AXP809_ID:
          ^
   drivers/regulator/axp20x-regulator.c:297:7: note: each undeclared identifier is reported only once for each function it appears in
   drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_workmode':
   drivers/regulator/axp20x-regulator.c:377:7: error: 'AXP809_ID' undeclared (first use in this function)
     case AXP809_ID:
          ^
   drivers/regulator/axp20x-regulator.c: In function 'axp20x_regulator_probe':
   drivers/regulator/axp20x-regulator.c:420:7: error: 'AXP809_ID' undeclared (first use in this function)
     case AXP809_ID:
          ^
   drivers/regulator/axp20x-regulator.c:422:17: error: 'AXP809_REG_ID_MAX' undeclared (first use in this function)
      nregulators = AXP809_REG_ID_MAX;
                    ^
   drivers/regulator/axp20x-regulator.c:422:15: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
      nregulators = AXP809_REG_ID_MAX;
                  ^
   In file included from include/linux/err.h:4:0,
                    from drivers/regulator/axp20x-regulator.c:16:
   drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC1SW)) {
                                                ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
      ^
   drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC1SW)) {
                                                ^
   include/linux/compiler.h:151:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
>> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
      ^
   drivers/regulator/axp20x-regulator.c:447:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC1SW)) {
                                                ^
   include/linux/compiler.h:162:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
>> drivers/regulator/axp20x-regulator.c:446:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
      ^
   drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
                                                ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
   drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
      ^
   drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
                                                ^
   include/linux/compiler.h:151:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
   drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
      ^
   drivers/regulator/axp20x-regulator.c:456:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
                                                ^
   include/linux/compiler.h:162:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
   drivers/regulator/axp20x-regulator.c:455:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
      ^
   drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC1))
                                                ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
   drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) ||
      ^
   drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC1))
                                                ^
   include/linux/compiler.h:151:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
   drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) ||
      ^
   drivers/regulator/axp20x-regulator.c:485:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC1))
                                                ^
   include/linux/compiler.h:162:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
   drivers/regulator/axp20x-regulator.c:484:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) ||
      ^
   drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC5))
                                                ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
   drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) ||
      ^
   drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC5))
                                                ^
   include/linux/compiler.h:151:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^
   drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) ||
      ^
   drivers/regulator/axp20x-regulator.c:491:45: warning: comparison between pointer and integer
          (regulators == axp809_regulators && i == AXP809_DCDC5))
                                                ^
   include/linux/compiler.h:162:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^
   drivers/regulator/axp20x-regulator.c:490:3: note: in expansion of macro 'if'
      if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) ||
      ^

vim +/if +446 drivers/regulator/axp20x-regulator.c

   430		/* This only sets the dcdc freq. Ignore any errors */
   431		axp20x_regulator_parse_dt(pdev);
   432	
   433		for (i = 0; i < nregulators; i++) {
   434			const struct regulator_desc *desc = &regulators[i];
   435			struct regulator_desc *new_desc;
   436	
   437			/*
   438			 * Regulators DC1SW and DC5LDO are connected internally,
   439			 * so we have to handle their supply names separately.
   440			 *
   441			 * We always register the regulators in proper sequence,
   442			 * so the supply names are correctly read. See the last
   443			 * part of this loop to see where we save the DT defined
   444			 * name.
   445			 */
 > 446			if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) ||
   447			    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
   448				new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
   449							GFP_KERNEL);
   450				*new_desc = regulators[i];
   451				new_desc->supply_name = dcdc1_name;
   452				desc = new_desc;
   453			}
   454	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 21692 bytes --]

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

* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree
  2016-03-29 17:19 ` kbuild test robot
@ 2016-03-29 17:24   ` Mark Brown
  0 siblings, 0 replies; 37+ messages in thread
From: Mark Brown @ 2016-03-29 17:24 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, Chen-Yu Tsai, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

On Wed, Mar 30, 2016 at 01:19:45AM +0800, kbuild test robot wrote:
> Hi Mark,
> 
> [auto build test ERROR on regulator/for-next]
> [also build test ERROR on v4.6-rc1 next-20160329]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

This was pushed by mistake, I've dropped it.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: Applied "regulator: axp20x: support AXP809 variant" to the regulator tree
  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
  1 sibling, 1 reply; 37+ messages in thread
From: kbuild test robot @ 2016-03-29 17:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: kbuild-all, Chen-Yu Tsai, Mark Brown, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 28822 bytes --]

Hi Mark,

[auto build test ERROR on regulator/for-next]
[also build test ERROR on v4.6-rc1 next-20160329]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Mark-Brown/Applied-regulator-axp20x-support-AXP809-variant-to-the-regulator-tree/20160330-005751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: sparc64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

>> drivers/regulator/axp20x-regulator.c:238:11: error: 'AXP809_DCDC1' undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
>> drivers/regulator/axp20x-regulator.c:238:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
     ^
   drivers/regulator/axp20x-regulator.c:238:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:240:11: error: 'AXP809_DCDC2' undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:240:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
     ^
   drivers/regulator/axp20x-regulator.c:240:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:242:11: error: 'AXP809_DCDC3' undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:242:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
     ^
   drivers/regulator/axp20x-regulator.c:242:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:244:18: error: 'AXP809_DCDC4' undeclared here (not in a function)
     AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
                     ^
   drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 'AXP_DESC_RANGES'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:244:2: error: array index in initializer not of integer type
     AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
     ^
   drivers/regulator/axp20x-regulator.c:244:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:247:11: error: 'AXP809_DCDC5' undeclared here (not in a function)
     AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:247:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
     ^
   drivers/regulator/axp20x-regulator.c:247:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:250:14: error: 'AXP809_DC1SW' undeclared here (not in a function)
     AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:250:2: error: array index in initializer not of integer type
     AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
     ^
   drivers/regulator/axp20x-regulator.c:250:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:253:11: error: 'AXP809_DC5LDO' undeclared here (not in a function)
     AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:253:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
     ^
   drivers/regulator/axp20x-regulator.c:253:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:255:11: error: 'AXP809_ALDO1' undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:255:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:255:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:257:11: error: 'AXP809_ALDO2' undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:257:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:257:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:259:11: error: 'AXP809_ALDO3' undeclared here (not in a function)
     AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:259:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:259:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:261:18: error: 'AXP809_DLDO1' undeclared here (not in a function)
     AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
                     ^
   drivers/regulator/axp20x-regulator.c:111:3: note: in definition of macro 'AXP_DESC_RANGES'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:261:2: error: array index in initializer not of integer type
     AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
     ^
   drivers/regulator/axp20x-regulator.c:261:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:264:11: error: 'AXP809_DLDO2' undeclared here (not in a function)
     AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:264:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:264:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:266:11: error: 'AXP809_ELDO1' undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:266:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:266:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:268:11: error: 'AXP809_ELDO2' undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:268:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:268:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:270:11: error: 'AXP809_ELDO3' undeclared here (not in a function)
     AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
              ^
   drivers/regulator/axp20x-regulator.c:63:3: note: in definition of macro 'AXP_DESC'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:270:2: error: array index in initializer not of integer type
     AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:270:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:272:14: error: 'AXP809_LDO_IO0' undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:272:2: error: array index in initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:272:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:275:14: error: 'AXP809_LDO_IO1' undeclared here (not in a function)
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
                 ^
   drivers/regulator/axp20x-regulator.c:41:3: note: in definition of macro 'AXP_DESC_IO'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:275:2: error: array index in initializer not of integer type
     AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
     ^
   drivers/regulator/axp20x-regulator.c:275:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:278:17: error: 'AXP809_RTC_LDO' undeclared here (not in a function)
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
                    ^
   drivers/regulator/axp20x-regulator.c:96:3: note: in definition of macro 'AXP_DESC_FIXED'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:278:2: error: array index in initializer not of integer type
     AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
     ^
   drivers/regulator/axp20x-regulator.c:278:2: error: (near initialization for 'axp809_regulators')
>> drivers/regulator/axp20x-regulator.c:279:14: error: 'AXP809_SW' undeclared here (not in a function)
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
                 ^
   drivers/regulator/axp20x-regulator.c:82:3: note: in definition of macro 'AXP_DESC_SW'
     [_family##_##_id] = {       \
      ^
   drivers/regulator/axp20x-regulator.c:279:2: error: array index in initializer not of integer type
     AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
     ^
   drivers/regulator/axp20x-regulator.c:279:2: error: (near initialization for 'axp809_regulators')
   drivers/regulator/axp20x-regulator.c: In function 'axp20x_set_dcdc_freq':

vim +/AXP809_DCDC1 +238 drivers/regulator/axp20x-regulator.c

    35	#define AXP22X_WORKMODE_DCDCX_MASK(x)	BIT(x)
    36	
    37	#define AXP20X_FREQ_DCDC_MASK		0x0f
    38	
    39	#define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
    40			    _vmask, _ereg, _emask, _enable_val, _disable_val)		\
  > 41		[_family##_##_id] = {							\
    42			.name		= (_match),					\
    43			.supply_name	= (_supply),					\
    44			.of_match	= of_match_ptr(_match),				\
    45			.regulators_node = of_match_ptr("regulators"),			\
    46			.type		= REGULATOR_VOLTAGE,				\
    47			.id		= _family##_##_id,				\
    48			.n_voltages	= (((_max) - (_min)) / (_step) + 1),		\
    49			.owner		= THIS_MODULE,					\
    50			.min_uV		= (_min) * 1000,				\
    51			.uV_step	= (_step) * 1000,				\
    52			.vsel_reg	= (_vreg),					\
    53			.vsel_mask	= (_vmask),					\
    54			.enable_reg	= (_ereg),					\
    55			.enable_mask	= (_emask),					\
    56			.enable_val	= (_enable_val),				\
    57			.disable_val	= (_disable_val),				\
    58			.ops		= &axp20x_ops,					\
    59		}
    60	
    61	#define AXP_DESC(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
    62			 _vmask, _ereg, _emask) 					\
  > 63		[_family##_##_id] = {							\
    64			.name		= (_match),					\
    65			.supply_name	= (_supply),					\
    66			.of_match	= of_match_ptr(_match),				\
    67			.regulators_node = of_match_ptr("regulators"),			\
    68			.type		= REGULATOR_VOLTAGE,				\
    69			.id		= _family##_##_id,				\
    70			.n_voltages	= (((_max) - (_min)) / (_step) + 1),		\
    71			.owner		= THIS_MODULE,					\
    72			.min_uV		= (_min) * 1000,				\
    73			.uV_step	= (_step) * 1000,				\
    74			.vsel_reg	= (_vreg),					\
    75			.vsel_mask	= (_vmask),					\
    76			.enable_reg	= (_ereg),					\
    77			.enable_mask	= (_emask),					\
    78			.ops		= &axp20x_ops,					\
    79		}
    80	
    81	#define AXP_DESC_SW(_family, _id, _match, _supply, _ereg, _emask)		\
  > 82		[_family##_##_id] = {							\
    83			.name		= (_match),					\
    84			.supply_name	= (_supply),					\
    85			.of_match	= of_match_ptr(_match),				\
    86			.regulators_node = of_match_ptr("regulators"),			\
    87			.type		= REGULATOR_VOLTAGE,				\
    88			.id		= _family##_##_id,				\
    89			.owner		= THIS_MODULE,					\
    90			.enable_reg	= (_ereg),					\
    91			.enable_mask	= (_emask),					\
    92			.ops		= &axp20x_ops_sw,				\
    93		}
    94	
    95	#define AXP_DESC_FIXED(_family, _id, _match, _supply, _volt)			\
  > 96		[_family##_##_id] = {							\
    97			.name		= (_match),					\
    98			.supply_name	= (_supply),					\
    99			.of_match	= of_match_ptr(_match),				\
   100			.regulators_node = of_match_ptr("regulators"),			\
   101			.type		= REGULATOR_VOLTAGE,				\
   102			.id		= _family##_##_id,				\
   103			.n_voltages	= 1,						\
   104			.owner		= THIS_MODULE,					\
   105			.min_uV		= (_volt) * 1000,				\
   106			.ops		= &axp20x_ops_fixed				\
   107		}
   108	
   109	#define AXP_DESC_RANGES(_family, _id, _match, _supply, _ranges, _n_voltages,	\
   110				_vreg, _vmask, _ereg, _emask)				\
 > 111		[_family##_##_id] = {							\
   112			.name		= (_match),					\
   113			.supply_name	= (_supply),					\
   114			.of_match	= of_match_ptr(_match),				\
   115			.regulators_node = of_match_ptr("regulators"),			\
   116			.type		= REGULATOR_VOLTAGE,				\
   117			.id		= _family##_##_id,				\
   118			.n_voltages	= (_n_voltages),				\
   119			.owner		= THIS_MODULE,					\
   120			.vsel_reg	= (_vreg),					\
   121			.vsel_mask	= (_vmask),					\
   122			.enable_reg	= (_ereg),					\
   123			.enable_mask	= (_emask),					\
   124			.linear_ranges	= (_ranges),					\
   125			.n_linear_ranges = ARRAY_SIZE(_ranges),				\
   126			.ops		= &axp20x_ops_range,				\
   127		}
   128	
   129	static struct regulator_ops axp20x_ops_fixed = {
   130		.list_voltage		= regulator_list_voltage_linear,
   131	};
   132	
   133	static struct regulator_ops axp20x_ops_range = {
   134		.set_voltage_sel	= regulator_set_voltage_sel_regmap,
   135		.get_voltage_sel	= regulator_get_voltage_sel_regmap,
   136		.list_voltage		= regulator_list_voltage_linear_range,
   137		.enable			= regulator_enable_regmap,
   138		.disable		= regulator_disable_regmap,
   139		.is_enabled		= regulator_is_enabled_regmap,
   140	};
   141	
   142	static struct regulator_ops axp20x_ops = {
   143		.set_voltage_sel	= regulator_set_voltage_sel_regmap,
   144		.get_voltage_sel	= regulator_get_voltage_sel_regmap,
   145		.list_voltage		= regulator_list_voltage_linear,
   146		.enable			= regulator_enable_regmap,
   147		.disable		= regulator_disable_regmap,
   148		.is_enabled		= regulator_is_enabled_regmap,
   149	};
   150	
   151	static struct regulator_ops axp20x_ops_sw = {
   152		.enable			= regulator_enable_regmap,
   153		.disable		= regulator_disable_regmap,
   154		.is_enabled		= regulator_is_enabled_regmap,
   155	};
   156	
   157	static const struct regulator_linear_range axp20x_ldo4_ranges[] = {
   158		REGULATOR_LINEAR_RANGE(1250000, 0x0, 0x0, 0),
   159		REGULATOR_LINEAR_RANGE(1300000, 0x1, 0x8, 100000),
   160		REGULATOR_LINEAR_RANGE(2500000, 0x9, 0xf, 100000),
   161	};
   162	
   163	static const struct regulator_desc axp20x_regulators[] = {
   164		AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
   165			 AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
   166		AXP_DESC(AXP20X, DCDC3, "dcdc3", "vin3", 700, 3500, 25,
   167			 AXP20X_DCDC3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x02),
   168		AXP_DESC_FIXED(AXP20X, LDO1, "ldo1", "acin", 1300),
   169		AXP_DESC(AXP20X, LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
   170			 AXP20X_LDO24_V_OUT, 0xf0, AXP20X_PWR_OUT_CTRL, 0x04),
   171		AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
   172			 AXP20X_LDO3_V_OUT, 0x7f, AXP20X_PWR_OUT_CTRL, 0x40),
   173		AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in", axp20x_ldo4_ranges,
   174				16, AXP20X_LDO24_V_OUT, 0x0f, AXP20X_PWR_OUT_CTRL,
   175				0x08),
   176		AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
   177			    AXP20X_LDO5_V_OUT, 0xf0, AXP20X_GPIO0_CTRL, 0x07,
   178			    AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
   179	};
   180	
   181	static const struct regulator_desc axp22x_regulators[] = {
   182		AXP_DESC(AXP22X, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
   183			 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)),
   184		AXP_DESC(AXP22X, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
   185			 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)),
   186		AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
   187			 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
   188		AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
   189			 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
   190		AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
   191			 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
   192		/* secondary switchable output of DCDC1 */
   193		AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
   194			    BIT(7)),
   195		/* LDO regulator internally chained to DCDC5 */
   196		AXP_DESC(AXP22X, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
   197			 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
   198		AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
   199			 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
   200		AXP_DESC(AXP22X, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
   201			 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
   202		AXP_DESC(AXP22X, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
   203			 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
   204		AXP_DESC(AXP22X, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
   205			 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
   206		AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
   207			 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)),
   208		AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
   209			 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
   210		AXP_DESC(AXP22X, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
   211			 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
   212		AXP_DESC(AXP22X, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
   213			 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
   214		AXP_DESC(AXP22X, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
   215			 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
   216		AXP_DESC(AXP22X, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
   217			 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
   218		AXP_DESC_IO(AXP22X, LDO_IO0, "ldo_io0", "ips", 1800, 3300, 100,
   219			    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
   220			    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
   221		AXP_DESC_IO(AXP22X, LDO_IO1, "ldo_io1", "ips", 1800, 3300, 100,
   222			    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
   223			    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
   224		AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
   225	};
   226	
   227	static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
   228		REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
   229		REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
   230	};
   231	
   232	static const struct regulator_linear_range axp809_dldo1_ranges[] = {
   233		REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),
   234		REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),
   235	};
   236	
   237	static const struct regulator_desc axp809_regulators[] = {
 > 238		AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
   239			 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)),
 > 240		AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
   241			 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)),
 > 242		AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
   243			 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
 > 244		AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges,
   245				57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1,
   246				BIT(4)),
 > 247		AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
   248			 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
   249		/* secondary switchable output of DCDC1 */
 > 250		AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2,
   251			    BIT(7)),
   252		/* LDO regulator internally chained to DCDC5 */
 > 253		AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100,
   254			 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
 > 255		AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
   256			 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
 > 257		AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
   258			 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
 > 259		AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
   260			 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
 > 261		AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,
   262				32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
   263				BIT(3)),
 > 264		AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
   265			 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)),
 > 266		AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
   267			 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
 > 268		AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
   269			 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
 > 270		AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
   271			 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
 > 272		AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100,
   273			    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
   274			    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
 > 275		AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100,
   276			    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
   277			    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
 > 278		AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800),
 > 279		AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
   280	};
   281	
   282	static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
   283	{
   284		struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
   285		u32 min, max, def, step;
   286	
   287		switch (axp20x->variant) {
   288		case AXP202_ID:
   289		case AXP209_ID:
   290			min = 750;
   291			max = 1875;
   292			def = 1500;
   293			step = 75;
   294			break;
   295		case AXP221_ID:
   296		case AXP223_ID:
 > 297		case AXP809_ID:
   298			min = 1800;
   299			max = 4050;
   300			def = 3000;
   301			step = 150;
   302			break;
   303		default:
   304			dev_err(&pdev->dev,
   305				"Setting DCDC frequency for unsupported AXP variant\n");
   306			return -EINVAL;
   307		}
   308	
   309		if (dcdcfreq == 0)
   310			dcdcfreq = def;
   311	
   312		if (dcdcfreq < min) {
   313			dcdcfreq = min;
   314			dev_warn(&pdev->dev, "DCDC frequency too low. Set to %ukHz\n",
   315				 min);
   316		}
   317	
   318		if (dcdcfreq > max) {
   319			dcdcfreq = max;
   320			dev_warn(&pdev->dev, "DCDC frequency too high. Set to %ukHz\n",
   321				 max);
   322		}
   323	
   324		dcdcfreq = (dcdcfreq - min) / step;
   325	
   326		return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,
   327					  AXP20X_FREQ_DCDC_MASK, dcdcfreq);
   328	}
   329	
   330	static int axp20x_regulator_parse_dt(struct platform_device *pdev)
   331	{
   332		struct device_node *np, *regulators;
   333		int ret;
   334		u32 dcdcfreq = 0;
   335	
   336		np = of_node_get(pdev->dev.parent->of_node);
   337		if (!np)
   338			return 0;
   339	
   340		regulators = of_get_child_by_name(np, "regulators");
   341		if (!regulators) {
   342			dev_warn(&pdev->dev, "regulators node not found\n");
   343		} else {
   344			of_property_read_u32(regulators, "x-powers,dcdc-freq", &dcdcfreq);
   345			ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
   346			if (ret < 0) {
   347				dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
   348				return ret;
   349			}
   350	
   351			of_node_put(regulators);
   352		}
   353	
   354		return 0;
   355	}
   356	
   357	static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
   358	{
   359		struct axp20x_dev *axp20x = rdev_get_drvdata(rdev);
   360		unsigned int mask;
   361	
   362		switch (axp20x->variant) {
   363		case AXP202_ID:
   364		case AXP209_ID:
   365			if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3))
   366				return -EINVAL;
   367	
   368			mask = AXP20X_WORKMODE_DCDC2_MASK;
   369			if (id == AXP20X_DCDC3)
   370				mask = AXP20X_WORKMODE_DCDC3_MASK;
   371	
   372			workmode <<= ffs(mask) - 1;
   373			break;
   374	
   375		case AXP221_ID:
   376		case AXP223_ID:
   377		case AXP809_ID:
   378			if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
   379				return -EINVAL;
   380	
   381			mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP22X_DCDC1);
   382			workmode <<= id - AXP22X_DCDC1;
   383			break;
   384	
   385		default:
   386			/* should not happen */
   387			WARN_ON(1);
   388			return -EINVAL;
   389		}
   390	
   391		return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode);
   392	}
   393	
   394	static int axp20x_regulator_probe(struct platform_device *pdev)
   395	{
   396		struct regulator_dev *rdev;
   397		struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
   398		const struct regulator_desc *regulators;
   399		struct regulator_config config = {
   400			.dev = pdev->dev.parent,
   401			.regmap = axp20x->regmap,
   402			.driver_data = axp20x,
   403		};
   404		int ret, i, nregulators;
   405		u32 workmode;
   406		const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
   407		const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
   408	
   409		switch (axp20x->variant) {
   410		case AXP202_ID:
   411		case AXP209_ID:
   412			regulators = axp20x_regulators;
   413			nregulators = AXP20X_REG_ID_MAX;
   414			break;
   415		case AXP221_ID:
   416		case AXP223_ID:
   417			regulators = axp22x_regulators;
   418			nregulators = AXP22X_REG_ID_MAX;
   419			break;
 > 420		case AXP809_ID:
   421			regulators = axp809_regulators;
 > 422			nregulators = AXP809_REG_ID_MAX;
   423			break;
   424		default:
   425			dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45793 bytes --]

^ 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).