All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/9] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-04-11  9:38 ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
as well as 4 configurable GPIOs. 

This set of patches introduces the core driver and support for two different
subsystems:
	- Regulators
	- PEK (Power Enable Key)

This patchset depends on patchsets:
	irq: sun4i IRQ 0 / ENMI fixes (Hans de Goede)
	ARM: sun7i/sun6i: irqchip: Irqchip driver for NMI controller (Carlo Caione)
	regulator: helpers: Modify helpers enabling multi-bit control (Carlo Caione)

Changes since v1:

	- Added a new standalone patch for defconfig

	- MFD core:
	  * Removed axp,system-power-controller property

	- Bindings documentation:
	  * Corrected description for dcdc-workmode property
	  * Removed unused axp20x-pek compatible

	- Input misc PEK driver:
	  * Fixed seconds in lower case

	- Regulators subsystem:
	  * Fixed axp20x_set_suspend_voltage()
	  * Switched to using multi-bit control for regulators
	  * When "regulators" node is not found driver doesn't quit
	  * Driver is now using devm_regulator_register()
	  * Added module_platform_driver() instead of subsys_initcall()

	- DT:
	  * Added new DTSI for AXP209
	  * Added support for cubietruck and olinuxino-micro

Changes since v2:

	- Added a new patch for multi_v7_defconfig to enable MFD core
	  and subsystems

	- DT:
	  * Dropped axp,system-power-controller property from DTS
	  * Moved compatible and interrupt-related properties from the
	    DTSI file to the DTS board files

	- Regulators subsystem:
	  * Deleted useless struct axp20x_regulators
	  * Added a warning when out of specs values are used for the
	    dcdc frequency

	- MFD core:
	  * Fixed coding style
	  * Removed IDs from device table for i2c

	- Bindings documentation:
	  * Several corrections and fixes

Changes since v3:

	- Removed x-powers-axp209.dtsi file
	- Rewritten bindings document

	- MFD core:
	  * Fixed casting
	  * Better comments / documentation

	- Input misc PEK driver:
	  * Timings are now expressed in ms and the sysfs appies the
	    closest possible value
	  * No more useless pretty-printing
	  * Removed devm_request_threaded_irq in favour of
	    devm_request_any_context_irq
	  * Moved from input attributes to platform device attributes

	- Regulators subsystem:
	  * Removed suspend mode (axp20x_set_suspend_voltage)
	  * Added regulators input supply

	- DT
	  * DTs doesn't include anymore the dtsi
	  * Added input supplies for regulators

Carlo Caione (9):
  mfd: AXP20x: Add mfd driver for AXP20x PMIC
  dt-bindings: add vendor-prefix for X-Powers
  mfd: AXP20x: Add bindings documentation
  input: misc: Add driver for AXP20x Power Enable Key
  input: misc: Add ABI docs for AXP20x PEK
  regulator: AXP20x: Add support for regulators subsystem
  ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  ARM: sunxi: Add AXP20x support in defconfig
  ARM: sunxi: Add AXP20x support multi_v7_defconfig

 .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
 Documentation/devicetree/bindings/mfd/axp20x.txt   |  96 +++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/boot/dts/sun4i-a10-a1000.dts              |  69 +++++
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts         |  69 +++++
 arch/arm/boot/dts/sun4i-a10-hackberry.dts          |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-inet97fv2.dts          |  69 +++++
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts         |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts     |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-pcduino.dts            |  69 +++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts        |  70 +++++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts         |  70 +++++
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts    |  70 +++++
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/sunxi_defconfig                   |   4 +
 drivers/input/misc/Kconfig                         |  11 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/axp20x-pek.c                    | 261 +++++++++++++++++++
 drivers/mfd/Kconfig                                |  12 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/axp20x.c                               | 249 ++++++++++++++++++
 drivers/regulator/Kconfig                          |   7 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/axp20x-regulator.c               | 285 +++++++++++++++++++++
 include/linux/mfd/axp20x.h                         | 180 +++++++++++++
 25 files changed, 1834 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
 create mode 100644 drivers/input/misc/axp20x-pek.c
 create mode 100644 drivers/mfd/axp20x.c
 create mode 100644 drivers/regulator/axp20x-regulator.c
 create mode 100644 include/linux/mfd/axp20x.h

-- 
1.8.3.2

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

* [PATCH v4 0/9] mfd: AXP20x: Add support for AXP202 and AXP209
@ 2014-04-11  9:38 ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
as well as 4 configurable GPIOs. 

This set of patches introduces the core driver and support for two different
subsystems:
	- Regulators
	- PEK (Power Enable Key)

This patchset depends on patchsets:
	irq: sun4i IRQ 0 / ENMI fixes (Hans de Goede)
	ARM: sun7i/sun6i: irqchip: Irqchip driver for NMI controller (Carlo Caione)
	regulator: helpers: Modify helpers enabling multi-bit control (Carlo Caione)

Changes since v1:

	- Added a new standalone patch for defconfig

	- MFD core:
	  * Removed axp,system-power-controller property

	- Bindings documentation:
	  * Corrected description for dcdc-workmode property
	  * Removed unused axp20x-pek compatible

	- Input misc PEK driver:
	  * Fixed seconds in lower case

	- Regulators subsystem:
	  * Fixed axp20x_set_suspend_voltage()
	  * Switched to using multi-bit control for regulators
	  * When "regulators" node is not found driver doesn't quit
	  * Driver is now using devm_regulator_register()
	  * Added module_platform_driver() instead of subsys_initcall()

	- DT:
	  * Added new DTSI for AXP209
	  * Added support for cubietruck and olinuxino-micro

Changes since v2:

	- Added a new patch for multi_v7_defconfig to enable MFD core
	  and subsystems

	- DT:
	  * Dropped axp,system-power-controller property from DTS
	  * Moved compatible and interrupt-related properties from the
	    DTSI file to the DTS board files

	- Regulators subsystem:
	  * Deleted useless struct axp20x_regulators
	  * Added a warning when out of specs values are used for the
	    dcdc frequency

	- MFD core:
	  * Fixed coding style
	  * Removed IDs from device table for i2c

	- Bindings documentation:
	  * Several corrections and fixes

Changes since v3:

	- Removed x-powers-axp209.dtsi file
	- Rewritten bindings document

	- MFD core:
	  * Fixed casting
	  * Better comments / documentation

	- Input misc PEK driver:
	  * Timings are now expressed in ms and the sysfs appies the
	    closest possible value
	  * No more useless pretty-printing
	  * Removed devm_request_threaded_irq in favour of
	    devm_request_any_context_irq
	  * Moved from input attributes to platform device attributes

	- Regulators subsystem:
	  * Removed suspend mode (axp20x_set_suspend_voltage)
	  * Added regulators input supply

	- DT
	  * DTs doesn't include anymore the dtsi
	  * Added input supplies for regulators

Carlo Caione (9):
  mfd: AXP20x: Add mfd driver for AXP20x PMIC
  dt-bindings: add vendor-prefix for X-Powers
  mfd: AXP20x: Add bindings documentation
  input: misc: Add driver for AXP20x Power Enable Key
  input: misc: Add ABI docs for AXP20x PEK
  regulator: AXP20x: Add support for regulators subsystem
  ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  ARM: sunxi: Add AXP20x support in defconfig
  ARM: sunxi: Add AXP20x support multi_v7_defconfig

 .../ABI/testing/sysfs-driver-input-axp-pek         |  11 +
 Documentation/devicetree/bindings/mfd/axp20x.txt   |  96 +++++++
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 arch/arm/boot/dts/sun4i-a10-a1000.dts              |  69 +++++
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts         |  69 +++++
 arch/arm/boot/dts/sun4i-a10-hackberry.dts          |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-inet97fv2.dts          |  69 +++++
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts         |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts     |  75 ++++++
 arch/arm/boot/dts/sun4i-a10-pcduino.dts            |  69 +++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts        |  70 +++++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts         |  70 +++++
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts    |  70 +++++
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/sunxi_defconfig                   |   4 +
 drivers/input/misc/Kconfig                         |  11 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/axp20x-pek.c                    | 261 +++++++++++++++++++
 drivers/mfd/Kconfig                                |  12 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/axp20x.c                               | 249 ++++++++++++++++++
 drivers/regulator/Kconfig                          |   7 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/axp20x-regulator.c               | 285 +++++++++++++++++++++
 include/linux/mfd/axp20x.h                         | 180 +++++++++++++
 25 files changed, 1834 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
 create mode 100644 drivers/input/misc/axp20x-pek.c
 create mode 100644 drivers/mfd/axp20x.c
 create mode 100644 drivers/regulator/axp20x-regulator.c
 create mode 100644 include/linux/mfd/axp20x.h

-- 
1.8.3.2

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

This patch introduces the preliminary support for PMICs X-Powers AXP202
and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
of Allwinner.

The core enables support for two subsystems:
- PEK (Power Enable Key)
- Regulators

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
 4 files changed, 442 insertions(+)
 create mode 100644 drivers/mfd/axp20x.c
 create mode 100644 include/linux/mfd/axp20x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 49bb445..a947bbe 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
 	  additional drivers must be enabled in order to use the
 	  functionality of the device.
 
+config MFD_AXP20X
+	bool "X-Powers AXP20X"
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	depends on I2C=y
+	help
+	  If you say Y here you get support for the X-Powers AXP202 and AXP209.
+	  This driver include only the core APIs. You have to select individual
+	  components like regulators or the PEK (Power Enable Key) under the
+	  corresponding menus.
+
 config MFD_CROS_EC
 	tristate "ChromeOS Embedded Controller"
 	select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 5aea5ef..fb773b5 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -101,6 +101,7 @@ obj-$(CONFIG_PMIC_DA9052)	+= da9052-irq.o
 obj-$(CONFIG_PMIC_DA9052)	+= da9052-core.o
 obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
+obj-$(CONFIG_MFD_AXP20X)	+= axp20x.o
 
 obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
new file mode 100644
index 0000000..747bc83
--- /dev/null
+++ b/drivers/mfd/axp20x.c
@@ -0,0 +1,249 @@
+/*
+ * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
+ *
+ * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
+ * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as 4 configurable GPIOs.
+ *
+ * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/mfd/core.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+
+#define AXP20X_OFF	0x80
+
+static const struct regmap_range axp20x_writeable_ranges[] = {
+	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+	regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
+};
+
+static const struct regmap_range axp20x_volatile_ranges[] = {
+	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+};
+
+static const struct regmap_access_table axp20x_writeable_table = {
+	.yes_ranges	= axp20x_writeable_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp20x_writeable_ranges),
+};
+
+static const struct regmap_access_table axp20x_volatile_table = {
+	.yes_ranges	= axp20x_volatile_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp20x_volatile_ranges),
+};
+
+static struct resource axp20x_pek_resources[] = {
+	{
+		.name	= "PEK_DBR",
+		.start	= AXP20X_IRQ_PEK_RIS_EDGE,
+		.end	= AXP20X_IRQ_PEK_RIS_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "PEK_DBF",
+		.start	= AXP20X_IRQ_PEK_FAL_EDGE,
+		.end	= AXP20X_IRQ_PEK_FAL_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static const struct regmap_config axp20x_regmap_config = {
+	.reg_bits	= 8,
+	.val_bits	= 8,
+	.wr_table	= &axp20x_writeable_table,
+	.volatile_table	= &axp20x_volatile_table,
+	.max_register	= AXP20X_FG_RES,
+	.cache_type	= REGCACHE_RBTREE,
+};
+
+#define AXP20X_IRQ(_irq, _off, _mask) \
+	[AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
+
+static const struct regmap_irq axp20x_regmap_irqs[] = {
+	AXP20X_IRQ(ACIN_OVER_V,		0, 7),
+	AXP20X_IRQ(ACIN_PLUGIN,		0, 6),
+	AXP20X_IRQ(ACIN_REMOVAL,	0, 5),
+	AXP20X_IRQ(VBUS_OVER_V,		0, 4),
+	AXP20X_IRQ(VBUS_PLUGIN,		0, 3),
+	AXP20X_IRQ(VBUS_REMOVAL,	0, 2),
+	AXP20X_IRQ(VBUS_V_LOW,		0, 1),
+	AXP20X_IRQ(BATT_PLUGIN,		1, 7),
+	AXP20X_IRQ(BATT_REMOVAL,	1, 6),
+	AXP20X_IRQ(BATT_ENT_ACT_MODE,	1, 5),
+	AXP20X_IRQ(BATT_EXIT_ACT_MODE,	1, 4),
+	AXP20X_IRQ(CHARG,		1, 3),
+	AXP20X_IRQ(CHARG_DONE,		1, 2),
+	AXP20X_IRQ(BATT_TEMP_HIGH,	1, 1),
+	AXP20X_IRQ(BATT_TEMP_LOW,	1, 0),
+	AXP20X_IRQ(DIE_TEMP_HIGH,	2, 7),
+	AXP20X_IRQ(CHARG_I_LOW,		2, 6),
+	AXP20X_IRQ(DCDC1_V_LONG,	2, 5),
+	AXP20X_IRQ(DCDC2_V_LONG,	2, 4),
+	AXP20X_IRQ(DCDC3_V_LONG,	2, 3),
+	AXP20X_IRQ(PEK_SHORT,		2, 1),
+	AXP20X_IRQ(PEK_LONG,		2, 0),
+	AXP20X_IRQ(N_OE_PWR_ON,		3, 7),
+	AXP20X_IRQ(N_OE_PWR_OFF,	3, 6),
+	AXP20X_IRQ(VBUS_VALID,		3, 5),
+	AXP20X_IRQ(VBUS_NOT_VALID,	3, 4),
+	AXP20X_IRQ(VBUS_SESS_VALID,	3, 3),
+	AXP20X_IRQ(VBUS_SESS_END,	3, 2),
+	AXP20X_IRQ(LOW_PWR_LVL1,	3, 1),
+	AXP20X_IRQ(LOW_PWR_LVL2,	3, 0),
+	AXP20X_IRQ(TIMER,		4, 7),
+	AXP20X_IRQ(PEK_RIS_EDGE,	4, 6),
+	AXP20X_IRQ(PEK_FAL_EDGE,	4, 5),
+	AXP20X_IRQ(GPIO3_INPUT,		4, 3),
+	AXP20X_IRQ(GPIO2_INPUT,		4, 2),
+	AXP20X_IRQ(GPIO1_INPUT,		4, 1),
+	AXP20X_IRQ(GPIO0_INPUT,		4, 0),
+};
+
+static const struct of_device_id axp20x_of_match[] = {
+	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_of_match);
+
+/*
+ * This is useless for OF-enabled devices, but it is needed by I2C subsystem
+ */
+static const struct i2c_device_id axp20x_i2c_id[] = {
+	{ },
+};
+MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
+
+static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
+	.name			= "axp20x_irq_chip",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.num_regs		= 5,
+	.irqs			= axp20x_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp20x_regmap_irqs),
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+};
+
+static struct mfd_cell axp20x_cells[] = {
+	{
+		.of_compatible	= "x-powers,axp20x-pek",
+		.name		= "axp20x-pek",
+		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
+		.resources	= axp20x_pek_resources,
+	}, {
+		.of_compatible	= "x-powers,axp20x-reg",
+		.name		= "axp20x-regulator",
+	},
+};
+
+static struct axp20x_dev *axp20x_pm_power_off;
+static void axp20x_power_off(void)
+{
+	regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
+		     AXP20X_OFF);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+			 const struct i2c_device_id *id)
+{
+	struct axp20x_dev *axp20x;
+	const struct of_device_id *of_id;
+	int ret;
+
+	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	of_id = of_match_device(axp20x_of_match, &i2c->dev);
+	if (!of_id) {
+		dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
+		return -ENODEV;
+	}
+	axp20x->variant = (long) of_id->data;
+
+	axp20x->i2c_client = i2c;
+	axp20x->dev = &i2c->dev;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq,
+				  IRQF_ONESHOT | IRQF_SHARED, -1,
+				  &axp20x_regmap_irq_chip,
+				  &axp20x->regmap_irqc);
+	if (ret) {
+		dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
+		return ret;
+	}
+
+	ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
+			      ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
+
+	if (ret) {
+		dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
+		regmap_del_irq_chip(i2c->irq, axp20x->regmap_irqc);
+		return ret;
+	}
+
+	if (!pm_power_off) {
+		axp20x_pm_power_off = axp20x;
+		pm_power_off = axp20x_power_off;
+	}
+
+	dev_info(&i2c->dev, "AXP20X driver loaded\n");
+
+	return 0;
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+	if (axp20x == axp20x_pm_power_off) {
+		axp20x_pm_power_off = NULL;
+		pm_power_off = NULL;
+	}
+
+	mfd_remove_devices(axp20x->dev);
+	regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
+
+	return 0;
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x",
+		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(axp20x_of_match),
+	},
+	.probe		= axp20x_i2c_probe,
+	.remove		= axp20x_i2c_remove,
+	.id_table	= axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
+MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
new file mode 100644
index 0000000..d0e31a2
--- /dev/null
+++ b/include/linux/mfd/axp20x.h
@@ -0,0 +1,180 @@
+/*
+ * Functions and registers to access AXP20X power management chip.
+ *
+ * Copyright (C) 2013, Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_MFD_AXP20X_H
+#define __LINUX_MFD_AXP20X_H
+
+enum {
+	AXP202_ID = 0,
+	AXP209_ID,
+};
+
+#define AXP20X_DATACACHE(m)		(0x04 + (m))
+
+/* Power supply */
+#define AXP20X_PWR_INPUT_STATUS		0x00
+#define AXP20X_PWR_OP_MODE		0x01
+#define AXP20X_USB_OTG_STATUS		0x02
+#define AXP20X_PWR_OUT_CTRL		0x12
+#define AXP20X_DCDC2_V_OUT		0x23
+#define AXP20X_DCDC2_LDO3_V_SCAL	0x25
+#define AXP20X_DCDC3_V_OUT		0x27
+#define AXP20X_LDO24_V_OUT		0x28
+#define AXP20X_LDO3_V_OUT		0x29
+#define AXP20X_VBUS_IPSOUT_MGMT		0x30
+#define AXP20X_V_OFF			0x31
+#define AXP20X_OFF_CTRL			0x32
+#define AXP20X_CHRG_CTRL1		0x33
+#define AXP20X_CHRG_CTRL2		0x34
+#define AXP20X_CHRG_BAK_CTRL		0x35
+#define AXP20X_PEK_KEY			0x36
+#define AXP20X_DCDC_FREQ		0x37
+#define AXP20X_V_LTF_CHRG		0x38
+#define AXP20X_V_HTF_CHRG		0x39
+#define AXP20X_APS_WARN_L1		0x3a
+#define AXP20X_APS_WARN_L2		0x3b
+#define AXP20X_V_LTF_DISCHRG		0x3c
+#define AXP20X_V_HTF_DISCHRG		0x3d
+
+/* Interrupt */
+#define AXP20X_IRQ1_EN			0x40
+#define AXP20X_IRQ2_EN			0x41
+#define AXP20X_IRQ3_EN			0x42
+#define AXP20X_IRQ4_EN			0x43
+#define AXP20X_IRQ5_EN			0x44
+#define AXP20X_IRQ1_STATE		0x48
+#define AXP20X_IRQ2_STATE		0x49
+#define AXP20X_IRQ3_STATE		0x4a
+#define AXP20X_IRQ4_STATE		0x4b
+#define AXP20X_IRQ5_STATE		0x4c
+
+/* ADC */
+#define AXP20X_ACIN_V_ADC_H		0x56
+#define AXP20X_ACIN_V_ADC_L		0x57
+#define AXP20X_ACIN_I_ADC_H		0x58
+#define AXP20X_ACIN_I_ADC_L		0x59
+#define AXP20X_VBUS_V_ADC_H		0x5a
+#define AXP20X_VBUS_V_ADC_L		0x5b
+#define AXP20X_VBUS_I_ADC_H		0x5c
+#define AXP20X_VBUS_I_ADC_L		0x5d
+#define AXP20X_TEMP_ADC_H		0x5e
+#define AXP20X_TEMP_ADC_L		0x5f
+#define AXP20X_TS_IN_H			0x62
+#define AXP20X_TS_IN_L			0x63
+#define AXP20X_GPIO0_V_ADC_H		0x64
+#define AXP20X_GPIO0_V_ADC_L		0x65
+#define AXP20X_GPIO1_V_ADC_H		0x66
+#define AXP20X_GPIO1_V_ADC_L		0x67
+#define AXP20X_PWR_BATT_H		0x70
+#define AXP20X_PWR_BATT_M		0x71
+#define AXP20X_PWR_BATT_L		0x72
+#define AXP20X_BATT_V_H			0x78
+#define AXP20X_BATT_V_L			0x79
+#define AXP20X_BATT_CHRG_I_H		0x7a
+#define AXP20X_BATT_CHRG_I_L		0x7b
+#define AXP20X_BATT_DISCHRG_I_H		0x7c
+#define AXP20X_BATT_DISCHRG_I_L		0x7d
+#define AXP20X_IPSOUT_V_HIGH_H		0x7e
+#define AXP20X_IPSOUT_V_HIGH_L		0x7f
+
+/* Power supply */
+#define AXP20X_DCDC_MODE		0x80
+#define AXP20X_ADC_EN1			0x82
+#define AXP20X_ADC_EN2			0x83
+#define AXP20X_ADC_RATE			0x84
+#define AXP20X_GPIO10_IN_RANGE		0x85
+#define AXP20X_GPIO1_ADC_IRQ_RIS	0x86
+#define AXP20X_GPIO1_ADC_IRQ_FAL	0x87
+#define AXP20X_TIMER_CTRL		0x8a
+#define AXP20X_VBUS_MON			0x8b
+#define AXP20X_OVER_TMP			0x8f
+
+/* GPIO */
+#define AXP20X_GPIO0_CTRL		0x90
+#define AXP20X_LDO5_V_OUT		0x91
+#define AXP20X_GPIO1_CTRL		0x92
+#define AXP20X_GPIO2_CTRL		0x93
+#define AXP20X_GPIO20_SS		0x94
+#define AXP20X_GPIO3_CTRL		0x95
+
+/* Battery */
+#define AXP20X_CHRG_CC_31_24		0xb0
+#define AXP20X_CHRG_CC_23_16		0xb1
+#define AXP20X_CHRG_CC_15_8		0xb2
+#define AXP20X_CHRG_CC_7_0		0xb3
+#define AXP20X_DISCHRG_CC_31_24		0xb4
+#define AXP20X_DISCHRG_CC_23_16		0xb5
+#define AXP20X_DISCHRG_CC_15_8		0xb6
+#define AXP20X_DISCHRG_CC_7_0		0xb7
+#define AXP20X_CC_CTRL			0xb8
+#define AXP20X_FG_RES			0xb9
+
+/* Regulators IDs */
+enum {
+	AXP20X_LDO1 = 0,
+	AXP20X_LDO2,
+	AXP20X_LDO3,
+	AXP20X_LDO4,
+	AXP20X_LDO5,
+	AXP20X_DCDC2,
+	AXP20X_DCDC3,
+	AXP20X_REG_ID_MAX,
+};
+
+/* IRQs */
+enum {
+	AXP20X_IRQ_ACIN_OVER_V = 1,
+	AXP20X_IRQ_ACIN_PLUGIN,
+	AXP20X_IRQ_ACIN_REMOVAL,
+	AXP20X_IRQ_VBUS_OVER_V,
+	AXP20X_IRQ_VBUS_PLUGIN,
+	AXP20X_IRQ_VBUS_REMOVAL,
+	AXP20X_IRQ_VBUS_V_LOW,
+	AXP20X_IRQ_BATT_PLUGIN,
+	AXP20X_IRQ_BATT_REMOVAL,
+	AXP20X_IRQ_BATT_ENT_ACT_MODE,
+	AXP20X_IRQ_BATT_EXIT_ACT_MODE,
+	AXP20X_IRQ_CHARG,
+	AXP20X_IRQ_CHARG_DONE,
+	AXP20X_IRQ_BATT_TEMP_HIGH,
+	AXP20X_IRQ_BATT_TEMP_LOW,
+	AXP20X_IRQ_DIE_TEMP_HIGH,
+	AXP20X_IRQ_CHARG_I_LOW,
+	AXP20X_IRQ_DCDC1_V_LONG,
+	AXP20X_IRQ_DCDC2_V_LONG,
+	AXP20X_IRQ_DCDC3_V_LONG,
+	AXP20X_IRQ_PEK_SHORT = 22,
+	AXP20X_IRQ_PEK_LONG,
+	AXP20X_IRQ_N_OE_PWR_ON,
+	AXP20X_IRQ_N_OE_PWR_OFF,
+	AXP20X_IRQ_VBUS_VALID,
+	AXP20X_IRQ_VBUS_NOT_VALID,
+	AXP20X_IRQ_VBUS_SESS_VALID,
+	AXP20X_IRQ_VBUS_SESS_END,
+	AXP20X_IRQ_LOW_PWR_LVL1,
+	AXP20X_IRQ_LOW_PWR_LVL2,
+	AXP20X_IRQ_TIMER,
+	AXP20X_IRQ_PEK_RIS_EDGE,
+	AXP20X_IRQ_PEK_FAL_EDGE,
+	AXP20X_IRQ_GPIO3_INPUT,
+	AXP20X_IRQ_GPIO2_INPUT,
+	AXP20X_IRQ_GPIO1_INPUT,
+	AXP20X_IRQ_GPIO0_INPUT,
+};
+
+struct axp20x_dev {
+	struct device			*dev;
+	struct i2c_client		*i2c_client;
+	struct regmap			*regmap;
+	struct regmap_irq_chip_data	*regmap_irqc;
+	long				variant;
+};
+
+#endif /* __LINUX_MFD_AXP20X_H */
-- 
1.8.3.2

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

This patch introduces the preliminary support for PMICs X-Powers AXP202
and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
of Allwinner.

The core enables support for two subsystems:
- PEK (Power Enable Key)
- Regulators

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 drivers/mfd/Kconfig        |  12 +++
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
 4 files changed, 442 insertions(+)
 create mode 100644 drivers/mfd/axp20x.c
 create mode 100644 include/linux/mfd/axp20x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 49bb445..a947bbe 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
 	  additional drivers must be enabled in order to use the
 	  functionality of the device.
 
+config MFD_AXP20X
+	bool "X-Powers AXP20X"
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	depends on I2C=y
+	help
+	  If you say Y here you get support for the X-Powers AXP202 and AXP209.
+	  This driver include only the core APIs. You have to select individual
+	  components like regulators or the PEK (Power Enable Key) under the
+	  corresponding menus.
+
 config MFD_CROS_EC
 	tristate "ChromeOS Embedded Controller"
 	select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 5aea5ef..fb773b5 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -101,6 +101,7 @@ obj-$(CONFIG_PMIC_DA9052)	+= da9052-irq.o
 obj-$(CONFIG_PMIC_DA9052)	+= da9052-core.o
 obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
+obj-$(CONFIG_MFD_AXP20X)	+= axp20x.o
 
 obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
new file mode 100644
index 0000000..747bc83
--- /dev/null
+++ b/drivers/mfd/axp20x.c
@@ -0,0 +1,249 @@
+/*
+ * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
+ *
+ * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
+ * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as 4 configurable GPIOs.
+ *
+ * Author: Carlo Caione <carlo@caione.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/regulator/consumer.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/mfd/core.h>
+#include <linux/of_device.h>
+#include <linux/of_irq.h>
+
+#define AXP20X_OFF	0x80
+
+static const struct regmap_range axp20x_writeable_ranges[] = {
+	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+	regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
+};
+
+static const struct regmap_range axp20x_volatile_ranges[] = {
+	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+};
+
+static const struct regmap_access_table axp20x_writeable_table = {
+	.yes_ranges	= axp20x_writeable_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp20x_writeable_ranges),
+};
+
+static const struct regmap_access_table axp20x_volatile_table = {
+	.yes_ranges	= axp20x_volatile_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp20x_volatile_ranges),
+};
+
+static struct resource axp20x_pek_resources[] = {
+	{
+		.name	= "PEK_DBR",
+		.start	= AXP20X_IRQ_PEK_RIS_EDGE,
+		.end	= AXP20X_IRQ_PEK_RIS_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "PEK_DBF",
+		.start	= AXP20X_IRQ_PEK_FAL_EDGE,
+		.end	= AXP20X_IRQ_PEK_FAL_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static const struct regmap_config axp20x_regmap_config = {
+	.reg_bits	= 8,
+	.val_bits	= 8,
+	.wr_table	= &axp20x_writeable_table,
+	.volatile_table	= &axp20x_volatile_table,
+	.max_register	= AXP20X_FG_RES,
+	.cache_type	= REGCACHE_RBTREE,
+};
+
+#define AXP20X_IRQ(_irq, _off, _mask) \
+	[AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
+
+static const struct regmap_irq axp20x_regmap_irqs[] = {
+	AXP20X_IRQ(ACIN_OVER_V,		0, 7),
+	AXP20X_IRQ(ACIN_PLUGIN,		0, 6),
+	AXP20X_IRQ(ACIN_REMOVAL,	0, 5),
+	AXP20X_IRQ(VBUS_OVER_V,		0, 4),
+	AXP20X_IRQ(VBUS_PLUGIN,		0, 3),
+	AXP20X_IRQ(VBUS_REMOVAL,	0, 2),
+	AXP20X_IRQ(VBUS_V_LOW,		0, 1),
+	AXP20X_IRQ(BATT_PLUGIN,		1, 7),
+	AXP20X_IRQ(BATT_REMOVAL,	1, 6),
+	AXP20X_IRQ(BATT_ENT_ACT_MODE,	1, 5),
+	AXP20X_IRQ(BATT_EXIT_ACT_MODE,	1, 4),
+	AXP20X_IRQ(CHARG,		1, 3),
+	AXP20X_IRQ(CHARG_DONE,		1, 2),
+	AXP20X_IRQ(BATT_TEMP_HIGH,	1, 1),
+	AXP20X_IRQ(BATT_TEMP_LOW,	1, 0),
+	AXP20X_IRQ(DIE_TEMP_HIGH,	2, 7),
+	AXP20X_IRQ(CHARG_I_LOW,		2, 6),
+	AXP20X_IRQ(DCDC1_V_LONG,	2, 5),
+	AXP20X_IRQ(DCDC2_V_LONG,	2, 4),
+	AXP20X_IRQ(DCDC3_V_LONG,	2, 3),
+	AXP20X_IRQ(PEK_SHORT,		2, 1),
+	AXP20X_IRQ(PEK_LONG,		2, 0),
+	AXP20X_IRQ(N_OE_PWR_ON,		3, 7),
+	AXP20X_IRQ(N_OE_PWR_OFF,	3, 6),
+	AXP20X_IRQ(VBUS_VALID,		3, 5),
+	AXP20X_IRQ(VBUS_NOT_VALID,	3, 4),
+	AXP20X_IRQ(VBUS_SESS_VALID,	3, 3),
+	AXP20X_IRQ(VBUS_SESS_END,	3, 2),
+	AXP20X_IRQ(LOW_PWR_LVL1,	3, 1),
+	AXP20X_IRQ(LOW_PWR_LVL2,	3, 0),
+	AXP20X_IRQ(TIMER,		4, 7),
+	AXP20X_IRQ(PEK_RIS_EDGE,	4, 6),
+	AXP20X_IRQ(PEK_FAL_EDGE,	4, 5),
+	AXP20X_IRQ(GPIO3_INPUT,		4, 3),
+	AXP20X_IRQ(GPIO2_INPUT,		4, 2),
+	AXP20X_IRQ(GPIO1_INPUT,		4, 1),
+	AXP20X_IRQ(GPIO0_INPUT,		4, 0),
+};
+
+static const struct of_device_id axp20x_of_match[] = {
+	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_of_match);
+
+/*
+ * This is useless for OF-enabled devices, but it is needed by I2C subsystem
+ */
+static const struct i2c_device_id axp20x_i2c_id[] = {
+	{ },
+};
+MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
+
+static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
+	.name			= "axp20x_irq_chip",
+	.status_base		= AXP20X_IRQ1_STATE,
+	.ack_base		= AXP20X_IRQ1_STATE,
+	.mask_base		= AXP20X_IRQ1_EN,
+	.num_regs		= 5,
+	.irqs			= axp20x_regmap_irqs,
+	.num_irqs		= ARRAY_SIZE(axp20x_regmap_irqs),
+	.mask_invert		= true,
+	.init_ack_masked	= true,
+};
+
+static struct mfd_cell axp20x_cells[] = {
+	{
+		.of_compatible	= "x-powers,axp20x-pek",
+		.name		= "axp20x-pek",
+		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
+		.resources	= axp20x_pek_resources,
+	}, {
+		.of_compatible	= "x-powers,axp20x-reg",
+		.name		= "axp20x-regulator",
+	},
+};
+
+static struct axp20x_dev *axp20x_pm_power_off;
+static void axp20x_power_off(void)
+{
+	regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
+		     AXP20X_OFF);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+			 const struct i2c_device_id *id)
+{
+	struct axp20x_dev *axp20x;
+	const struct of_device_id *of_id;
+	int ret;
+
+	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	of_id = of_match_device(axp20x_of_match, &i2c->dev);
+	if (!of_id) {
+		dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
+		return -ENODEV;
+	}
+	axp20x->variant = (long) of_id->data;
+
+	axp20x->i2c_client = i2c;
+	axp20x->dev = &i2c->dev;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq,
+				  IRQF_ONESHOT | IRQF_SHARED, -1,
+				  &axp20x_regmap_irq_chip,
+				  &axp20x->regmap_irqc);
+	if (ret) {
+		dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret);
+		return ret;
+	}
+
+	ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells,
+			      ARRAY_SIZE(axp20x_cells), NULL, 0, NULL);
+
+	if (ret) {
+		dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
+		regmap_del_irq_chip(i2c->irq, axp20x->regmap_irqc);
+		return ret;
+	}
+
+	if (!pm_power_off) {
+		axp20x_pm_power_off = axp20x;
+		pm_power_off = axp20x_power_off;
+	}
+
+	dev_info(&i2c->dev, "AXP20X driver loaded\n");
+
+	return 0;
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+	if (axp20x == axp20x_pm_power_off) {
+		axp20x_pm_power_off = NULL;
+		pm_power_off = NULL;
+	}
+
+	mfd_remove_devices(axp20x->dev);
+	regmap_del_irq_chip(axp20x->i2c_client->irq, axp20x->regmap_irqc);
+
+	return 0;
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x",
+		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(axp20x_of_match),
+	},
+	.probe		= axp20x_i2c_probe,
+	.remove		= axp20x_i2c_remove,
+	.id_table	= axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
new file mode 100644
index 0000000..d0e31a2
--- /dev/null
+++ b/include/linux/mfd/axp20x.h
@@ -0,0 +1,180 @@
+/*
+ * Functions and registers to access AXP20X power management chip.
+ *
+ * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_MFD_AXP20X_H
+#define __LINUX_MFD_AXP20X_H
+
+enum {
+	AXP202_ID = 0,
+	AXP209_ID,
+};
+
+#define AXP20X_DATACACHE(m)		(0x04 + (m))
+
+/* Power supply */
+#define AXP20X_PWR_INPUT_STATUS		0x00
+#define AXP20X_PWR_OP_MODE		0x01
+#define AXP20X_USB_OTG_STATUS		0x02
+#define AXP20X_PWR_OUT_CTRL		0x12
+#define AXP20X_DCDC2_V_OUT		0x23
+#define AXP20X_DCDC2_LDO3_V_SCAL	0x25
+#define AXP20X_DCDC3_V_OUT		0x27
+#define AXP20X_LDO24_V_OUT		0x28
+#define AXP20X_LDO3_V_OUT		0x29
+#define AXP20X_VBUS_IPSOUT_MGMT		0x30
+#define AXP20X_V_OFF			0x31
+#define AXP20X_OFF_CTRL			0x32
+#define AXP20X_CHRG_CTRL1		0x33
+#define AXP20X_CHRG_CTRL2		0x34
+#define AXP20X_CHRG_BAK_CTRL		0x35
+#define AXP20X_PEK_KEY			0x36
+#define AXP20X_DCDC_FREQ		0x37
+#define AXP20X_V_LTF_CHRG		0x38
+#define AXP20X_V_HTF_CHRG		0x39
+#define AXP20X_APS_WARN_L1		0x3a
+#define AXP20X_APS_WARN_L2		0x3b
+#define AXP20X_V_LTF_DISCHRG		0x3c
+#define AXP20X_V_HTF_DISCHRG		0x3d
+
+/* Interrupt */
+#define AXP20X_IRQ1_EN			0x40
+#define AXP20X_IRQ2_EN			0x41
+#define AXP20X_IRQ3_EN			0x42
+#define AXP20X_IRQ4_EN			0x43
+#define AXP20X_IRQ5_EN			0x44
+#define AXP20X_IRQ1_STATE		0x48
+#define AXP20X_IRQ2_STATE		0x49
+#define AXP20X_IRQ3_STATE		0x4a
+#define AXP20X_IRQ4_STATE		0x4b
+#define AXP20X_IRQ5_STATE		0x4c
+
+/* ADC */
+#define AXP20X_ACIN_V_ADC_H		0x56
+#define AXP20X_ACIN_V_ADC_L		0x57
+#define AXP20X_ACIN_I_ADC_H		0x58
+#define AXP20X_ACIN_I_ADC_L		0x59
+#define AXP20X_VBUS_V_ADC_H		0x5a
+#define AXP20X_VBUS_V_ADC_L		0x5b
+#define AXP20X_VBUS_I_ADC_H		0x5c
+#define AXP20X_VBUS_I_ADC_L		0x5d
+#define AXP20X_TEMP_ADC_H		0x5e
+#define AXP20X_TEMP_ADC_L		0x5f
+#define AXP20X_TS_IN_H			0x62
+#define AXP20X_TS_IN_L			0x63
+#define AXP20X_GPIO0_V_ADC_H		0x64
+#define AXP20X_GPIO0_V_ADC_L		0x65
+#define AXP20X_GPIO1_V_ADC_H		0x66
+#define AXP20X_GPIO1_V_ADC_L		0x67
+#define AXP20X_PWR_BATT_H		0x70
+#define AXP20X_PWR_BATT_M		0x71
+#define AXP20X_PWR_BATT_L		0x72
+#define AXP20X_BATT_V_H			0x78
+#define AXP20X_BATT_V_L			0x79
+#define AXP20X_BATT_CHRG_I_H		0x7a
+#define AXP20X_BATT_CHRG_I_L		0x7b
+#define AXP20X_BATT_DISCHRG_I_H		0x7c
+#define AXP20X_BATT_DISCHRG_I_L		0x7d
+#define AXP20X_IPSOUT_V_HIGH_H		0x7e
+#define AXP20X_IPSOUT_V_HIGH_L		0x7f
+
+/* Power supply */
+#define AXP20X_DCDC_MODE		0x80
+#define AXP20X_ADC_EN1			0x82
+#define AXP20X_ADC_EN2			0x83
+#define AXP20X_ADC_RATE			0x84
+#define AXP20X_GPIO10_IN_RANGE		0x85
+#define AXP20X_GPIO1_ADC_IRQ_RIS	0x86
+#define AXP20X_GPIO1_ADC_IRQ_FAL	0x87
+#define AXP20X_TIMER_CTRL		0x8a
+#define AXP20X_VBUS_MON			0x8b
+#define AXP20X_OVER_TMP			0x8f
+
+/* GPIO */
+#define AXP20X_GPIO0_CTRL		0x90
+#define AXP20X_LDO5_V_OUT		0x91
+#define AXP20X_GPIO1_CTRL		0x92
+#define AXP20X_GPIO2_CTRL		0x93
+#define AXP20X_GPIO20_SS		0x94
+#define AXP20X_GPIO3_CTRL		0x95
+
+/* Battery */
+#define AXP20X_CHRG_CC_31_24		0xb0
+#define AXP20X_CHRG_CC_23_16		0xb1
+#define AXP20X_CHRG_CC_15_8		0xb2
+#define AXP20X_CHRG_CC_7_0		0xb3
+#define AXP20X_DISCHRG_CC_31_24		0xb4
+#define AXP20X_DISCHRG_CC_23_16		0xb5
+#define AXP20X_DISCHRG_CC_15_8		0xb6
+#define AXP20X_DISCHRG_CC_7_0		0xb7
+#define AXP20X_CC_CTRL			0xb8
+#define AXP20X_FG_RES			0xb9
+
+/* Regulators IDs */
+enum {
+	AXP20X_LDO1 = 0,
+	AXP20X_LDO2,
+	AXP20X_LDO3,
+	AXP20X_LDO4,
+	AXP20X_LDO5,
+	AXP20X_DCDC2,
+	AXP20X_DCDC3,
+	AXP20X_REG_ID_MAX,
+};
+
+/* IRQs */
+enum {
+	AXP20X_IRQ_ACIN_OVER_V = 1,
+	AXP20X_IRQ_ACIN_PLUGIN,
+	AXP20X_IRQ_ACIN_REMOVAL,
+	AXP20X_IRQ_VBUS_OVER_V,
+	AXP20X_IRQ_VBUS_PLUGIN,
+	AXP20X_IRQ_VBUS_REMOVAL,
+	AXP20X_IRQ_VBUS_V_LOW,
+	AXP20X_IRQ_BATT_PLUGIN,
+	AXP20X_IRQ_BATT_REMOVAL,
+	AXP20X_IRQ_BATT_ENT_ACT_MODE,
+	AXP20X_IRQ_BATT_EXIT_ACT_MODE,
+	AXP20X_IRQ_CHARG,
+	AXP20X_IRQ_CHARG_DONE,
+	AXP20X_IRQ_BATT_TEMP_HIGH,
+	AXP20X_IRQ_BATT_TEMP_LOW,
+	AXP20X_IRQ_DIE_TEMP_HIGH,
+	AXP20X_IRQ_CHARG_I_LOW,
+	AXP20X_IRQ_DCDC1_V_LONG,
+	AXP20X_IRQ_DCDC2_V_LONG,
+	AXP20X_IRQ_DCDC3_V_LONG,
+	AXP20X_IRQ_PEK_SHORT = 22,
+	AXP20X_IRQ_PEK_LONG,
+	AXP20X_IRQ_N_OE_PWR_ON,
+	AXP20X_IRQ_N_OE_PWR_OFF,
+	AXP20X_IRQ_VBUS_VALID,
+	AXP20X_IRQ_VBUS_NOT_VALID,
+	AXP20X_IRQ_VBUS_SESS_VALID,
+	AXP20X_IRQ_VBUS_SESS_END,
+	AXP20X_IRQ_LOW_PWR_LVL1,
+	AXP20X_IRQ_LOW_PWR_LVL2,
+	AXP20X_IRQ_TIMER,
+	AXP20X_IRQ_PEK_RIS_EDGE,
+	AXP20X_IRQ_PEK_FAL_EDGE,
+	AXP20X_IRQ_GPIO3_INPUT,
+	AXP20X_IRQ_GPIO2_INPUT,
+	AXP20X_IRQ_GPIO1_INPUT,
+	AXP20X_IRQ_GPIO0_INPUT,
+};
+
+struct axp20x_dev {
+	struct device			*dev;
+	struct i2c_client		*i2c_client;
+	struct regmap			*regmap;
+	struct regmap_irq_chip_data	*regmap_irqc;
+	long				variant;
+};
+
+#endif /* __LINUX_MFD_AXP20X_H */
-- 
1.8.3.2

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

* [PATCH v4 2/9] dt-bindings: add vendor-prefix for X-Powers
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 40ce2df..d06ba8c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -95,3 +95,4 @@ winbond Winbond Electronics corp.
 wlf	Wolfson Microelectronics
 wm	Wondermedia Technologies, Inc.
 xlnx	Xilinx
+x-powers	X-Powers
-- 
1.8.3.2

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

* [PATCH v4 2/9] dt-bindings: add vendor-prefix for X-Powers
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 40ce2df..d06ba8c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -95,3 +95,4 @@ winbond Winbond Electronics corp.
 wlf	Wolfson Microelectronics
 wm	Wondermedia Technologies, Inc.
 xlnx	Xilinx
+x-powers	X-Powers
-- 
1.8.3.2

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

* [PATCH v4 3/9] mfd: AXP20x: Add bindings documentation
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Bindings documentation for the AXP20x driver. In this file also
sub-nodes are documented.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 96 ++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
new file mode 100644
index 0000000..f0d894a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,96 @@
+AXP202/AXP209 device tree bindings
+
+The axp20x family current members :-
+axp202 (X-Powers)
+axp209 (X-Powers)
+
+Required properties:
+- compatible: "x-powers,axp202" or "x-powers,axp209"
+- reg: The I2C slave address for the AXP chip
+- interrupt-parent: The parent interrupt controller
+- interrupts: Interrupt specifiers for interrupt sources
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- acin-supply: The input supply for LDO1
+- vin2-supply: The input supply for DCDC2
+- vin3-supply: The input supply for DCDC3
+- ldo24in-supply: The input supply for LDO2, LDO4
+- ldo3in-supply: The input supply for LDO3
+- ldo5in-supply: The input supply for LDO5
+
+- regulators: A node that houses a sub-node for each regulator. The regulators are
+	      bound using their name as listed here: dcdc2, dcdc3, ldo1, ldo2,
+	      ldo3, ldo4, ldo5.  The bindings details of individual regulator
+	      device can be found in:
+	      Documentation/devicetree/bindings/regulator/regulator.txt with
+	      the exception of x-powers,dcdc-freq
+- compatible (for regulators): "x-powers,axp20x-reg"
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties for DCDCs:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
+			  Default: AUTO mode
+
+Example:
+
+axp209: pmic@34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 8>;
+
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	acin-supply = <&axp_ipsout_reg>;
+	vin2-supply = <&axp_ipsout_reg>;
+	vin3-supply = <&axp_ipsout_reg>;
+	ldo24in-supply = <&axp_ipsout_reg>;
+	ldo3in-supply = <&axp_ipsout_reg>;
+	ldo5in-supply = <&axp_ipsout_reg>;
+
+	regulators {
+		compatible = "x-powers,axp20x-reg";
+
+		x-powers,dcdc-freq = <1500>;
+
+		axp_vcore_reg: dcdc2 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <2275000>;
+			regulator-always-on;
+		};
+
+		axp_ddr_reg: dcdc3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+			regulator-always-on;
+		};
+
+		axp_rtc_reg: ldo1 {
+			regulator-always-on;
+		};
+
+		axp_analog_reg: ldo2 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		axp_pll_reg: ldo3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+		};
+
+		axp_hdmi_reg: ldo4 {
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		axp_mic_reg: ldo5 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+		};
+	};
+};
+
-- 
1.8.3.2

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

* [PATCH v4 3/9] mfd: AXP20x: Add bindings documentation
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Bindings documentation for the AXP20x driver. In this file also
sub-nodes are documented.

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 96 ++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
new file mode 100644
index 0000000..f0d894a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -0,0 +1,96 @@
+AXP202/AXP209 device tree bindings
+
+The axp20x family current members :-
+axp202 (X-Powers)
+axp209 (X-Powers)
+
+Required properties:
+- compatible: "x-powers,axp202" or "x-powers,axp209"
+- reg: The I2C slave address for the AXP chip
+- interrupt-parent: The parent interrupt controller
+- interrupts: Interrupt specifiers for interrupt sources
+- interrupt-controller: axp20x has its own internal IRQs
+- #interrupt-cells: Should be set to 1
+- acin-supply: The input supply for LDO1
+- vin2-supply: The input supply for DCDC2
+- vin3-supply: The input supply for DCDC3
+- ldo24in-supply: The input supply for LDO2, LDO4
+- ldo3in-supply: The input supply for LDO3
+- ldo5in-supply: The input supply for LDO5
+
+- regulators: A node that houses a sub-node for each regulator. The regulators are
+	      bound using their name as listed here: dcdc2, dcdc3, ldo1, ldo2,
+	      ldo3, ldo4, ldo5.  The bindings details of individual regulator
+	      device can be found in:
+	      Documentation/devicetree/bindings/regulator/regulator.txt with
+	      the exception of x-powers,dcdc-freq
+- compatible (for regulators): "x-powers,axp20x-reg"
+- x-powers,dcdc-freq: defines the work frequency of DC-DC in KHz
+		      (range: 750-1875). Default: 1.5MHz
+
+Optional properties for DCDCs:
+- x-powers,dcdc-workmode: 1 for PWM mode, 0 for AUTO mode
+			  Default: AUTO mode
+
+Example:
+
+axp209: pmic at 34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 8>;
+
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	acin-supply = <&axp_ipsout_reg>;
+	vin2-supply = <&axp_ipsout_reg>;
+	vin3-supply = <&axp_ipsout_reg>;
+	ldo24in-supply = <&axp_ipsout_reg>;
+	ldo3in-supply = <&axp_ipsout_reg>;
+	ldo5in-supply = <&axp_ipsout_reg>;
+
+	regulators {
+		compatible = "x-powers,axp20x-reg";
+
+		x-powers,dcdc-freq = <1500>;
+
+		axp_vcore_reg: dcdc2 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <2275000>;
+			regulator-always-on;
+		};
+
+		axp_ddr_reg: dcdc3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+			regulator-always-on;
+		};
+
+		axp_rtc_reg: ldo1 {
+			regulator-always-on;
+		};
+
+		axp_analog_reg: ldo2 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+
+		axp_pll_reg: ldo3 {
+			regulator-min-microvolt = <700000>;
+			regulator-max-microvolt = <3500000>;
+		};
+
+		axp_hdmi_reg: ldo4 {
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <3300000>;
+		};
+
+		axp_mic_reg: ldo5 {
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+		};
+	};
+};
+
-- 
1.8.3.2

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

* [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

This patch add support for the Power Enable Key found on MFD AXP202 and
AXP209. Besides the basic support for the button, the driver adds two
entries in sysfs to configure the time delay for power on/off.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 261 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 273 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7904ab0..87244fb 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
 	  To compile this driver as a module, choose M here. The module will
 	  be called retu-pwrbutton.
 
+config INPUT_AXP20X_PEK
+	tristate "X-Powers AXP20X power button driver"
+	depends on MFD_AXP20X
+	help
+	  Say Y here if you want to enable power key reporting via the
+	  AXP20X PMIC.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called axp20x-pek.
+
+
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index cda71fc..624abf5 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
 obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
+obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
 obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
 obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
 obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
new file mode 100644
index 0000000..a9112bd
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,261 @@
+/*
+ * axp20x power button driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program 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.
+ */
+
+#include <linux/errno.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_PEK_STARTUP_MASK		(0xc0)
+#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
+
+struct axp20x_pek {
+	struct axp20x_dev *axp20x;
+	struct input_dev *input;
+	int irq_dbr;
+	int irq_dbf;
+};
+
+struct axp20x_time {
+	unsigned int time;
+	unsigned int idx;
+};
+
+static const struct axp20x_time startup_time[] = {
+	{ .time = 128,  .idx = 0 },
+	{ .time = 1000, .idx = 2 },
+	{ .time = 3000, .idx = 1 },
+	{ .time = 2000, .idx = 3 },
+};
+
+static const struct axp20x_time shutdown_time[] = {
+	{ .time = 4000,  .idx = 0 },
+	{ .time = 6000,  .idx = 1 },
+	{ .time = 8000,  .idx = 2 },
+	{ .time = 10000, .idx = 3 },
+};
+
+struct axp20x_pek_ext_attr {
+	const struct axp20x_time *p_time;
+	unsigned int mask;
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
+	.p_time	= startup_time,
+	.mask	= AXP20X_PEK_STARTUP_MASK,
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
+	.p_time	= shutdown_time,
+	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
+};
+
+static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
+{
+	return container_of(attr, struct dev_ext_attribute, attr)->var;
+}
+
+static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
+				    char *buf)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	unsigned int val;
+	int ret, i;
+
+	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
+	if (ret != 0)
+		return ret;
+
+	val &= axp20x_ea->mask;
+	val >>= ffs(axp20x_ea->mask) - 1;
+
+	for (i = 0; i < 4; i++)
+		if (val == axp20x_ea->p_time[i].idx)
+			val = axp20x_ea->p_time[i].time;
+
+	return sprintf(buf, "%ums\n", val);
+}
+
+static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	char val_str[20];
+	size_t len;
+	int ret, i;
+	unsigned int val, idx = 0;
+	unsigned int best_err = UINT_MAX;
+
+	val_str[sizeof(val_str) - 1] = '\0';
+	strncpy(val_str, buf, sizeof(val_str) - 1);
+	len = strlen(val_str);
+
+	if (len && val_str[len - 1] == '\n')
+		val_str[len - 1] = '\0';
+
+	ret = kstrtouint(val_str, 10, &val);
+	if (ret)
+		return ret;
+
+	for (i = 3; i >= 0; i--) {
+		unsigned int err;
+
+		err = abs(axp20x_ea->p_time[i].time - val);
+		if (err < best_err) {
+			best_err = err;
+			idx = axp20x_ea->p_time[i].idx;
+		}
+
+		if (!err)
+			break;
+	}
+
+	idx <<= ffs(axp20x_ea->mask) - 1;
+	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
+				 AXP20X_PEK_KEY,
+				 axp20x_ea->mask, idx);
+	if (ret != 0)
+		return -EINVAL;
+	return count;
+}
+
+static struct dev_ext_attribute axp20x_dev_attr_startup = {
+	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_startup_ext_attr
+};
+
+static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
+	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_shutdown_ext_attr
+};
+
+static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
+{
+	struct input_dev *idev = pwr;
+	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
+
+	if (irq == axp20x_pek->irq_dbr)
+		input_report_key(idev, KEY_POWER, true);
+	else if (irq == axp20x_pek->irq_dbf)
+		input_report_key(idev, KEY_POWER, false);
+
+	input_sync(idev);
+
+	return IRQ_HANDLED;
+}
+
+static int axp20x_pek_probe(struct platform_device *pdev)
+{
+	struct axp20x_pek *axp20x_pek;
+	struct axp20x_dev *axp20x;
+	struct input_dev *idev;
+	int error;
+
+	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
+				  GFP_KERNEL);
+	if (!axp20x_pek)
+		return -ENOMEM;
+
+	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
+	axp20x = axp20x_pek->axp20x;
+
+	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
+	if (axp20x_pek->irq_dbr < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
+				axp20x_pek->irq_dbr);
+		return axp20x_pek->irq_dbr;
+	}
+	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbr);
+
+	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
+	if (axp20x_pek->irq_dbf < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
+				axp20x_pek->irq_dbf);
+		return axp20x_pek->irq_dbf;
+	}
+	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbf);
+
+	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
+	if (!axp20x_pek->input)
+		return -ENOMEM;
+
+	idev = axp20x_pek->input;
+
+	idev->name = "axp20x-pek";
+	idev->phys = "m1kbd/input2";
+	idev->dev.parent = &pdev->dev;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	input_set_drvdata(idev, axp20x_pek);
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbr", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
+			axp20x_pek->irq_dbr, error);
+
+		return error;
+	}
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbf", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
+			axp20x_pek->irq_dbf, error);
+		return error;
+	}
+
+
+	if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
+	    device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
+		return -ENODEV;
+
+	error = input_register_device(idev);
+	if (error) {
+		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
+		return error;
+	}
+
+	platform_set_drvdata(pdev, axp20x_pek);
+
+	return 0;
+}
+
+static struct platform_driver axp20x_pek_driver = {
+	.probe		= axp20x_pek_probe,
+	.driver		= {
+		.name		= "axp20x-pek",
+		.owner		= THIS_MODULE,
+	},
+};
+module_platform_driver(axp20x_pek_driver);
+
+MODULE_DESCRIPTION("axp20x Power Button");
+MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
+MODULE_LICENSE("GPL");
-- 
1.8.3.2

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

* [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

This patch add support for the Power Enable Key found on MFD AXP202 and
AXP209. Besides the basic support for the button, the driver adds two
entries in sysfs to configure the time delay for power on/off.

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 drivers/input/misc/Kconfig      |  11 ++
 drivers/input/misc/Makefile     |   1 +
 drivers/input/misc/axp20x-pek.c | 261 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 273 insertions(+)
 create mode 100644 drivers/input/misc/axp20x-pek.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7904ab0..87244fb 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
 	  To compile this driver as a module, choose M here. The module will
 	  be called retu-pwrbutton.
 
+config INPUT_AXP20X_PEK
+	tristate "X-Powers AXP20X power button driver"
+	depends on MFD_AXP20X
+	help
+	  Say Y here if you want to enable power key reporting via the
+	  AXP20X PMIC.
+
+	  To compile this driver as a module, choose M here. The module will
+	  be called axp20x-pek.
+
+
 config INPUT_TWL4030_PWRBUTTON
 	tristate "TWL4030 Power button Driver"
 	depends on TWL4030_CORE
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index cda71fc..624abf5 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
 obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
 obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
 obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
+obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
 obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
 obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
 obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
new file mode 100644
index 0000000..a9112bd
--- /dev/null
+++ b/drivers/input/misc/axp20x-pek.c
@@ -0,0 +1,261 @@
+/*
+ * axp20x power button driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo@caione.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program 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.
+ */
+
+#include <linux/errno.h>
+#include <linux/irq.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_PEK_STARTUP_MASK		(0xc0)
+#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
+
+struct axp20x_pek {
+	struct axp20x_dev *axp20x;
+	struct input_dev *input;
+	int irq_dbr;
+	int irq_dbf;
+};
+
+struct axp20x_time {
+	unsigned int time;
+	unsigned int idx;
+};
+
+static const struct axp20x_time startup_time[] = {
+	{ .time = 128,  .idx = 0 },
+	{ .time = 1000, .idx = 2 },
+	{ .time = 3000, .idx = 1 },
+	{ .time = 2000, .idx = 3 },
+};
+
+static const struct axp20x_time shutdown_time[] = {
+	{ .time = 4000,  .idx = 0 },
+	{ .time = 6000,  .idx = 1 },
+	{ .time = 8000,  .idx = 2 },
+	{ .time = 10000, .idx = 3 },
+};
+
+struct axp20x_pek_ext_attr {
+	const struct axp20x_time *p_time;
+	unsigned int mask;
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
+	.p_time	= startup_time,
+	.mask	= AXP20X_PEK_STARTUP_MASK,
+};
+
+static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
+	.p_time	= shutdown_time,
+	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
+};
+
+static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
+{
+	return container_of(attr, struct dev_ext_attribute, attr)->var;
+}
+
+static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
+				    char *buf)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	unsigned int val;
+	int ret, i;
+
+	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
+	if (ret != 0)
+		return ret;
+
+	val &= axp20x_ea->mask;
+	val >>= ffs(axp20x_ea->mask) - 1;
+
+	for (i = 0; i < 4; i++)
+		if (val == axp20x_ea->p_time[i].idx)
+			val = axp20x_ea->p_time[i].time;
+
+	return sprintf(buf, "%ums\n", val);
+}
+
+static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
+				     const char *buf, size_t count)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
+	char val_str[20];
+	size_t len;
+	int ret, i;
+	unsigned int val, idx = 0;
+	unsigned int best_err = UINT_MAX;
+
+	val_str[sizeof(val_str) - 1] = '\0';
+	strncpy(val_str, buf, sizeof(val_str) - 1);
+	len = strlen(val_str);
+
+	if (len && val_str[len - 1] == '\n')
+		val_str[len - 1] = '\0';
+
+	ret = kstrtouint(val_str, 10, &val);
+	if (ret)
+		return ret;
+
+	for (i = 3; i >= 0; i--) {
+		unsigned int err;
+
+		err = abs(axp20x_ea->p_time[i].time - val);
+		if (err < best_err) {
+			best_err = err;
+			idx = axp20x_ea->p_time[i].idx;
+		}
+
+		if (!err)
+			break;
+	}
+
+	idx <<= ffs(axp20x_ea->mask) - 1;
+	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
+				 AXP20X_PEK_KEY,
+				 axp20x_ea->mask, idx);
+	if (ret != 0)
+		return -EINVAL;
+	return count;
+}
+
+static struct dev_ext_attribute axp20x_dev_attr_startup = {
+	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_startup_ext_attr
+};
+
+static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
+	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
+	.var	= &axp20x_pek_shutdown_ext_attr
+};
+
+static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
+{
+	struct input_dev *idev = pwr;
+	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
+
+	if (irq == axp20x_pek->irq_dbr)
+		input_report_key(idev, KEY_POWER, true);
+	else if (irq == axp20x_pek->irq_dbf)
+		input_report_key(idev, KEY_POWER, false);
+
+	input_sync(idev);
+
+	return IRQ_HANDLED;
+}
+
+static int axp20x_pek_probe(struct platform_device *pdev)
+{
+	struct axp20x_pek *axp20x_pek;
+	struct axp20x_dev *axp20x;
+	struct input_dev *idev;
+	int error;
+
+	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
+				  GFP_KERNEL);
+	if (!axp20x_pek)
+		return -ENOMEM;
+
+	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
+	axp20x = axp20x_pek->axp20x;
+
+	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
+	if (axp20x_pek->irq_dbr < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
+				axp20x_pek->irq_dbr);
+		return axp20x_pek->irq_dbr;
+	}
+	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbr);
+
+	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
+	if (axp20x_pek->irq_dbf < 0) {
+		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
+				axp20x_pek->irq_dbf);
+		return axp20x_pek->irq_dbf;
+	}
+	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
+						  axp20x_pek->irq_dbf);
+
+	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
+	if (!axp20x_pek->input)
+		return -ENOMEM;
+
+	idev = axp20x_pek->input;
+
+	idev->name = "axp20x-pek";
+	idev->phys = "m1kbd/input2";
+	idev->dev.parent = &pdev->dev;
+
+	input_set_capability(idev, EV_KEY, KEY_POWER);
+
+	input_set_drvdata(idev, axp20x_pek);
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbr", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
+			axp20x_pek->irq_dbr, error);
+
+		return error;
+	}
+
+	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
+					  axp20x_pek_irq, 0,
+					  "axp20x-pek-dbf", idev);
+	if (error < 0) {
+		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
+			axp20x_pek->irq_dbf, error);
+		return error;
+	}
+
+
+	if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
+	    device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
+		return -ENODEV;
+
+	error = input_register_device(idev);
+	if (error) {
+		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
+		return error;
+	}
+
+	platform_set_drvdata(pdev, axp20x_pek);
+
+	return 0;
+}
+
+static struct platform_driver axp20x_pek_driver = {
+	.probe		= axp20x_pek_probe,
+	.driver		= {
+		.name		= "axp20x-pek",
+		.owner		= THIS_MODULE,
+	},
+};
+module_platform_driver(axp20x_pek_driver);
+
+MODULE_DESCRIPTION("axp20x Power Button");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_LICENSE("GPL");
-- 
1.8.3.2

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

* [PATCH v4 5/9] input: misc: Add ABI docs for AXP20x PEK
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 Documentation/ABI/testing/sysfs-driver-input-axp-pek | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek

diff --git a/Documentation/ABI/testing/sysfs-driver-input-axp-pek b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
new file mode 100644
index 0000000..f8cdad2
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/startup
+Date:		March 2014
+Contact:	Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+Description:	Startup time. Board is powered on if the button is pressed
+		for more than <startup_time>
+
+What:		/sys/class/input/input(x)/shutdown
+Date:		March 2014
+Contact:	Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+Description:	Shutdown time. Board is powered off if the button is pressed
+		for more than <shutdown_time>
-- 
1.8.3.2

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

* [PATCH v4 5/9] input: misc: Add ABI docs for AXP20x PEK
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Add ABI entries for the PEK found on PMU X-Powers AXP202 and AXP209.

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 Documentation/ABI/testing/sysfs-driver-input-axp-pek | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek

diff --git a/Documentation/ABI/testing/sysfs-driver-input-axp-pek b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
new file mode 100644
index 0000000..f8cdad2
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-input-axp-pek
@@ -0,0 +1,11 @@
+What:		/sys/class/input/input(x)/startup
+Date:		March 2014
+Contact:	Carlo Caione <carlo@caione.org>
+Description:	Startup time. Board is powered on if the button is pressed
+		for more than <startup_time>
+
+What:		/sys/class/input/input(x)/shutdown
+Date:		March 2014
+Contact:	Carlo Caione <carlo@caione.org>
+Description:	Shutdown time. Board is powered off if the button is pressed
+		for more than <shutdown_time>
-- 
1.8.3.2

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

* [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
LDOs. This patch introduces basic support for those regulators.

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 drivers/regulator/Kconfig            |   7 +
 drivers/regulator/Makefile           |   1 +
 drivers/regulator/axp20x-regulator.c | 285 +++++++++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/regulator/axp20x-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 6a79328..9f3bc48 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -139,6 +139,13 @@ config REGULATOR_AS3722
 	  AS3722 PMIC. This will enable support for all the software
 	  controllable DCDC/LDO regulators.
 
+config REGULATOR_AXP20X
+	tristate "X-POWERS AXP20X PMIC Regulators"
+	depends on MFD_AXP20X
+	help
+	  This driver provides support for the voltage regulators on the
+	  AXP20X PMIC.
+
 config REGULATOR_DA903X
 	tristate "Dialog Semiconductor DA9030/DA9034 regulators"
 	depends on PMIC_DA903X
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 979f9dd..1dd084a 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
+obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055)	+= da9055-regulator.o
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
new file mode 100644
index 0000000..78a29e6
--- /dev/null
+++ b/drivers/regulator/axp20x-regulator.c
@@ -0,0 +1,285 @@
+/*
+ * AXP20x regulators driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program 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.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
+
+#define AXP20X_IO_ENABLED		0x03
+#define AXP20X_IO_DISABLED		0x07
+
+#define AXP20X_WORKMODE_DCDC2_MASK	BIT(2)
+#define AXP20X_WORKMODE_DCDC3_MASK	BIT(1)
+
+#define AXP20X_FREQ_DCDC_MASK		0x0f
+
+#define AXP20X_DESC_IO(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg,   \
+		       _emask, _enable_val, _disable_val)			\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_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),					\
+		.enable_val	= (_enable_val),				\
+		.disable_val	= (_disable_val),				\
+		.ops		= &axp20x_ops,					\
+	}
+
+#define AXP20X_DESC(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg,	\
+		    _emask) 							\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_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,					\
+	}
+
+#define AXP20X_DESC_FIXED(_id, _supply, _volt)					\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_id,					\
+		.n_voltages	= 1,						\
+		.owner		= THIS_MODULE,					\
+		.min_uV		= (_volt) * 1000,				\
+		.ops		= &axp20x_ops_fixed				\
+	}
+
+#define AXP20X_DESC_TABLE(_id, _supply, _table, _vreg, _vmask, _ereg, _emask)	\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_id,					\
+		.n_voltages	= ARRAY_SIZE(_table),				\
+		.owner		= THIS_MODULE,					\
+		.vsel_reg	= (_vreg),					\
+		.vsel_mask	= (_vmask),					\
+		.enable_reg	= (_ereg),					\
+		.enable_mask	= (_emask),					\
+		.volt_table	= (_table),					\
+		.ops		= &axp20x_ops_table,				\
+	}
+
+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 = {
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.list_voltage		= regulator_list_voltage_table,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops axp20x_ops = {
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.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,
+};
+
+static const struct regulator_desc axp20x_regulators[] = {
+	AXP20X_DESC(DCDC2, "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT, 0x3f,
+		    AXP20X_PWR_OUT_CTRL, 0x10),
+	AXP20X_DESC(DCDC3, "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT, 0x7f,
+		    AXP20X_PWR_OUT_CTRL, 0x02),
+	AXP20X_DESC_FIXED(LDO1, "acin", 1300),
+	AXP20X_DESC(LDO2, "ldo24in", 1800, 3300, 100, AXP20X_LDO24_V_OUT, 0xf0,
+		    AXP20X_PWR_OUT_CTRL, 0x04),
+	AXP20X_DESC(LDO3, "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT, 0x7f,
+		    AXP20X_PWR_OUT_CTRL, 0x40),
+	AXP20X_DESC_TABLE(LDO4, "ldo24in", axp20x_ldo4_data, AXP20X_LDO24_V_OUT, 0x0f,
+			  AXP20X_PWR_OUT_CTRL, 0x08),
+	AXP20X_DESC_IO(LDO5, "ldo5in", 1800, 3300, 100, AXP20X_LDO5_V_OUT, 0xf0,
+		       AXP20X_GPIO0_CTRL, 0x07, AXP20X_IO_ENABLED,
+		       AXP20X_IO_DISABLED),
+};
+
+#define AXP_MATCH(_name, _id) \
+	[AXP20X_##_id] = { \
+		.name		= #_name, \
+		.driver_data	= (void *) &axp20x_regulators[AXP20X_##_id], \
+	}
+
+static struct of_regulator_match axp20x_matches[] = {
+	AXP_MATCH(dcdc2, DCDC2),
+	AXP_MATCH(dcdc3, DCDC3),
+	AXP_MATCH(ldo1, LDO1),
+	AXP_MATCH(ldo2, LDO2),
+	AXP_MATCH(ldo3, LDO3),
+	AXP_MATCH(ldo4, LDO4),
+	AXP_MATCH(ldo5, LDO5),
+};
+
+static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
+{
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+
+	if (dcdcfreq < 750) {
+		dcdcfreq = 750;
+		dev_warn(&pdev->dev, "DCDC frequency too low. Set to 750kHz\n");
+	}
+
+	if (dcdcfreq > 1875) {
+		dcdcfreq = 1875;
+		dev_warn(&pdev->dev, "DCDC frequency too high. Set to 1875kHz\n");
+	}
+
+	dcdcfreq = (dcdcfreq - 750) / 75;
+
+	return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,
+				  AXP20X_FREQ_DCDC_MASK, dcdcfreq);
+}
+
+static int axp20x_regulator_parse_dt(struct platform_device *pdev)
+{
+	struct device_node *np, *regulators;
+	int ret;
+	u32 dcdcfreq;
+
+	np = of_node_get(pdev->dev.parent->of_node);
+	if (!np)
+		return 0;
+
+	regulators = of_find_node_by_name(np, "regulators");
+	if (!regulators) {
+		dev_warn(&pdev->dev, "regulators node not found\n");
+	} else {
+		ret = of_regulator_match(&pdev->dev, regulators, axp20x_matches,
+					 ARRAY_SIZE(axp20x_matches));
+		if (ret < 0) {
+			dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
+			return ret;
+		}
+
+		dcdcfreq = 1500;
+		of_property_read_u32(regulators, "x-powers,dcdc-freq", &dcdcfreq);
+		ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
+			return ret;
+		}
+
+		of_node_put(regulators);
+	}
+
+	return 0;
+}
+
+static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
+{
+	unsigned int mask = AXP20X_WORKMODE_DCDC2_MASK;
+
+	if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3))
+		return -EINVAL;
+
+	if (id == AXP20X_DCDC3)
+		mask = AXP20X_WORKMODE_DCDC3_MASK;
+
+	workmode <<= ffs(mask) - 1;
+
+	return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode);
+}
+
+static int axp20x_regulator_probe(struct platform_device *pdev)
+{
+	struct regulator_dev *rdev;
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+	struct regulator_config config = { };
+	struct regulator_init_data *init_data;
+	int ret, i;
+	u32 workmode;
+
+	ret = axp20x_regulator_parse_dt(pdev);
+	if (ret)
+		return ret;
+
+	for (i = 0; i < AXP20X_REG_ID_MAX; i++) {
+		init_data = axp20x_matches[i].init_data;
+
+		config.dev = &pdev->dev;
+		config.init_data = init_data;
+		config.regmap = axp20x->regmap;
+		config.of_node = axp20x_matches[i].of_node;
+
+		rdev = devm_regulator_register(&pdev->dev, &axp20x_regulators[i],
+					       &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register %s\n",
+				axp20x_regulators[i].name);
+
+			return PTR_ERR(rdev);
+		}
+
+		ret = of_property_read_u32(axp20x_matches[i].of_node, "x-powers,dcdc-workmode",
+					   &workmode);
+		if (!ret) {
+			if (axp20x_set_dcdc_workmode(rdev, i, workmode))
+				dev_err(&pdev->dev, "Failed to set workmode on %s\n",
+					axp20x_regulators[i].name);
+		}
+	}
+
+	return 0;
+}
+
+static struct platform_driver axp20x_regulator_driver = {
+	.probe	= axp20x_regulator_probe,
+	.driver	= {
+		.name		= "axp20x-regulator",
+		.owner		= THIS_MODULE,
+	},
+};
+
+module_platform_driver(axp20x_regulator_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
+MODULE_DESCRIPTION("Regulator Driver for AXP20X PMIC");
-- 
1.8.3.2

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

* [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
LDOs. This patch introduces basic support for those regulators.

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 drivers/regulator/Kconfig            |   7 +
 drivers/regulator/Makefile           |   1 +
 drivers/regulator/axp20x-regulator.c | 285 +++++++++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/regulator/axp20x-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 6a79328..9f3bc48 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -139,6 +139,13 @@ config REGULATOR_AS3722
 	  AS3722 PMIC. This will enable support for all the software
 	  controllable DCDC/LDO regulators.
 
+config REGULATOR_AXP20X
+	tristate "X-POWERS AXP20X PMIC Regulators"
+	depends on MFD_AXP20X
+	help
+	  This driver provides support for the voltage regulators on the
+	  AXP20X PMIC.
+
 config REGULATOR_DA903X
 	tristate "Dialog Semiconductor DA9030/DA9034 regulators"
 	depends on PMIC_DA903X
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 979f9dd..1dd084a 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
 obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o
+obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DA9055)	+= da9055-regulator.o
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
new file mode 100644
index 0000000..78a29e6
--- /dev/null
+++ b/drivers/regulator/axp20x-regulator.c
@@ -0,0 +1,285 @@
+/*
+ * AXP20x regulators driver.
+ *
+ * Copyright (C) 2013 Carlo Caione <carlo@caione.org>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program 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.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
+
+#define AXP20X_IO_ENABLED		0x03
+#define AXP20X_IO_DISABLED		0x07
+
+#define AXP20X_WORKMODE_DCDC2_MASK	BIT(2)
+#define AXP20X_WORKMODE_DCDC3_MASK	BIT(1)
+
+#define AXP20X_FREQ_DCDC_MASK		0x0f
+
+#define AXP20X_DESC_IO(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg,   \
+		       _emask, _enable_val, _disable_val)			\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_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),					\
+		.enable_val	= (_enable_val),				\
+		.disable_val	= (_disable_val),				\
+		.ops		= &axp20x_ops,					\
+	}
+
+#define AXP20X_DESC(_id, _supply, _min, _max, _step, _vreg, _vmask, _ereg,	\
+		    _emask) 							\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_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,					\
+	}
+
+#define AXP20X_DESC_FIXED(_id, _supply, _volt)					\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_id,					\
+		.n_voltages	= 1,						\
+		.owner		= THIS_MODULE,					\
+		.min_uV		= (_volt) * 1000,				\
+		.ops		= &axp20x_ops_fixed				\
+	}
+
+#define AXP20X_DESC_TABLE(_id, _supply, _table, _vreg, _vmask, _ereg, _emask)	\
+	[AXP20X_##_id] = {							\
+		.name		= #_id,						\
+		.supply_name	= (_supply),					\
+		.type		= REGULATOR_VOLTAGE,				\
+		.id		= AXP20X_##_id,					\
+		.n_voltages	= ARRAY_SIZE(_table),				\
+		.owner		= THIS_MODULE,					\
+		.vsel_reg	= (_vreg),					\
+		.vsel_mask	= (_vmask),					\
+		.enable_reg	= (_ereg),					\
+		.enable_mask	= (_emask),					\
+		.volt_table	= (_table),					\
+		.ops		= &axp20x_ops_table,				\
+	}
+
+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 = {
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.list_voltage		= regulator_list_voltage_table,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.is_enabled		= regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops axp20x_ops = {
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.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,
+};
+
+static const struct regulator_desc axp20x_regulators[] = {
+	AXP20X_DESC(DCDC2, "vin2", 700, 2275, 25, AXP20X_DCDC2_V_OUT, 0x3f,
+		    AXP20X_PWR_OUT_CTRL, 0x10),
+	AXP20X_DESC(DCDC3, "vin3", 700, 3500, 25, AXP20X_DCDC3_V_OUT, 0x7f,
+		    AXP20X_PWR_OUT_CTRL, 0x02),
+	AXP20X_DESC_FIXED(LDO1, "acin", 1300),
+	AXP20X_DESC(LDO2, "ldo24in", 1800, 3300, 100, AXP20X_LDO24_V_OUT, 0xf0,
+		    AXP20X_PWR_OUT_CTRL, 0x04),
+	AXP20X_DESC(LDO3, "ldo3in", 700, 3500, 25, AXP20X_LDO3_V_OUT, 0x7f,
+		    AXP20X_PWR_OUT_CTRL, 0x40),
+	AXP20X_DESC_TABLE(LDO4, "ldo24in", axp20x_ldo4_data, AXP20X_LDO24_V_OUT, 0x0f,
+			  AXP20X_PWR_OUT_CTRL, 0x08),
+	AXP20X_DESC_IO(LDO5, "ldo5in", 1800, 3300, 100, AXP20X_LDO5_V_OUT, 0xf0,
+		       AXP20X_GPIO0_CTRL, 0x07, AXP20X_IO_ENABLED,
+		       AXP20X_IO_DISABLED),
+};
+
+#define AXP_MATCH(_name, _id) \
+	[AXP20X_##_id] = { \
+		.name		= #_name, \
+		.driver_data	= (void *) &axp20x_regulators[AXP20X_##_id], \
+	}
+
+static struct of_regulator_match axp20x_matches[] = {
+	AXP_MATCH(dcdc2, DCDC2),
+	AXP_MATCH(dcdc3, DCDC3),
+	AXP_MATCH(ldo1, LDO1),
+	AXP_MATCH(ldo2, LDO2),
+	AXP_MATCH(ldo3, LDO3),
+	AXP_MATCH(ldo4, LDO4),
+	AXP_MATCH(ldo5, LDO5),
+};
+
+static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
+{
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+
+	if (dcdcfreq < 750) {
+		dcdcfreq = 750;
+		dev_warn(&pdev->dev, "DCDC frequency too low. Set to 750kHz\n");
+	}
+
+	if (dcdcfreq > 1875) {
+		dcdcfreq = 1875;
+		dev_warn(&pdev->dev, "DCDC frequency too high. Set to 1875kHz\n");
+	}
+
+	dcdcfreq = (dcdcfreq - 750) / 75;
+
+	return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,
+				  AXP20X_FREQ_DCDC_MASK, dcdcfreq);
+}
+
+static int axp20x_regulator_parse_dt(struct platform_device *pdev)
+{
+	struct device_node *np, *regulators;
+	int ret;
+	u32 dcdcfreq;
+
+	np = of_node_get(pdev->dev.parent->of_node);
+	if (!np)
+		return 0;
+
+	regulators = of_find_node_by_name(np, "regulators");
+	if (!regulators) {
+		dev_warn(&pdev->dev, "regulators node not found\n");
+	} else {
+		ret = of_regulator_match(&pdev->dev, regulators, axp20x_matches,
+					 ARRAY_SIZE(axp20x_matches));
+		if (ret < 0) {
+			dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
+			return ret;
+		}
+
+		dcdcfreq = 1500;
+		of_property_read_u32(regulators, "x-powers,dcdc-freq", &dcdcfreq);
+		ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
+			return ret;
+		}
+
+		of_node_put(regulators);
+	}
+
+	return 0;
+}
+
+static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
+{
+	unsigned int mask = AXP20X_WORKMODE_DCDC2_MASK;
+
+	if ((id != AXP20X_DCDC2) && (id != AXP20X_DCDC3))
+		return -EINVAL;
+
+	if (id == AXP20X_DCDC3)
+		mask = AXP20X_WORKMODE_DCDC3_MASK;
+
+	workmode <<= ffs(mask) - 1;
+
+	return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode);
+}
+
+static int axp20x_regulator_probe(struct platform_device *pdev)
+{
+	struct regulator_dev *rdev;
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+	struct regulator_config config = { };
+	struct regulator_init_data *init_data;
+	int ret, i;
+	u32 workmode;
+
+	ret = axp20x_regulator_parse_dt(pdev);
+	if (ret)
+		return ret;
+
+	for (i = 0; i < AXP20X_REG_ID_MAX; i++) {
+		init_data = axp20x_matches[i].init_data;
+
+		config.dev = &pdev->dev;
+		config.init_data = init_data;
+		config.regmap = axp20x->regmap;
+		config.of_node = axp20x_matches[i].of_node;
+
+		rdev = devm_regulator_register(&pdev->dev, &axp20x_regulators[i],
+					       &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register %s\n",
+				axp20x_regulators[i].name);
+
+			return PTR_ERR(rdev);
+		}
+
+		ret = of_property_read_u32(axp20x_matches[i].of_node, "x-powers,dcdc-workmode",
+					   &workmode);
+		if (!ret) {
+			if (axp20x_set_dcdc_workmode(rdev, i, workmode))
+				dev_err(&pdev->dev, "Failed to set workmode on %s\n",
+					axp20x_regulators[i].name);
+		}
+	}
+
+	return 0;
+}
+
+static struct platform_driver axp20x_regulator_driver = {
+	.probe	= axp20x_regulator_probe,
+	.driver	= {
+		.name		= "axp20x-regulator",
+		.owner		= THIS_MODULE,
+	},
+};
+
+module_platform_driver(axp20x_regulator_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
+MODULE_DESCRIPTION("Regulator Driver for AXP20X PMIC");
-- 
1.8.3.2

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---

In all the DTs the min and max microvolt allowed for each regulator are actually
the min and max voltage possible for the regulator itself. This is not safe but
we do not have the ranges allowed for each board and the original Allwinner 
driver does exactly this way.

AXP20x has the so called Power Path Management (IPS) that can select the proper
power supply according to the status of the external power and the Li-battery
status. The output of the IPS block is usually a 5V fixed voltage used as 
input supply for all the other regulators. This fixed voltage is represented
in the DT as a fixed voltage regulator in the "regulator" subnode.

 arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
 10 files changed, 711 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index fa746aea..029a880 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -88,6 +88,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 4684cbe..635fd4b 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -80,6 +80,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index d7c17e4..8f2db9c 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -82,6 +82,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c@01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	reg_emac_3v3: emac-3v3 {
diff --git a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
index fe9272e..c1d6fdb 100644
--- a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
+++ b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
@@ -34,6 +34,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		usbphy: phy@01c13400 {
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index dd84a9e..e472034 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -47,6 +47,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c@01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	reg_usb1_vbus: usb1-vbus {
diff --git a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
index 66cf0c7..84e6e20 100644
--- a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
@@ -81,6 +81,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c@01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	leds {
diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index 255b47e..42b15d2 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -66,6 +66,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index 68de89f..9f64f56 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -66,6 +66,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index cb25d3c..c8e6f1b 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -73,6 +73,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c@01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index eeadf76..6ec7137 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -95,6 +95,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic@34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c@01c2b000 {
-- 
1.8.3.2

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Carlo Caione <carlo@caione.org>
---

In all the DTs the min and max microvolt allowed for each regulator are actually
the min and max voltage possible for the regulator itself. This is not safe but
we do not have the ranges allowed for each board and the original Allwinner 
driver does exactly this way.

AXP20x has the so called Power Path Management (IPS) that can select the proper
power supply according to the status of the external power and the Li-battery
status. The output of the IPS block is usually a 5V fixed voltage used as 
input supply for all the other regulators. This fixed voltage is represented
in the DT as a fixed voltage regulator in the "regulator" subnode.

 arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
 10 files changed, 711 insertions(+)

diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
index fa746aea..029a880 100644
--- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
+++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
@@ -88,6 +88,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 4684cbe..635fd4b 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -80,6 +80,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c at 01c2b000 {
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index d7c17e4..8f2db9c 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -82,6 +82,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c at 01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	reg_emac_3v3: emac-3v3 {
diff --git a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
index fe9272e..c1d6fdb 100644
--- a/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
+++ b/arch/arm/boot/dts/sun4i-a10-inet97fv2.dts
@@ -34,6 +34,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		usbphy: phy at 01c13400 {
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
index dd84a9e..e472034 100644
--- a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -47,6 +47,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c at 01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	reg_usb1_vbus: usb1-vbus {
diff --git a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
index 66cf0c7..84e6e20 100644
--- a/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
+++ b/arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts
@@ -81,6 +81,81 @@
 			pinctrl-0 = <&uart0_pins_a>;
 			status = "okay";
 		};
+
+		i2c0: i2c at 01c2ac00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins_a>;
+			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
+		};
 	};
 
 	leds {
diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
index 255b47e..42b15d2 100644
--- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts
+++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts
@@ -66,6 +66,75 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupts = <0>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 	};
 
diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
index 68de89f..9f64f56 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts
@@ -66,6 +66,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c at 01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
index cb25d3c..c8e6f1b 100644
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
@@ -73,6 +73,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c at 01c2b000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index eeadf76..6ec7137 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -95,6 +95,76 @@
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins_a>;
 			status = "okay";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			axp209: pmic at 34 {
+				compatible = "x-powers,axp209";
+				reg = <0x34>;
+				interrupt-parent = <&nmi_intc>;
+				interrupts = <0 8>;
+
+				interrupt-controller;
+				#interrupt-cells = <1>;
+
+				acin-supply = <&axp_ipsout_reg>;
+				vin2-supply = <&axp_ipsout_reg>;
+				vin3-supply = <&axp_ipsout_reg>;
+				ldo24in-supply = <&axp_ipsout_reg>;
+				ldo3in-supply = <&axp_ipsout_reg>;
+				ldo5in-supply = <&axp_ipsout_reg>;
+
+				regulators {
+					compatible = "x-powers,axp20x-reg";
+
+					x-powers,dcdc-freq = <1500>;
+
+					axp_ipsout_reg: axp_ipsout {
+						compatible = "regulator-fixed";
+						regulator-name = "axp-ipsout";
+						regulator-min-microvolt = <5000000>;
+						regulator-max-microvolt = <5000000>;
+						regulator-always-on;
+					};
+
+					axp_vcore_reg: dcdc2 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <2275000>;
+						regulator-always-on;
+					};
+
+					axp_ddr_reg: dcdc3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+						regulator-always-on;
+					};
+
+					axp_rtc_reg: ldo1 {
+						regulator-always-on;
+					};
+
+					axp_analog_reg: ldo2 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+						regulator-always-on;
+					};
+
+					axp_pll_reg: ldo3 {
+						regulator-min-microvolt = <700000>;
+						regulator-max-microvolt = <3500000>;
+					};
+
+					axp_hdmi_reg: ldo4 {
+						regulator-min-microvolt = <1250000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					axp_mic_reg: ldo5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <3300000>;
+					};
+				};
+			};
 		};
 
 		i2c1: i2c at 01c2b000 {
-- 
1.8.3.2

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

* [PATCH v4 8/9] ARM: sunxi: Add AXP20x support in defconfig
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 arch/arm/configs/sunxi_defconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index b5df4a5..6e305da 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -40,6 +40,8 @@ CONFIG_SUN4I_EMAC=y
 # CONFIG_NET_VENDOR_STMICRO is not set
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
@@ -55,6 +57,7 @@ CONFIG_GPIO_SYSFS=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
 CONFIG_SUNXI_WATCHDOG=y
+CONFIG_MFD_AXP20X=y
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
@@ -69,3 +72,4 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS=y
 CONFIG_PRINTK_TIME=y
+CONFIG_REGULATOR_AXP20X=y
-- 
1.8.3.2

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

* [PATCH v4 8/9] ARM: sunxi: Add AXP20x support in defconfig
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 arch/arm/configs/sunxi_defconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig
index b5df4a5..6e305da 100644
--- a/arch/arm/configs/sunxi_defconfig
+++ b/arch/arm/configs/sunxi_defconfig
@@ -40,6 +40,8 @@ CONFIG_SUN4I_EMAC=y
 # CONFIG_NET_VENDOR_STMICRO is not set
 # CONFIG_NET_VENDOR_WIZNET is not set
 # CONFIG_WLAN is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=8
@@ -55,6 +57,7 @@ CONFIG_GPIO_SYSFS=y
 # CONFIG_HWMON is not set
 CONFIG_WATCHDOG=y
 CONFIG_SUNXI_WATCHDOG=y
+CONFIG_MFD_AXP20X=y
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
@@ -69,3 +72,4 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NLS=y
 CONFIG_PRINTK_TIME=y
+CONFIG_REGULATOR_AXP20X=y
-- 
1.8.3.2

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

* [PATCH v4 9/9] ARM: sunxi: Add AXP20x support multi_v7_defconfig
  2014-04-11  9:38 ` Carlo Caione
@ 2014-04-11  9:38     ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione

Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index ee69829..239c014 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -134,6 +134,7 @@ CONFIG_KEYBOARD_SPEAR=y
 CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_INPUT_MPU3050=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIAL_8250=y
@@ -189,6 +190,7 @@ CONFIG_SENSORS_LM90=y
 CONFIG_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
 CONFIG_MFD_AS3722=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
@@ -199,6 +201,7 @@ CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8907=y
 CONFIG_REGULATOR_PALMAS=y
-- 
1.8.3.2

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

* [PATCH v4 9/9] ARM: sunxi: Add AXP20x support multi_v7_defconfig
@ 2014-04-11  9:38     ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11  9:38 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Carlo Caione <carlo@caione.org>
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index ee69829..239c014 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -134,6 +134,7 @@ CONFIG_KEYBOARD_SPEAR=y
 CONFIG_KEYBOARD_CROS_EC=y
 CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_INPUT_MISC=y
+CONFIG_INPUT_AXP20X_PEK=y
 CONFIG_INPUT_MPU3050=y
 CONFIG_SERIO_AMBAKMI=y
 CONFIG_SERIAL_8250=y
@@ -189,6 +190,7 @@ CONFIG_SENSORS_LM90=y
 CONFIG_THERMAL=y
 CONFIG_ARMADA_THERMAL=y
 CONFIG_MFD_AS3722=y
+CONFIG_MFD_AXP20X=y
 CONFIG_MFD_CROS_EC=y
 CONFIG_MFD_CROS_EC_SPI=y
 CONFIG_MFD_MAX8907=y
@@ -199,6 +201,7 @@ CONFIG_MFD_TPS65910=y
 CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
 CONFIG_REGULATOR_AB8500=y
 CONFIG_REGULATOR_AS3722=y
+CONFIG_REGULATOR_AXP20X=y
 CONFIG_REGULATOR_GPIO=y
 CONFIG_REGULATOR_MAX8907=y
 CONFIG_REGULATOR_PALMAS=y
-- 
1.8.3.2

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

* Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-11 11:25         ` Arnd Bergmann
  -1 siblings, 0 replies; 74+ messages in thread
From: Arnd Bergmann @ 2014-04-11 11:25 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Carlo Caione, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Friday 11 April 2014 11:38:05 Carlo Caione wrote:
> +#define AXP20X_IRQ(_irq, _off, _mask) \
> +       [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
> +
> +static const struct regmap_irq axp20x_regmap_irqs[] = {
> +       AXP20X_IRQ(ACIN_OVER_V,         0, 7),
> +       AXP20X_IRQ(ACIN_PLUGIN,         0, 6),
> +       AXP20X_IRQ(ACIN_REMOVAL,        0, 5),
> +       AXP20X_IRQ(VBUS_OVER_V,         0, 4),
> +       AXP20X_IRQ(VBUS_PLUGIN,         0, 3),
> +       AXP20X_IRQ(VBUS_REMOVAL,        0, 2),
> +       AXP20X_IRQ(VBUS_V_LOW,          0, 1),
> +       AXP20X_IRQ(BATT_PLUGIN,         1, 7),
> +       AXP20X_IRQ(BATT_REMOVAL,        1, 6),
> +       AXP20X_IRQ(BATT_ENT_ACT_MODE,   1, 5),
> +       AXP20X_IRQ(BATT_EXIT_ACT_MODE,  1, 4),
> +       AXP20X_IRQ(CHARG,               1, 3),
> +       AXP20X_IRQ(CHARG_DONE,          1, 2),
> +       AXP20X_IRQ(BATT_TEMP_HIGH,      1, 1),

Why do you have to enumerate the interrupts here? Can't you just
put all the numbers into the DT nodes of the devices using them?

In general, I would say that the mfd driver should not care about
what is connected to it.

	Arnd

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-11 11:25         ` Arnd Bergmann
  0 siblings, 0 replies; 74+ messages in thread
From: Arnd Bergmann @ 2014-04-11 11:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 11 April 2014 11:38:05 Carlo Caione wrote:
> +#define AXP20X_IRQ(_irq, _off, _mask) \
> +       [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
> +
> +static const struct regmap_irq axp20x_regmap_irqs[] = {
> +       AXP20X_IRQ(ACIN_OVER_V,         0, 7),
> +       AXP20X_IRQ(ACIN_PLUGIN,         0, 6),
> +       AXP20X_IRQ(ACIN_REMOVAL,        0, 5),
> +       AXP20X_IRQ(VBUS_OVER_V,         0, 4),
> +       AXP20X_IRQ(VBUS_PLUGIN,         0, 3),
> +       AXP20X_IRQ(VBUS_REMOVAL,        0, 2),
> +       AXP20X_IRQ(VBUS_V_LOW,          0, 1),
> +       AXP20X_IRQ(BATT_PLUGIN,         1, 7),
> +       AXP20X_IRQ(BATT_REMOVAL,        1, 6),
> +       AXP20X_IRQ(BATT_ENT_ACT_MODE,   1, 5),
> +       AXP20X_IRQ(BATT_EXIT_ACT_MODE,  1, 4),
> +       AXP20X_IRQ(CHARG,               1, 3),
> +       AXP20X_IRQ(CHARG_DONE,          1, 2),
> +       AXP20X_IRQ(BATT_TEMP_HIGH,      1, 1),

Why do you have to enumerate the interrupts here? Can't you just
put all the numbers into the DT nodes of the devices using them?

In general, I would say that the mfd driver should not care about
what is connected to it.

	Arnd

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

* Re: [linux-sunxi] Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11 11:25         ` Arnd Bergmann
@ 2014-04-11 12:03           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 12:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, maxime.ripard, hdegoede, emilio, wens, sameo,
	dmitry.torokhov, linux-input, linux-doc, lgirdwood, broonie,
	lee.jones, boris.brezillon, linux-sunxi

On Fri, Apr 11, 2014 at 1:25 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Friday 11 April 2014 11:38:05 Carlo Caione wrote:
>> +#define AXP20X_IRQ(_irq, _off, _mask) \
>> +       [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
>> +
>> +static const struct regmap_irq axp20x_regmap_irqs[] = {
>> +       AXP20X_IRQ(ACIN_OVER_V,         0, 7),
>> +       AXP20X_IRQ(ACIN_PLUGIN,         0, 6),
>> +       AXP20X_IRQ(ACIN_REMOVAL,        0, 5),
>> +       AXP20X_IRQ(VBUS_OVER_V,         0, 4),
>> +       AXP20X_IRQ(VBUS_PLUGIN,         0, 3),
>> +       AXP20X_IRQ(VBUS_REMOVAL,        0, 2),
>> +       AXP20X_IRQ(VBUS_V_LOW,          0, 1),
>> +       AXP20X_IRQ(BATT_PLUGIN,         1, 7),
>> +       AXP20X_IRQ(BATT_REMOVAL,        1, 6),
>> +       AXP20X_IRQ(BATT_ENT_ACT_MODE,   1, 5),
>> +       AXP20X_IRQ(BATT_EXIT_ACT_MODE,  1, 4),
>> +       AXP20X_IRQ(CHARG,               1, 3),
>> +       AXP20X_IRQ(CHARG_DONE,          1, 2),
>> +       AXP20X_IRQ(BATT_TEMP_HIGH,      1, 1),
>
> Why do you have to enumerate the interrupts here? Can't you just
> put all the numbers into the DT nodes of the devices using them?
>
> In general, I would say that the mfd driver should not care about
> what is connected to it.

I need this for the regmap irq chip (to be used in regmap_add_irq_chip()).
I'm not sure if you are suggesting to get rid of the irq chip.

br,

-- 
Carlo Caione

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

* [linux-sunxi] Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-11 12:03           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 12:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 1:25 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Friday 11 April 2014 11:38:05 Carlo Caione wrote:
>> +#define AXP20X_IRQ(_irq, _off, _mask) \
>> +       [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
>> +
>> +static const struct regmap_irq axp20x_regmap_irqs[] = {
>> +       AXP20X_IRQ(ACIN_OVER_V,         0, 7),
>> +       AXP20X_IRQ(ACIN_PLUGIN,         0, 6),
>> +       AXP20X_IRQ(ACIN_REMOVAL,        0, 5),
>> +       AXP20X_IRQ(VBUS_OVER_V,         0, 4),
>> +       AXP20X_IRQ(VBUS_PLUGIN,         0, 3),
>> +       AXP20X_IRQ(VBUS_REMOVAL,        0, 2),
>> +       AXP20X_IRQ(VBUS_V_LOW,          0, 1),
>> +       AXP20X_IRQ(BATT_PLUGIN,         1, 7),
>> +       AXP20X_IRQ(BATT_REMOVAL,        1, 6),
>> +       AXP20X_IRQ(BATT_ENT_ACT_MODE,   1, 5),
>> +       AXP20X_IRQ(BATT_EXIT_ACT_MODE,  1, 4),
>> +       AXP20X_IRQ(CHARG,               1, 3),
>> +       AXP20X_IRQ(CHARG_DONE,          1, 2),
>> +       AXP20X_IRQ(BATT_TEMP_HIGH,      1, 1),
>
> Why do you have to enumerate the interrupts here? Can't you just
> put all the numbers into the DT nodes of the devices using them?
>
> In general, I would say that the mfd driver should not care about
> what is connected to it.

I need this for the regmap irq chip (to be used in regmap_add_irq_chip()).
I'm not sure if you are suggesting to get rid of the irq chip.

br,

-- 
Carlo Caione

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

* Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11 11:25         ` Arnd Bergmann
@ 2014-04-11 12:09           ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Carlo Caione,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Fri, Apr 11, 2014 at 01:25:03PM +0200, Arnd Bergmann wrote:

> Why do you have to enumerate the interrupts here? Can't you just
> put all the numbers into the DT nodes of the devices using them?

> In general, I would say that the mfd driver should not care about
> what is connected to it.

This then means that all the machines using the device need to define
the interrupt table and have the MFD cells represented in the DT which
means encoding Linux abstractions into the DT.

In cases where the device is also used with ACPI or platform data that's
a definite issue since they have different idioms.  That applies less to
PMICs tightly bound to particular SoCs but is an issue in general, not
all the world is DT.

There's also issues here with us changing our subsystems.  Things like
clocks are a bit indistinct at present, they're sort of floating between
clock and other subsystems.  We've also done things like invent extcon,
making completely new subdevices.  Keeping the data out of DT avoids
problems when this happens.  The balance changes a bit if there are
clearly reusable IPs within the device but sadly hardware designers
don't always give us that and even then sometimes we don't want to use
them like that.

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

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-11 12:09           ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 01:25:03PM +0200, Arnd Bergmann wrote:

> Why do you have to enumerate the interrupts here? Can't you just
> put all the numbers into the DT nodes of the devices using them?

> In general, I would say that the mfd driver should not care about
> what is connected to it.

This then means that all the machines using the device need to define
the interrupt table and have the MFD cells represented in the DT which
means encoding Linux abstractions into the DT.

In cases where the device is also used with ACPI or platform data that's
a definite issue since they have different idioms.  That applies less to
PMICs tightly bound to particular SoCs but is an issue in general, not
all the world is DT.

There's also issues here with us changing our subsystems.  Things like
clocks are a bit indistinct at present, they're sort of floating between
clock and other subsystems.  We've also done things like invent extcon,
making completely new subdevices.  Keeping the data out of DT avoids
problems when this happens.  The balance changes a bit if there are
clearly reusable IPs within the device but sadly hardware designers
don't always give us that and even then sometimes we don't want to use
them like that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140411/a6e837c1/attachment.sig>

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

* Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-11 12:23         ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:23 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Fri, Apr 11, 2014 at 11:38:10AM +0200, Carlo Caione wrote:
> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
> LDOs. This patch introduces basic support for those regulators.

Applied, thanks, but I had to resolve some trivial add/add conflicts
with the Broadcom regulator driver Makefile and Kconfig additions -
please remember to submit patches against current code.

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

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

* [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-04-11 12:23         ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 11:38:10AM +0200, Carlo Caione wrote:
> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
> LDOs. This patch introduces basic support for those regulators.

Applied, thanks, but I had to resolve some trivial add/add conflicts
with the Broadcom regulator driver Makefile and Kconfig additions -
please remember to submit patches against current code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140411/638e3f2c/attachment.sig>

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-11 12:29         ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:29 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:

> In all the DTs the min and max microvolt allowed for each regulator are actually
> the min and max voltage possible for the regulator itself. This is not safe but
> we do not have the ranges allowed for each board and the original Allwinner 
> driver does exactly this way.

Is there any code in their kernel which varies the supply voltages?  If
there isn't then simply omitting the voltage ranges is the best option,
leaving the supplies fixed.  If there is then the range it uses is a
good starting point.  In general supplies will be fixed voltage on a
given board unless there is a specific reason to vary them.

> +				regulators {
> +					compatible = "x-powers,axp20x-reg";

This compatible isn't part of the driver.

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

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-11 12:29         ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 12:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:

> In all the DTs the min and max microvolt allowed for each regulator are actually
> the min and max voltage possible for the regulator itself. This is not safe but
> we do not have the ranges allowed for each board and the original Allwinner 
> driver does exactly this way.

Is there any code in their kernel which varies the supply voltages?  If
there isn't then simply omitting the voltage ranges is the best option,
leaving the supplies fixed.  If there is then the range it uses is a
good starting point.  In general supplies will be fixed voltage on a
given board unless there is a specific reason to vary them.

> +				regulators {
> +					compatible = "x-powers,axp20x-reg";

This compatible isn't part of the driver.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140411/afa8ad0f/attachment.sig>

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

* Re: [linux-sunxi] Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-04-11 12:23         ` Mark Brown
@ 2014-04-11 12:29           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 12:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel, maxime.ripard, hdegoede, emilio, wens, sameo,
	dmitry.torokhov, linux-input, linux-doc, lgirdwood, lee.jones,
	boris.brezillon, linux-sunxi

On Fri, Apr 11, 2014 at 2:23 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 11, 2014 at 11:38:10AM +0200, Carlo Caione wrote:
>> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
>> LDOs. This patch introduces basic support for those regulators.
>
> Applied, thanks, but I had to resolve some trivial add/add conflicts
> with the Broadcom regulator driver Makefile and Kconfig additions -
> please remember to submit patches against current code.

Sorry, I'll do next time.

Thank you,

-- 
Carlo Caione

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

* [linux-sunxi] Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-04-11 12:29           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 12:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 2:23 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 11, 2014 at 11:38:10AM +0200, Carlo Caione wrote:
>> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
>> LDOs. This patch introduces basic support for those regulators.
>
> Applied, thanks, but I had to resolve some trivial add/add conflicts
> with the Broadcom regulator driver Makefile and Kconfig additions -
> please remember to submit patches against current code.

Sorry, I'll do next time.

Thank you,

-- 
Carlo Caione

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11 12:29         ` Mark Brown
@ 2014-04-11 13:04           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 13:04 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel, linux-sunxi, maxime.ripard, hdegoede, emilio,
	wens, sameo, dmitry.torokhov, linux-input, linux-doc, lgirdwood,
	lee.jones, boris.brezillon

On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>
>> In all the DTs the min and max microvolt allowed for each regulator are actually
>> the min and max voltage possible for the regulator itself. This is not safe but
>> we do not have the ranges allowed for each board and the original Allwinner
>> driver does exactly this way.
>
> Is there any code in their kernel which varies the supply voltages?  If
> there isn't then simply omitting the voltage ranges is the best option,
> leaving the supplies fixed.  If there is then the range it uses is a
> good starting point.  In general supplies will be fixed voltage on a
> given board unless there is a specific reason to vary them.

The supply voltage (ipsout) for the regulators is fixed and AFAIK
there is no code for changing it.
I'll omit the voltage ranges then.

>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>
> This compatible isn't part of the driver.

Yes I know. The problem here is that in v4 I had to fill in the field
.of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
because the regulator_dev_lookup() checks for dev->of_node when
looking for the supply so I needed the compatible string in the DT to
have the dev->of_node filled in by mfd_add_device().
What do you suggest? Modify the regulator driver?

Thank you,

-- 
Carlo Caione

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-11 13:04           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-11 13:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>
>> In all the DTs the min and max microvolt allowed for each regulator are actually
>> the min and max voltage possible for the regulator itself. This is not safe but
>> we do not have the ranges allowed for each board and the original Allwinner
>> driver does exactly this way.
>
> Is there any code in their kernel which varies the supply voltages?  If
> there isn't then simply omitting the voltage ranges is the best option,
> leaving the supplies fixed.  If there is then the range it uses is a
> good starting point.  In general supplies will be fixed voltage on a
> given board unless there is a specific reason to vary them.

The supply voltage (ipsout) for the regulators is fixed and AFAIK
there is no code for changing it.
I'll omit the voltage ranges then.

>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>
> This compatible isn't part of the driver.

Yes I know. The problem here is that in v4 I had to fill in the field
.of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
because the regulator_dev_lookup() checks for dev->of_node when
looking for the supply so I needed the compatible string in the DT to
have the dev->of_node filled in by mfd_add_device().
What do you suggest? Modify the regulator driver?

Thank you,

-- 
Carlo Caione

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

* Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11 12:09           ` Mark Brown
@ 2014-04-11 13:16               ` Arnd Bergmann
  -1 siblings, 0 replies; 74+ messages in thread
From: Arnd Bergmann @ 2014-04-11 13:16 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Carlo Caione,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Friday 11 April 2014 13:09:08 Mark Brown wrote:
> On Fri, Apr 11, 2014 at 01:25:03PM +0200, Arnd Bergmann wrote:
> 
> > Why do you have to enumerate the interrupts here? Can't you just
> > put all the numbers into the DT nodes of the devices using them?
> 
> > In general, I would say that the mfd driver should not care about
> > what is connected to it.
> 
> This then means that all the machines using the device need to define
> the interrupt table and have the MFD cells represented in the DT which
> means encoding Linux abstractions into the DT.
> 
> In cases where the device is also used with ACPI or platform data that's
> a definite issue since they have different idioms.  That applies less to
> PMICs tightly bound to particular SoCs but is an issue in general, not
> all the world is DT.
> 
> There's also issues here with us changing our subsystems.  Things like
> clocks are a bit indistinct at present, they're sort of floating between
> clock and other subsystems.  We've also done things like invent extcon,
> making completely new subdevices.  Keeping the data out of DT avoids
> problems when this happens.  The balance changes a bit if there are
> clearly reusable IPs within the device but sadly hardware designers
> don't always give us that and even then sometimes we don't want to use
> them like that.

Ok, fair enough.

	Arnd

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-11 13:16               ` Arnd Bergmann
  0 siblings, 0 replies; 74+ messages in thread
From: Arnd Bergmann @ 2014-04-11 13:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 11 April 2014 13:09:08 Mark Brown wrote:
> On Fri, Apr 11, 2014 at 01:25:03PM +0200, Arnd Bergmann wrote:
> 
> > Why do you have to enumerate the interrupts here? Can't you just
> > put all the numbers into the DT nodes of the devices using them?
> 
> > In general, I would say that the mfd driver should not care about
> > what is connected to it.
> 
> This then means that all the machines using the device need to define
> the interrupt table and have the MFD cells represented in the DT which
> means encoding Linux abstractions into the DT.
> 
> In cases where the device is also used with ACPI or platform data that's
> a definite issue since they have different idioms.  That applies less to
> PMICs tightly bound to particular SoCs but is an issue in general, not
> all the world is DT.
> 
> There's also issues here with us changing our subsystems.  Things like
> clocks are a bit indistinct at present, they're sort of floating between
> clock and other subsystems.  We've also done things like invent extcon,
> making completely new subdevices.  Keeping the data out of DT avoids
> problems when this happens.  The balance changes a bit if there are
> clearly reusable IPs within the device but sadly hardware designers
> don't always give us that and even then sometimes we don't want to use
> them like that.

Ok, fair enough.

	Arnd

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11 13:04           ` Carlo Caione
@ 2014-04-11 16:18               ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 16:18 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Fri, Apr 11, 2014 at 03:04:32PM +0200, Carlo Caione wrote:
> On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:

> >> +                             regulators {
> >> +                                     compatible = "x-powers,axp20x-reg";

> > This compatible isn't part of the driver.

> Yes I know. The problem here is that in v4 I had to fill in the field
> .of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
> because the regulator_dev_lookup() checks for dev->of_node when
> looking for the supply so I needed the compatible string in the DT to
> have the dev->of_node filled in by mfd_add_device().
> What do you suggest? Modify the regulator driver?

You're looking for regulator_bulk_register_supply_alias() in the MFD
driver (via parent_supplies in the MFD cell probably).

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

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-11 16:18               ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-11 16:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 03:04:32PM +0200, Carlo Caione wrote:
> On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie@kernel.org> wrote:

> >> +                             regulators {
> >> +                                     compatible = "x-powers,axp20x-reg";

> > This compatible isn't part of the driver.

> Yes I know. The problem here is that in v4 I had to fill in the field
> .of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
> because the regulator_dev_lookup() checks for dev->of_node when
> looking for the supply so I needed the compatible string in the DT to
> have the dev->of_node filled in by mfd_add_device().
> What do you suggest? Modify the regulator driver?

You're looking for regulator_bulk_register_supply_alias() in the MFD
driver (via parent_supplies in the MFD cell probably).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140411/7b11da57/attachment.sig>

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

* Re: [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-13  8:17         ` Dmitry Torokhov
  -1 siblings, 0 replies; 74+ messages in thread
From: Dmitry Torokhov @ 2014-04-13  8:17 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Fri, Apr 11, 2014 at 11:38:08AM +0200, Carlo Caione wrote:
> This patch add support for the Power Enable Key found on MFD AXP202 and
> AXP209. Besides the basic support for the button, the driver adds two
> entries in sysfs to configure the time delay for power on/off.
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/input/misc/Kconfig      |  11 ++
>  drivers/input/misc/Makefile     |   1 +
>  drivers/input/misc/axp20x-pek.c | 261 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 273 insertions(+)
>  create mode 100644 drivers/input/misc/axp20x-pek.c
> 
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 7904ab0..87244fb 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
>  	  To compile this driver as a module, choose M here. The module will
>  	  be called retu-pwrbutton.
>  
> +config INPUT_AXP20X_PEK
> +	tristate "X-Powers AXP20X power button driver"
> +	depends on MFD_AXP20X
> +	help
> +	  Say Y here if you want to enable power key reporting via the
> +	  AXP20X PMIC.
> +
> +	  To compile this driver as a module, choose M here. The module will
> +	  be called axp20x-pek.
> +
> +
>  config INPUT_TWL4030_PWRBUTTON
>  	tristate "TWL4030 Power button Driver"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index cda71fc..624abf5 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
>  obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
>  obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
>  obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
> +obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
>  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
>  obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
>  obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> new file mode 100644
> index 0000000..a9112bd
> --- /dev/null
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -0,0 +1,261 @@
> +/*
> + * axp20x power button driver.
> + *
> + * Copyright (C) 2013 Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * This program 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.
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/irq.h>
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +
> +#define AXP20X_PEK_STARTUP_MASK		(0xc0)
> +#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
> +
> +struct axp20x_pek {
> +	struct axp20x_dev *axp20x;
> +	struct input_dev *input;
> +	int irq_dbr;
> +	int irq_dbf;
> +};
> +
> +struct axp20x_time {
> +	unsigned int time;
> +	unsigned int idx;
> +};
> +
> +static const struct axp20x_time startup_time[] = {
> +	{ .time = 128,  .idx = 0 },
> +	{ .time = 1000, .idx = 2 },
> +	{ .time = 3000, .idx = 1 },
> +	{ .time = 2000, .idx = 3 },
> +};
> +
> +static const struct axp20x_time shutdown_time[] = {
> +	{ .time = 4000,  .idx = 0 },
> +	{ .time = 6000,  .idx = 1 },
> +	{ .time = 8000,  .idx = 2 },
> +	{ .time = 10000, .idx = 3 },
> +};
> +
> +struct axp20x_pek_ext_attr {
> +	const struct axp20x_time *p_time;
> +	unsigned int mask;
> +};
> +
> +static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
> +	.p_time	= startup_time,
> +	.mask	= AXP20X_PEK_STARTUP_MASK,
> +};
> +
> +static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
> +	.p_time	= shutdown_time,
> +	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
> +};
> +
> +static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
> +{
> +	return container_of(attr, struct dev_ext_attribute, attr)->var;
> +}
> +
> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
> +				    char *buf)
> +{
> +	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> +	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
> +	unsigned int val;
> +	int ret, i;
> +
> +	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
> +	if (ret != 0)
> +		return ret;
> +
> +	val &= axp20x_ea->mask;
> +	val >>= ffs(axp20x_ea->mask) - 1;
> +
> +	for (i = 0; i < 4; i++)
> +		if (val == axp20x_ea->p_time[i].idx)
> +			val = axp20x_ea->p_time[i].time;
> +
> +	return sprintf(buf, "%ums\n", val);

Please do not print ums and instead document the units in sysfs ABI
docs.

> +}
> +
> +static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
> +				     const char *buf, size_t count)
> +{
> +	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> +	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
> +	char val_str[20];
> +	size_t len;
> +	int ret, i;
> +	unsigned int val, idx = 0;
> +	unsigned int best_err = UINT_MAX;
> +
> +	val_str[sizeof(val_str) - 1] = '\0';
> +	strncpy(val_str, buf, sizeof(val_str) - 1);
> +	len = strlen(val_str);
> +
> +	if (len && val_str[len - 1] == '\n')
> +		val_str[len - 1] = '\0';
> +
> +	ret = kstrtouint(val_str, 10, &val);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 3; i >= 0; i--) {
> +		unsigned int err;
> +
> +		err = abs(axp20x_ea->p_time[i].time - val);
> +		if (err < best_err) {
> +			best_err = err;
> +			idx = axp20x_ea->p_time[i].idx;
> +		}
> +
> +		if (!err)
> +			break;
> +	}
> +
> +	idx <<= ffs(axp20x_ea->mask) - 1;
> +	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
> +				 AXP20X_PEK_KEY,
> +				 axp20x_ea->mask, idx);
> +	if (ret != 0)
> +		return -EINVAL;
> +	return count;
> +}
> +
> +static struct dev_ext_attribute axp20x_dev_attr_startup = {
> +	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
> +	.var	= &axp20x_pek_startup_ext_attr
> +};
> +
> +static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
> +	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
> +	.var	= &axp20x_pek_shutdown_ext_attr
> +};
> +
> +static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
> +{
> +	struct input_dev *idev = pwr;
> +	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
> +
> +	if (irq == axp20x_pek->irq_dbr)
> +		input_report_key(idev, KEY_POWER, true);
> +	else if (irq == axp20x_pek->irq_dbf)
> +		input_report_key(idev, KEY_POWER, false);
> +
> +	input_sync(idev);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int axp20x_pek_probe(struct platform_device *pdev)
> +{
> +	struct axp20x_pek *axp20x_pek;
> +	struct axp20x_dev *axp20x;
> +	struct input_dev *idev;
> +	int error;
> +
> +	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
> +				  GFP_KERNEL);
> +	if (!axp20x_pek)
> +		return -ENOMEM;
> +
> +	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
> +	axp20x = axp20x_pek->axp20x;
> +
> +	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
> +	if (axp20x_pek->irq_dbr < 0) {
> +		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
> +				axp20x_pek->irq_dbr);
> +		return axp20x_pek->irq_dbr;
> +	}
> +	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
> +						  axp20x_pek->irq_dbr);
> +
> +	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
> +	if (axp20x_pek->irq_dbf < 0) {
> +		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
> +				axp20x_pek->irq_dbf);
> +		return axp20x_pek->irq_dbf;
> +	}
> +	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
> +						  axp20x_pek->irq_dbf);
> +
> +	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
> +	if (!axp20x_pek->input)
> +		return -ENOMEM;
> +
> +	idev = axp20x_pek->input;
> +
> +	idev->name = "axp20x-pek";
> +	idev->phys = "m1kbd/input2";
> +	idev->dev.parent = &pdev->dev;
> +
> +	input_set_capability(idev, EV_KEY, KEY_POWER);
> +
> +	input_set_drvdata(idev, axp20x_pek);
> +
> +	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
> +					  axp20x_pek_irq, 0,
> +					  "axp20x-pek-dbr", idev);
> +	if (error < 0) {
> +		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
> +			axp20x_pek->irq_dbr, error);
> +
> +		return error;
> +	}
> +
> +	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
> +					  axp20x_pek_irq, 0,
> +					  "axp20x-pek-dbf", idev);
> +	if (error < 0) {
> +		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
> +			axp20x_pek->irq_dbf, error);
> +		return error;
> +	}
> +
> +
> +	if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
> +	    device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
> +		return -ENODEV;

I think you still want to use attribute group here. You also need to
clean up the attributes when unbinding device. Also, why returning
-ENODEV instead of the proper error code?

> +
> +	error = input_register_device(idev);
> +	if (error) {
> +		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
> +		return error;
> +	}
> +
> +	platform_set_drvdata(pdev, axp20x_pek);
> +
> +	return 0;
> +}
> +
> +static struct platform_driver axp20x_pek_driver = {
> +	.probe		= axp20x_pek_probe,
> +	.driver		= {
> +		.name		= "axp20x-pek",
> +		.owner		= THIS_MODULE,
> +	},
> +};
> +module_platform_driver(axp20x_pek_driver);
> +
> +MODULE_DESCRIPTION("axp20x Power Button");
> +MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
> +MODULE_LICENSE("GPL");
> -- 
> 1.8.3.2
> 

Thanks.

-- 
Dmitry

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

* [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-04-13  8:17         ` Dmitry Torokhov
  0 siblings, 0 replies; 74+ messages in thread
From: Dmitry Torokhov @ 2014-04-13  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 11:38:08AM +0200, Carlo Caione wrote:
> This patch add support for the Power Enable Key found on MFD AXP202 and
> AXP209. Besides the basic support for the button, the driver adds two
> entries in sysfs to configure the time delay for power on/off.
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  drivers/input/misc/Kconfig      |  11 ++
>  drivers/input/misc/Makefile     |   1 +
>  drivers/input/misc/axp20x-pek.c | 261 ++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 273 insertions(+)
>  create mode 100644 drivers/input/misc/axp20x-pek.c
> 
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 7904ab0..87244fb 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -393,6 +393,17 @@ config INPUT_RETU_PWRBUTTON
>  	  To compile this driver as a module, choose M here. The module will
>  	  be called retu-pwrbutton.
>  
> +config INPUT_AXP20X_PEK
> +	tristate "X-Powers AXP20X power button driver"
> +	depends on MFD_AXP20X
> +	help
> +	  Say Y here if you want to enable power key reporting via the
> +	  AXP20X PMIC.
> +
> +	  To compile this driver as a module, choose M here. The module will
> +	  be called axp20x-pek.
> +
> +
>  config INPUT_TWL4030_PWRBUTTON
>  	tristate "TWL4030 Power button Driver"
>  	depends on TWL4030_CORE
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index cda71fc..624abf5 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -50,6 +50,7 @@ obj-$(CONFIG_INPUT_POWERMATE)		+= powermate.o
>  obj-$(CONFIG_INPUT_PWM_BEEPER)		+= pwm-beeper.o
>  obj-$(CONFIG_INPUT_RB532_BUTTON)	+= rb532_button.o
>  obj-$(CONFIG_INPUT_RETU_PWRBUTTON)	+= retu-pwrbutton.o
> +obj-$(CONFIG_INPUT_AXP20X_PEK)		+= axp20x-pek.o
>  obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER)	+= rotary_encoder.o
>  obj-$(CONFIG_INPUT_SGI_BTNS)		+= sgi_btns.o
>  obj-$(CONFIG_INPUT_SIRFSOC_ONKEY)	+= sirfsoc-onkey.o
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> new file mode 100644
> index 0000000..a9112bd
> --- /dev/null
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -0,0 +1,261 @@
> +/*
> + * axp20x power button driver.
> + *
> + * Copyright (C) 2013 Carlo Caione <carlo@caione.org>
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file "COPYING" in the main directory of this
> + * archive for more details.
> + *
> + * This program 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.
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/irq.h>
> +#include <linux/init.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +
> +#define AXP20X_PEK_STARTUP_MASK		(0xc0)
> +#define AXP20X_PEK_SHUTDOWN_MASK	(0x03)
> +
> +struct axp20x_pek {
> +	struct axp20x_dev *axp20x;
> +	struct input_dev *input;
> +	int irq_dbr;
> +	int irq_dbf;
> +};
> +
> +struct axp20x_time {
> +	unsigned int time;
> +	unsigned int idx;
> +};
> +
> +static const struct axp20x_time startup_time[] = {
> +	{ .time = 128,  .idx = 0 },
> +	{ .time = 1000, .idx = 2 },
> +	{ .time = 3000, .idx = 1 },
> +	{ .time = 2000, .idx = 3 },
> +};
> +
> +static const struct axp20x_time shutdown_time[] = {
> +	{ .time = 4000,  .idx = 0 },
> +	{ .time = 6000,  .idx = 1 },
> +	{ .time = 8000,  .idx = 2 },
> +	{ .time = 10000, .idx = 3 },
> +};
> +
> +struct axp20x_pek_ext_attr {
> +	const struct axp20x_time *p_time;
> +	unsigned int mask;
> +};
> +
> +static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = {
> +	.p_time	= startup_time,
> +	.mask	= AXP20X_PEK_STARTUP_MASK,
> +};
> +
> +static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = {
> +	.p_time	= shutdown_time,
> +	.mask	= AXP20X_PEK_SHUTDOWN_MASK,
> +};
> +
> +static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
> +{
> +	return container_of(attr, struct dev_ext_attribute, attr)->var;
> +}
> +
> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
> +				    char *buf)
> +{
> +	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> +	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
> +	unsigned int val;
> +	int ret, i;
> +
> +	ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
> +	if (ret != 0)
> +		return ret;
> +
> +	val &= axp20x_ea->mask;
> +	val >>= ffs(axp20x_ea->mask) - 1;
> +
> +	for (i = 0; i < 4; i++)
> +		if (val == axp20x_ea->p_time[i].idx)
> +			val = axp20x_ea->p_time[i].time;
> +
> +	return sprintf(buf, "%ums\n", val);

Please do not print ums and instead document the units in sysfs ABI
docs.

> +}
> +
> +static ssize_t axp20x_store_ext_attr(struct device *dev, struct device_attribute *attr,
> +				     const char *buf, size_t count)
> +{
> +	struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
> +	struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
> +	char val_str[20];
> +	size_t len;
> +	int ret, i;
> +	unsigned int val, idx = 0;
> +	unsigned int best_err = UINT_MAX;
> +
> +	val_str[sizeof(val_str) - 1] = '\0';
> +	strncpy(val_str, buf, sizeof(val_str) - 1);
> +	len = strlen(val_str);
> +
> +	if (len && val_str[len - 1] == '\n')
> +		val_str[len - 1] = '\0';
> +
> +	ret = kstrtouint(val_str, 10, &val);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 3; i >= 0; i--) {
> +		unsigned int err;
> +
> +		err = abs(axp20x_ea->p_time[i].time - val);
> +		if (err < best_err) {
> +			best_err = err;
> +			idx = axp20x_ea->p_time[i].idx;
> +		}
> +
> +		if (!err)
> +			break;
> +	}
> +
> +	idx <<= ffs(axp20x_ea->mask) - 1;
> +	ret = regmap_update_bits(axp20x_pek->axp20x->regmap,
> +				 AXP20X_PEK_KEY,
> +				 axp20x_ea->mask, idx);
> +	if (ret != 0)
> +		return -EINVAL;
> +	return count;
> +}
> +
> +static struct dev_ext_attribute axp20x_dev_attr_startup = {
> +	.attr	= __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
> +	.var	= &axp20x_pek_startup_ext_attr
> +};
> +
> +static struct dev_ext_attribute axp20x_dev_attr_shutdown = {
> +	.attr	= __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr),
> +	.var	= &axp20x_pek_shutdown_ext_attr
> +};
> +
> +static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
> +{
> +	struct input_dev *idev = pwr;
> +	struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
> +
> +	if (irq == axp20x_pek->irq_dbr)
> +		input_report_key(idev, KEY_POWER, true);
> +	else if (irq == axp20x_pek->irq_dbf)
> +		input_report_key(idev, KEY_POWER, false);
> +
> +	input_sync(idev);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int axp20x_pek_probe(struct platform_device *pdev)
> +{
> +	struct axp20x_pek *axp20x_pek;
> +	struct axp20x_dev *axp20x;
> +	struct input_dev *idev;
> +	int error;
> +
> +	axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
> +				  GFP_KERNEL);
> +	if (!axp20x_pek)
> +		return -ENOMEM;
> +
> +	axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
> +	axp20x = axp20x_pek->axp20x;
> +
> +	axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
> +	if (axp20x_pek->irq_dbr < 0) {
> +		dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
> +				axp20x_pek->irq_dbr);
> +		return axp20x_pek->irq_dbr;
> +	}
> +	axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
> +						  axp20x_pek->irq_dbr);
> +
> +	axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
> +	if (axp20x_pek->irq_dbf < 0) {
> +		dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
> +				axp20x_pek->irq_dbf);
> +		return axp20x_pek->irq_dbf;
> +	}
> +	axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
> +						  axp20x_pek->irq_dbf);
> +
> +	axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
> +	if (!axp20x_pek->input)
> +		return -ENOMEM;
> +
> +	idev = axp20x_pek->input;
> +
> +	idev->name = "axp20x-pek";
> +	idev->phys = "m1kbd/input2";
> +	idev->dev.parent = &pdev->dev;
> +
> +	input_set_capability(idev, EV_KEY, KEY_POWER);
> +
> +	input_set_drvdata(idev, axp20x_pek);
> +
> +	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
> +					  axp20x_pek_irq, 0,
> +					  "axp20x-pek-dbr", idev);
> +	if (error < 0) {
> +		dev_err(axp20x->dev, "Failed to request dbr IRQ#%d: %d\n",
> +			axp20x_pek->irq_dbr, error);
> +
> +		return error;
> +	}
> +
> +	error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
> +					  axp20x_pek_irq, 0,
> +					  "axp20x-pek-dbf", idev);
> +	if (error < 0) {
> +		dev_err(axp20x->dev, "Failed to request dbf IRQ#%d: %d\n",
> +			axp20x_pek->irq_dbf, error);
> +		return error;
> +	}
> +
> +
> +	if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
> +	    device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
> +		return -ENODEV;

I think you still want to use attribute group here. You also need to
clean up the attributes when unbinding device. Also, why returning
-ENODEV instead of the proper error code?

> +
> +	error = input_register_device(idev);
> +	if (error) {
> +		dev_err(axp20x->dev, "Can't register input device: %d\n", error);
> +		return error;
> +	}
> +
> +	platform_set_drvdata(pdev, axp20x_pek);
> +
> +	return 0;
> +}
> +
> +static struct platform_driver axp20x_pek_driver = {
> +	.probe		= axp20x_pek_probe,
> +	.driver		= {
> +		.name		= "axp20x-pek",
> +		.owner		= THIS_MODULE,
> +	},
> +};
> +module_platform_driver(axp20x_pek_driver);
> +
> +MODULE_DESCRIPTION("axp20x Power Button");
> +MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
> +MODULE_LICENSE("GPL");
> -- 
> 1.8.3.2
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-14  9:52         ` Maxime Ripard
  -1 siblings, 0 replies; 74+ messages in thread
From: Maxime Ripard @ 2014-04-14  9:52 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

Hi Carlo,

On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> ---
> 
> In all the DTs the min and max microvolt allowed for each regulator are actually
> the min and max voltage possible for the regulator itself. This is not safe but
> we do not have the ranges allowed for each board and the original Allwinner 
> driver does exactly this way.
> 
> AXP20x has the so called Power Path Management (IPS) that can select the proper
> power supply according to the status of the external power and the Li-battery
> status. The output of the IPS block is usually a 5V fixed voltage used as 
> input supply for all the other regulators. This fixed voltage is represented
> in the DT as a fixed voltage regulator in the "regulator" subnode.
> 
>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++

That looks like a lot of them. Did you test all of them?
Are all those regulators you define used on all these boards?

>  10 files changed, 711 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> index fa746aea..029a880 100644
> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> @@ -88,6 +88,75 @@
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&i2c0_pins_a>;
>  			status = "okay";
> +			#address-cells = <1>;
> +			#size-cells = <0>;

That should be in the DTSI.

> +			axp209: pmic@34 {
> +				compatible = "x-powers,axp209";
> +				reg = <0x34>;
> +				interrupts = <0>;
> +
> +				interrupt-controller;
> +				#interrupt-cells = <1>;
> +
> +				acin-supply = <&axp_ipsout_reg>;
> +				vin2-supply = <&axp_ipsout_reg>;
> +				vin3-supply = <&axp_ipsout_reg>;
> +				ldo24in-supply = <&axp_ipsout_reg>;
> +				ldo3in-supply = <&axp_ipsout_reg>;
> +				ldo5in-supply = <&axp_ipsout_reg>;
> +
> +				regulators {
> +					compatible = "x-powers,axp20x-reg";

I told you a few times already, but don't introduce pattern-matching
compatibles.

> +
> +					x-powers,dcdc-freq = <1500>;
> +
> +					axp_ipsout_reg: axp_ipsout {
> +						compatible = "regulator-fixed";
> +						regulator-name = "axp-ipsout";
> +						regulator-min-microvolt = <5000000>;
> +						regulator-max-microvolt = <5000000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_vcore_reg: dcdc2 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <2275000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_ddr_reg: dcdc3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_rtc_reg: ldo1 {
> +						regulator-always-on;
> +					};
> +
> +					axp_analog_reg: ldo2 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_pll_reg: ldo3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +					};
> +
> +					axp_hdmi_reg: ldo4 {
> +						regulator-min-microvolt = <1250000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +
> +					axp_mic_reg: ldo5 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +				};
> +			};
>  		};
>  	};
>  
> diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> index 4684cbe..635fd4b 100644
> --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> @@ -80,6 +80,75 @@
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&i2c0_pins_a>;
>  			status = "okay";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			axp209: pmic@34 {
> +				compatible = "x-powers,axp209";
> +				reg = <0x34>;
> +				interrupts = <0>;
> +
> +				interrupt-controller;
> +				#interrupt-cells = <1>;
> +
> +				acin-supply = <&axp_ipsout_reg>;
> +				vin2-supply = <&axp_ipsout_reg>;
> +				vin3-supply = <&axp_ipsout_reg>;
> +				ldo24in-supply = <&axp_ipsout_reg>;
> +				ldo3in-supply = <&axp_ipsout_reg>;
> +				ldo5in-supply = <&axp_ipsout_reg>;
> +
> +				regulators {
> +					compatible = "x-powers,axp20x-reg";
> +
> +					x-powers,dcdc-freq = <1500>;
> +
> +					axp_ipsout_reg: axp_ipsout {
> +						compatible = "regulator-fixed";
> +						regulator-name = "axp-ipsout";
> +						regulator-min-microvolt = <5000000>;
> +						regulator-max-microvolt = <5000000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_vcore_reg: dcdc2 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <2275000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_ddr_reg: dcdc3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_rtc_reg: ldo1 {
> +						regulator-always-on;
> +					};
> +
> +					axp_analog_reg: ldo2 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_pll_reg: ldo3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +					};
> +
> +					axp_hdmi_reg: ldo4 {
> +						regulator-min-microvolt = <1250000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +
> +					axp_mic_reg: ldo5 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +				};
> +			};
>  		};
>  
>  		i2c1: i2c@01c2b000 {
> diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> index d7c17e4..8f2db9c 100644
> --- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> @@ -82,6 +82,81 @@
>  			pinctrl-0 = <&uart0_pins_a>;
>  			status = "okay";
>  		};
> +
> +		i2c0: i2c@01c2ac00 {
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&i2c0_pins_a>;
> +			status = "okay";

That should be in a separate patch.

These comments apply to most of the changes here. Make sure you edit
all of them.

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: 836 bytes --]

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-14  9:52         ` Maxime Ripard
  0 siblings, 0 replies; 74+ messages in thread
From: Maxime Ripard @ 2014-04-14  9:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Carlo,

On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
> 
> In all the DTs the min and max microvolt allowed for each regulator are actually
> the min and max voltage possible for the regulator itself. This is not safe but
> we do not have the ranges allowed for each board and the original Allwinner 
> driver does exactly this way.
> 
> AXP20x has the so called Power Path Management (IPS) that can select the proper
> power supply according to the status of the external power and the Li-battery
> status. The output of the IPS block is usually a 5V fixed voltage used as 
> input supply for all the other regulators. This fixed voltage is represented
> in the DT as a fixed voltage regulator in the "regulator" subnode.
> 
>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++

That looks like a lot of them. Did you test all of them?
Are all those regulators you define used on all these boards?

>  10 files changed, 711 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> index fa746aea..029a880 100644
> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
> @@ -88,6 +88,75 @@
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&i2c0_pins_a>;
>  			status = "okay";
> +			#address-cells = <1>;
> +			#size-cells = <0>;

That should be in the DTSI.

> +			axp209: pmic at 34 {
> +				compatible = "x-powers,axp209";
> +				reg = <0x34>;
> +				interrupts = <0>;
> +
> +				interrupt-controller;
> +				#interrupt-cells = <1>;
> +
> +				acin-supply = <&axp_ipsout_reg>;
> +				vin2-supply = <&axp_ipsout_reg>;
> +				vin3-supply = <&axp_ipsout_reg>;
> +				ldo24in-supply = <&axp_ipsout_reg>;
> +				ldo3in-supply = <&axp_ipsout_reg>;
> +				ldo5in-supply = <&axp_ipsout_reg>;
> +
> +				regulators {
> +					compatible = "x-powers,axp20x-reg";

I told you a few times already, but don't introduce pattern-matching
compatibles.

> +
> +					x-powers,dcdc-freq = <1500>;
> +
> +					axp_ipsout_reg: axp_ipsout {
> +						compatible = "regulator-fixed";
> +						regulator-name = "axp-ipsout";
> +						regulator-min-microvolt = <5000000>;
> +						regulator-max-microvolt = <5000000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_vcore_reg: dcdc2 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <2275000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_ddr_reg: dcdc3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_rtc_reg: ldo1 {
> +						regulator-always-on;
> +					};
> +
> +					axp_analog_reg: ldo2 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_pll_reg: ldo3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +					};
> +
> +					axp_hdmi_reg: ldo4 {
> +						regulator-min-microvolt = <1250000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +
> +					axp_mic_reg: ldo5 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +				};
> +			};
>  		};
>  	};
>  
> diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> index 4684cbe..635fd4b 100644
> --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
> @@ -80,6 +80,75 @@
>  			pinctrl-names = "default";
>  			pinctrl-0 = <&i2c0_pins_a>;
>  			status = "okay";
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			axp209: pmic at 34 {
> +				compatible = "x-powers,axp209";
> +				reg = <0x34>;
> +				interrupts = <0>;
> +
> +				interrupt-controller;
> +				#interrupt-cells = <1>;
> +
> +				acin-supply = <&axp_ipsout_reg>;
> +				vin2-supply = <&axp_ipsout_reg>;
> +				vin3-supply = <&axp_ipsout_reg>;
> +				ldo24in-supply = <&axp_ipsout_reg>;
> +				ldo3in-supply = <&axp_ipsout_reg>;
> +				ldo5in-supply = <&axp_ipsout_reg>;
> +
> +				regulators {
> +					compatible = "x-powers,axp20x-reg";
> +
> +					x-powers,dcdc-freq = <1500>;
> +
> +					axp_ipsout_reg: axp_ipsout {
> +						compatible = "regulator-fixed";
> +						regulator-name = "axp-ipsout";
> +						regulator-min-microvolt = <5000000>;
> +						regulator-max-microvolt = <5000000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_vcore_reg: dcdc2 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <2275000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_ddr_reg: dcdc3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_rtc_reg: ldo1 {
> +						regulator-always-on;
> +					};
> +
> +					axp_analog_reg: ldo2 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +						regulator-always-on;
> +					};
> +
> +					axp_pll_reg: ldo3 {
> +						regulator-min-microvolt = <700000>;
> +						regulator-max-microvolt = <3500000>;
> +					};
> +
> +					axp_hdmi_reg: ldo4 {
> +						regulator-min-microvolt = <1250000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +
> +					axp_mic_reg: ldo5 {
> +						regulator-min-microvolt = <1800000>;
> +						regulator-max-microvolt = <3300000>;
> +					};
> +				};
> +			};
>  		};
>  
>  		i2c1: i2c at 01c2b000 {
> diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> index d7c17e4..8f2db9c 100644
> --- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
> @@ -82,6 +82,81 @@
>  			pinctrl-0 = <&uart0_pins_a>;
>  			status = "okay";
>  		};
> +
> +		i2c0: i2c at 01c2ac00 {
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&i2c0_pins_a>;
> +			status = "okay";

That should be in a separate patch.

These comments apply to most of the changes here. Make sure you edit
all of them.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140414/8e5946b5/attachment.sig>

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

* Re: Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-14  9:52         ` Maxime Ripard
@ 2014-04-14 10:02           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-14 10:02 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Mon, Apr 14, 2014 at 11:52 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hi Carlo,

Hi Maxime,

> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> ---
>>
>> In all the DTs the min and max microvolt allowed for each regulator are actually
>> the min and max voltage possible for the regulator itself. This is not safe but
>> we do not have the ranges allowed for each board and the original Allwinner
>> driver does exactly this way.
>>
>> AXP20x has the so called Power Path Management (IPS) that can select the proper
>> power supply according to the status of the external power and the Li-battery
>> status. The output of the IPS block is usually a 5V fixed voltage used as
>> input supply for all the other regulators. This fixed voltage is represented
>> in the DT as a fixed voltage regulator in the "regulator" subnode.
>>
>>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
>
> That looks like a lot of them. Did you test all of them?
> Are all those regulators you define used on all these boards?

I tested it only on cubieboard2, all the other boards are contributed by Hans.
I'll double check with Hans.

>>  10 files changed, 711 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> index fa746aea..029a880 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> @@ -88,6 +88,75 @@
>>                       pinctrl-names = "default";
>>                       pinctrl-0 = <&i2c0_pins_a>;
>>                       status = "okay";
>> +                     #address-cells = <1>;
>> +                     #size-cells = <0>;
>
> That should be in the DTSI.

Agree.

>> +                     axp209: pmic@34 {
>> +                             compatible = "x-powers,axp209";
>> +                             reg = <0x34>;
>> +                             interrupts = <0>;
>> +
>> +                             interrupt-controller;
>> +                             #interrupt-cells = <1>;
>> +
>> +                             acin-supply = <&axp_ipsout_reg>;
>> +                             vin2-supply = <&axp_ipsout_reg>;
>> +                             vin3-supply = <&axp_ipsout_reg>;
>> +                             ldo24in-supply = <&axp_ipsout_reg>;
>> +                             ldo3in-supply = <&axp_ipsout_reg>;
>> +                             ldo5in-supply = <&axp_ipsout_reg>;
>> +
>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>
> I told you a few times already, but don't introduce pattern-matching
> compatibles.

Probably that compatible will be deleted in the next version using
regulator_bulk_register_supply_alias() as suggested by Mark.

>> +
>> +                                     x-powers,dcdc-freq = <1500>;
>> +
>> +                                     axp_ipsout_reg: axp_ipsout {
>> +                                             compatible = "regulator-fixed";
>> +                                             regulator-name = "axp-ipsout";
>> +                                             regulator-min-microvolt = <5000000>;
>> +                                             regulator-max-microvolt = <5000000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_vcore_reg: dcdc2 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <2275000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_ddr_reg: dcdc3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_rtc_reg: ldo1 {
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_analog_reg: ldo2 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_pll_reg: ldo3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                     };
>> +
>> +                                     axp_hdmi_reg: ldo4 {
>> +                                             regulator-min-microvolt = <1250000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +
>> +                                     axp_mic_reg: ldo5 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +                             };
>> +                     };
>>               };
>>       };
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> index 4684cbe..635fd4b 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> @@ -80,6 +80,75 @@
>>                       pinctrl-names = "default";
>>                       pinctrl-0 = <&i2c0_pins_a>;
>>                       status = "okay";
>> +                     #address-cells = <1>;
>> +                     #size-cells = <0>;
>> +
>> +                     axp209: pmic@34 {
>> +                             compatible = "x-powers,axp209";
>> +                             reg = <0x34>;
>> +                             interrupts = <0>;
>> +
>> +                             interrupt-controller;
>> +                             #interrupt-cells = <1>;
>> +
>> +                             acin-supply = <&axp_ipsout_reg>;
>> +                             vin2-supply = <&axp_ipsout_reg>;
>> +                             vin3-supply = <&axp_ipsout_reg>;
>> +                             ldo24in-supply = <&axp_ipsout_reg>;
>> +                             ldo3in-supply = <&axp_ipsout_reg>;
>> +                             ldo5in-supply = <&axp_ipsout_reg>;
>> +
>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>> +
>> +                                     x-powers,dcdc-freq = <1500>;
>> +
>> +                                     axp_ipsout_reg: axp_ipsout {
>> +                                             compatible = "regulator-fixed";
>> +                                             regulator-name = "axp-ipsout";
>> +                                             regulator-min-microvolt = <5000000>;
>> +                                             regulator-max-microvolt = <5000000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_vcore_reg: dcdc2 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <2275000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_ddr_reg: dcdc3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_rtc_reg: ldo1 {
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_analog_reg: ldo2 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_pll_reg: ldo3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                     };
>> +
>> +                                     axp_hdmi_reg: ldo4 {
>> +                                             regulator-min-microvolt = <1250000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +
>> +                                     axp_mic_reg: ldo5 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +                             };
>> +                     };
>>               };
>>
>>               i2c1: i2c@01c2b000 {
>> diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> index d7c17e4..8f2db9c 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> @@ -82,6 +82,81 @@
>>                       pinctrl-0 = <&uart0_pins_a>;
>>                       status = "okay";
>>               };
>> +
>> +             i2c0: i2c@01c2ac00 {
>> +                     pinctrl-names = "default";
>> +                     pinctrl-0 = <&i2c0_pins_a>;
>> +                     status = "okay";
>
> That should be in a separate patch.
>
> These comments apply to most of the changes here. Make sure you edit
> all of them.

Ok. Thanks.

-- 
Carlo Caione

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

* [linux-sunxi] Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-14 10:02           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-14 10:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 14, 2014 at 11:52 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi Carlo,

Hi Maxime,

> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> Signed-off-by: Carlo Caione <carlo@caione.org>
>> ---
>>
>> In all the DTs the min and max microvolt allowed for each regulator are actually
>> the min and max voltage possible for the regulator itself. This is not safe but
>> we do not have the ranges allowed for each board and the original Allwinner
>> driver does exactly this way.
>>
>> AXP20x has the so called Power Path Management (IPS) that can select the proper
>> power supply according to the status of the external power and the Li-battery
>> status. The output of the IPS block is usually a 5V fixed voltage used as
>> input supply for all the other regulators. This fixed voltage is represented
>> in the DT as a fixed voltage regulator in the "regulator" subnode.
>>
>>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
>
> That looks like a lot of them. Did you test all of them?
> Are all those regulators you define used on all these boards?

I tested it only on cubieboard2, all the other boards are contributed by Hans.
I'll double check with Hans.

>>  10 files changed, 711 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> index fa746aea..029a880 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>> @@ -88,6 +88,75 @@
>>                       pinctrl-names = "default";
>>                       pinctrl-0 = <&i2c0_pins_a>;
>>                       status = "okay";
>> +                     #address-cells = <1>;
>> +                     #size-cells = <0>;
>
> That should be in the DTSI.

Agree.

>> +                     axp209: pmic at 34 {
>> +                             compatible = "x-powers,axp209";
>> +                             reg = <0x34>;
>> +                             interrupts = <0>;
>> +
>> +                             interrupt-controller;
>> +                             #interrupt-cells = <1>;
>> +
>> +                             acin-supply = <&axp_ipsout_reg>;
>> +                             vin2-supply = <&axp_ipsout_reg>;
>> +                             vin3-supply = <&axp_ipsout_reg>;
>> +                             ldo24in-supply = <&axp_ipsout_reg>;
>> +                             ldo3in-supply = <&axp_ipsout_reg>;
>> +                             ldo5in-supply = <&axp_ipsout_reg>;
>> +
>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>
> I told you a few times already, but don't introduce pattern-matching
> compatibles.

Probably that compatible will be deleted in the next version using
regulator_bulk_register_supply_alias() as suggested by Mark.

>> +
>> +                                     x-powers,dcdc-freq = <1500>;
>> +
>> +                                     axp_ipsout_reg: axp_ipsout {
>> +                                             compatible = "regulator-fixed";
>> +                                             regulator-name = "axp-ipsout";
>> +                                             regulator-min-microvolt = <5000000>;
>> +                                             regulator-max-microvolt = <5000000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_vcore_reg: dcdc2 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <2275000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_ddr_reg: dcdc3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_rtc_reg: ldo1 {
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_analog_reg: ldo2 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_pll_reg: ldo3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                     };
>> +
>> +                                     axp_hdmi_reg: ldo4 {
>> +                                             regulator-min-microvolt = <1250000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +
>> +                                     axp_mic_reg: ldo5 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +                             };
>> +                     };
>>               };
>>       };
>>
>> diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> index 4684cbe..635fd4b 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
>> @@ -80,6 +80,75 @@
>>                       pinctrl-names = "default";
>>                       pinctrl-0 = <&i2c0_pins_a>;
>>                       status = "okay";
>> +                     #address-cells = <1>;
>> +                     #size-cells = <0>;
>> +
>> +                     axp209: pmic at 34 {
>> +                             compatible = "x-powers,axp209";
>> +                             reg = <0x34>;
>> +                             interrupts = <0>;
>> +
>> +                             interrupt-controller;
>> +                             #interrupt-cells = <1>;
>> +
>> +                             acin-supply = <&axp_ipsout_reg>;
>> +                             vin2-supply = <&axp_ipsout_reg>;
>> +                             vin3-supply = <&axp_ipsout_reg>;
>> +                             ldo24in-supply = <&axp_ipsout_reg>;
>> +                             ldo3in-supply = <&axp_ipsout_reg>;
>> +                             ldo5in-supply = <&axp_ipsout_reg>;
>> +
>> +                             regulators {
>> +                                     compatible = "x-powers,axp20x-reg";
>> +
>> +                                     x-powers,dcdc-freq = <1500>;
>> +
>> +                                     axp_ipsout_reg: axp_ipsout {
>> +                                             compatible = "regulator-fixed";
>> +                                             regulator-name = "axp-ipsout";
>> +                                             regulator-min-microvolt = <5000000>;
>> +                                             regulator-max-microvolt = <5000000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_vcore_reg: dcdc2 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <2275000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_ddr_reg: dcdc3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_rtc_reg: ldo1 {
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_analog_reg: ldo2 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                             regulator-always-on;
>> +                                     };
>> +
>> +                                     axp_pll_reg: ldo3 {
>> +                                             regulator-min-microvolt = <700000>;
>> +                                             regulator-max-microvolt = <3500000>;
>> +                                     };
>> +
>> +                                     axp_hdmi_reg: ldo4 {
>> +                                             regulator-min-microvolt = <1250000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +
>> +                                     axp_mic_reg: ldo5 {
>> +                                             regulator-min-microvolt = <1800000>;
>> +                                             regulator-max-microvolt = <3300000>;
>> +                                     };
>> +                             };
>> +                     };
>>               };
>>
>>               i2c1: i2c at 01c2b000 {
>> diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> index d7c17e4..8f2db9c 100644
>> --- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> +++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
>> @@ -82,6 +82,81 @@
>>                       pinctrl-0 = <&uart0_pins_a>;
>>                       status = "okay";
>>               };
>> +
>> +             i2c0: i2c at 01c2ac00 {
>> +                     pinctrl-names = "default";
>> +                     pinctrl-0 = <&i2c0_pins_a>;
>> +                     status = "okay";
>
> That should be in a separate patch.
>
> These comments apply to most of the changes here. Make sure you edit
> all of them.

Ok. Thanks.

-- 
Carlo Caione

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

* Re: Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-14 10:02           ` [linux-sunxi] " Carlo Caione
@ 2014-04-14 10:20               ` Hans de Goede
  -1 siblings, 0 replies; 74+ messages in thread
From: Hans de Goede @ 2014-04-14 10:20 UTC (permalink / raw)
  To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Maxime Ripard
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	emilio-0Z03zUJReD5OxF6Tv1QG9Q, wens-jdAy2FN1RRM,
	sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

Hi,

On 04/14/2014 12:02 PM, Carlo Caione wrote:
> On Mon, Apr 14, 2014 at 11:52 AM, Maxime Ripard
> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> Hi Carlo,
> 
> Hi Maxime,
> 
>> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>>> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>>> ---
>>>
>>> In all the DTs the min and max microvolt allowed for each regulator are actually
>>> the min and max voltage possible for the regulator itself. This is not safe but
>>> we do not have the ranges allowed for each board and the original Allwinner
>>> driver does exactly this way.
>>>
>>> AXP20x has the so called Power Path Management (IPS) that can select the proper
>>> power supply according to the status of the external power and the Li-battery
>>> status. The output of the IPS block is usually a 5V fixed voltage used as
>>> input supply for all the other regulators. This fixed voltage is represented
>>> in the DT as a fixed voltage regulator in the "regulator" subnode.
>>>
>>>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
>>
>> That looks like a lot of them. Did you test all of them?
>> Are all those regulators you define used on all these boards?
> 
> I tested it only on cubieboard2, all the other boards are contributed by Hans.
> I'll double check with Hans.

Well my contribution stems from the time when we still had a dtsi for the regulators,
if were going to do them per board, then we should be more precise IMHO.

As Mark has also mentioned we should probably pin the regulators to a certain
voltage, except for those which we expect to be controlled by a driver, so basically
all of them should be pinned to a certain voltage except for DCDC2 which gets used
for the cpu voltage which we will want to scale as soon as we've a cpufreq driver.

While testing the latest revision of your code I also noticed that the kernel ends
up disabling LDO3 and LDO4, which could be fine on some boards and a problem on
other boards.

I think we need to be careful here. For now it may be best to only add the DCDC2 regulator
to the dts, as we know that dcdc2 is used for the cpu voltage everywhere, and we will
actually want to control that later on.

For the others, for the boards where we've schematics (*) it would be good to add the other
regulators with fixed voltages as specified in the schematics. For the rest it may be
best to simply leave the regulators alone / at their default settings.




> 
>>>  10 files changed, 711 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> index fa746aea..029a880 100644
>>> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> @@ -88,6 +88,75 @@
>>>                       pinctrl-names = "default";
>>>                       pinctrl-0 = <&i2c0_pins_a>;
>>>                       status = "okay";
>>> +                     #address-cells = <1>;
>>> +                     #size-cells = <0>;
>>
>> That should be in the DTSI.
> 
> Agree.

Note I've just send a patch-series for that and Maxime has added that series to his
sunxi/dt-for-3.16 branch.

<snip>

Regards,

Hans

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

* [linux-sunxi] Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-14 10:20               ` Hans de Goede
  0 siblings, 0 replies; 74+ messages in thread
From: Hans de Goede @ 2014-04-14 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 04/14/2014 12:02 PM, Carlo Caione wrote:
> On Mon, Apr 14, 2014 at 11:52 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
>> Hi Carlo,
> 
> Hi Maxime,
> 
>> On Fri, Apr 11, 2014 at 11:38:11AM +0200, Carlo Caione wrote:
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> Signed-off-by: Carlo Caione <carlo@caione.org>
>>> ---
>>>
>>> In all the DTs the min and max microvolt allowed for each regulator are actually
>>> the min and max voltage possible for the regulator itself. This is not safe but
>>> we do not have the ranges allowed for each board and the original Allwinner
>>> driver does exactly this way.
>>>
>>> AXP20x has the so called Power Path Management (IPS) that can select the proper
>>> power supply according to the status of the external power and the Li-battery
>>> status. The output of the IPS block is usually a 5V fixed voltage used as
>>> input supply for all the other regulators. This fixed voltage is represented
>>> in the DT as a fixed voltage regulator in the "regulator" subnode.
>>>
>>>  arch/arm/boot/dts/sun4i-a10-a1000.dts           | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-cubieboard.dts      | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-hackberry.dts       | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-inet97fv2.dts       | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-mini-xplus.dts      | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-olinuxino-lime.dts  | 75 +++++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun4i-a10-pcduino.dts         | 69 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-cubieboard2.dts     | 70 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-cubietruck.dts      | 70 +++++++++++++++++++++++
>>>  arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 70 +++++++++++++++++++++++
>>
>> That looks like a lot of them. Did you test all of them?
>> Are all those regulators you define used on all these boards?
> 
> I tested it only on cubieboard2, all the other boards are contributed by Hans.
> I'll double check with Hans.

Well my contribution stems from the time when we still had a dtsi for the regulators,
if were going to do them per board, then we should be more precise IMHO.

As Mark has also mentioned we should probably pin the regulators to a certain
voltage, except for those which we expect to be controlled by a driver, so basically
all of them should be pinned to a certain voltage except for DCDC2 which gets used
for the cpu voltage which we will want to scale as soon as we've a cpufreq driver.

While testing the latest revision of your code I also noticed that the kernel ends
up disabling LDO3 and LDO4, which could be fine on some boards and a problem on
other boards.

I think we need to be careful here. For now it may be best to only add the DCDC2 regulator
to the dts, as we know that dcdc2 is used for the cpu voltage everywhere, and we will
actually want to control that later on.

For the others, for the boards where we've schematics (*) it would be good to add the other
regulators with fixed voltages as specified in the schematics. For the rest it may be
best to simply leave the regulators alone / at their default settings.




> 
>>>  10 files changed, 711 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/sun4i-a10-a1000.dts b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> index fa746aea..029a880 100644
>>> --- a/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> +++ b/arch/arm/boot/dts/sun4i-a10-a1000.dts
>>> @@ -88,6 +88,75 @@
>>>                       pinctrl-names = "default";
>>>                       pinctrl-0 = <&i2c0_pins_a>;
>>>                       status = "okay";
>>> +                     #address-cells = <1>;
>>> +                     #size-cells = <0>;
>>
>> That should be in the DTSI.
> 
> Agree.

Note I've just send a patch-series for that and Maxime has added that series to his
sunxi/dt-for-3.16 branch.

<snip>

Regards,

Hans

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

* Re: Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-14 10:20               ` [linux-sunxi] " Hans de Goede
@ 2014-04-14 11:16                   ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-14 11:16 UTC (permalink / raw)
  To: Hans de Goede
  Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Maxime Ripard,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	emilio-0Z03zUJReD5OxF6Tv1QG9Q, wens-jdAy2FN1RRM,
	sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Mon, Apr 14, 2014 at 12:20:32PM +0200, Hans de Goede wrote:

Please fix your mailer to word wrap at less than 80 columns.

> As Mark has also mentioned we should probably pin the regulators to a
> certain voltage, except for those which we expect to be controlled by
> a driver, so basically all of them should be pinned to a certain
> voltage except for DCDC2 which gets used for the cpu voltage which we
> will want to scale as soon as we've a cpufreq driver.

If you don't know what to do with the regulators and don't have any
information on what's safe then you shouldn't be specifying a voltage at
all.

> While testing the latest revision of your code I also noticed that the
> kernel ends up disabling LDO3 and LDO4, which could be fine on some
> boards and a problem on other boards.

> I think we need to be careful here. For now it may be best to only add
> the DCDC2 regulator to the dts, as we know that dcdc2 is used for the
> cpu voltage everywhere, and we will actually want to control that
> later on.

You need to at least specify that regulators that need to be kept on are
always-on.

> For the others, for the boards where we've schematics (*) it would be
> good to add the other regulators with fixed voltages as specified in
> the schematics. For the rest it may be best to simply leave the
> regulators alone / at their default settings.

If everyone has been running the board at a voltage different to that in
the schematic then I'd not assume that everything has been validated at
the voltage in the schematic, if production firmware is available that's
going to be a more reliable guide than the schematic but it sounds like
all these boards have just been left to run at their default voltages.

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

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

* [linux-sunxi] Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-14 11:16                   ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-14 11:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 14, 2014 at 12:20:32PM +0200, Hans de Goede wrote:

Please fix your mailer to word wrap at less than 80 columns.

> As Mark has also mentioned we should probably pin the regulators to a
> certain voltage, except for those which we expect to be controlled by
> a driver, so basically all of them should be pinned to a certain
> voltage except for DCDC2 which gets used for the cpu voltage which we
> will want to scale as soon as we've a cpufreq driver.

If you don't know what to do with the regulators and don't have any
information on what's safe then you shouldn't be specifying a voltage at
all.

> While testing the latest revision of your code I also noticed that the
> kernel ends up disabling LDO3 and LDO4, which could be fine on some
> boards and a problem on other boards.

> I think we need to be careful here. For now it may be best to only add
> the DCDC2 regulator to the dts, as we know that dcdc2 is used for the
> cpu voltage everywhere, and we will actually want to control that
> later on.

You need to at least specify that regulators that need to be kept on are
always-on.

> For the others, for the boards where we've schematics (*) it would be
> good to add the other regulators with fixed voltages as specified in
> the schematics. For the rest it may be best to simply leave the
> regulators alone / at their default settings.

If everyone has been running the board at a voltage different to that in
the schematic then I'd not assume that everything has been validated at
the voltage in the schematic, if production firmware is available that's
going to be a more reliable guide than the schematic but it sounds like
all these boards have just been left to run at their default voltages.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140414/c1fb3028/attachment.sig>

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

* Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-11  9:38     ` Carlo Caione
@ 2014-04-16 15:43         ` Lee Jones
  -1 siblings, 0 replies; 74+ messages in thread
From: Lee Jones @ 2014-04-16 15:43 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

> This patch introduces the preliminary support for PMICs X-Powers AXP202
> and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
> used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
> of Allwinner.
> 
> The core enables support for two subsystems:
> - PEK (Power Enable Key)
> - Regulators
> 
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/mfd/Kconfig        |  12 +++
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
>  4 files changed, 442 insertions(+)
>  create mode 100644 drivers/mfd/axp20x.c
>  create mode 100644 include/linux/mfd/axp20x.h

This looks good to me know.

Once you have all the other Acks you need I'd be happy to create an
immutable branch for the other maintainers to pull from.

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

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-16 15:43         ` Lee Jones
  0 siblings, 0 replies; 74+ messages in thread
From: Lee Jones @ 2014-04-16 15:43 UTC (permalink / raw)
  To: linux-arm-kernel

> This patch introduces the preliminary support for PMICs X-Powers AXP202
> and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
> used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
> of Allwinner.
> 
> The core enables support for two subsystems:
> - PEK (Power Enable Key)
> - Regulators
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  drivers/mfd/Kconfig        |  12 +++
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
>  4 files changed, 442 insertions(+)
>  create mode 100644 drivers/mfd/axp20x.c
>  create mode 100644 include/linux/mfd/axp20x.h

This looks good to me know.

Once you have all the other Acks you need I'd be happy to create an
immutable branch for the other maintainers to pull from.

-- 
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] 74+ messages in thread

* Re: [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
  2014-04-16 15:43         ` Lee Jones
@ 2014-04-16 15:44           ` Lee Jones
  -1 siblings, 0 replies; 74+ messages in thread
From: Lee Jones @ 2014-04-16 15:44 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

> > This patch introduces the preliminary support for PMICs X-Powers AXP202
> > and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
> > used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
> > of Allwinner.
> > 
> > The core enables support for two subsystems:
> > - PEK (Power Enable Key)
> > - Regulators
> > 
> > Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> > ---
> >  drivers/mfd/Kconfig        |  12 +++
> >  drivers/mfd/Makefile       |   1 +
> >  drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
> >  4 files changed, 442 insertions(+)
> >  create mode 100644 drivers/mfd/axp20x.c
> >  create mode 100644 include/linux/mfd/axp20x.h
> 
> This looks good to me know.
> 
> Once you have all the other Acks you need I'd be happy to create an
> immutable branch for the other maintainers to pull from.

Whoops, forgot this:
  Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

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

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC
@ 2014-04-16 15:44           ` Lee Jones
  0 siblings, 0 replies; 74+ messages in thread
From: Lee Jones @ 2014-04-16 15:44 UTC (permalink / raw)
  To: linux-arm-kernel

> > This patch introduces the preliminary support for PMICs X-Powers AXP202
> > and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
> > used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
> > of Allwinner.
> > 
> > The core enables support for two subsystems:
> > - PEK (Power Enable Key)
> > - Regulators
> > 
> > Signed-off-by: Carlo Caione <carlo@caione.org>
> > ---
> >  drivers/mfd/Kconfig        |  12 +++
> >  drivers/mfd/Makefile       |   1 +
> >  drivers/mfd/axp20x.c       | 249 +++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++
> >  4 files changed, 442 insertions(+)
> >  create mode 100644 drivers/mfd/axp20x.c
> >  create mode 100644 include/linux/mfd/axp20x.h
> 
> This looks good to me know.
> 
> Once you have all the other Acks you need I'd be happy to create an
> immutable branch for the other maintainers to pull from.

Whoops, forgot this:
  Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
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] 74+ messages in thread

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-11 16:18               ` Mark Brown
@ 2014-04-17 10:06                   ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-17 10:06 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Fri, Apr 11, 2014 at 6:18 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Fri, Apr 11, 2014 at 03:04:32PM +0200, Carlo Caione wrote:
>> On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>
>> >> +                             regulators {
>> >> +                                     compatible = "x-powers,axp20x-reg";
>
>> > This compatible isn't part of the driver.
>
>> Yes I know. The problem here is that in v4 I had to fill in the field
>> .of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
>> because the regulator_dev_lookup() checks for dev->of_node when
>> looking for the supply so I needed the compatible string in the DT to
>> have the dev->of_node filled in by mfd_add_device().
>> What do you suggest? Modify the regulator driver?
>
> You're looking for regulator_bulk_register_supply_alias() in the MFD
> driver (via parent_supplies in the MFD cell probably).

Hi Mark,
I'm fighting with a small issue when using the
regulator_bulk_register_supply_alias(). Problem is that when using the
.parent_supplies entry in the MFD driver, I hit the

WARN_ON(!list_empty(&dev->devres_head));

in linux/drivers/base/dd.c#L272, but, apart from the warning,
everything seems to work correctly.
A possible explanation I gave myself is that in the mfd_add_device()
we try to use the devm_* API when the regulator device is not bound to
the driver yet (I found some information here
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
Is this the case?

Thanks,

-- 
Carlo Caione

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-17 10:06                   ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-17 10:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 11, 2014 at 6:18 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Apr 11, 2014 at 03:04:32PM +0200, Carlo Caione wrote:
>> On Fri, Apr 11, 2014 at 2:29 PM, Mark Brown <broonie@kernel.org> wrote:
>
>> >> +                             regulators {
>> >> +                                     compatible = "x-powers,axp20x-reg";
>
>> > This compatible isn't part of the driver.
>
>> Yes I know. The problem here is that in v4 I had to fill in the field
>> .of_compatible of the mfd_cell with "x-powers,axp20x-reg". This
>> because the regulator_dev_lookup() checks for dev->of_node when
>> looking for the supply so I needed the compatible string in the DT to
>> have the dev->of_node filled in by mfd_add_device().
>> What do you suggest? Modify the regulator driver?
>
> You're looking for regulator_bulk_register_supply_alias() in the MFD
> driver (via parent_supplies in the MFD cell probably).

Hi Mark,
I'm fighting with a small issue when using the
regulator_bulk_register_supply_alias(). Problem is that when using the
.parent_supplies entry in the MFD driver, I hit the

WARN_ON(!list_empty(&dev->devres_head));

in linux/drivers/base/dd.c#L272, but, apart from the warning,
everything seems to work correctly.
A possible explanation I gave myself is that in the mfd_add_device()
we try to use the devm_* API when the regulator device is not bound to
the driver yet (I found some information here
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
Is this the case?

Thanks,

-- 
Carlo Caione

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

* Re: [linux-sunxi] Re: [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
  2014-04-13  8:17         ` Dmitry Torokhov
@ 2014-04-17 12:07           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-17 12:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-arm-kernel, maxime.ripard, hdegoede, emilio, wens, sameo,
	linux-input, linux-doc, lgirdwood, broonie, lee.jones,
	boris.brezillon, linux-sunxi

On Sun, Apr 13, 2014 at 10:17 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

<cut>

>> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
>> +                                 char *buf)
>> +{
>> +     struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
>> +     struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
>> +     unsigned int val;
>> +     int ret, i;
>> +
>> +     ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
>> +     if (ret != 0)
>> +             return ret;
>> +
>> +     val &= axp20x_ea->mask;
>> +     val >>= ffs(axp20x_ea->mask) - 1;
>> +
>> +     for (i = 0; i < 4; i++)
>> +             if (val == axp20x_ea->p_time[i].idx)
>> +                     val = axp20x_ea->p_time[i].time;
>> +
>> +     return sprintf(buf, "%ums\n", val);
>
> Please do not print ums and instead document the units in sysfs ABI
> docs.

Ok, I'll fix it.

<cut>

>> +     if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
>> +         device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
>> +             return -ENODEV;
>
> I think you still want to use attribute group here. You also need to
> clean up the attributes when unbinding device. Also, why returning
> -ENODEV instead of the proper error code?

I'll fix the error code and I'll add the clean up code.
I'm still a bit puzzled about the attribute group for the platform
devices. IIRC for the platform devices the default attribute group is
still a bit an issue [1]

[1] http://www.spinics.net/lists/hotplug/msg05775.html

Thanks for the review,

-- 
Carlo Caione

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

* [linux-sunxi] Re: [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key
@ 2014-04-17 12:07           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-17 12:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Apr 13, 2014 at 10:17 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

<cut>

>> +static ssize_t axp20x_show_ext_attr(struct device *dev, struct device_attribute *attr,
>> +                                 char *buf)
>> +{
>> +     struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
>> +     struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
>> +     unsigned int val;
>> +     int ret, i;
>> +
>> +     ret = regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
>> +     if (ret != 0)
>> +             return ret;
>> +
>> +     val &= axp20x_ea->mask;
>> +     val >>= ffs(axp20x_ea->mask) - 1;
>> +
>> +     for (i = 0; i < 4; i++)
>> +             if (val == axp20x_ea->p_time[i].idx)
>> +                     val = axp20x_ea->p_time[i].time;
>> +
>> +     return sprintf(buf, "%ums\n", val);
>
> Please do not print ums and instead document the units in sysfs ABI
> docs.

Ok, I'll fix it.

<cut>

>> +     if (device_create_file(&pdev->dev, &axp20x_dev_attr_startup.attr) ||
>> +         device_create_file(&pdev->dev, &axp20x_dev_attr_shutdown.attr))
>> +             return -ENODEV;
>
> I think you still want to use attribute group here. You also need to
> clean up the attributes when unbinding device. Also, why returning
> -ENODEV instead of the proper error code?

I'll fix the error code and I'll add the clean up code.
I'm still a bit puzzled about the attribute group for the platform
devices. IIRC for the platform devices the default attribute group is
still a bit an issue [1]

[1] http://www.spinics.net/lists/hotplug/msg05775.html

Thanks for the review,

-- 
Carlo Caione

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-17 10:06                   ` Carlo Caione
@ 2014-04-18 15:15                       ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-18 15:15 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

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

On Thu, Apr 17, 2014 at 12:06:34PM +0200, Carlo Caione wrote:

> I'm fighting with a small issue when using the
> regulator_bulk_register_supply_alias(). Problem is that when using the
> .parent_supplies entry in the MFD driver, I hit the
> 
> WARN_ON(!list_empty(&dev->devres_head));
> 
> in linux/drivers/base/dd.c#L272, but, apart from the warning,
> everything seems to work correctly.
> A possible explanation I gave myself is that in the mfd_add_device()
> we try to use the devm_* API when the regulator device is not bound to
> the driver yet (I found some information here
> http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
> Is this the case?

Without knowing more about the case you're hitting it's hard to say - I
do run a board which exercises the API for a MFD (with the arizona
drivers) regularly and haven't noticed an issue so there must be
something different about what you're trying to do.

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

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-18 15:15                       ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-18 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 17, 2014 at 12:06:34PM +0200, Carlo Caione wrote:

> I'm fighting with a small issue when using the
> regulator_bulk_register_supply_alias(). Problem is that when using the
> .parent_supplies entry in the MFD driver, I hit the
> 
> WARN_ON(!list_empty(&dev->devres_head));
> 
> in linux/drivers/base/dd.c#L272, but, apart from the warning,
> everything seems to work correctly.
> A possible explanation I gave myself is that in the mfd_add_device()
> we try to use the devm_* API when the regulator device is not bound to
> the driver yet (I found some information here
> http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
> Is this the case?

Without knowing more about the case you're hitting it's hard to say - I
do run a board which exercises the API for a MFD (with the arizona
drivers) regularly and haven't noticed an issue so there must be
something different about what you're trying to do.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140418/b18fbf1d/attachment.sig>

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-18 15:15                       ` Mark Brown
@ 2014-04-23 20:25                           ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-23 20:25 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

On Fri, Apr 18, 2014 at 04:15:51PM +0100, Mark Brown wrote:
> On Thu, Apr 17, 2014 at 12:06:34PM +0200, Carlo Caione wrote:
> 
> > I'm fighting with a small issue when using the
> > regulator_bulk_register_supply_alias(). Problem is that when using the
> > .parent_supplies entry in the MFD driver, I hit the
> > 
> > WARN_ON(!list_empty(&dev->devres_head));
> > 
> > in linux/drivers/base/dd.c#L272, but, apart from the warning,
> > everything seems to work correctly.
> > A possible explanation I gave myself is that in the mfd_add_device()
> > we try to use the devm_* API when the regulator device is not bound to
> > the driver yet (I found some information here
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
> > Is this the case?
> 
> Without knowing more about the case you're hitting it's hard to say - I
> do run a board which exercises the API for a MFD (with the arizona
> drivers) regularly and haven't noticed an issue so there must be
> something different about what you're trying to do.

I'm having a really hard time with this problem, so any hint is welcome
:) The small modification I'm using on top of the patches in this series
is here: http://bpaste.net/show/228330/

Unfortunately as I said I got this when booting:
http://bpaste.net/show/nUhUTzELT32v9HNPathL/

Thanks,

--
Carlo Caione

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-23 20:25                           ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-04-23 20:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 18, 2014 at 04:15:51PM +0100, Mark Brown wrote:
> On Thu, Apr 17, 2014 at 12:06:34PM +0200, Carlo Caione wrote:
> 
> > I'm fighting with a small issue when using the
> > regulator_bulk_register_supply_alias(). Problem is that when using the
> > .parent_supplies entry in the MFD driver, I hit the
> > 
> > WARN_ON(!list_empty(&dev->devres_head));
> > 
> > in linux/drivers/base/dd.c#L272, but, apart from the warning,
> > everything seems to work correctly.
> > A possible explanation I gave myself is that in the mfd_add_device()
> > we try to use the devm_* API when the regulator device is not bound to
> > the driver yet (I found some information here
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/104442.html).
> > Is this the case?
> 
> Without knowing more about the case you're hitting it's hard to say - I
> do run a board which exercises the API for a MFD (with the arizona
> drivers) regularly and haven't noticed an issue so there must be
> something different about what you're trying to do.

I'm having a really hard time with this problem, so any hint is welcome
:) The small modification I'm using on top of the patches in this series
is here: http://bpaste.net/show/228330/

Unfortunately as I said I got this when booting:
http://bpaste.net/show/nUhUTzELT32v9HNPathL/

Thanks,

--
Carlo Caione

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-23 20:25                           ` Carlo Caione
@ 2014-04-24 13:30                               ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-24 13:30 UTC (permalink / raw)
  To: Carlo Caione
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, Charles Keepax

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

On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:

> I'm having a really hard time with this problem, so any hint is welcome
> :) The small modification I'm using on top of the patches in this series
> is here: http://bpaste.net/show/228330/

> Unfortunately as I said I got this when booting:
> http://bpaste.net/show/nUhUTzELT32v9HNPathL/

Huh, actually the arizona drivers do show this (it was being masked in
my logs by another unrelated bug).  I guess the Wolfson guys aren't
working with upstream much (though Charles did write the orignal code
here...).

The issue is the MFD core, it shouldn't be using managed allocations
here - the error reported by the assert is entirely correct.  If the
CODEC driver is bound and unbound it'll not be possible to reload it
as things stand.  

Your driver is correct but the implementation needs to be fixed -
possibly with an API change on free since at the minute the cells to be
freed don't get passed back into the MFD core when deallocating.

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

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-24 13:30                               ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-24 13:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:

> I'm having a really hard time with this problem, so any hint is welcome
> :) The small modification I'm using on top of the patches in this series
> is here: http://bpaste.net/show/228330/

> Unfortunately as I said I got this when booting:
> http://bpaste.net/show/nUhUTzELT32v9HNPathL/

Huh, actually the arizona drivers do show this (it was being masked in
my logs by another unrelated bug).  I guess the Wolfson guys aren't
working with upstream much (though Charles did write the orignal code
here...).

The issue is the MFD core, it shouldn't be using managed allocations
here - the error reported by the assert is entirely correct.  If the
CODEC driver is bound and unbound it'll not be possible to reload it
as things stand.  

Your driver is correct but the implementation needs to be fixed -
possibly with an API change on free since at the minute the cells to be
freed don't get passed back into the MFD core when deallocating.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140424/f92224c1/attachment-0001.sig>

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-24 13:30                               ` Mark Brown
@ 2014-04-24 16:35                                 ` Charles Keepax
  -1 siblings, 0 replies; 74+ messages in thread
From: Charles Keepax @ 2014-04-24 16:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: Carlo Caione, boris.brezillon, sameo, linux-doc, emilio,
	dmitry.torokhov, wens, lgirdwood, hdegoede, linux-sunxi,
	linux-input, maxime.ripard, lee.jones, linux-arm-kernel

On Thu, Apr 24, 2014 at 02:30:36PM +0100, Mark Brown wrote:
> On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:
> 
> > I'm having a really hard time with this problem, so any hint is welcome
> > :) The small modification I'm using on top of the patches in this series
> > is here: http://bpaste.net/show/228330/
> 
> > Unfortunately as I said I got this when booting:
> > http://bpaste.net/show/nUhUTzELT32v9HNPathL/
> 
> Huh, actually the arizona drivers do show this (it was being masked in
> my logs by another unrelated bug).  I guess the Wolfson guys aren't
> working with upstream much (though Charles did write the orignal code
> here...).

I run upstream fairly regularly here (although mostly on Arndale
rather than Speyside). On closer inspection of my kernel log
don't seem to have anything related to it, which is odd.

> The issue is the MFD core, it shouldn't be using managed allocations
> here - the error reported by the assert is entirely correct.  If the
> CODEC driver is bound and unbound it'll not be possible to reload it
> as things stand.  
> 
> Your driver is correct but the implementation needs to be fixed -
> possibly with an API change on free since at the minute the cells to be
> freed don't get passed back into the MFD core when deallocating.

This does indeed look broken, I will have a look and think about it.
Unfortunately I am travelling most of next week, so if I don't
manage to get something out over the weekend there may be a slight
delay on me getting a fix out.

Thanks,
Charles

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-24 16:35                                 ` Charles Keepax
  0 siblings, 0 replies; 74+ messages in thread
From: Charles Keepax @ 2014-04-24 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 24, 2014 at 02:30:36PM +0100, Mark Brown wrote:
> On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:
> 
> > I'm having a really hard time with this problem, so any hint is welcome
> > :) The small modification I'm using on top of the patches in this series
> > is here: http://bpaste.net/show/228330/
> 
> > Unfortunately as I said I got this when booting:
> > http://bpaste.net/show/nUhUTzELT32v9HNPathL/
> 
> Huh, actually the arizona drivers do show this (it was being masked in
> my logs by another unrelated bug).  I guess the Wolfson guys aren't
> working with upstream much (though Charles did write the orignal code
> here...).

I run upstream fairly regularly here (although mostly on Arndale
rather than Speyside). On closer inspection of my kernel log
don't seem to have anything related to it, which is odd.

> The issue is the MFD core, it shouldn't be using managed allocations
> here - the error reported by the assert is entirely correct.  If the
> CODEC driver is bound and unbound it'll not be possible to reload it
> as things stand.  
> 
> Your driver is correct but the implementation needs to be fixed -
> possibly with an API change on free since at the minute the cells to be
> freed don't get passed back into the MFD core when deallocating.

This does indeed look broken, I will have a look and think about it.
Unfortunately I am travelling most of next week, so if I don't
manage to get something out over the weekend there may be a slight
delay on me getting a fix out.

Thanks,
Charles

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-24 16:35                                 ` Charles Keepax
@ 2014-04-24 16:58                                     ` Charles Keepax
  -1 siblings, 0 replies; 74+ messages in thread
From: Charles Keepax @ 2014-04-24 16:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	sameo-VuQAYsv1563Yd54FQh9/CA, linux-doc-u79uwXL29TY76Z2rM5mHXA,
	emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, wens-jdAy2FN1RRM,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Carlo Caione,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Apr 24, 2014 at 05:35:23PM +0100, Charles Keepax wrote:
> On Thu, Apr 24, 2014 at 02:30:36PM +0100, Mark Brown wrote:
> > On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:
> > 
> > > I'm having a really hard time with this problem, so any hint is welcome
> > > :) The small modification I'm using on top of the patches in this series
> > > is here: http://bpaste.net/show/228330/
> > 
> > > Unfortunately as I said I got this when booting:
> > > http://bpaste.net/show/nUhUTzELT32v9HNPathL/
> > 
> > Huh, actually the arizona drivers do show this (it was being masked in
> > my logs by another unrelated bug).  I guess the Wolfson guys aren't
> > working with upstream much (though Charles did write the orignal code
> > here...).
> 
> I run upstream fairly regularly here (although mostly on Arndale
> rather than Speyside). On closer inspection of my kernel log
> don't seem to have anything related to it, which is odd.

Ah ok seems I am getting an error but for some reason for me it
shows up looking very unrelated to the supply mapping. In that it
shows up much later in the log and doesn't seem to mention the
MFD at all:

[    2.938985] ------------[ cut here ]------------
[    2.942216] WARNING: CPU: 0 PID: 1 at drivers/base/dd.c:272 driver_probe_device+0x127/0x184()
[    2.950680] Modules linked in:
[    2.953677] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.15.0-rc2+ #636
[    2.960246] [<80011ab9>] (unwind_backtrace) from [<8000f461>] (show_stack+0x11/0x14)
[    2.967972] [<8000f461>] (show_stack) from [<804c3bab>] (dump_stack+0x53/0x68)
[    2.975171] [<804c3bab>] (dump_stack) from [<8001bc55>] (warn_slowpath_common+0x51/0x70)
[    2.983239] [<8001bc55>] (warn_slowpath_common) from [<8001bc8b>] (warn_slowpath_null+0x17/0x1c)
[    2.992009] [<8001bc8b>] (warn_slowpath_null) from [<802c040f>] (driver_probe_device+0x127/0x184)
[    3.000864] [<802c040f>] (driver_probe_device) from [<802c04bd>] (__driver_attach+0x51/0x54)
[    3.009278] [<802c04bd>] (__driver_attach) from [<802bf2fd>] (bus_for_each_dev+0x2d/0x4c)
[    3.017437] [<802bf2fd>] (bus_for_each_dev) from [<802bfde7>] (bus_add_driver+0x8f/0x130)
[    3.025603] [<802bfde7>] (bus_add_driver) from [<802c08b7>] (driver_register+0x3b/0x88)
[    3.033540] [<802c08b7>] (driver_register) from [<800087df>] (do_one_initcall+0xa7/0xe8)
[    3.041618] [<800087df>] (do_one_initcall) from [<8097d9e7>] (kernel_init_freeable+0xb7/0x14c)
[    3.050219] [<8097d9e7>] (kernel_init_freeable) from [<804bec2b>] (kernel_init+0xf/0xa4)
[    3.058286] [<804bec2b>] (kernel_init) from [<8000cebd>] (ret_from_fork+0x11/0x20)
[    3.065835] ---[ end trace f838bbad8b4018a1 ]---

The fix looks pretty trivial though, hopefully get it out
tonight/tomorrow morning.

Thanks,
Charles

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-24 16:58                                     ` Charles Keepax
  0 siblings, 0 replies; 74+ messages in thread
From: Charles Keepax @ 2014-04-24 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 24, 2014 at 05:35:23PM +0100, Charles Keepax wrote:
> On Thu, Apr 24, 2014 at 02:30:36PM +0100, Mark Brown wrote:
> > On Wed, Apr 23, 2014 at 10:25:46PM +0200, Carlo Caione wrote:
> > 
> > > I'm having a really hard time with this problem, so any hint is welcome
> > > :) The small modification I'm using on top of the patches in this series
> > > is here: http://bpaste.net/show/228330/
> > 
> > > Unfortunately as I said I got this when booting:
> > > http://bpaste.net/show/nUhUTzELT32v9HNPathL/
> > 
> > Huh, actually the arizona drivers do show this (it was being masked in
> > my logs by another unrelated bug).  I guess the Wolfson guys aren't
> > working with upstream much (though Charles did write the orignal code
> > here...).
> 
> I run upstream fairly regularly here (although mostly on Arndale
> rather than Speyside). On closer inspection of my kernel log
> don't seem to have anything related to it, which is odd.

Ah ok seems I am getting an error but for some reason for me it
shows up looking very unrelated to the supply mapping. In that it
shows up much later in the log and doesn't seem to mention the
MFD at all:

[    2.938985] ------------[ cut here ]------------
[    2.942216] WARNING: CPU: 0 PID: 1 at drivers/base/dd.c:272 driver_probe_device+0x127/0x184()
[    2.950680] Modules linked in:
[    2.953677] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.15.0-rc2+ #636
[    2.960246] [<80011ab9>] (unwind_backtrace) from [<8000f461>] (show_stack+0x11/0x14)
[    2.967972] [<8000f461>] (show_stack) from [<804c3bab>] (dump_stack+0x53/0x68)
[    2.975171] [<804c3bab>] (dump_stack) from [<8001bc55>] (warn_slowpath_common+0x51/0x70)
[    2.983239] [<8001bc55>] (warn_slowpath_common) from [<8001bc8b>] (warn_slowpath_null+0x17/0x1c)
[    2.992009] [<8001bc8b>] (warn_slowpath_null) from [<802c040f>] (driver_probe_device+0x127/0x184)
[    3.000864] [<802c040f>] (driver_probe_device) from [<802c04bd>] (__driver_attach+0x51/0x54)
[    3.009278] [<802c04bd>] (__driver_attach) from [<802bf2fd>] (bus_for_each_dev+0x2d/0x4c)
[    3.017437] [<802bf2fd>] (bus_for_each_dev) from [<802bfde7>] (bus_add_driver+0x8f/0x130)
[    3.025603] [<802bfde7>] (bus_add_driver) from [<802c08b7>] (driver_register+0x3b/0x88)
[    3.033540] [<802c08b7>] (driver_register) from [<800087df>] (do_one_initcall+0xa7/0xe8)
[    3.041618] [<800087df>] (do_one_initcall) from [<8097d9e7>] (kernel_init_freeable+0xb7/0x14c)
[    3.050219] [<8097d9e7>] (kernel_init_freeable) from [<804bec2b>] (kernel_init+0xf/0xa4)
[    3.058286] [<804bec2b>] (kernel_init) from [<8000cebd>] (ret_from_fork+0x11/0x20)
[    3.065835] ---[ end trace f838bbad8b4018a1 ]---

The fix looks pretty trivial though, hopefully get it out
tonight/tomorrow morning.

Thanks,
Charles

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

* Re: [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
  2014-04-24 16:58                                     ` Charles Keepax
@ 2014-04-24 17:12                                         ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-24 17:12 UTC (permalink / raw)
  To: Charles Keepax
  Cc: boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	sameo-VuQAYsv1563Yd54FQh9/CA, linux-doc-u79uwXL29TY76Z2rM5mHXA,
	emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, wens-jdAy2FN1RRM,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Carlo Caione,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

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

On Thu, Apr 24, 2014 at 05:58:47PM +0100, Charles Keepax wrote:

> Ah ok seems I am getting an error but for some reason for me it
> shows up looking very unrelated to the supply mapping. In that it
> shows up much later in the log and doesn't seem to mention the
> MFD at all:

If you look at the warning you'll see that it's complaining that it's
trying to probe a device which has devres stuff attached to it which is
happens at the time the function driver gets loaded.

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

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

* [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards
@ 2014-04-24 17:12                                         ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-04-24 17:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 24, 2014 at 05:58:47PM +0100, Charles Keepax wrote:

> Ah ok seems I am getting an error but for some reason for me it
> shows up looking very unrelated to the supply mapping. In that it
> shows up much later in the log and doesn't seem to mention the
> MFD at all:

If you look at the warning you'll see that it's complaining that it's
trying to probe a device which has devres stuff attached to it which is
happens at the time the function driver gets loaded.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140424/c7006a8c/attachment.sig>

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

* Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-04-11  9:38     ` Carlo Caione
@ 2014-05-15 18:03         ` Boris BREZILLON
  -1 siblings, 0 replies; 74+ messages in thread
From: Boris BREZILLON @ 2014-05-15 18:03 UTC (permalink / raw)
  To: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A

Hello Carlo,

On 11/04/2014 11:38, Carlo Caione wrote:
> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
> LDOs. This patch introduces basic support for those regulators.
>
> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/regulator/Kconfig            |   7 +
>  drivers/regulator/Makefile           |   1 +
[...]
> +	if (!np)
> +		return 0;
> +
> +	regulators = of_find_node_by_name(np, "regulators");

I know I'm late, and this patch has already been applied, but shouldn't
we use of_get_child_by_name instead of of_find_node_by_name.
This might lead to wrong regulators node parsing if other regulators are
defined in the DT after the axp20x node, because, AFAIK, this function
searches for DT nodes defined after the specified np node, but not
necessarely children of the np node.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-05-15 18:03         ` Boris BREZILLON
  0 siblings, 0 replies; 74+ messages in thread
From: Boris BREZILLON @ 2014-05-15 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Carlo,

On 11/04/2014 11:38, Carlo Caione wrote:
> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
> LDOs. This patch introduces basic support for those regulators.
>
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  drivers/regulator/Kconfig            |   7 +
>  drivers/regulator/Makefile           |   1 +
[...]
> +	if (!np)
> +		return 0;
> +
> +	regulators = of_find_node_by_name(np, "regulators");

I know I'm late, and this patch has already been applied, but shouldn't
we use of_get_child_by_name instead of of_find_node_by_name.
This might lead to wrong regulators node parsing if other regulators are
defined in the DT after the axp20x node, because, AFAIK, this function
searches for DT nodes defined after the specified np node, but not
necessarely children of the np node.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-05-15 18:03         ` Boris BREZILLON
@ 2014-05-15 18:18             ` Mark Brown
  -1 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-05-15 18:18 UTC (permalink / raw)
  To: Boris BREZILLON
  Cc: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A

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

On Thu, May 15, 2014 at 08:03:06PM +0200, Boris BREZILLON wrote:

> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.

Yes.

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

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

* [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-05-15 18:18             ` Mark Brown
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Brown @ 2014-05-15 18:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 15, 2014 at 08:03:06PM +0200, Boris BREZILLON wrote:

> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.

Yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140515/4c782607/attachment.sig>

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

* Re: Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
  2014-05-15 18:03         ` Boris BREZILLON
@ 2014-05-16  7:40             ` Carlo Caione
  -1 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-05-16  7:40 UTC (permalink / raw)
  To: boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: Carlo Caione, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	hdegoede-H+wXaHxf7aLQT0dZR+AlfA, emilio-0Z03zUJReD5OxF6Tv1QG9Q,
	wens-jdAy2FN1RRM, sameo-VuQAYsv1563Yd54FQh9/CA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

On Thu, May 15, 2014 at 8:03 PM, Boris BREZILLON
<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hello Carlo,
>
> On 11/04/2014 11:38, Carlo Caione wrote:
>> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
>> LDOs. This patch introduces basic support for those regulators.
>>
>> Signed-off-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> ---
>>  drivers/regulator/Kconfig            |   7 +
>>  drivers/regulator/Makefile           |   1 +
> [...]
>> +     if (!np)
>> +             return 0;
>> +
>> +     regulators = of_find_node_by_name(np, "regulators");
>
> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.

Right. I'll prepare a fix. Feel free to submit a patch if you want.

Thank you,

-- 
Carlo Caione

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

* [linux-sunxi] Re: [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem
@ 2014-05-16  7:40             ` Carlo Caione
  0 siblings, 0 replies; 74+ messages in thread
From: Carlo Caione @ 2014-05-16  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 15, 2014 at 8:03 PM, Boris BREZILLON
<boris.brezillon@free-electrons.com> wrote:
> Hello Carlo,
>
> On 11/04/2014 11:38, Carlo Caione wrote:
>> AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
>> LDOs. This patch introduces basic support for those regulators.
>>
>> Signed-off-by: Carlo Caione <carlo@caione.org>
>> ---
>>  drivers/regulator/Kconfig            |   7 +
>>  drivers/regulator/Makefile           |   1 +
> [...]
>> +     if (!np)
>> +             return 0;
>> +
>> +     regulators = of_find_node_by_name(np, "regulators");
>
> I know I'm late, and this patch has already been applied, but shouldn't
> we use of_get_child_by_name instead of of_find_node_by_name.
> This might lead to wrong regulators node parsing if other regulators are
> defined in the DT after the axp20x node, because, AFAIK, this function
> searches for DT nodes defined after the specified np node, but not
> necessarely children of the np node.

Right. I'll prepare a fix. Feel free to submit a patch if you want.

Thank you,

-- 
Carlo Caione

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

end of thread, other threads:[~2014-05-16  7:40 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-11  9:38 [PATCH v4 0/9] mfd: AXP20x: Add support for AXP202 and AXP209 Carlo Caione
2014-04-11  9:38 ` Carlo Caione
     [not found] ` <1397209093-10077-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11  9:38   ` [PATCH v4 1/9] mfd: AXP20x: Add mfd driver for AXP20x PMIC Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-2-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 11:25       ` Arnd Bergmann
2014-04-11 11:25         ` Arnd Bergmann
2014-04-11 12:03         ` [linux-sunxi] " Carlo Caione
2014-04-11 12:03           ` Carlo Caione
2014-04-11 12:09         ` Mark Brown
2014-04-11 12:09           ` Mark Brown
     [not found]           ` <20140411120908.GC28800-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-11 13:16             ` Arnd Bergmann
2014-04-11 13:16               ` Arnd Bergmann
2014-04-16 15:43       ` Lee Jones
2014-04-16 15:43         ` Lee Jones
2014-04-16 15:44         ` Lee Jones
2014-04-16 15:44           ` Lee Jones
2014-04-11  9:38   ` [PATCH v4 2/9] dt-bindings: add vendor-prefix for X-Powers Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 3/9] mfd: AXP20x: Add bindings documentation Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 4/9] input: misc: Add driver for AXP20x Power Enable Key Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-5-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-13  8:17       ` Dmitry Torokhov
2014-04-13  8:17         ` Dmitry Torokhov
2014-04-17 12:07         ` [linux-sunxi] " Carlo Caione
2014-04-17 12:07           ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 5/9] input: misc: Add ABI docs for AXP20x PEK Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 6/9] regulator: AXP20x: Add support for regulators subsystem Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-7-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 12:23       ` Mark Brown
2014-04-11 12:23         ` Mark Brown
2014-04-11 12:29         ` [linux-sunxi] " Carlo Caione
2014-04-11 12:29           ` Carlo Caione
2014-05-15 18:03       ` Boris BREZILLON
2014-05-15 18:03         ` Boris BREZILLON
     [not found]         ` <5375015A.10701-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-05-15 18:18           ` Mark Brown
2014-05-15 18:18             ` Mark Brown
2014-05-16  7:40           ` Carlo Caione
2014-05-16  7:40             ` [linux-sunxi] " Carlo Caione
2014-04-11  9:38   ` [PATCH v4 7/9] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards Carlo Caione
2014-04-11  9:38     ` Carlo Caione
     [not found]     ` <1397209093-10077-8-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
2014-04-11 12:29       ` Mark Brown
2014-04-11 12:29         ` Mark Brown
2014-04-11 13:04         ` Carlo Caione
2014-04-11 13:04           ` Carlo Caione
     [not found]           ` <CAOQ7t2Y2B7f+eZApDHKiKm9=bOXo6oUA2RLY7ENn7qPLQEboMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-11 16:18             ` Mark Brown
2014-04-11 16:18               ` Mark Brown
     [not found]               ` <20140411161813.GF28800-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-17 10:06                 ` Carlo Caione
2014-04-17 10:06                   ` Carlo Caione
     [not found]                   ` <CAOQ7t2YO_MjUZkkoEe1Grft+fVttWoOro85Sru2P3LXbx8Kjbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-18 15:15                     ` Mark Brown
2014-04-18 15:15                       ` Mark Brown
     [not found]                       ` <20140418151551.GZ12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-23 20:25                         ` Carlo Caione
2014-04-23 20:25                           ` Carlo Caione
     [not found]                           ` <20140423202546.GA3890-OP/Sd6KM9CusbfqNwF1Yyl6hYfS7NtTn@public.gmane.org>
2014-04-24 13:30                             ` Mark Brown
2014-04-24 13:30                               ` Mark Brown
2014-04-24 16:35                               ` Charles Keepax
2014-04-24 16:35                                 ` Charles Keepax
     [not found]                                 ` <20140424163523.GB25663-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2014-04-24 16:58                                   ` Charles Keepax
2014-04-24 16:58                                     ` Charles Keepax
     [not found]                                     ` <20140424165847.GC25663-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2014-04-24 17:12                                       ` Mark Brown
2014-04-24 17:12                                         ` Mark Brown
2014-04-14  9:52       ` Maxime Ripard
2014-04-14  9:52         ` Maxime Ripard
2014-04-14 10:02         ` Carlo Caione
2014-04-14 10:02           ` [linux-sunxi] " Carlo Caione
     [not found]           ` <CAOQ7t2ZybF=dm-NBQ3niN7gb-Asgwz5CW-VSkOzWR6t2NCaA8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-14 10:20             ` Hans de Goede
2014-04-14 10:20               ` [linux-sunxi] " Hans de Goede
     [not found]               ` <534BB670.8030102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-14 11:16                 ` Mark Brown
2014-04-14 11:16                   ` [linux-sunxi] " Mark Brown
2014-04-11  9:38   ` [PATCH v4 8/9] ARM: sunxi: Add AXP20x support in defconfig Carlo Caione
2014-04-11  9:38     ` Carlo Caione
2014-04-11  9:38   ` [PATCH v4 9/9] ARM: sunxi: Add AXP20x support multi_v7_defconfig Carlo Caione
2014-04-11  9:38     ` Carlo Caione

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.