All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] mfd: axp20x: Add support for RSB based AXP223
@ 2015-10-14 16:32 ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

Hi everyone,

This series adds support for the Reduced Serial Bus based AXP223 PMIC.
The AXP223 is functionally identical to the AXP221, which we already
support. Only some default values for the regulators are different.
The defaults fit their recommended application, paired with different
SoCs.

Patch 1 adds AXP223 to the list of supported chips in the DT binding.

Patch 2 splits the axp20x mfd driver into 2 parts, a core library, and
an I2C driver.

Patch 3 adds an RSB based driver for the AXP223.

Patch 4 adds support for the AXP223 regulators

Patch 5 adds the NMI interrupt controller to the sun8i dtsi. This is
chained to the GIC, and exposes an external NMI pin for the PMIC.

Patch 6 enables the AXP223 PMIC and its regulators for the Sinlinx
SinA33.

Another patch enabling the PMIC for the A23/A33 Q8 format tablets
is available, but I'll send it after I get the simplefb regulator
support merged. Otherwise the LCD would get powered down. The whole
branch is available at https://github.com/wens/linux/tree/axp223.

This series is a bit messy to merge. RSB support has just been merged
and is queued up for 4.4. It is available at

  https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git
  
  tags/sunxi-drivers-for-4.4

Patch 4 depends on patch 3 for the new ID, and RSB support, obviously.
And patch 3 depends on patch 2. I suppose with Lee's ack, Mark can
merge the tag above, or wait for 4.4-rc1, then the first 4 patches.


Regards
ChenYu


Chen-Yu Tsai (6):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: Add NMI interrupt controller node
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi             |   8 ++
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  79 +++++++++++++-
 drivers/mfd/Kconfig                              |  30 +++++-
 drivers/mfd/Makefile                             |   4 +-
 drivers/mfd/{axp20x.c => axp20x-core.c}          | 107 +++----------------
 drivers/mfd/axp20x-i2c.c                         | 127 +++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  93 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++-
 10 files changed, 386 insertions(+), 106 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.1


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

* [PATCH 0/6] mfd: axp20x: Add support for RSB based AXP223
@ 2015-10-14 16:32 ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

Hi everyone,

This series adds support for the Reduced Serial Bus based AXP223 PMIC.
The AXP223 is functionally identical to the AXP221, which we already
support. Only some default values for the regulators are different.
The defaults fit their recommended application, paired with different
SoCs.

Patch 1 adds AXP223 to the list of supported chips in the DT binding.

Patch 2 splits the axp20x mfd driver into 2 parts, a core library, and
an I2C driver.

Patch 3 adds an RSB based driver for the AXP223.

Patch 4 adds support for the AXP223 regulators

Patch 5 adds the NMI interrupt controller to the sun8i dtsi. This is
chained to the GIC, and exposes an external NMI pin for the PMIC.

Patch 6 enables the AXP223 PMIC and its regulators for the Sinlinx
SinA33.

Another patch enabling the PMIC for the A23/A33 Q8 format tablets
is available, but I'll send it after I get the simplefb regulator
support merged. Otherwise the LCD would get powered down. The whole
branch is available at https://github.com/wens/linux/tree/axp223.

This series is a bit messy to merge. RSB support has just been merged
and is queued up for 4.4. It is available at

  https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git
  
  tags/sunxi-drivers-for-4.4

Patch 4 depends on patch 3 for the new ID, and RSB support, obviously.
And patch 3 depends on patch 2. I suppose with Lee's ack, Mark can
merge the tag above, or wait for 4.4-rc1, then the first 4 patches.


Regards
ChenYu


Chen-Yu Tsai (6):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: Add NMI interrupt controller node
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi             |   8 ++
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  79 +++++++++++++-
 drivers/mfd/Kconfig                              |  30 +++++-
 drivers/mfd/Makefile                             |   4 +-
 drivers/mfd/{axp20x.c => axp20x-core.c}          | 107 +++----------------
 drivers/mfd/axp20x-i2c.c                         | 127 +++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  93 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++-
 10 files changed, 386 insertions(+), 106 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.1

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

* [PATCH 0/6] mfd: axp20x: Add support for RSB based AXP223
@ 2015-10-14 16:32 ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

This series adds support for the Reduced Serial Bus based AXP223 PMIC.
The AXP223 is functionally identical to the AXP221, which we already
support. Only some default values for the regulators are different.
The defaults fit their recommended application, paired with different
SoCs.

Patch 1 adds AXP223 to the list of supported chips in the DT binding.

Patch 2 splits the axp20x mfd driver into 2 parts, a core library, and
an I2C driver.

Patch 3 adds an RSB based driver for the AXP223.

Patch 4 adds support for the AXP223 regulators

Patch 5 adds the NMI interrupt controller to the sun8i dtsi. This is
chained to the GIC, and exposes an external NMI pin for the PMIC.

Patch 6 enables the AXP223 PMIC and its regulators for the Sinlinx
SinA33.

Another patch enabling the PMIC for the A23/A33 Q8 format tablets
is available, but I'll send it after I get the simplefb regulator
support merged. Otherwise the LCD would get powered down. The whole
branch is available at https://github.com/wens/linux/tree/axp223.

This series is a bit messy to merge. RSB support has just been merged
and is queued up for 4.4. It is available at

  https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git
  
  tags/sunxi-drivers-for-4.4

Patch 4 depends on patch 3 for the new ID, and RSB support, obviously.
And patch 3 depends on patch 2. I suppose with Lee's ack, Mark can
merge the tag above, or wait for 4.4-rc1, then the first 4 patches.


Regards
ChenYu


Chen-Yu Tsai (6):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: Add NMI interrupt controller node
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi             |   8 ++
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  79 +++++++++++++-
 drivers/mfd/Kconfig                              |  30 +++++-
 drivers/mfd/Makefile                             |   4 +-
 drivers/mfd/{axp20x.c => axp20x-core.c}          | 107 +++----------------
 drivers/mfd/axp20x-i2c.c                         | 127 +++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  93 +++++++++++++++++
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++-
 10 files changed, 386 insertions(+), 106 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.1

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

* [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

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

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index a474359dd206..fd39fa54571b 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -5,11 +5,12 @@ axp152 (X-Powers)
 axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
+axp223 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221"
-- reg: The I2C slave address for the AXP chip
+	      "x-powers,axp221", "x-powers,axp223"
+- reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
 - interrupt-controller: The PMIC has its own internal IRQs
@@ -51,7 +52,7 @@ LDO3		: LDO		: ldo3in-supply
 LDO4		: LDO		: ldo24in-supply	: shared supply
 LDO5		: LDO		: ldo5in-supply
 
-AXP221 regulators, type, and corresponding input supply names:
+AXP221/AXP223 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
 ---------	  ----		  -----------		  -----
-- 
2.6.1


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

* [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/axp20x.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index a474359dd206..fd39fa54571b 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -5,11 +5,12 @@ axp152 (X-Powers)
 axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
+axp223 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221"
-- reg: The I2C slave address for the AXP chip
+	      "x-powers,axp221", "x-powers,axp223"
+- reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
 - interrupt-controller: The PMIC has its own internal IRQs
@@ -51,7 +52,7 @@ LDO3		: LDO		: ldo3in-supply
 LDO4		: LDO		: ldo24in-supply	: shared supply
 LDO5		: LDO		: ldo5in-supply
 
-AXP221 regulators, type, and corresponding input supply names:
+AXP221/AXP223 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
 ---------	  ----		  -----------		  -----
-- 
2.6.1

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

* [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

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

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index a474359dd206..fd39fa54571b 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -5,11 +5,12 @@ axp152 (X-Powers)
 axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
+axp223 (X-Powers)
 
 Required properties:
 - compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
-	      "x-powers,axp221"
-- reg: The I2C slave address for the AXP chip
+	      "x-powers,axp221", "x-powers,axp223"
+- reg: The I2C slave address or RSB hardware address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
 - interrupt-controller: The PMIC has its own internal IRQs
@@ -51,7 +52,7 @@ LDO3		: LDO		: ldo3in-supply
 LDO4		: LDO		: ldo24in-supply	: shared supply
 LDO5		: LDO		: ldo5in-supply
 
-AXP221 regulators, type, and corresponding input supply names:
+AXP221/AXP223 regulators, type, and corresponding input supply names:
 
 Regulator	  Type		  Supply Name		  Notes
 ---------	  ----		  -----------		  -----
-- 
2.6.1

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

* [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

The axp20x driver assumes the device is i2c based. This is not the
case with later models, which use a proprietary 2 wire serial bus
called "Reduced Serial Bus".

This patch follows the example of mfd/wm831x and splits it into
an interface independet core, and an i2c specific glue layer.

The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.

Included but unused header files are removed as well.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/mfd/Kconfig                     |  18 ++++-
 drivers/mfd/Makefile                    |   3 +-
 drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
 drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h              |  33 ++++++++-
 5 files changed, 186 insertions(+), 100 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 99d63675f073..9ba3feb3f2fc 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -79,15 +79,25 @@ config MFD_BCM590XX
 	help
 	  Support for the BCM590xx PMUs from Broadcom
 
+# Keep the old symbol until subdevice driver dependencies and defconfigs
+# have been updated.
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	bool "X-Powers AXP series PMICs"
+	select MFD_AXP20X_I2C
+
+config MFD_AXP20X_CORE
+	bool
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
+
+config MFD_AXP20X_I2C
+	bool "X-Powers AXP series I2C PMICs"
+	select MFD_AXP20X_CORE
+	select REGMAP_I2C
 	depends on I2C=y
 	help
-	  If you say Y here you get support for the X-Powers AXP202, AXP209 and
-	  AXP288 power management IC (PMIC).
+	  If you say Y here you get support for the X-Powers AXP series I2C
+	  based power management ICs (PMICs).
 	  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.
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a59e3fcc8626..ce3ad5fd4e2f 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -106,7 +106,8 @@ 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_AXP20X_CORE)	+= axp20x-core.o
+obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.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-core.c
similarity index 87%
rename from drivers/mfd/axp20x.c
rename to drivers/mfd/axp20x-core.c
index 3f576b76c322..dd33548d93c4 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x-core.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * This file contains the interface independent core functions.
+ *
  * Author: Carlo Caione <carlo@caione.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -13,18 +15,14 @@
  */
 
 #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>
 #include <linux/acpi.h>
 
 #define AXP20X_OFF	0x80
@@ -361,32 +359,6 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
-static const struct of_device_id axp20x_of_match[] = {
-	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
-	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
-	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
-	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_acpi_match[] = {
-	{
-		.id = "INT33F4",
-		.driver_data = AXP288_ID,
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
-
 static const struct regmap_irq_chip axp152_regmap_irq_chip = {
 	.name			= "axp152_irq_chip",
 	.status_base		= AXP152_IRQ1_STATE,
@@ -586,27 +558,8 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 {
-	const struct acpi_device_id *acpi_id;
-	const struct of_device_id *of_id;
-
-	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
-		if (!of_id) {
-			dev_err(dev, "Unable to match OF ID\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) of_id->data;
-	} else {
-		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
-		if (!acpi_id || !acpi_id->driver_data) {
-			dev_err(dev, "Unable to match ACPI ID and data\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) acpi_id->driver_data;
-	}
-
 	switch (axp20x->variant) {
 	case AXP152_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp152_cells);
@@ -643,37 +596,16 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 	return 0;
 }
 
-static int axp20x_i2c_probe(struct i2c_client *i2c,
-			 const struct i2c_device_id *id)
+int axp20x_device_probe(struct axp20x_dev *axp20x)
 {
-	struct axp20x_dev *axp20x;
 	int ret;
 
-	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
-	if (!axp20x)
-		return -ENOMEM;
-
-	ret = axp20x_match_device(axp20x, &i2c->dev);
-	if (ret)
-		return ret;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
-	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,
+	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->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);
+		dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
 		return ret;
 	}
 
@@ -681,8 +613,8 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 			axp20x->nr_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);
+		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
+		regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 		return ret;
 	}
 
@@ -691,39 +623,24 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 		pm_power_off = axp20x_power_off;
 	}
 
-	dev_info(&i2c->dev, "AXP20X driver loaded\n");
+	dev_info(axp20x->dev, "AXP20X driver loaded\n");
 
 	return 0;
 }
 
-static int axp20x_i2c_remove(struct i2c_client *i2c)
+int axp20x_device_remove(struct axp20x_dev *axp20x)
 {
-	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);
+	regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 
 	return 0;
 }
 
-static struct i2c_driver axp20x_i2c_driver = {
-	.driver = {
-		.name	= "axp20x",
-		.of_match_table	= of_match_ptr(axp20x_of_match),
-		.acpi_match_table = ACPI_PTR(axp20x_acpi_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/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..3916f5253500
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,127 @@
+/*
+ * axp20x-i2c.c - I2C driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the I2C variants.
+ *
+ * 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/acpi.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+static const struct of_device_id axp20x_i2c_of_match[] = {
+	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
+	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_i2c_acpi_match[] = {
+	{
+		.id = "INT33F4",
+		.driver_data = AXP288_ID,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
+
+static int axp20x_i2c_match_device(struct axp20x_dev *axp20x,
+				   struct device *dev)
+{
+	const struct acpi_device_id *acpi_id;
+	const struct of_device_id *of_id;
+
+	if (dev->of_node) {
+		of_id = of_match_device(axp20x_i2c_of_match, dev);
+		if (!of_id) {
+			dev_err(dev, "Unable to match OF ID\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) of_id->data;
+	} else {
+		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
+		if (!acpi_id || !acpi_id->driver_data) {
+			dev_err(dev, "Unable to match ACPI ID and data\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) acpi_id->driver_data;
+	}
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+			    const struct i2c_device_id *id)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_i2c_match_device(axp20x, &i2c->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x",
+		.of_match_table	= of_match_ptr(axp20x_i2c_of_match),
+		.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
+	},
+	.probe		= axp20x_i2c_probe,
+	.remove		= axp20x_i2c_remove,
+	.id_table	= axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD I2C 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
index b24c771cebd5..908f97f6e2d7 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -396,7 +396,7 @@ enum axp288_irqs {
 
 struct axp20x_dev {
 	struct device			*dev;
-	struct i2c_client		*i2c_client;
+	int				irq;
 	struct regmap			*regmap;
 	struct regmap_irq_chip_data	*regmap_irqc;
 	long				variant;
@@ -462,4 +462,35 @@ static inline int axp20x_read_variable_width(struct regmap *regmap,
 	return result;
 }
 
+/**
+ * axp20x_match_device(): Setup axp20x variant related fields
+ *
+ * @axp20x: axp20x device to setup (.variant field must be set)
+ * @dev: device associated with this axp20x device
+ *
+ * This lets the axp20x core configure the mfd cells and register maps
+ * for later use.
+ */
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev);
+
+/**
+ * axp20x_device_probe(): Probe a configured axp20x device
+ *
+ * @axp20x: axp20x device to probe (must be configured)
+ *
+ * This function lets the axp20x core register the axp20x mfd devices
+ * and irqchip. The axp20x device passed in must be fully configured
+ * with axp20x_match_device, its irq set, and regmap created.
+ */
+int axp20x_device_probe(struct axp20x_dev *axp20x);
+
+/**
+ * axp20x_device_probe(): Remove a axp20x device
+ *
+ * @axp20x: axp20x device to remove
+ *
+ * This tells the axp20x core to remove the associated mfd devices
+ */
+int axp20x_device_remove(struct axp20x_dev *axp20x);
+
 #endif /* __LINUX_MFD_AXP20X_H */
-- 
2.6.1


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

* [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

The axp20x driver assumes the device is i2c based. This is not the
case with later models, which use a proprietary 2 wire serial bus
called "Reduced Serial Bus".

This patch follows the example of mfd/wm831x and splits it into
an interface independet core, and an i2c specific glue layer.

The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.

Included but unused header files are removed as well.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 drivers/mfd/Kconfig                     |  18 ++++-
 drivers/mfd/Makefile                    |   3 +-
 drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
 drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h              |  33 ++++++++-
 5 files changed, 186 insertions(+), 100 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 99d63675f073..9ba3feb3f2fc 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -79,15 +79,25 @@ config MFD_BCM590XX
 	help
 	  Support for the BCM590xx PMUs from Broadcom
 
+# Keep the old symbol until subdevice driver dependencies and defconfigs
+# have been updated.
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	bool "X-Powers AXP series PMICs"
+	select MFD_AXP20X_I2C
+
+config MFD_AXP20X_CORE
+	bool
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
+
+config MFD_AXP20X_I2C
+	bool "X-Powers AXP series I2C PMICs"
+	select MFD_AXP20X_CORE
+	select REGMAP_I2C
 	depends on I2C=y
 	help
-	  If you say Y here you get support for the X-Powers AXP202, AXP209 and
-	  AXP288 power management IC (PMIC).
+	  If you say Y here you get support for the X-Powers AXP series I2C
+	  based power management ICs (PMICs).
 	  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.
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a59e3fcc8626..ce3ad5fd4e2f 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -106,7 +106,8 @@ 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_AXP20X_CORE)	+= axp20x-core.o
+obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.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-core.c
similarity index 87%
rename from drivers/mfd/axp20x.c
rename to drivers/mfd/axp20x-core.c
index 3f576b76c322..dd33548d93c4 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x-core.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * This file contains the interface independent core functions.
+ *
  * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -13,18 +15,14 @@
  */
 
 #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>
 #include <linux/acpi.h>
 
 #define AXP20X_OFF	0x80
@@ -361,32 +359,6 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
-static const struct of_device_id axp20x_of_match[] = {
-	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
-	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
-	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
-	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_acpi_match[] = {
-	{
-		.id = "INT33F4",
-		.driver_data = AXP288_ID,
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
-
 static const struct regmap_irq_chip axp152_regmap_irq_chip = {
 	.name			= "axp152_irq_chip",
 	.status_base		= AXP152_IRQ1_STATE,
@@ -586,27 +558,8 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 {
-	const struct acpi_device_id *acpi_id;
-	const struct of_device_id *of_id;
-
-	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
-		if (!of_id) {
-			dev_err(dev, "Unable to match OF ID\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) of_id->data;
-	} else {
-		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
-		if (!acpi_id || !acpi_id->driver_data) {
-			dev_err(dev, "Unable to match ACPI ID and data\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) acpi_id->driver_data;
-	}
-
 	switch (axp20x->variant) {
 	case AXP152_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp152_cells);
@@ -643,37 +596,16 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 	return 0;
 }
 
-static int axp20x_i2c_probe(struct i2c_client *i2c,
-			 const struct i2c_device_id *id)
+int axp20x_device_probe(struct axp20x_dev *axp20x)
 {
-	struct axp20x_dev *axp20x;
 	int ret;
 
-	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
-	if (!axp20x)
-		return -ENOMEM;
-
-	ret = axp20x_match_device(axp20x, &i2c->dev);
-	if (ret)
-		return ret;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
-	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,
+	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->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);
+		dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
 		return ret;
 	}
 
@@ -681,8 +613,8 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 			axp20x->nr_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);
+		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
+		regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 		return ret;
 	}
 
@@ -691,39 +623,24 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 		pm_power_off = axp20x_power_off;
 	}
 
-	dev_info(&i2c->dev, "AXP20X driver loaded\n");
+	dev_info(axp20x->dev, "AXP20X driver loaded\n");
 
 	return 0;
 }
 
-static int axp20x_i2c_remove(struct i2c_client *i2c)
+int axp20x_device_remove(struct axp20x_dev *axp20x)
 {
-	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);
+	regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 
 	return 0;
 }
 
-static struct i2c_driver axp20x_i2c_driver = {
-	.driver = {
-		.name	= "axp20x",
-		.of_match_table	= of_match_ptr(axp20x_of_match),
-		.acpi_match_table = ACPI_PTR(axp20x_acpi_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/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..3916f5253500
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,127 @@
+/*
+ * axp20x-i2c.c - I2C driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the I2C variants.
+ *
+ * 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/acpi.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+static const struct of_device_id axp20x_i2c_of_match[] = {
+	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
+	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_i2c_acpi_match[] = {
+	{
+		.id = "INT33F4",
+		.driver_data = AXP288_ID,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
+
+static int axp20x_i2c_match_device(struct axp20x_dev *axp20x,
+				   struct device *dev)
+{
+	const struct acpi_device_id *acpi_id;
+	const struct of_device_id *of_id;
+
+	if (dev->of_node) {
+		of_id = of_match_device(axp20x_i2c_of_match, dev);
+		if (!of_id) {
+			dev_err(dev, "Unable to match OF ID\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) of_id->data;
+	} else {
+		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
+		if (!acpi_id || !acpi_id->driver_data) {
+			dev_err(dev, "Unable to match ACPI ID and data\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) acpi_id->driver_data;
+	}
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+			    const struct i2c_device_id *id)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_i2c_match_device(axp20x, &i2c->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x",
+		.of_match_table	= of_match_ptr(axp20x_i2c_of_match),
+		.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
+	},
+	.probe		= axp20x_i2c_probe,
+	.remove		= axp20x_i2c_remove,
+	.id_table	= axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD I2C 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
index b24c771cebd5..908f97f6e2d7 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -396,7 +396,7 @@ enum axp288_irqs {
 
 struct axp20x_dev {
 	struct device			*dev;
-	struct i2c_client		*i2c_client;
+	int				irq;
 	struct regmap			*regmap;
 	struct regmap_irq_chip_data	*regmap_irqc;
 	long				variant;
@@ -462,4 +462,35 @@ static inline int axp20x_read_variable_width(struct regmap *regmap,
 	return result;
 }
 
+/**
+ * axp20x_match_device(): Setup axp20x variant related fields
+ *
+ * @axp20x: axp20x device to setup (.variant field must be set)
+ * @dev: device associated with this axp20x device
+ *
+ * This lets the axp20x core configure the mfd cells and register maps
+ * for later use.
+ */
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev);
+
+/**
+ * axp20x_device_probe(): Probe a configured axp20x device
+ *
+ * @axp20x: axp20x device to probe (must be configured)
+ *
+ * This function lets the axp20x core register the axp20x mfd devices
+ * and irqchip. The axp20x device passed in must be fully configured
+ * with axp20x_match_device, its irq set, and regmap created.
+ */
+int axp20x_device_probe(struct axp20x_dev *axp20x);
+
+/**
+ * axp20x_device_probe(): Remove a axp20x device
+ *
+ * @axp20x: axp20x device to remove
+ *
+ * This tells the axp20x core to remove the associated mfd devices
+ */
+int axp20x_device_remove(struct axp20x_dev *axp20x);
+
 #endif /* __LINUX_MFD_AXP20X_H */
-- 
2.6.1

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

* [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

The axp20x driver assumes the device is i2c based. This is not the
case with later models, which use a proprietary 2 wire serial bus
called "Reduced Serial Bus".

This patch follows the example of mfd/wm831x and splits it into
an interface independet core, and an i2c specific glue layer.

The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.

Included but unused header files are removed as well.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/mfd/Kconfig                     |  18 ++++-
 drivers/mfd/Makefile                    |   3 +-
 drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
 drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h              |  33 ++++++++-
 5 files changed, 186 insertions(+), 100 deletions(-)
 rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 99d63675f073..9ba3feb3f2fc 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -79,15 +79,25 @@ config MFD_BCM590XX
 	help
 	  Support for the BCM590xx PMUs from Broadcom
 
+# Keep the old symbol until subdevice driver dependencies and defconfigs
+# have been updated.
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	bool "X-Powers AXP series PMICs"
+	select MFD_AXP20X_I2C
+
+config MFD_AXP20X_CORE
+	bool
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
+
+config MFD_AXP20X_I2C
+	bool "X-Powers AXP series I2C PMICs"
+	select MFD_AXP20X_CORE
+	select REGMAP_I2C
 	depends on I2C=y
 	help
-	  If you say Y here you get support for the X-Powers AXP202, AXP209 and
-	  AXP288 power management IC (PMIC).
+	  If you say Y here you get support for the X-Powers AXP series I2C
+	  based power management ICs (PMICs).
 	  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.
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a59e3fcc8626..ce3ad5fd4e2f 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -106,7 +106,8 @@ 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_AXP20X_CORE)	+= axp20x-core.o
+obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.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-core.c
similarity index 87%
rename from drivers/mfd/axp20x.c
rename to drivers/mfd/axp20x-core.c
index 3f576b76c322..dd33548d93c4 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x-core.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * This file contains the interface independent core functions.
+ *
  * Author: Carlo Caione <carlo@caione.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -13,18 +15,14 @@
  */
 
 #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>
 #include <linux/acpi.h>
 
 #define AXP20X_OFF	0x80
@@ -361,32 +359,6 @@ static const struct regmap_irq axp288_regmap_irqs[] = {
 	INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG,            5, 1),
 };
 
-static const struct of_device_id axp20x_of_match[] = {
-	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
-	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
-	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
-	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_acpi_match[] = {
-	{
-		.id = "INT33F4",
-		.driver_data = AXP288_ID,
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
-
 static const struct regmap_irq_chip axp152_regmap_irq_chip = {
 	.name			= "axp152_irq_chip",
 	.status_base		= AXP152_IRQ1_STATE,
@@ -586,27 +558,8 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 {
-	const struct acpi_device_id *acpi_id;
-	const struct of_device_id *of_id;
-
-	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
-		if (!of_id) {
-			dev_err(dev, "Unable to match OF ID\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) of_id->data;
-	} else {
-		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
-		if (!acpi_id || !acpi_id->driver_data) {
-			dev_err(dev, "Unable to match ACPI ID and data\n");
-			return -ENODEV;
-		}
-		axp20x->variant = (long) acpi_id->driver_data;
-	}
-
 	switch (axp20x->variant) {
 	case AXP152_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp152_cells);
@@ -643,37 +596,16 @@ static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 	return 0;
 }
 
-static int axp20x_i2c_probe(struct i2c_client *i2c,
-			 const struct i2c_device_id *id)
+int axp20x_device_probe(struct axp20x_dev *axp20x)
 {
-	struct axp20x_dev *axp20x;
 	int ret;
 
-	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
-	if (!axp20x)
-		return -ENOMEM;
-
-	ret = axp20x_match_device(axp20x, &i2c->dev);
-	if (ret)
-		return ret;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
-	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,
+	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->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);
+		dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
 		return ret;
 	}
 
@@ -681,8 +613,8 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 			axp20x->nr_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);
+		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
+		regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 		return ret;
 	}
 
@@ -691,39 +623,24 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 		pm_power_off = axp20x_power_off;
 	}
 
-	dev_info(&i2c->dev, "AXP20X driver loaded\n");
+	dev_info(axp20x->dev, "AXP20X driver loaded\n");
 
 	return 0;
 }
 
-static int axp20x_i2c_remove(struct i2c_client *i2c)
+int axp20x_device_remove(struct axp20x_dev *axp20x)
 {
-	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);
+	regmap_del_irq_chip(axp20x->irq, axp20x->regmap_irqc);
 
 	return 0;
 }
 
-static struct i2c_driver axp20x_i2c_driver = {
-	.driver = {
-		.name	= "axp20x",
-		.of_match_table	= of_match_ptr(axp20x_of_match),
-		.acpi_match_table = ACPI_PTR(axp20x_acpi_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/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..3916f5253500
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,127 @@
+/*
+ * axp20x-i2c.c - I2C driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the I2C variants.
+ *
+ * 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/acpi.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+static const struct of_device_id axp20x_i2c_of_match[] = {
+	{ .compatible = "x-powers,axp152", .data = (void *) AXP152_ID },
+	{ .compatible = "x-powers,axp202", .data = (void *) AXP202_ID },
+	{ .compatible = "x-powers,axp209", .data = (void *) AXP209_ID },
+	{ .compatible = "x-powers,axp221", .data = (void *) AXP221_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 acpi_device_id axp20x_i2c_acpi_match[] = {
+	{
+		.id = "INT33F4",
+		.driver_data = AXP288_ID,
+	},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match);
+
+static int axp20x_i2c_match_device(struct axp20x_dev *axp20x,
+				   struct device *dev)
+{
+	const struct acpi_device_id *acpi_id;
+	const struct of_device_id *of_id;
+
+	if (dev->of_node) {
+		of_id = of_match_device(axp20x_i2c_of_match, dev);
+		if (!of_id) {
+			dev_err(dev, "Unable to match OF ID\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) of_id->data;
+	} else {
+		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
+		if (!acpi_id || !acpi_id->driver_data) {
+			dev_err(dev, "Unable to match ACPI ID and data\n");
+			return -ENODEV;
+		}
+		axp20x->variant = (long) acpi_id->driver_data;
+	}
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_i2c_probe(struct i2c_client *i2c,
+			    const struct i2c_device_id *id)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_i2c_match_device(axp20x, &i2c->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_i2c_remove(struct i2c_client *i2c)
+{
+	struct axp20x_dev *axp20x = i2c_get_clientdata(i2c);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x",
+		.of_match_table	= of_match_ptr(axp20x_i2c_of_match),
+		.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
+	},
+	.probe		= axp20x_i2c_probe,
+	.remove		= axp20x_i2c_remove,
+	.id_table	= axp20x_i2c_id,
+};
+
+module_i2c_driver(axp20x_i2c_driver);
+
+MODULE_DESCRIPTION("PMIC MFD I2C 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
index b24c771cebd5..908f97f6e2d7 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -396,7 +396,7 @@ enum axp288_irqs {
 
 struct axp20x_dev {
 	struct device			*dev;
-	struct i2c_client		*i2c_client;
+	int				irq;
 	struct regmap			*regmap;
 	struct regmap_irq_chip_data	*regmap_irqc;
 	long				variant;
@@ -462,4 +462,35 @@ static inline int axp20x_read_variable_width(struct regmap *regmap,
 	return result;
 }
 
+/**
+ * axp20x_match_device(): Setup axp20x variant related fields
+ *
+ * @axp20x: axp20x device to setup (.variant field must be set)
+ * @dev: device associated with this axp20x device
+ *
+ * This lets the axp20x core configure the mfd cells and register maps
+ * for later use.
+ */
+int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev);
+
+/**
+ * axp20x_device_probe(): Probe a configured axp20x device
+ *
+ * @axp20x: axp20x device to probe (must be configured)
+ *
+ * This function lets the axp20x core register the axp20x mfd devices
+ * and irqchip. The axp20x device passed in must be fully configured
+ * with axp20x_match_device, its irq set, and regmap created.
+ */
+int axp20x_device_probe(struct axp20x_dev *axp20x);
+
+/**
+ * axp20x_device_probe(): Remove a axp20x device
+ *
+ * @axp20x: axp20x device to remove
+ *
+ * This tells the axp20x core to remove the associated mfd devices
+ */
+int axp20x_device_remove(struct axp20x_dev *axp20x);
+
 #endif /* __LINUX_MFD_AXP20X_H */
-- 
2.6.1

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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/mfd/Kconfig        | 12 ++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-core.c  |  2 +
 drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ba3feb3f2fc..6e5edb61d42e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -84,6 +84,7 @@ config MFD_BCM590XX
 config MFD_AXP20X
 	bool "X-Powers AXP series PMICs"
 	select MFD_AXP20X_I2C
+	select MFD_AXP20X_RSB
 
 config MFD_AXP20X_CORE
 	bool
@@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	bool "X-Powers AXP series RSB PMICs"
+	select MFD_AXP20X_CORE
+	depends on SUNXI_RSB=y
+	help
+	  If you say Y here you get support for the X-Powers AXP series RSB
+	  based power management ICs (PMICs).
+	  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 ce3ad5fd4e2f..1eb278619dd6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
 obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
+obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
 
 obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
index dd33548d93c4..baecccb6d400 100644
--- a/drivers/mfd/axp20x-core.c
+++ b/drivers/mfd/axp20x-core.c
@@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
 		axp20x->cells = axp22x_cells;
 		axp20x->regmap_cfg = &axp22x_regmap_config;
diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..5d053d177717
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,93 @@
+/*
+ * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the RSB variants.
+ *
+ * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/soc/sunxi/sunxi_rsb.h>
+
+static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
+
+static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
+					 struct device *dev)
+{
+	const struct of_device_id *of_id;
+
+	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
+	if (!of_id) {
+		dev_err(dev, "Unable to match OF ID\n");
+		return -ENODEV;
+	}
+	axp20x->variant = (long) of_id->data;
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	sunxi_rsb_device_set_drvdata(rdev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-sunxi-rsb",
+		.of_match_table	= of_match_ptr(axp20x_sunxi_rsb_of_match),
+	},
+	.probe	= axp20x_sunxi_rsb_probe,
+	.remove	= axp20x_sunxi_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_sunxi_rsb_driver);
+
+MODULE_DESCRIPTION("PMIC MFD sunXi RSB driver for AXP20X");
+MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 908f97f6e2d7..fef8dea18e66 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -18,6 +18,7 @@ enum {
 	AXP202_ID,
 	AXP209_ID,
 	AXP221_ID,
+	AXP223_ID,
 	AXP288_ID,
 	NR_AXP20X_VARIANTS,
 };
-- 
2.6.1


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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 drivers/mfd/Kconfig        | 12 ++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-core.c  |  2 +
 drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ba3feb3f2fc..6e5edb61d42e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -84,6 +84,7 @@ config MFD_BCM590XX
 config MFD_AXP20X
 	bool "X-Powers AXP series PMICs"
 	select MFD_AXP20X_I2C
+	select MFD_AXP20X_RSB
 
 config MFD_AXP20X_CORE
 	bool
@@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	bool "X-Powers AXP series RSB PMICs"
+	select MFD_AXP20X_CORE
+	depends on SUNXI_RSB=y
+	help
+	  If you say Y here you get support for the X-Powers AXP series RSB
+	  based power management ICs (PMICs).
+	  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 ce3ad5fd4e2f..1eb278619dd6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
 obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
+obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
 
 obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
index dd33548d93c4..baecccb6d400 100644
--- a/drivers/mfd/axp20x-core.c
+++ b/drivers/mfd/axp20x-core.c
@@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
 		axp20x->cells = axp22x_cells;
 		axp20x->regmap_cfg = &axp22x_regmap_config;
diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..5d053d177717
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,93 @@
+/*
+ * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the RSB variants.
+ *
+ * Author: Chen-Yu Tsai <wens-jdAy2FN1RRM@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/acpi.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/soc/sunxi/sunxi_rsb.h>
+
+static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
+
+static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
+					 struct device *dev)
+{
+	const struct of_device_id *of_id;
+
+	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
+	if (!of_id) {
+		dev_err(dev, "Unable to match OF ID\n");
+		return -ENODEV;
+	}
+	axp20x->variant = (long) of_id->data;
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	sunxi_rsb_device_set_drvdata(rdev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-sunxi-rsb",
+		.of_match_table	= of_match_ptr(axp20x_sunxi_rsb_of_match),
+	},
+	.probe	= axp20x_sunxi_rsb_probe,
+	.remove	= axp20x_sunxi_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_sunxi_rsb_driver);
+
+MODULE_DESCRIPTION("PMIC MFD sunXi RSB driver for AXP20X");
+MODULE_AUTHOR("Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 908f97f6e2d7..fef8dea18e66 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -18,6 +18,7 @@ enum {
 	AXP202_ID,
 	AXP209_ID,
 	AXP221_ID,
+	AXP223_ID,
 	AXP288_ID,
 	NR_AXP20X_VARIANTS,
 };
-- 
2.6.1

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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/mfd/Kconfig        | 12 ++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-core.c  |  2 +
 drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 109 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ba3feb3f2fc..6e5edb61d42e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -84,6 +84,7 @@ config MFD_BCM590XX
 config MFD_AXP20X
 	bool "X-Powers AXP series PMICs"
 	select MFD_AXP20X_I2C
+	select MFD_AXP20X_RSB
 
 config MFD_AXP20X_CORE
 	bool
@@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	bool "X-Powers AXP series RSB PMICs"
+	select MFD_AXP20X_CORE
+	depends on SUNXI_RSB=y
+	help
+	  If you say Y here you get support for the X-Powers AXP series RSB
+	  based power management ICs (PMICs).
+	  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 ce3ad5fd4e2f..1eb278619dd6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
 obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
 obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
+obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
 
 obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
 obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
index dd33548d93c4..baecccb6d400 100644
--- a/drivers/mfd/axp20x-core.c
+++ b/drivers/mfd/axp20x-core.c
@@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
 		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
 		axp20x->cells = axp22x_cells;
 		axp20x->regmap_cfg = &axp22x_regmap_config;
diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..5d053d177717
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,93 @@
+/*
+ * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
+ *
+ * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
+ * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
+ * as well as configurable GPIOs.
+ *
+ * This driver supports the RSB variants.
+ *
+ * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/of_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/soc/sunxi/sunxi_rsb.h>
+
+static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
+
+static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
+					 struct device *dev)
+{
+	const struct of_device_id *of_id;
+
+	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
+	if (!of_id) {
+		dev_err(dev, "Unable to match OF ID\n");
+		return -ENODEV;
+	}
+	axp20x->variant = (long) of_id->data;
+
+	return axp20x_match_device(axp20x, dev);
+}
+
+static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x;
+	int ret;
+
+	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
+	if (!axp20x)
+		return -ENOMEM;
+
+	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
+	if (ret)
+		return ret;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	sunxi_rsb_device_set_drvdata(rdev, axp20x);
+
+	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
+	if (IS_ERR(axp20x->regmap)) {
+		ret = PTR_ERR(axp20x->regmap);
+		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
+		return ret;
+	}
+
+	return axp20x_device_probe(axp20x);
+}
+
+static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-sunxi-rsb",
+		.of_match_table	= of_match_ptr(axp20x_sunxi_rsb_of_match),
+	},
+	.probe	= axp20x_sunxi_rsb_probe,
+	.remove	= axp20x_sunxi_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_sunxi_rsb_driver);
+
+MODULE_DESCRIPTION("PMIC MFD sunXi RSB driver for AXP20X");
+MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 908f97f6e2d7..fef8dea18e66 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -18,6 +18,7 @@ enum {
 	AXP202_ID,
 	AXP209_ID,
 	AXP221_ID,
+	AXP223_ID,
 	AXP288_ID,
 	NR_AXP20X_VARIANTS,
 };
-- 
2.6.1

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

* [PATCH 4/6] regulator: axp20x: Support new AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

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

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 35de22fdb7a0..55cce8125716 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 75;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		min = 1800;
 		max = 4050;
 		def = 3000;
@@ -322,6 +323,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		break;
 
 	case AXP221_ID:
+	case AXP223_ID:
 		if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
 			return -EINVAL;
 
@@ -360,6 +362,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		nregulators = AXP20X_REG_ID_MAX;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		regulators = axp22x_regulators;
 		nregulators = AXP22X_REG_ID_MAX;
 		break;
-- 
2.6.1


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

* [PATCH 4/6] regulator: axp20x: Support new AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

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

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 35de22fdb7a0..55cce8125716 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 75;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		min = 1800;
 		max = 4050;
 		def = 3000;
@@ -322,6 +323,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		break;
 
 	case AXP221_ID:
+	case AXP223_ID:
 		if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
 			return -EINVAL;
 
@@ -360,6 +362,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		nregulators = AXP20X_REG_ID_MAX;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		regulators = axp22x_regulators;
 		nregulators = AXP22X_REG_ID_MAX;
 		break;
-- 
2.6.1

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

* [PATCH 4/6] regulator: axp20x: Support new AXP223 PMIC
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.

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

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 35de22fdb7a0..55cce8125716 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
 		step = 75;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		min = 1800;
 		max = 4050;
 		def = 3000;
@@ -322,6 +323,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
 		break;
 
 	case AXP221_ID:
+	case AXP223_ID:
 		if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
 			return -EINVAL;
 
@@ -360,6 +362,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		nregulators = AXP20X_REG_ID_MAX;
 		break;
 	case AXP221_ID:
+	case AXP223_ID:
 		regulators = axp22x_regulators;
 		nregulators = AXP22X_REG_ID_MAX;
 		break;
-- 
2.6.1

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

* [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

The NMI interrupt controller is in charge of the NMI pin exposed by
the SoC to the PMIC. The PMIC signals interrupts through this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
index 828aaf52c342..a1e3acd325f4 100644
--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
@@ -579,6 +579,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller@01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		prcm@01f01400 {
 			compatible = "allwinner,sun8i-a23-prcm";
 			reg = <0x01f01400 0x200>;
-- 
2.6.1


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

* [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

The NMI interrupt controller is in charge of the NMI pin exposed by
the SoC to the PMIC. The PMIC signals interrupts through this.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
index 828aaf52c342..a1e3acd325f4 100644
--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
@@ -579,6 +579,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller@01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		prcm@01f01400 {
 			compatible = "allwinner,sun8i-a23-prcm";
 			reg = <0x01f01400 0x200>;
-- 
2.6.1

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

* [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

The NMI interrupt controller is in charge of the NMI pin exposed by
the SoC to the PMIC. The PMIC signals interrupts through this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
index 828aaf52c342..a1e3acd325f4 100644
--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
@@ -579,6 +579,14 @@
 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nmi_intc: interrupt-controller at 01f00c0c {
+			compatible = "allwinner,sun6i-a31-sc-nmi";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x01f00c0c 0x38>;
+			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		prcm at 01f01400 {
 			compatible = "allwinner,sun8i-a23-prcm";
 			reg = <0x01f01400 0x200>;
-- 
2.6.1

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

* [PATCH 6/6] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede, linux-arm-kernel, devicetree,
	linux-kernel, linux-sunxi

This board has a X-Powers AXP223 PMIC connected via RSB. It's regulators
provide power to various parts of the SoC and the board.

Also update the regulator supply phandles.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts | 79 +++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
index 13ce68f06dd6..91a0fde47fdd 100644
--- a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
+++ b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
@@ -68,7 +68,7 @@
 };
 
 &lradc {
-	vref-supply = <&reg_vcc3v0>;
+	vref-supply = <&reg_dcdc1>;
 	status = "okay";
 
 	button@200 {
@@ -96,7 +96,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_sina33>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -106,7 +106,7 @@
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <8>;
 	non-removable;
 	status = "okay";
@@ -132,6 +132,79 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3e3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3e3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		eldoin-supply = <&reg_dcdc1>;
+	};
+};
+
+#include "axp22x.dtsi"
+
+&reg_aldo1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-io";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <2350000>;
+	regulator-max-microvolt = <2650000>;
+	regulator-name = "vdd-dll";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc5ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-3v0";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_rtc_ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.1


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

* [PATCH 6/6] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala
  Cc: Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

This board has a X-Powers AXP223 PMIC connected via RSB. It's regulators
provide power to various parts of the SoC and the board.

Also update the regulator supply phandles.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts | 79 +++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
index 13ce68f06dd6..91a0fde47fdd 100644
--- a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
+++ b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
@@ -68,7 +68,7 @@
 };
 
 &lradc {
-	vref-supply = <&reg_vcc3v0>;
+	vref-supply = <&reg_dcdc1>;
 	status = "okay";
 
 	button@200 {
@@ -96,7 +96,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_sina33>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -106,7 +106,7 @@
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <8>;
 	non-removable;
 	status = "okay";
@@ -132,6 +132,79 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3e3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3e3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		eldoin-supply = <&reg_dcdc1>;
+	};
+};
+
+#include "axp22x.dtsi"
+
+&reg_aldo1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-io";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <2350000>;
+	regulator-max-microvolt = <2650000>;
+	regulator-name = "vdd-dll";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc5ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-3v0";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_rtc_ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.1

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

* [PATCH 6/6] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2015-10-14 16:32   ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-14 16:32 UTC (permalink / raw)
  To: linux-arm-kernel

This board has a X-Powers AXP223 PMIC connected via RSB. It's regulators
provide power to various parts of the SoC and the board.

Also update the regulator supply phandles.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts | 79 +++++++++++++++++++++++++-
 1 file changed, 76 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
index 13ce68f06dd6..91a0fde47fdd 100644
--- a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
+++ b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
@@ -68,7 +68,7 @@
 };
 
 &lradc {
-	vref-supply = <&reg_vcc3v0>;
+	vref-supply = <&reg_dcdc1>;
 	status = "okay";
 
 	button at 200 {
@@ -96,7 +96,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_sina33>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -106,7 +106,7 @@
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <8>;
 	non-removable;
 	status = "okay";
@@ -132,6 +132,79 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic at 3e3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3e3>;
+		interrupt-parent = <&nmi_intc>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+		eldoin-supply = <&reg_dcdc1>;
+	};
+};
+
+#include "axp22x.dtsi"
+
+&reg_aldo1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-io";
+};
+
+&reg_aldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <2350000>;
+	regulator-max-microvolt = <2650000>;
+	regulator-name = "vdd-dll";
+};
+
+&reg_aldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2700000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-pll-avcc";
+};
+
+&reg_dc5ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpus";
+};
+
+&reg_dcdc1 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-3v0";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-sys";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <900000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc5 {
+	regulator-always-on;
+	regulator-min-microvolt = <1500000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vcc-dram";
+};
+
+&reg_rtc_ldo {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.1

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 17:47     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 17:47 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: kbuild-all, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: i386-randconfig-s1-201541 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_RSB which has unmet direct dependencies (HAS_IOMEM && SUNXI_RSB)
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0xe00d7): undefined reference to `__devm_regmap_init_sunxi_rsb'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
>> axp20x-rsb.c:(.init.text+0x81ce): undefined reference to `sunxi_rsb_driver_register'

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

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

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 17:47     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 17:47 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: i386-randconfig-s1-201541 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_RSB which has unmet direct dependencies (HAS_IOMEM && SUNXI_RSB)
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0xe00d7): undefined reference to `__devm_regmap_init_sunxi_rsb'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
>> axp20x-rsb.c:(.init.text+0x81ce): undefined reference to `sunxi_rsb_driver_register'

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

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

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

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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 17:47     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 17:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: i386-randconfig-s1-201541 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_RSB which has unmet direct dependencies (HAS_IOMEM && SUNXI_RSB)
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0xe00d7): undefined reference to `__devm_regmap_init_sunxi_rsb'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
>> axp20x-rsb.c:(.init.text+0x81ce): undefined reference to `sunxi_rsb_driver_register'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 25103 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151015/b327a98a/attachment-0001.obj>

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

* Re: [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 20:22     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 20:22 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: kbuild-all, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_I2C which has unmet direct dependencies (HAS_IOMEM && I2C=y)
   drivers/built-in.o: In function `axp20x_i2c_remove':
>> axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
>> axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
>> axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
>> axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
>> axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
>> axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

sparse warnings: (new ones prefixed by >>)

>> drivers/iio/adc/axp288_adc.c:49:41: sparse: duplicate const 

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

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

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

* Re: [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 20:22     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 20:22 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_I2C which has unmet direct dependencies (HAS_IOMEM && I2C=y)
   drivers/built-in.o: In function `axp20x_i2c_remove':
>> axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
>> axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
>> axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
>> axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
>> axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
>> axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

sparse warnings: (new ones prefixed by >>)

>> drivers/iio/adc/axp288_adc.c:49:41: sparse: duplicate const 

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

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

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

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

* [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 20:22     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 20:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

warning: (MFD_AXP20X) selects MFD_AXP20X_I2C which has unmet direct dependencies (HAS_IOMEM && I2C=y)
   drivers/built-in.o: In function `axp20x_i2c_remove':
>> axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
>> axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
>> axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
>> axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
>> axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
>> axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

sparse warnings: (new ones prefixed by >>)

>> drivers/iio/adc/axp288_adc.c:49:41: sparse: duplicate const 

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 50714 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151015/50431846/attachment-0001.obj>

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

* Re: [linux-sunxi] [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 22:37     ` Julian Calaby
  0 siblings, 0 replies; 62+ messages in thread
From: Julian Calaby @ 2015-10-14 22:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Hans de Goede, Mailing List, Arm, devicetree,
	linux-kernel, linux-sunxi

Hi Chen-Yu,

On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> The axp20x driver assumes the device is i2c based. This is not the
> case with later models, which use a proprietary 2 wire serial bus
> called "Reduced Serial Bus".
>
> This patch follows the example of mfd/wm831x and splits it into
> an interface independet core, and an i2c specific glue layer.
>
> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>
> Included but unused header files are removed as well.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/Kconfig                     |  18 ++++-
>  drivers/mfd/Makefile                    |   3 +-
>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>  5 files changed, 186 insertions(+), 100 deletions(-)
>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>  create mode 100644 drivers/mfd/axp20x-i2c.c
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 99d63675f073..9ba3feb3f2fc 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>         help
>           Support for the BCM590xx PMUs from Broadcom
>
> +# Keep the old symbol until subdevice driver dependencies and defconfigs
> +# have been updated.
>  config MFD_AXP20X
> -       bool "X-Powers AXP20X"
> +       bool "X-Powers AXP series PMICs"
> +       select MFD_AXP20X_I2C

Unless something has changed in KConfig, (and my knowledge on this is
likely to be outdated) I don't believe this will work as I don't think
selects don't get propagated like you expect. Have you checked that
all possible configuration options survive make oldconfig and build
without warnings?

Also, unless there's some compelling reason not to, it's probably a
good idea to update the dependent drivers and defconfigs now. (or make
this change in a gentler manner.)

> +
> +config MFD_AXP20X_CORE
> +       bool
>         select MFD_CORE
> -       select REGMAP_I2C
>         select REGMAP_IRQ
> +
> +config MFD_AXP20X_I2C
> +       bool "X-Powers AXP series I2C PMICs"
> +       select MFD_AXP20X_CORE
> +       select REGMAP_I2C
>         depends on I2C=y
>         help
> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
> -         AXP288 power management IC (PMIC).
> +         If you say Y here you get support for the X-Powers AXP series I2C
> +         based power management ICs (PMICs).
>           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.

Thanks,

-- 
Julian Calaby

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

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

* Re: [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 22:37     ` Julian Calaby
  0 siblings, 0 replies; 62+ messages in thread
From: Julian Calaby @ 2015-10-14 22:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Mark Brown, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Hans de Goede, Mailing List, Arm, devicetree,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi

Hi Chen-Yu,

On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> The axp20x driver assumes the device is i2c based. This is not the
> case with later models, which use a proprietary 2 wire serial bus
> called "Reduced Serial Bus".
>
> This patch follows the example of mfd/wm831x and splits it into
> an interface independet core, and an i2c specific glue layer.
>
> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>
> Included but unused header files are removed as well.
>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
>  drivers/mfd/Kconfig                     |  18 ++++-
>  drivers/mfd/Makefile                    |   3 +-
>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>  5 files changed, 186 insertions(+), 100 deletions(-)
>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>  create mode 100644 drivers/mfd/axp20x-i2c.c
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 99d63675f073..9ba3feb3f2fc 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>         help
>           Support for the BCM590xx PMUs from Broadcom
>
> +# Keep the old symbol until subdevice driver dependencies and defconfigs
> +# have been updated.
>  config MFD_AXP20X
> -       bool "X-Powers AXP20X"
> +       bool "X-Powers AXP series PMICs"
> +       select MFD_AXP20X_I2C

Unless something has changed in KConfig, (and my knowledge on this is
likely to be outdated) I don't believe this will work as I don't think
selects don't get propagated like you expect. Have you checked that
all possible configuration options survive make oldconfig and build
without warnings?

Also, unless there's some compelling reason not to, it's probably a
good idea to update the dependent drivers and defconfigs now. (or make
this change in a gentler manner.)

> +
> +config MFD_AXP20X_CORE
> +       bool
>         select MFD_CORE
> -       select REGMAP_I2C
>         select REGMAP_IRQ
> +
> +config MFD_AXP20X_I2C
> +       bool "X-Powers AXP series I2C PMICs"
> +       select MFD_AXP20X_CORE
> +       select REGMAP_I2C
>         depends on I2C=y
>         help
> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
> -         AXP288 power management IC (PMIC).
> +         If you say Y here you get support for the X-Powers AXP series I2C
> +         based power management ICs (PMICs).
>           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.

Thanks,

-- 
Julian Calaby

Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Profile: http://www.google.com/profiles/julian.calaby/

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

* [linux-sunxi] [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-14 22:37     ` Julian Calaby
  0 siblings, 0 replies; 62+ messages in thread
From: Julian Calaby @ 2015-10-14 22:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chen-Yu,

On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> The axp20x driver assumes the device is i2c based. This is not the
> case with later models, which use a proprietary 2 wire serial bus
> called "Reduced Serial Bus".
>
> This patch follows the example of mfd/wm831x and splits it into
> an interface independet core, and an i2c specific glue layer.
>
> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>
> Included but unused header files are removed as well.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/Kconfig                     |  18 ++++-
>  drivers/mfd/Makefile                    |   3 +-
>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>  5 files changed, 186 insertions(+), 100 deletions(-)
>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>  create mode 100644 drivers/mfd/axp20x-i2c.c
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 99d63675f073..9ba3feb3f2fc 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>         help
>           Support for the BCM590xx PMUs from Broadcom
>
> +# Keep the old symbol until subdevice driver dependencies and defconfigs
> +# have been updated.
>  config MFD_AXP20X
> -       bool "X-Powers AXP20X"
> +       bool "X-Powers AXP series PMICs"
> +       select MFD_AXP20X_I2C

Unless something has changed in KConfig, (and my knowledge on this is
likely to be outdated) I don't believe this will work as I don't think
selects don't get propagated like you expect. Have you checked that
all possible configuration options survive make oldconfig and build
without warnings?

Also, unless there's some compelling reason not to, it's probably a
good idea to update the dependent drivers and defconfigs now. (or make
this change in a gentler manner.)

> +
> +config MFD_AXP20X_CORE
> +       bool
>         select MFD_CORE
> -       select REGMAP_I2C
>         select REGMAP_IRQ
> +
> +config MFD_AXP20X_I2C
> +       bool "X-Powers AXP series I2C PMICs"
> +       select MFD_AXP20X_CORE
> +       select REGMAP_I2C
>         depends on I2C=y
>         help
> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
> -         AXP288 power management IC (PMIC).
> +         If you say Y here you get support for the X-Powers AXP series I2C
> +         based power management ICs (PMICs).
>           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.

Thanks,

-- 
Julian Calaby

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

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 23:00     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 23:00 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: kbuild-all, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `axp20x_i2c_remove':
   axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
   axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
   axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
   axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_remove':
>> axp20x-rsb.c:(.text+0x228388): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0x22844d): undefined reference to `axp20x_match_device'
   axp20x-rsb.c:(.text+0x2284cb): undefined reference to `__devm_regmap_init_sunxi_rsb'
>> axp20x-rsb.c:(.text+0x228518): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
   axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
   axp20x-rsb.c:(.init.text+0x1a8e9): undefined reference to `sunxi_rsb_driver_register'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
   axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

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

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

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 23:00     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 23:00 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Chen-Yu Tsai, Hans de Goede,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `axp20x_i2c_remove':
   axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
   axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
   axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
   axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_remove':
>> axp20x-rsb.c:(.text+0x228388): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0x22844d): undefined reference to `axp20x_match_device'
   axp20x-rsb.c:(.text+0x2284cb): undefined reference to `__devm_regmap_init_sunxi_rsb'
>> axp20x-rsb.c:(.text+0x228518): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
   axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
   axp20x-rsb.c:(.init.text+0x1a8e9): undefined reference to `sunxi_rsb_driver_register'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
   axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

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

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

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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-14 23:00     ` kbuild test robot
  0 siblings, 0 replies; 62+ messages in thread
From: kbuild test robot @ 2015-10-14 23:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chen-Yu,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu-Tsai/mfd-axp20x-Add-support-for-RSB-based-AXP223/20151015-004334
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `axp20x_i2c_remove':
   axp20x-i2c.c:(.text+0x22810b): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_i2c_probe':
   axp20x-i2c.c:(.text+0x22827d): undefined reference to `axp20x_match_device'
   axp20x-i2c.c:(.text+0x2282ff): undefined reference to `__devm_regmap_init_i2c'
   axp20x-i2c.c:(.text+0x22834c): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_remove':
>> axp20x-rsb.c:(.text+0x228388): undefined reference to `axp20x_device_remove'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_probe':
>> axp20x-rsb.c:(.text+0x22844d): undefined reference to `axp20x_match_device'
   axp20x-rsb.c:(.text+0x2284cb): undefined reference to `__devm_regmap_init_sunxi_rsb'
>> axp20x-rsb.c:(.text+0x228518): undefined reference to `axp20x_device_probe'
   drivers/built-in.o: In function `axp20x_i2c_driver_init':
   axp20x-i2c.c:(.init.text+0x1a8c9): undefined reference to `i2c_register_driver'
   drivers/built-in.o: In function `axp20x_sunxi_rsb_driver_init':
   axp20x-rsb.c:(.init.text+0x1a8e9): undefined reference to `sunxi_rsb_driver_register'
   drivers/built-in.o: In function `axp20x_i2c_driver_exit':
   axp20x-i2c.c:(.exit.text+0x683): undefined reference to `i2c_del_driver'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 50719 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151015/21cb6bfa/attachment-0001.obj>

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

* Re: [linux-sunxi] [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-15  7:39       ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-15  7:39 UTC (permalink / raw)
  To: Julian Calaby
  Cc: Chen-Yu Tsai, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Hans de Goede, Mailing List, Arm,
	devicetree, linux-kernel, linux-sunxi

On Thu, Oct 15, 2015 at 6:37 AM, Julian Calaby <julian.calaby@gmail.com> wrote:
> Hi Chen-Yu,
>
> On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens@csie.org> wrote:
>> The axp20x driver assumes the device is i2c based. This is not the
>> case with later models, which use a proprietary 2 wire serial bus
>> called "Reduced Serial Bus".
>>
>> This patch follows the example of mfd/wm831x and splits it into
>> an interface independet core, and an i2c specific glue layer.
>>
>> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
>> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>>
>> Included but unused header files are removed as well.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  drivers/mfd/Kconfig                     |  18 ++++-
>>  drivers/mfd/Makefile                    |   3 +-
>>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>>  5 files changed, 186 insertions(+), 100 deletions(-)
>>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>>  create mode 100644 drivers/mfd/axp20x-i2c.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 99d63675f073..9ba3feb3f2fc 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>>         help
>>           Support for the BCM590xx PMUs from Broadcom
>>
>> +# Keep the old symbol until subdevice driver dependencies and defconfigs
>> +# have been updated.
>>  config MFD_AXP20X
>> -       bool "X-Powers AXP20X"
>> +       bool "X-Powers AXP series PMICs"
>> +       select MFD_AXP20X_I2C
>
> Unless something has changed in KConfig, (and my knowledge on this is
> likely to be outdated) I don't believe this will work as I don't think
> selects don't get propagated like you expect. Have you checked that
> all possible configuration options survive make oldconfig and build
> without warnings?

Yeah this totally did not work out like I expected.

> Also, unless there's some compelling reason not to, it's probably a
> good idea to update the dependent drivers and defconfigs now. (or make
> this change in a gentler manner.)

What I wanted was to keep the original symbol for a release cycle or
more, giving me time to update the related entries across the kernel.
After the changes are in, we could remove the old one.

The other way would be to change MFD_AXP20X to a hidden symbol, and
let the 2 new ones select that. Then we'd just update all the
defconfigs.

I'll rework this and add defconfig updates.

Thanks
ChenYu

>> +
>> +config MFD_AXP20X_CORE
>> +       bool
>>         select MFD_CORE
>> -       select REGMAP_I2C
>>         select REGMAP_IRQ
>> +
>> +config MFD_AXP20X_I2C
>> +       bool "X-Powers AXP series I2C PMICs"
>> +       select MFD_AXP20X_CORE
>> +       select REGMAP_I2C
>>         depends on I2C=y
>>         help
>> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
>> -         AXP288 power management IC (PMIC).
>> +         If you say Y here you get support for the X-Powers AXP series I2C
>> +         based power management ICs (PMICs).
>>           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.
>
> Thanks,
>
> --
> Julian Calaby
>
> Email: julian.calaby@gmail.com
> Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-15  7:39       ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-15  7:39 UTC (permalink / raw)
  To: Julian Calaby
  Cc: Chen-Yu Tsai, Maxime Ripard, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Hans de Goede, Mailing List, Arm,
	devicetree, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi

On Thu, Oct 15, 2015 at 6:37 AM, Julian Calaby <julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Chen-Yu,
>
> On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
>> The axp20x driver assumes the device is i2c based. This is not the
>> case with later models, which use a proprietary 2 wire serial bus
>> called "Reduced Serial Bus".
>>
>> This patch follows the example of mfd/wm831x and splits it into
>> an interface independet core, and an i2c specific glue layer.
>>
>> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
>> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>>
>> Included but unused header files are removed as well.
>>
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>>  drivers/mfd/Kconfig                     |  18 ++++-
>>  drivers/mfd/Makefile                    |   3 +-
>>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>>  5 files changed, 186 insertions(+), 100 deletions(-)
>>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>>  create mode 100644 drivers/mfd/axp20x-i2c.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 99d63675f073..9ba3feb3f2fc 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>>         help
>>           Support for the BCM590xx PMUs from Broadcom
>>
>> +# Keep the old symbol until subdevice driver dependencies and defconfigs
>> +# have been updated.
>>  config MFD_AXP20X
>> -       bool "X-Powers AXP20X"
>> +       bool "X-Powers AXP series PMICs"
>> +       select MFD_AXP20X_I2C
>
> Unless something has changed in KConfig, (and my knowledge on this is
> likely to be outdated) I don't believe this will work as I don't think
> selects don't get propagated like you expect. Have you checked that
> all possible configuration options survive make oldconfig and build
> without warnings?

Yeah this totally did not work out like I expected.

> Also, unless there's some compelling reason not to, it's probably a
> good idea to update the dependent drivers and defconfigs now. (or make
> this change in a gentler manner.)

What I wanted was to keep the original symbol for a release cycle or
more, giving me time to update the related entries across the kernel.
After the changes are in, we could remove the old one.

The other way would be to change MFD_AXP20X to a hidden symbol, and
let the 2 new ones select that. Then we'd just update all the
defconfigs.

I'll rework this and add defconfig updates.

Thanks
ChenYu

>> +
>> +config MFD_AXP20X_CORE
>> +       bool
>>         select MFD_CORE
>> -       select REGMAP_I2C
>>         select REGMAP_IRQ
>> +
>> +config MFD_AXP20X_I2C
>> +       bool "X-Powers AXP series I2C PMICs"
>> +       select MFD_AXP20X_CORE
>> +       select REGMAP_I2C
>>         depends on I2C=y
>>         help
>> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
>> -         AXP288 power management IC (PMIC).
>> +         If you say Y here you get support for the X-Powers AXP series I2C
>> +         based power management ICs (PMICs).
>>           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.
>
> Thanks,
>
> --
> Julian Calaby
>
> Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> Profile: http://www.google.com/profiles/julian.calaby/

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

* [linux-sunxi] [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits
@ 2015-10-15  7:39       ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-15  7:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 15, 2015 at 6:37 AM, Julian Calaby <julian.calaby@gmail.com> wrote:
> Hi Chen-Yu,
>
> On Thu, Oct 15, 2015 at 3:32 AM, Chen-Yu Tsai <wens@csie.org> wrote:
>> The axp20x driver assumes the device is i2c based. This is not the
>> case with later models, which use a proprietary 2 wire serial bus
>> called "Reduced Serial Bus".
>>
>> This patch follows the example of mfd/wm831x and splits it into
>> an interface independet core, and an i2c specific glue layer.
>>
>> The old MFD_AXP20X Kconfig symbol is kept until sub-device drivers
>> and defconfigs have migrated to the new MFD_AXP20X_CORE symbol.
>>
>> Included but unused header files are removed as well.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  drivers/mfd/Kconfig                     |  18 ++++-
>>  drivers/mfd/Makefile                    |   3 +-
>>  drivers/mfd/{axp20x.c => axp20x-core.c} | 105 +++-----------------------
>>  drivers/mfd/axp20x-i2c.c                | 127 ++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h              |  33 ++++++++-
>>  5 files changed, 186 insertions(+), 100 deletions(-)
>>  rename drivers/mfd/{axp20x.c => axp20x-core.c} (87%)
>>  create mode 100644 drivers/mfd/axp20x-i2c.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 99d63675f073..9ba3feb3f2fc 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -79,15 +79,25 @@ config MFD_BCM590XX
>>         help
>>           Support for the BCM590xx PMUs from Broadcom
>>
>> +# Keep the old symbol until subdevice driver dependencies and defconfigs
>> +# have been updated.
>>  config MFD_AXP20X
>> -       bool "X-Powers AXP20X"
>> +       bool "X-Powers AXP series PMICs"
>> +       select MFD_AXP20X_I2C
>
> Unless something has changed in KConfig, (and my knowledge on this is
> likely to be outdated) I don't believe this will work as I don't think
> selects don't get propagated like you expect. Have you checked that
> all possible configuration options survive make oldconfig and build
> without warnings?

Yeah this totally did not work out like I expected.

> Also, unless there's some compelling reason not to, it's probably a
> good idea to update the dependent drivers and defconfigs now. (or make
> this change in a gentler manner.)

What I wanted was to keep the original symbol for a release cycle or
more, giving me time to update the related entries across the kernel.
After the changes are in, we could remove the old one.

The other way would be to change MFD_AXP20X to a hidden symbol, and
let the 2 new ones select that. Then we'd just update all the
defconfigs.

I'll rework this and add defconfig updates.

Thanks
ChenYu

>> +
>> +config MFD_AXP20X_CORE
>> +       bool
>>         select MFD_CORE
>> -       select REGMAP_I2C
>>         select REGMAP_IRQ
>> +
>> +config MFD_AXP20X_I2C
>> +       bool "X-Powers AXP series I2C PMICs"
>> +       select MFD_AXP20X_CORE
>> +       select REGMAP_I2C
>>         depends on I2C=y
>>         help
>> -         If you say Y here you get support for the X-Powers AXP202, AXP209 and
>> -         AXP288 power management IC (PMIC).
>> +         If you say Y here you get support for the X-Powers AXP series I2C
>> +         based power management ICs (PMICs).
>>           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.
>
> Thanks,
>
> --
> Julian Calaby
>
> Email: julian.calaby at gmail.com
> Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-15 20:36     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-15 20:36 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Thu, Oct 15, 2015 at 12:32:17AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

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

Thanks!
Maxime

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

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

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

* Re: [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-15 20:36     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-15 20:36 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

On Thu, Oct 15, 2015 at 12:32:17AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Thanks!
Maxime

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

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

* [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2015-10-15 20:36     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-15 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 15, 2015 at 12:32:17AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

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

Thanks!
Maxime

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

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-16  6:41     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/Kconfig        | 12 ++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-core.c  |  2 +
>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 109 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 9ba3feb3f2fc..6e5edb61d42e 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>  config MFD_AXP20X
>  	bool "X-Powers AXP series PMICs"
>  	select MFD_AXP20X_I2C
> +	select MFD_AXP20X_RSB
>  
>  config MFD_AXP20X_CORE
>  	bool
> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	bool "X-Powers AXP series RSB PMICs"
> +	select MFD_AXP20X_CORE
> +	depends on SUNXI_RSB=y

Do we need that? Even if the bus is compiled as a module, the driver
will not be probed before that, will it?

> +	help
> +	  If you say Y here you get support for the X-Powers AXP series RSB
> +	  based power management ICs (PMICs).
> +	  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 ce3ad5fd4e2f..1eb278619dd6 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
>  obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
>  obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
>  obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
> +obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
>  
>  obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
>  obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
> index dd33548d93c4..baecccb6d400 100644
> --- a/drivers/mfd/axp20x-core.c
> +++ b/drivers/mfd/axp20x-core.c
> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>  		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>  		break;
>  	case AXP221_ID:
> +	case AXP223_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>  		axp20x->cells = axp22x_cells;
>  		axp20x->regmap_cfg = &axp22x_regmap_config;
> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..5d053d177717
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,93 @@
> +/*
> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
> + *
> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> + * as well as configurable GPIOs.
> + *
> + * This driver supports the RSB variants.
> + *
> + * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
> +#include <linux/err.h>
> +#include <linux/module.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/of_device.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/soc/sunxi/sunxi_rsb.h>
> +
> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
> +
> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
> +					 struct device *dev)
> +{
> +	const struct of_device_id *of_id;
> +
> +	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
> +	if (!of_id) {
> +		dev_err(dev, "Unable to match OF ID\n");
> +		return -ENODEV;
> +	}
> +	axp20x->variant = (long) of_id->data;
> +
> +	return axp20x_match_device(axp20x, dev);
> +}
> +
> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x;
> +	int ret;
> +
> +	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
> +	if (!axp20x)
> +		return -ENOMEM;
> +
> +	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	sunxi_rsb_device_set_drvdata(rdev, axp20x);
> +
> +	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
> +	if (IS_ERR(axp20x->regmap)) {
> +		ret = PTR_ERR(axp20x->regmap);
> +		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return axp20x_device_probe(axp20x);
> +}
> +
> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-sunxi-rsb",

Do we need to be that verbose in the name of the driver?

axp20x-rsb should be enough, especially since it's also the name of
your file.

Looks good otherwise, thanks!
Maxime

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

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

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

* Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-16  6:41     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:41 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
>  drivers/mfd/Kconfig        | 12 ++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-core.c  |  2 +
>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 109 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 9ba3feb3f2fc..6e5edb61d42e 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>  config MFD_AXP20X
>  	bool "X-Powers AXP series PMICs"
>  	select MFD_AXP20X_I2C
> +	select MFD_AXP20X_RSB
>  
>  config MFD_AXP20X_CORE
>  	bool
> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	bool "X-Powers AXP series RSB PMICs"
> +	select MFD_AXP20X_CORE
> +	depends on SUNXI_RSB=y

Do we need that? Even if the bus is compiled as a module, the driver
will not be probed before that, will it?

> +	help
> +	  If you say Y here you get support for the X-Powers AXP series RSB
> +	  based power management ICs (PMICs).
> +	  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 ce3ad5fd4e2f..1eb278619dd6 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
>  obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
>  obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
>  obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
> +obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
>  
>  obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
>  obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
> index dd33548d93c4..baecccb6d400 100644
> --- a/drivers/mfd/axp20x-core.c
> +++ b/drivers/mfd/axp20x-core.c
> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>  		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>  		break;
>  	case AXP221_ID:
> +	case AXP223_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>  		axp20x->cells = axp22x_cells;
>  		axp20x->regmap_cfg = &axp22x_regmap_config;
> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..5d053d177717
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,93 @@
> +/*
> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
> + *
> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> + * as well as configurable GPIOs.
> + *
> + * This driver supports the RSB variants.
> + *
> + * Author: Chen-Yu Tsai <wens-jdAy2FN1RRM@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/acpi.h>
> +#include <linux/err.h>
> +#include <linux/module.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/of_device.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/soc/sunxi/sunxi_rsb.h>
> +
> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
> +
> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
> +					 struct device *dev)
> +{
> +	const struct of_device_id *of_id;
> +
> +	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
> +	if (!of_id) {
> +		dev_err(dev, "Unable to match OF ID\n");
> +		return -ENODEV;
> +	}
> +	axp20x->variant = (long) of_id->data;
> +
> +	return axp20x_match_device(axp20x, dev);
> +}
> +
> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x;
> +	int ret;
> +
> +	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
> +	if (!axp20x)
> +		return -ENOMEM;
> +
> +	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	sunxi_rsb_device_set_drvdata(rdev, axp20x);
> +
> +	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
> +	if (IS_ERR(axp20x->regmap)) {
> +		ret = PTR_ERR(axp20x->regmap);
> +		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return axp20x_device_probe(axp20x);
> +}
> +
> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-sunxi-rsb",

Do we need to be that verbose in the name of the driver?

axp20x-rsb should be enough, especially since it's also the name of
your file.

Looks good otherwise, thanks!
Maxime

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

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

* [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-16  6:41     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/mfd/Kconfig        | 12 ++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-core.c  |  2 +
>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 109 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 9ba3feb3f2fc..6e5edb61d42e 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>  config MFD_AXP20X
>  	bool "X-Powers AXP series PMICs"
>  	select MFD_AXP20X_I2C
> +	select MFD_AXP20X_RSB
>  
>  config MFD_AXP20X_CORE
>  	bool
> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	bool "X-Powers AXP series RSB PMICs"
> +	select MFD_AXP20X_CORE
> +	depends on SUNXI_RSB=y

Do we need that? Even if the bus is compiled as a module, the driver
will not be probed before that, will it?

> +	help
> +	  If you say Y here you get support for the X-Powers AXP series RSB
> +	  based power management ICs (PMICs).
> +	  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 ce3ad5fd4e2f..1eb278619dd6 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)	+= da9052-spi.o
>  obj-$(CONFIG_MFD_DA9052_I2C)	+= da9052-i2c.o
>  obj-$(CONFIG_MFD_AXP20X_CORE)	+= axp20x-core.o
>  obj-$(CONFIG_MFD_AXP20X_I2C)	+= axp20x-i2c.o
> +obj-$(CONFIG_MFD_AXP20X_RSB)	+= axp20x-rsb.o
>  
>  obj-$(CONFIG_MFD_LP3943)	+= lp3943.o
>  obj-$(CONFIG_MFD_LP8788)	+= lp8788.o lp8788-irq.o
> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
> index dd33548d93c4..baecccb6d400 100644
> --- a/drivers/mfd/axp20x-core.c
> +++ b/drivers/mfd/axp20x-core.c
> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>  		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>  		break;
>  	case AXP221_ID:
> +	case AXP223_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>  		axp20x->cells = axp22x_cells;
>  		axp20x->regmap_cfg = &axp22x_regmap_config;
> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..5d053d177717
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,93 @@
> +/*
> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
> + *
> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> + * as well as configurable GPIOs.
> + *
> + * This driver supports the RSB variants.
> + *
> + * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
> +#include <linux/err.h>
> +#include <linux/module.h>
> +#include <linux/mfd/axp20x.h>
> +#include <linux/of_device.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/soc/sunxi/sunxi_rsb.h>
> +
> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
> +
> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
> +					 struct device *dev)
> +{
> +	const struct of_device_id *of_id;
> +
> +	of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
> +	if (!of_id) {
> +		dev_err(dev, "Unable to match OF ID\n");
> +		return -ENODEV;
> +	}
> +	axp20x->variant = (long) of_id->data;
> +
> +	return axp20x_match_device(axp20x, dev);
> +}
> +
> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x;
> +	int ret;
> +
> +	axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
> +	if (!axp20x)
> +		return -ENOMEM;
> +
> +	ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
> +	if (ret)
> +		return ret;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	sunxi_rsb_device_set_drvdata(rdev, axp20x);
> +
> +	axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
> +	if (IS_ERR(axp20x->regmap)) {
> +		ret = PTR_ERR(axp20x->regmap);
> +		dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return axp20x_device_probe(axp20x);
> +}
> +
> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-sunxi-rsb",

Do we need to be that verbose in the name of the driver?

axp20x-rsb should be enough, especially since it's also the name of
your file.

Looks good otherwise, 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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151016/42cc5aa7/attachment-0001.sig>

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

* Re: [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-16  6:44     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:44 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Thu, Oct 15, 2015 at 12:32:21AM +0800, Chen-Yu Tsai wrote:
> The NMI interrupt controller is in charge of the NMI pin exposed by
> the SoC to the PMIC. The PMIC signals interrupts through this.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Applied, thanks!
Maxime

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

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

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

* Re: [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-16  6:44     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:44 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

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

On Thu, Oct 15, 2015 at 12:32:21AM +0800, Chen-Yu Tsai wrote:
> The NMI interrupt controller is in charge of the NMI pin exposed by
> the SoC to the PMIC. The PMIC signals interrupts through this.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Applied, thanks!
Maxime

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

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

* [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node
@ 2015-10-16  6:44     ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 15, 2015 at 12:32:21AM +0800, Chen-Yu Tsai wrote:
> The NMI interrupt controller is in charge of the NMI pin exposed by
> the SoC to the PMIC. The PMIC signals interrupts through this.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Applied, 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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151016/04ce1372/attachment.sig>

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

* Re: [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
  2015-10-16  6:41     ` Maxime Ripard
  (?)
@ 2015-10-16  6:46       ` Chen-Yu Tsai
  -1 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-16  6:46 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> It is functionally identical to AXP221; only the regulator default
>> voltage/status and the external host interface are different.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  drivers/mfd/Kconfig        | 12 ++++++
>>  drivers/mfd/Makefile       |  1 +
>>  drivers/mfd/axp20x-core.c  |  2 +
>>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h |  1 +
>>  5 files changed, 109 insertions(+)
>>  create mode 100644 drivers/mfd/axp20x-rsb.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>>  config MFD_AXP20X
>>       bool "X-Powers AXP series PMICs"
>>       select MFD_AXP20X_I2C
>> +     select MFD_AXP20X_RSB
>>
>>  config MFD_AXP20X_CORE
>>       bool
>> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>>         components like regulators or the PEK (Power Enable Key) under the
>>         corresponding menus.
>>
>> +config MFD_AXP20X_RSB
>> +     bool "X-Powers AXP series RSB PMICs"
>> +     select MFD_AXP20X_CORE
>> +     depends on SUNXI_RSB=y
>
> Do we need that? Even if the bus is compiled as a module, the driver
> will not be probed before that, will it?

There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

And both drivers are bool, i.e. can't be compiled as a module. What we
don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

AFAIK the same goes for the I2C version.

>> +     help
>> +       If you say Y here you get support for the X-Powers AXP series RSB
>> +       based power management ICs (PMICs).
>> +       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 ce3ad5fd4e2f..1eb278619dd6 100644
>> --- a/drivers/mfd/Makefile
>> +++ b/drivers/mfd/Makefile
>> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)      += da9052-spi.o
>>  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
>>  obj-$(CONFIG_MFD_AXP20X_CORE)        += axp20x-core.o
>>  obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
>> +obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
>>
>>  obj-$(CONFIG_MFD_LP3943)     += lp3943.o
>>  obj-$(CONFIG_MFD_LP8788)     += lp8788.o lp8788-irq.o
>> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
>> index dd33548d93c4..baecccb6d400 100644
>> --- a/drivers/mfd/axp20x-core.c
>> +++ b/drivers/mfd/axp20x-core.c
>> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>>       "AXP202",
>>       "AXP209",
>>       "AXP221",
>> +     "AXP223",
>>       "AXP288",
>>  };
>>
>> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>>               axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>>               break;
>>       case AXP221_ID:
>> +     case AXP223_ID:
>>               axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>>               axp20x->cells = axp22x_cells;
>>               axp20x->regmap_cfg = &axp22x_regmap_config;
>> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
>> new file mode 100644
>> index 000000000000..5d053d177717
>> --- /dev/null
>> +++ b/drivers/mfd/axp20x-rsb.c
>> @@ -0,0 +1,93 @@
>> +/*
>> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
>> + *
>> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
>> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>> + * as well as configurable GPIOs.
>> + *
>> + * This driver supports the RSB variants.
>> + *
>> + * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
>> +#include <linux/err.h>
>> +#include <linux/module.h>
>> +#include <linux/mfd/axp20x.h>
>> +#include <linux/of_device.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
>> +#include <linux/soc/sunxi/sunxi_rsb.h>
>> +
>> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
>> +     { .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
>> +     { },
>> +};
>> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
>> +
>> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
>> +                                      struct device *dev)
>> +{
>> +     const struct of_device_id *of_id;
>> +
>> +     of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
>> +     if (!of_id) {
>> +             dev_err(dev, "Unable to match OF ID\n");
>> +             return -ENODEV;
>> +     }
>> +     axp20x->variant = (long) of_id->data;
>> +
>> +     return axp20x_match_device(axp20x, dev);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x;
>> +     int ret;
>> +
>> +     axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
>> +     if (!axp20x)
>> +             return -ENOMEM;
>> +
>> +     ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     axp20x->dev = &rdev->dev;
>> +     axp20x->irq = rdev->irq;
>> +     sunxi_rsb_device_set_drvdata(rdev, axp20x);
>> +
>> +     axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
>> +     if (IS_ERR(axp20x->regmap)) {
>> +             ret = PTR_ERR(axp20x->regmap);
>> +             dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return axp20x_device_probe(axp20x);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
>> +
>> +     return axp20x_device_remove(axp20x);
>> +}
>> +
>> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
>> +     .driver = {
>> +             .name   = "axp20x-sunxi-rsb",
>
> Do we need to be that verbose in the name of the driver?
>
> axp20x-rsb should be enough, especially since it's also the name of
> your file.

Sure.

> Looks good otherwise, thanks!

Thanks!

ChenYu

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

* Re: Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-16  6:46       ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-16  6:46 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> It is functionally identical to AXP221; only the regulator default
>> voltage/status and the external host interface are different.
>>
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>>  drivers/mfd/Kconfig        | 12 ++++++
>>  drivers/mfd/Makefile       |  1 +
>>  drivers/mfd/axp20x-core.c  |  2 +
>>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h |  1 +
>>  5 files changed, 109 insertions(+)
>>  create mode 100644 drivers/mfd/axp20x-rsb.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>>  config MFD_AXP20X
>>       bool "X-Powers AXP series PMICs"
>>       select MFD_AXP20X_I2C
>> +     select MFD_AXP20X_RSB
>>
>>  config MFD_AXP20X_CORE
>>       bool
>> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>>         components like regulators or the PEK (Power Enable Key) under the
>>         corresponding menus.
>>
>> +config MFD_AXP20X_RSB
>> +     bool "X-Powers AXP series RSB PMICs"
>> +     select MFD_AXP20X_CORE
>> +     depends on SUNXI_RSB=y
>
> Do we need that? Even if the bus is compiled as a module, the driver
> will not be probed before that, will it?

There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

And both drivers are bool, i.e. can't be compiled as a module. What we
don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

AFAIK the same goes for the I2C version.

>> +     help
>> +       If you say Y here you get support for the X-Powers AXP series RSB
>> +       based power management ICs (PMICs).
>> +       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 ce3ad5fd4e2f..1eb278619dd6 100644
>> --- a/drivers/mfd/Makefile
>> +++ b/drivers/mfd/Makefile
>> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)      += da9052-spi.o
>>  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
>>  obj-$(CONFIG_MFD_AXP20X_CORE)        += axp20x-core.o
>>  obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
>> +obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
>>
>>  obj-$(CONFIG_MFD_LP3943)     += lp3943.o
>>  obj-$(CONFIG_MFD_LP8788)     += lp8788.o lp8788-irq.o
>> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
>> index dd33548d93c4..baecccb6d400 100644
>> --- a/drivers/mfd/axp20x-core.c
>> +++ b/drivers/mfd/axp20x-core.c
>> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>>       "AXP202",
>>       "AXP209",
>>       "AXP221",
>> +     "AXP223",
>>       "AXP288",
>>  };
>>
>> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>>               axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>>               break;
>>       case AXP221_ID:
>> +     case AXP223_ID:
>>               axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>>               axp20x->cells = axp22x_cells;
>>               axp20x->regmap_cfg = &axp22x_regmap_config;
>> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
>> new file mode 100644
>> index 000000000000..5d053d177717
>> --- /dev/null
>> +++ b/drivers/mfd/axp20x-rsb.c
>> @@ -0,0 +1,93 @@
>> +/*
>> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
>> + *
>> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
>> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>> + * as well as configurable GPIOs.
>> + *
>> + * This driver supports the RSB variants.
>> + *
>> + * Author: Chen-Yu Tsai <wens-jdAy2FN1RRM@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/acpi.h>
>> +#include <linux/err.h>
>> +#include <linux/module.h>
>> +#include <linux/mfd/axp20x.h>
>> +#include <linux/of_device.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
>> +#include <linux/soc/sunxi/sunxi_rsb.h>
>> +
>> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
>> +     { .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
>> +     { },
>> +};
>> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
>> +
>> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
>> +                                      struct device *dev)
>> +{
>> +     const struct of_device_id *of_id;
>> +
>> +     of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
>> +     if (!of_id) {
>> +             dev_err(dev, "Unable to match OF ID\n");
>> +             return -ENODEV;
>> +     }
>> +     axp20x->variant = (long) of_id->data;
>> +
>> +     return axp20x_match_device(axp20x, dev);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x;
>> +     int ret;
>> +
>> +     axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
>> +     if (!axp20x)
>> +             return -ENOMEM;
>> +
>> +     ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     axp20x->dev = &rdev->dev;
>> +     axp20x->irq = rdev->irq;
>> +     sunxi_rsb_device_set_drvdata(rdev, axp20x);
>> +
>> +     axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
>> +     if (IS_ERR(axp20x->regmap)) {
>> +             ret = PTR_ERR(axp20x->regmap);
>> +             dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return axp20x_device_probe(axp20x);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
>> +
>> +     return axp20x_device_remove(axp20x);
>> +}
>> +
>> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
>> +     .driver = {
>> +             .name   = "axp20x-sunxi-rsb",
>
> Do we need to be that verbose in the name of the driver?
>
> axp20x-rsb should be enough, especially since it's also the name of
> your file.

Sure.

> Looks good otherwise, thanks!

Thanks!

ChenYu

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

* [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-16  6:46       ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-16  6:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> It is functionally identical to AXP221; only the regulator default
>> voltage/status and the external host interface are different.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  drivers/mfd/Kconfig        | 12 ++++++
>>  drivers/mfd/Makefile       |  1 +
>>  drivers/mfd/axp20x-core.c  |  2 +
>>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/mfd/axp20x.h |  1 +
>>  5 files changed, 109 insertions(+)
>>  create mode 100644 drivers/mfd/axp20x-rsb.c
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>>  config MFD_AXP20X
>>       bool "X-Powers AXP series PMICs"
>>       select MFD_AXP20X_I2C
>> +     select MFD_AXP20X_RSB
>>
>>  config MFD_AXP20X_CORE
>>       bool
>> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>>         components like regulators or the PEK (Power Enable Key) under the
>>         corresponding menus.
>>
>> +config MFD_AXP20X_RSB
>> +     bool "X-Powers AXP series RSB PMICs"
>> +     select MFD_AXP20X_CORE
>> +     depends on SUNXI_RSB=y
>
> Do we need that? Even if the bus is compiled as a module, the driver
> will not be probed before that, will it?

There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

And both drivers are bool, i.e. can't be compiled as a module. What we
don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

AFAIK the same goes for the I2C version.

>> +     help
>> +       If you say Y here you get support for the X-Powers AXP series RSB
>> +       based power management ICs (PMICs).
>> +       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 ce3ad5fd4e2f..1eb278619dd6 100644
>> --- a/drivers/mfd/Makefile
>> +++ b/drivers/mfd/Makefile
>> @@ -108,6 +108,7 @@ obj-$(CONFIG_MFD_DA9052_SPI)      += da9052-spi.o
>>  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
>>  obj-$(CONFIG_MFD_AXP20X_CORE)        += axp20x-core.o
>>  obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
>> +obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
>>
>>  obj-$(CONFIG_MFD_LP3943)     += lp3943.o
>>  obj-$(CONFIG_MFD_LP8788)     += lp8788.o lp8788-irq.o
>> diff --git a/drivers/mfd/axp20x-core.c b/drivers/mfd/axp20x-core.c
>> index dd33548d93c4..baecccb6d400 100644
>> --- a/drivers/mfd/axp20x-core.c
>> +++ b/drivers/mfd/axp20x-core.c
>> @@ -32,6 +32,7 @@ static const char * const axp20x_model_names[] = {
>>       "AXP202",
>>       "AXP209",
>>       "AXP221",
>> +     "AXP223",
>>       "AXP288",
>>  };
>>
>> @@ -575,6 +576,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
>>               axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>>               break;
>>       case AXP221_ID:
>> +     case AXP223_ID:
>>               axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
>>               axp20x->cells = axp22x_cells;
>>               axp20x->regmap_cfg = &axp22x_regmap_config;
>> diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c
>> new file mode 100644
>> index 000000000000..5d053d177717
>> --- /dev/null
>> +++ b/drivers/mfd/axp20x-rsb.c
>> @@ -0,0 +1,93 @@
>> +/*
>> + * axp20x-rsb.c - RSB driver for the X-Powers' Power Management ICs
>> + *
>> + * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
>> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>> + * as well as configurable GPIOs.
>> + *
>> + * This driver supports the RSB variants.
>> + *
>> + * Author: Chen-Yu Tsai <wens@csie.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/acpi.h>
>> +#include <linux/err.h>
>> +#include <linux/module.h>
>> +#include <linux/mfd/axp20x.h>
>> +#include <linux/of_device.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
>> +#include <linux/soc/sunxi/sunxi_rsb.h>
>> +
>> +static const struct of_device_id axp20x_sunxi_rsb_of_match[] = {
>> +     { .compatible = "x-powers,axp223", .data = (void *) AXP223_ID },
>> +     { },
>> +};
>> +MODULE_DEVICE_TABLE(of, axp20x_sunxi_rsb_of_match);
>> +
>> +static int axp20x_sunxi_rsb_match_device(struct axp20x_dev *axp20x,
>> +                                      struct device *dev)
>> +{
>> +     const struct of_device_id *of_id;
>> +
>> +     of_id = of_match_device(axp20x_sunxi_rsb_of_match, dev);
>> +     if (!of_id) {
>> +             dev_err(dev, "Unable to match OF ID\n");
>> +             return -ENODEV;
>> +     }
>> +     axp20x->variant = (long) of_id->data;
>> +
>> +     return axp20x_match_device(axp20x, dev);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_probe(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x;
>> +     int ret;
>> +
>> +     axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL);
>> +     if (!axp20x)
>> +             return -ENOMEM;
>> +
>> +     ret = axp20x_sunxi_rsb_match_device(axp20x, &rdev->dev);
>> +     if (ret)
>> +             return ret;
>> +
>> +     axp20x->dev = &rdev->dev;
>> +     axp20x->irq = rdev->irq;
>> +     sunxi_rsb_device_set_drvdata(rdev, axp20x);
>> +
>> +     axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg);
>> +     if (IS_ERR(axp20x->regmap)) {
>> +             ret = PTR_ERR(axp20x->regmap);
>> +             dev_err(&rdev->dev, "regmap init failed: %d\n", ret);
>> +             return ret;
>> +     }
>> +
>> +     return axp20x_device_probe(axp20x);
>> +}
>> +
>> +static int axp20x_sunxi_rsb_remove(struct sunxi_rsb_device *rdev)
>> +{
>> +     struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
>> +
>> +     return axp20x_device_remove(axp20x);
>> +}
>> +
>> +static struct sunxi_rsb_driver axp20x_sunxi_rsb_driver = {
>> +     .driver = {
>> +             .name   = "axp20x-sunxi-rsb",
>
> Do we need to be that verbose in the name of the driver?
>
> axp20x-rsb should be enough, especially since it's also the name of
> your file.

Sure.

> Looks good otherwise, thanks!

Thanks!

ChenYu

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

* Re: [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19  6:02         ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19  6:02 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> It is functionally identical to AXP221; only the regulator default
> >> voltage/status and the external host interface are different.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >>  drivers/mfd/Kconfig        | 12 ++++++
> >>  drivers/mfd/Makefile       |  1 +
> >>  drivers/mfd/axp20x-core.c  |  2 +
> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >>  include/linux/mfd/axp20x.h |  1 +
> >>  5 files changed, 109 insertions(+)
> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >>
> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> --- a/drivers/mfd/Kconfig
> >> +++ b/drivers/mfd/Kconfig
> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >>  config MFD_AXP20X
> >>       bool "X-Powers AXP series PMICs"
> >>       select MFD_AXP20X_I2C
> >> +     select MFD_AXP20X_RSB
> >>
> >>  config MFD_AXP20X_CORE
> >>       bool
> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >>         components like regulators or the PEK (Power Enable Key) under the
> >>         corresponding menus.
> >>
> >> +config MFD_AXP20X_RSB
> >> +     bool "X-Powers AXP series RSB PMICs"
> >> +     select MFD_AXP20X_CORE
> >> +     depends on SUNXI_RSB=y
> >
> > Do we need that? Even if the bus is compiled as a module, the driver
> > will not be probed before that, will it?
> 
> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

If it's exported, everything should be fine, no?

> And both drivers are bool, i.e. can't be compiled as a module. What we
> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

What would really be the issue here? The driver wouldn't be probed,
and that's it. Or am I missing something?

Maxime

> AFAIK the same goes for the I2C version.

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

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

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

* Re: Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19  6:02         ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19  6:02 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> It is functionally identical to AXP221; only the regulator default
> >> voltage/status and the external host interface are different.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> >> ---
> >>  drivers/mfd/Kconfig        | 12 ++++++
> >>  drivers/mfd/Makefile       |  1 +
> >>  drivers/mfd/axp20x-core.c  |  2 +
> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >>  include/linux/mfd/axp20x.h |  1 +
> >>  5 files changed, 109 insertions(+)
> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >>
> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> --- a/drivers/mfd/Kconfig
> >> +++ b/drivers/mfd/Kconfig
> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >>  config MFD_AXP20X
> >>       bool "X-Powers AXP series PMICs"
> >>       select MFD_AXP20X_I2C
> >> +     select MFD_AXP20X_RSB
> >>
> >>  config MFD_AXP20X_CORE
> >>       bool
> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >>         components like regulators or the PEK (Power Enable Key) under the
> >>         corresponding menus.
> >>
> >> +config MFD_AXP20X_RSB
> >> +     bool "X-Powers AXP series RSB PMICs"
> >> +     select MFD_AXP20X_CORE
> >> +     depends on SUNXI_RSB=y
> >
> > Do we need that? Even if the bus is compiled as a module, the driver
> > will not be probed before that, will it?
> 
> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

If it's exported, everything should be fine, no?

> And both drivers are bool, i.e. can't be compiled as a module. What we
> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

What would really be the issue here? The driver wouldn't be probed,
and that's it. Or am I missing something?

Maxime

> AFAIK the same goes for the I2C version.

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

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

* [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19  6:02         ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19  6:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> It is functionally identical to AXP221; only the regulator default
> >> voltage/status and the external host interface are different.
> >>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >>  drivers/mfd/Kconfig        | 12 ++++++
> >>  drivers/mfd/Makefile       |  1 +
> >>  drivers/mfd/axp20x-core.c  |  2 +
> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >>  include/linux/mfd/axp20x.h |  1 +
> >>  5 files changed, 109 insertions(+)
> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >>
> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> --- a/drivers/mfd/Kconfig
> >> +++ b/drivers/mfd/Kconfig
> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >>  config MFD_AXP20X
> >>       bool "X-Powers AXP series PMICs"
> >>       select MFD_AXP20X_I2C
> >> +     select MFD_AXP20X_RSB
> >>
> >>  config MFD_AXP20X_CORE
> >>       bool
> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >>         components like regulators or the PEK (Power Enable Key) under the
> >>         corresponding menus.
> >>
> >> +config MFD_AXP20X_RSB
> >> +     bool "X-Powers AXP series RSB PMICs"
> >> +     select MFD_AXP20X_CORE
> >> +     depends on SUNXI_RSB=y
> >
> > Do we need that? Even if the bus is compiled as a module, the driver
> > will not be probed before that, will it?
> 
> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().

If it's exported, everything should be fine, no?

> And both drivers are bool, i.e. can't be compiled as a module. What we
> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.

What would really be the issue here? The driver wouldn't be probed,
and that's it. Or am I missing something?

Maxime

> AFAIK the same goes for the I2C version.

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151019/d6e861f6/attachment.sig>

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

* Re: [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
  2015-10-19  6:02         ` Maxime Ripard
  (?)
@ 2015-10-19  6:20           ` Chen-Yu Tsai
  -1 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-19  6:20 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> It is functionally identical to AXP221; only the regulator default
>> >> voltage/status and the external host interface are different.
>> >>
>> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> >> ---
>> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >>  drivers/mfd/Makefile       |  1 +
>> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >>  include/linux/mfd/axp20x.h |  1 +
>> >>  5 files changed, 109 insertions(+)
>> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >>
>> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> --- a/drivers/mfd/Kconfig
>> >> +++ b/drivers/mfd/Kconfig
>> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >>  config MFD_AXP20X
>> >>       bool "X-Powers AXP series PMICs"
>> >>       select MFD_AXP20X_I2C
>> >> +     select MFD_AXP20X_RSB
>> >>
>> >>  config MFD_AXP20X_CORE
>> >>       bool
>> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >>         components like regulators or the PEK (Power Enable Key) under the
>> >>         corresponding menus.
>> >>
>> >> +config MFD_AXP20X_RSB
>> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> +     select MFD_AXP20X_CORE
>> >> +     depends on SUNXI_RSB=y
>> >
>> > Do we need that? Even if the bus is compiled as a module, the driver
>> > will not be probed before that, will it?
>>
>> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>
> If it's exported, everything should be fine, no?
>
>> And both drivers are bool, i.e. can't be compiled as a module. What we
>> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>
> What would really be the issue here? The driver wouldn't be probed,
> and that's it. Or am I missing something?

The RSB bus / slave device functions have been merged into the RSB driver
itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
bus/device related functions are not compiled, i.e. link error:

drivers/built-in.o: In function `axp20x_rsb_probe':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
reference to `__devm_regmap_init_sunxi_rsb'
drivers/built-in.o: In function `axp20x_rsb_driver_init':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
reference to `sunxi_rsb_driver_register'
Makefile:927: recipe for target 'vmlinux' failed

The dependency is like "depends on I2C=y" for the I2C version.

If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
and if the depended on symbol is a tristate, which it actually is for I2c,
we'd want it to be compiled in, and not built as a module, or again we'd get
a undefined reference link error.

Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
isn't.

Hope this clears it up.


Regards
ChenYu

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

* Re: Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19  6:20           ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-19  6:20 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> It is functionally identical to AXP221; only the regulator default
>> >> voltage/status and the external host interface are different.
>> >>
>> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> >> ---
>> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >>  drivers/mfd/Makefile       |  1 +
>> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >>  include/linux/mfd/axp20x.h |  1 +
>> >>  5 files changed, 109 insertions(+)
>> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >>
>> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> --- a/drivers/mfd/Kconfig
>> >> +++ b/drivers/mfd/Kconfig
>> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >>  config MFD_AXP20X
>> >>       bool "X-Powers AXP series PMICs"
>> >>       select MFD_AXP20X_I2C
>> >> +     select MFD_AXP20X_RSB
>> >>
>> >>  config MFD_AXP20X_CORE
>> >>       bool
>> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >>         components like regulators or the PEK (Power Enable Key) under the
>> >>         corresponding menus.
>> >>
>> >> +config MFD_AXP20X_RSB
>> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> +     select MFD_AXP20X_CORE
>> >> +     depends on SUNXI_RSB=y
>> >
>> > Do we need that? Even if the bus is compiled as a module, the driver
>> > will not be probed before that, will it?
>>
>> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>
> If it's exported, everything should be fine, no?
>
>> And both drivers are bool, i.e. can't be compiled as a module. What we
>> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>
> What would really be the issue here? The driver wouldn't be probed,
> and that's it. Or am I missing something?

The RSB bus / slave device functions have been merged into the RSB driver
itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
bus/device related functions are not compiled, i.e. link error:

drivers/built-in.o: In function `axp20x_rsb_probe':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
reference to `__devm_regmap_init_sunxi_rsb'
drivers/built-in.o: In function `axp20x_rsb_driver_init':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
reference to `sunxi_rsb_driver_register'
Makefile:927: recipe for target 'vmlinux' failed

The dependency is like "depends on I2C=y" for the I2C version.

If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
and if the depended on symbol is a tristate, which it actually is for I2c,
we'd want it to be compiled in, and not built as a module, or again we'd get
a undefined reference link error.

Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
isn't.

Hope this clears it up.


Regards
ChenYu

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

* [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19  6:20           ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-19  6:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> It is functionally identical to AXP221; only the regulator default
>> >> voltage/status and the external host interface are different.
>> >>
>> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> >> ---
>> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >>  drivers/mfd/Makefile       |  1 +
>> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >>  include/linux/mfd/axp20x.h |  1 +
>> >>  5 files changed, 109 insertions(+)
>> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >>
>> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> --- a/drivers/mfd/Kconfig
>> >> +++ b/drivers/mfd/Kconfig
>> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >>  config MFD_AXP20X
>> >>       bool "X-Powers AXP series PMICs"
>> >>       select MFD_AXP20X_I2C
>> >> +     select MFD_AXP20X_RSB
>> >>
>> >>  config MFD_AXP20X_CORE
>> >>       bool
>> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >>         components like regulators or the PEK (Power Enable Key) under the
>> >>         corresponding menus.
>> >>
>> >> +config MFD_AXP20X_RSB
>> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> +     select MFD_AXP20X_CORE
>> >> +     depends on SUNXI_RSB=y
>> >
>> > Do we need that? Even if the bus is compiled as a module, the driver
>> > will not be probed before that, will it?
>>
>> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>
> If it's exported, everything should be fine, no?
>
>> And both drivers are bool, i.e. can't be compiled as a module. What we
>> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>
> What would really be the issue here? The driver wouldn't be probed,
> and that's it. Or am I missing something?

The RSB bus / slave device functions have been merged into the RSB driver
itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
bus/device related functions are not compiled, i.e. link error:

drivers/built-in.o: In function `axp20x_rsb_probe':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
reference to `__devm_regmap_init_sunxi_rsb'
drivers/built-in.o: In function `axp20x_rsb_driver_init':
/home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
reference to `sunxi_rsb_driver_register'
Makefile:927: recipe for target 'vmlinux' failed

The dependency is like "depends on I2C=y" for the I2C version.

If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
and if the depended on symbol is a tristate, which it actually is for I2c,
we'd want it to be compiled in, and not built as a module, or again we'd get
a undefined reference link error.

Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
isn't.

Hope this clears it up.


Regards
ChenYu

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

* Re: [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19 18:48             ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19 18:48 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> >> It is functionally identical to AXP221; only the regulator default
> >> >> voltage/status and the external host interface are different.
> >> >>
> >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> >> ---
> >> >>  drivers/mfd/Kconfig        | 12 ++++++
> >> >>  drivers/mfd/Makefile       |  1 +
> >> >>  drivers/mfd/axp20x-core.c  |  2 +
> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >> >>  include/linux/mfd/axp20x.h |  1 +
> >> >>  5 files changed, 109 insertions(+)
> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >> >>
> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> >> --- a/drivers/mfd/Kconfig
> >> >> +++ b/drivers/mfd/Kconfig
> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >> >>  config MFD_AXP20X
> >> >>       bool "X-Powers AXP series PMICs"
> >> >>       select MFD_AXP20X_I2C
> >> >> +     select MFD_AXP20X_RSB
> >> >>
> >> >>  config MFD_AXP20X_CORE
> >> >>       bool
> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >> >>         components like regulators or the PEK (Power Enable Key) under the
> >> >>         corresponding menus.
> >> >>
> >> >> +config MFD_AXP20X_RSB
> >> >> +     bool "X-Powers AXP series RSB PMICs"
> >> >> +     select MFD_AXP20X_CORE
> >> >> +     depends on SUNXI_RSB=y
> >> >
> >> > Do we need that? Even if the bus is compiled as a module, the driver
> >> > will not be probed before that, will it?
> >>
> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
> >
> > If it's exported, everything should be fine, no?
> >
> >> And both drivers are bool, i.e. can't be compiled as a module. What we
> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
> >
> > What would really be the issue here? The driver wouldn't be probed,
> > and that's it. Or am I missing something?
> 
> The RSB bus / slave device functions have been merged into the RSB driver
> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
> bus/device related functions are not compiled, i.e. link error:
> 
> drivers/built-in.o: In function `axp20x_rsb_probe':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
> reference to `__devm_regmap_init_sunxi_rsb'
> drivers/built-in.o: In function `axp20x_rsb_driver_init':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
> reference to `sunxi_rsb_driver_register'
> Makefile:927: recipe for target 'vmlinux' failed
>
> The dependency is like "depends on I2C=y" for the I2C version.
> 
> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
> and if the depended on symbol is a tristate, which it actually is for I2c,
> we'd want it to be compiled in, and not built as a module, or again we'd get
> a undefined reference link error.

Yeah, but my point was more why not have both the RSB driver and MFD
as a module? The part where RSB is a module and the driver is
statically built doesn't make sense (and I don't think a depends on
allow that), but having both make sense.

> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
> isn't.

Yes, it's better for multi-platform / distro kernels.

Maxime

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

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

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

* Re: Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19 18:48             ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19 18:48 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> >> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> >> It is functionally identical to AXP221; only the regulator default
> >> >> voltage/status and the external host interface are different.
> >> >>
> >> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> >> >> ---
> >> >>  drivers/mfd/Kconfig        | 12 ++++++
> >> >>  drivers/mfd/Makefile       |  1 +
> >> >>  drivers/mfd/axp20x-core.c  |  2 +
> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >> >>  include/linux/mfd/axp20x.h |  1 +
> >> >>  5 files changed, 109 insertions(+)
> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >> >>
> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> >> --- a/drivers/mfd/Kconfig
> >> >> +++ b/drivers/mfd/Kconfig
> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >> >>  config MFD_AXP20X
> >> >>       bool "X-Powers AXP series PMICs"
> >> >>       select MFD_AXP20X_I2C
> >> >> +     select MFD_AXP20X_RSB
> >> >>
> >> >>  config MFD_AXP20X_CORE
> >> >>       bool
> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >> >>         components like regulators or the PEK (Power Enable Key) under the
> >> >>         corresponding menus.
> >> >>
> >> >> +config MFD_AXP20X_RSB
> >> >> +     bool "X-Powers AXP series RSB PMICs"
> >> >> +     select MFD_AXP20X_CORE
> >> >> +     depends on SUNXI_RSB=y
> >> >
> >> > Do we need that? Even if the bus is compiled as a module, the driver
> >> > will not be probed before that, will it?
> >>
> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
> >
> > If it's exported, everything should be fine, no?
> >
> >> And both drivers are bool, i.e. can't be compiled as a module. What we
> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
> >
> > What would really be the issue here? The driver wouldn't be probed,
> > and that's it. Or am I missing something?
> 
> The RSB bus / slave device functions have been merged into the RSB driver
> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
> bus/device related functions are not compiled, i.e. link error:
> 
> drivers/built-in.o: In function `axp20x_rsb_probe':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
> reference to `__devm_regmap_init_sunxi_rsb'
> drivers/built-in.o: In function `axp20x_rsb_driver_init':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
> reference to `sunxi_rsb_driver_register'
> Makefile:927: recipe for target 'vmlinux' failed
>
> The dependency is like "depends on I2C=y" for the I2C version.
> 
> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
> and if the depended on symbol is a tristate, which it actually is for I2c,
> we'd want it to be compiled in, and not built as a module, or again we'd get
> a undefined reference link error.

Yeah, but my point was more why not have both the RSB driver and MFD
as a module? The part where RSB is a module and the driver is
statically built doesn't make sense (and I don't think a depends on
allow that), but having both make sense.

> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
> isn't.

Yes, it's better for multi-platform / distro kernels.

Maxime

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

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

* [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-19 18:48             ` Maxime Ripard
  0 siblings, 0 replies; 62+ messages in thread
From: Maxime Ripard @ 2015-10-19 18:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> >> >> It is functionally identical to AXP221; only the regulator default
> >> >> voltage/status and the external host interface are different.
> >> >>
> >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> >> ---
> >> >>  drivers/mfd/Kconfig        | 12 ++++++
> >> >>  drivers/mfd/Makefile       |  1 +
> >> >>  drivers/mfd/axp20x-core.c  |  2 +
> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
> >> >>  include/linux/mfd/axp20x.h |  1 +
> >> >>  5 files changed, 109 insertions(+)
> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
> >> >>
> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
> >> >> --- a/drivers/mfd/Kconfig
> >> >> +++ b/drivers/mfd/Kconfig
> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
> >> >>  config MFD_AXP20X
> >> >>       bool "X-Powers AXP series PMICs"
> >> >>       select MFD_AXP20X_I2C
> >> >> +     select MFD_AXP20X_RSB
> >> >>
> >> >>  config MFD_AXP20X_CORE
> >> >>       bool
> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
> >> >>         components like regulators or the PEK (Power Enable Key) under the
> >> >>         corresponding menus.
> >> >>
> >> >> +config MFD_AXP20X_RSB
> >> >> +     bool "X-Powers AXP series RSB PMICs"
> >> >> +     select MFD_AXP20X_CORE
> >> >> +     depends on SUNXI_RSB=y
> >> >
> >> > Do we need that? Even if the bus is compiled as a module, the driver
> >> > will not be probed before that, will it?
> >>
> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
> >
> > If it's exported, everything should be fine, no?
> >
> >> And both drivers are bool, i.e. can't be compiled as a module. What we
> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
> >
> > What would really be the issue here? The driver wouldn't be probed,
> > and that's it. Or am I missing something?
> 
> The RSB bus / slave device functions have been merged into the RSB driver
> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
> bus/device related functions are not compiled, i.e. link error:
> 
> drivers/built-in.o: In function `axp20x_rsb_probe':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
> reference to `__devm_regmap_init_sunxi_rsb'
> drivers/built-in.o: In function `axp20x_rsb_driver_init':
> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
> reference to `sunxi_rsb_driver_register'
> Makefile:927: recipe for target 'vmlinux' failed
>
> The dependency is like "depends on I2C=y" for the I2C version.
> 
> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
> and if the depended on symbol is a tristate, which it actually is for I2c,
> we'd want it to be compiled in, and not built as a module, or again we'd get
> a undefined reference link error.

Yeah, but my point was more why not have both the RSB driver and MFD
as a module? The part where RSB is a module and the driver is
statically built doesn't make sense (and I don't think a depends on
allow that), but having both make sense.

> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
> isn't.

Yes, it's better for multi-platform / distro kernels.

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: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151019/f74dccae/attachment.sig>

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

* Re: [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
  2015-10-19 18:48             ` Maxime Ripard
  (?)
@ 2015-10-20  4:04               ` Chen-Yu Tsai
  -1 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-20  4:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Tue, Oct 20, 2015 at 2:48 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
>> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> >> <maxime.ripard@free-electrons.com> wrote:
>> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> >> It is functionally identical to AXP221; only the regulator default
>> >> >> voltage/status and the external host interface are different.
>> >> >>
>> >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> >> >> ---
>> >> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >> >>  drivers/mfd/Makefile       |  1 +
>> >> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >> >>  include/linux/mfd/axp20x.h |  1 +
>> >> >>  5 files changed, 109 insertions(+)
>> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >> >>
>> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> >> --- a/drivers/mfd/Kconfig
>> >> >> +++ b/drivers/mfd/Kconfig
>> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >> >>  config MFD_AXP20X
>> >> >>       bool "X-Powers AXP series PMICs"
>> >> >>       select MFD_AXP20X_I2C
>> >> >> +     select MFD_AXP20X_RSB
>> >> >>
>> >> >>  config MFD_AXP20X_CORE
>> >> >>       bool
>> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >> >>         components like regulators or the PEK (Power Enable Key) under the
>> >> >>         corresponding menus.
>> >> >>
>> >> >> +config MFD_AXP20X_RSB
>> >> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> >> +     select MFD_AXP20X_CORE
>> >> >> +     depends on SUNXI_RSB=y
>> >> >
>> >> > Do we need that? Even if the bus is compiled as a module, the driver
>> >> > will not be probed before that, will it?
>> >>
>> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>> >
>> > If it's exported, everything should be fine, no?
>> >
>> >> And both drivers are bool, i.e. can't be compiled as a module. What we
>> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>> >
>> > What would really be the issue here? The driver wouldn't be probed,
>> > and that's it. Or am I missing something?
>>
>> The RSB bus / slave device functions have been merged into the RSB driver
>> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
>> bus/device related functions are not compiled, i.e. link error:
>>
>> drivers/built-in.o: In function `axp20x_rsb_probe':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
>> reference to `__devm_regmap_init_sunxi_rsb'
>> drivers/built-in.o: In function `axp20x_rsb_driver_init':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
>> reference to `sunxi_rsb_driver_register'
>> Makefile:927: recipe for target 'vmlinux' failed
>>
>> The dependency is like "depends on I2C=y" for the I2C version.
>>
>> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
>> and if the depended on symbol is a tristate, which it actually is for I2c,
>> we'd want it to be compiled in, and not built as a module, or again we'd get
>> a undefined reference link error.
>
> Yeah, but my point was more why not have both the RSB driver and MFD
> as a module? The part where RSB is a module and the driver is
> statically built doesn't make sense (and I don't think a depends on
> allow that), but having both make sense.

Ok. I have no problem with building them as modules. I was just following
what the original driver did.

It seems half the mfd driver can be built as modules, while the other
half can only be built-in. I don't know what the criteria is here.

>> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
>> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
>> isn't.
>
> Yes, it's better for multi-platform / distro kernels.

I guess I'll do a follow up patch for sunxi-rsb?

Regards
ChenYu

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

* Re: Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-20  4:04               ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-20  4:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

On Tue, Oct 20, 2015 at 2:48 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
>> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
>> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> >> <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> >> It is functionally identical to AXP221; only the regulator default
>> >> >> voltage/status and the external host interface are different.
>> >> >>
>> >> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> >> >> ---
>> >> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >> >>  drivers/mfd/Makefile       |  1 +
>> >> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >> >>  include/linux/mfd/axp20x.h |  1 +
>> >> >>  5 files changed, 109 insertions(+)
>> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >> >>
>> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> >> --- a/drivers/mfd/Kconfig
>> >> >> +++ b/drivers/mfd/Kconfig
>> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >> >>  config MFD_AXP20X
>> >> >>       bool "X-Powers AXP series PMICs"
>> >> >>       select MFD_AXP20X_I2C
>> >> >> +     select MFD_AXP20X_RSB
>> >> >>
>> >> >>  config MFD_AXP20X_CORE
>> >> >>       bool
>> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >> >>         components like regulators or the PEK (Power Enable Key) under the
>> >> >>         corresponding menus.
>> >> >>
>> >> >> +config MFD_AXP20X_RSB
>> >> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> >> +     select MFD_AXP20X_CORE
>> >> >> +     depends on SUNXI_RSB=y
>> >> >
>> >> > Do we need that? Even if the bus is compiled as a module, the driver
>> >> > will not be probed before that, will it?
>> >>
>> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>> >
>> > If it's exported, everything should be fine, no?
>> >
>> >> And both drivers are bool, i.e. can't be compiled as a module. What we
>> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>> >
>> > What would really be the issue here? The driver wouldn't be probed,
>> > and that's it. Or am I missing something?
>>
>> The RSB bus / slave device functions have been merged into the RSB driver
>> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
>> bus/device related functions are not compiled, i.e. link error:
>>
>> drivers/built-in.o: In function `axp20x_rsb_probe':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
>> reference to `__devm_regmap_init_sunxi_rsb'
>> drivers/built-in.o: In function `axp20x_rsb_driver_init':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
>> reference to `sunxi_rsb_driver_register'
>> Makefile:927: recipe for target 'vmlinux' failed
>>
>> The dependency is like "depends on I2C=y" for the I2C version.
>>
>> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
>> and if the depended on symbol is a tristate, which it actually is for I2c,
>> we'd want it to be compiled in, and not built as a module, or again we'd get
>> a undefined reference link error.
>
> Yeah, but my point was more why not have both the RSB driver and MFD
> as a module? The part where RSB is a module and the driver is
> statically built doesn't make sense (and I don't think a depends on
> allow that), but having both make sense.

Ok. I have no problem with building them as modules. I was just following
what the original driver did.

It seems half the mfd driver can be built as modules, while the other
half can only be built-in. I don't know what the criteria is here.

>> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
>> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
>> isn't.
>
> Yes, it's better for multi-platform / distro kernels.

I guess I'll do a follow up patch for sunxi-rsb?

Regards
ChenYu

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

* [linux-sunxi] Re: [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2015-10-20  4:04               ` Chen-Yu Tsai
  0 siblings, 0 replies; 62+ messages in thread
From: Chen-Yu Tsai @ 2015-10-20  4:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 20, 2015 at 2:48 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Mon, Oct 19, 2015 at 02:20:29PM +0800, Chen-Yu Tsai wrote:
>> On Mon, Oct 19, 2015 at 2:02 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > On Fri, Oct 16, 2015 at 02:46:23PM +0800, Chen-Yu Tsai wrote:
>> >> On Fri, Oct 16, 2015 at 2:41 PM, Maxime Ripard
>> >> <maxime.ripard@free-electrons.com> wrote:
>> >> > On Thu, Oct 15, 2015 at 12:32:19AM +0800, Chen-Yu Tsai wrote:
>> >> >> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
>> >> >> It is functionally identical to AXP221; only the regulator default
>> >> >> voltage/status and the external host interface are different.
>> >> >>
>> >> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> >> >> ---
>> >> >>  drivers/mfd/Kconfig        | 12 ++++++
>> >> >>  drivers/mfd/Makefile       |  1 +
>> >> >>  drivers/mfd/axp20x-core.c  |  2 +
>> >> >>  drivers/mfd/axp20x-rsb.c   | 93 ++++++++++++++++++++++++++++++++++++++++++++++
>> >> >>  include/linux/mfd/axp20x.h |  1 +
>> >> >>  5 files changed, 109 insertions(+)
>> >> >>  create mode 100644 drivers/mfd/axp20x-rsb.c
>> >> >>
>> >> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> >> >> index 9ba3feb3f2fc..6e5edb61d42e 100644
>> >> >> --- a/drivers/mfd/Kconfig
>> >> >> +++ b/drivers/mfd/Kconfig
>> >> >> @@ -84,6 +84,7 @@ config MFD_BCM590XX
>> >> >>  config MFD_AXP20X
>> >> >>       bool "X-Powers AXP series PMICs"
>> >> >>       select MFD_AXP20X_I2C
>> >> >> +     select MFD_AXP20X_RSB
>> >> >>
>> >> >>  config MFD_AXP20X_CORE
>> >> >>       bool
>> >> >> @@ -102,6 +103,17 @@ config MFD_AXP20X_I2C
>> >> >>         components like regulators or the PEK (Power Enable Key) under the
>> >> >>         corresponding menus.
>> >> >>
>> >> >> +config MFD_AXP20X_RSB
>> >> >> +     bool "X-Powers AXP series RSB PMICs"
>> >> >> +     select MFD_AXP20X_CORE
>> >> >> +     depends on SUNXI_RSB=y
>> >> >
>> >> > Do we need that? Even if the bus is compiled as a module, the driver
>> >> > will not be probed before that, will it?
>> >>
>> >> There's a compile/link dependency on the __devm_regmap_init_sunxi_rsb().
>> >
>> > If it's exported, everything should be fine, no?
>> >
>> >> And both drivers are bool, i.e. can't be compiled as a module. What we
>> >> don't want is enabling MFD_AXP20X_RSB without SUNXI_RSB.
>> >
>> > What would really be the issue here? The driver wouldn't be probed,
>> > and that's it. Or am I missing something?
>>
>> The RSB bus / slave device functions have been merged into the RSB driver
>> itself. Enabling MFD_AXP20X_RSB without enabling SUNXI_RSB means that RSB
>> bus/device related functions are not compiled, i.e. link error:
>>
>> drivers/built-in.o: In function `axp20x_rsb_probe':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:64: undefined
>> reference to `__devm_regmap_init_sunxi_rsb'
>> drivers/built-in.o: In function `axp20x_rsb_driver_init':
>> /home/wens/sunxi/linux/drivers/mfd/axp20x-rsb.c:89: undefined
>> reference to `sunxi_rsb_driver_register'
>> Makefile:927: recipe for target 'vmlinux' failed
>>
>> The dependency is like "depends on I2C=y" for the I2C version.
>>
>> If you're asking about why "=y", I guess it's because MFD_AXP20X_RSB is bool,
>> and if the depended on symbol is a tristate, which it actually is for I2c,
>> we'd want it to be compiled in, and not built as a module, or again we'd get
>> a undefined reference link error.
>
> Yeah, but my point was more why not have both the RSB driver and MFD
> as a module? The part where RSB is a module and the driver is
> statically built doesn't make sense (and I don't think a depends on
> allow that), but having both make sense.

Ok. I have no problem with building them as modules. I was just following
what the original driver did.

It seems half the mfd driver can be built as modules, while the other
half can only be built-in. I don't know what the criteria is here.

>> Would it make sense to have SUNXI_RSB as a tristate symbol, i.e. can be built
>> as a module? I'm nore sure. For multi-platform kernels, probably? Currently it
>> isn't.
>
> Yes, it's better for multi-platform / distro kernels.

I guess I'll do a follow up patch for sunxi-rsb?

Regards
ChenYu

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

* Re: [PATCH 4/6] regulator: axp20x: Support new AXP223 PMIC
  2015-10-14 16:32   ` Chen-Yu Tsai
@ 2015-10-22 12:50     ` Mark Brown
  -1 siblings, 0 replies; 62+ messages in thread
From: Mark Brown @ 2015-10-22 12:50 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Samuel Ortiz, Lee Jones, Liam Girdwood,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Hans de Goede, linux-arm-kernel, devicetree, linux-kernel,
	linux-sunxi

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

On Thu, Oct 15, 2015 at 12:32:20AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.

Reviwed-by: Mark Brown <broonie@kernel.org>

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

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

* [PATCH 4/6] regulator: axp20x: Support new AXP223 PMIC
@ 2015-10-22 12:50     ` Mark Brown
  0 siblings, 0 replies; 62+ messages in thread
From: Mark Brown @ 2015-10-22 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Oct 15, 2015 at 12:32:20AM +0800, Chen-Yu Tsai wrote:
> The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
> It is functionally identical to AXP221; only the regulator default
> voltage/status and the external host interface are different.

Reviwed-by: Mark Brown <broonie@kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151022/4177eab1/attachment.sig>

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

end of thread, other threads:[~2015-10-22 23:36 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14 16:32 [PATCH 0/6] mfd: axp20x: Add support for RSB based AXP223 Chen-Yu Tsai
2015-10-14 16:32 ` Chen-Yu Tsai
2015-10-14 16:32 ` Chen-Yu Tsai
2015-10-14 16:32 ` [PATCH 1/6] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-15 20:36   ` Maxime Ripard
2015-10-15 20:36     ` Maxime Ripard
2015-10-15 20:36     ` Maxime Ripard
2015-10-14 16:32 ` [PATCH 2/6] mfd: axp20x: Split the driver into core and i2c bits Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 20:22   ` kbuild test robot
2015-10-14 20:22     ` kbuild test robot
2015-10-14 20:22     ` kbuild test robot
2015-10-14 22:37   ` [linux-sunxi] " Julian Calaby
2015-10-14 22:37     ` Julian Calaby
2015-10-14 22:37     ` Julian Calaby
2015-10-15  7:39     ` [linux-sunxi] " Chen-Yu Tsai
2015-10-15  7:39       ` Chen-Yu Tsai
2015-10-15  7:39       ` Chen-Yu Tsai
2015-10-14 16:32 ` [PATCH 3/6] mfd: axp20x: Add support for RSB based AXP223 PMIC Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 17:47   ` kbuild test robot
2015-10-14 17:47     ` kbuild test robot
2015-10-14 17:47     ` kbuild test robot
2015-10-14 23:00   ` kbuild test robot
2015-10-14 23:00     ` kbuild test robot
2015-10-14 23:00     ` kbuild test robot
2015-10-16  6:41   ` Maxime Ripard
2015-10-16  6:41     ` Maxime Ripard
2015-10-16  6:41     ` Maxime Ripard
2015-10-16  6:46     ` [linux-sunxi] " Chen-Yu Tsai
2015-10-16  6:46       ` Chen-Yu Tsai
2015-10-16  6:46       ` Chen-Yu Tsai
2015-10-19  6:02       ` [linux-sunxi] " Maxime Ripard
2015-10-19  6:02         ` Maxime Ripard
2015-10-19  6:02         ` Maxime Ripard
2015-10-19  6:20         ` [linux-sunxi] " Chen-Yu Tsai
2015-10-19  6:20           ` Chen-Yu Tsai
2015-10-19  6:20           ` Chen-Yu Tsai
2015-10-19 18:48           ` [linux-sunxi] " Maxime Ripard
2015-10-19 18:48             ` Maxime Ripard
2015-10-19 18:48             ` Maxime Ripard
2015-10-20  4:04             ` [linux-sunxi] " Chen-Yu Tsai
2015-10-20  4:04               ` Chen-Yu Tsai
2015-10-20  4:04               ` Chen-Yu Tsai
2015-10-14 16:32 ` [PATCH 4/6] regulator: axp20x: Support new " Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-22 12:50   ` Mark Brown
2015-10-22 12:50     ` Mark Brown
2015-10-14 16:32 ` [PATCH 5/6] ARM: dts: sun8i: Add NMI interrupt controller node Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-16  6:44   ` Maxime Ripard
2015-10-16  6:44     ` Maxime Ripard
2015-10-16  6:44     ` Maxime Ripard
2015-10-14 16:32 ` [PATCH 6/6] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai
2015-10-14 16:32   ` Chen-Yu Tsai

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.