All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] mfd: axp20x: Add support for RSB based AXP223
@ 2016-01-13  3:30 ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

Hi everyone,

This is v7 of the AXP223 PMIC series. v7 fixes the address of the AXP223
in the DT. 

Lee, please merge the first 8 patches. Once they're in, Maxime can take
the DTS patches.

Changes since v6:

  - Add copyright notice to axp20x-rsb.c

  - Correct order of header files in axp20x-rsb.c

  - Use generic dev_set_drvdata() instead of sunxi_rsb_device_set_drvdata()

  - Drop file name from file headers

  - Add patch adding missing copyright notice for original axp20x author

Changes since v5:

  - Correct AXP223 address to 0x3a3.

Changes since v4:

  - Get rid of second parameter of axp20x_match_device() (new patch 2)

  - Match against dev->driver->of_match_table, so the entirety of
    axp20x_match_device() can be kept in the core. (new patch 3)

  - Move *_device_id tables to bottom of the driver, right above driver
    declaration. (patch 4 & 6)

  - Remove extra whitespaces while moving i2c specific code (patch 4)

  - Remove leftover whitespace and code style issues in axp20x core
    (new patch 5)

  - Remove extra whitespaces in rsb specific code (patch 6)

Changes since v3:

  - Removed settings for axp223 reg_rtc_ldo from board dts files that
    are already in axp22x.dtsi. The name is kept.

  - Dropped simplefb label and defconfig patches, as they are merged.

Changes since v2:

  - s/It's/Its/ for the commit messages of patches 5 and 7

  - Add Rob's Acked-by for patch 1

Changes since v1:

  - Dropped NMI interrupt controller dts patch (Merged)

  - Change MFD_AXP20X to represent the axp20x core, and drop MFD_AXP20X_CORE
  
  - Keep the axp20x core bits named axp20x.c

  - Add patch 7 to add AXP223 to sun8i-q8-common.dtsi

  - Add patch 8 & 9 to update defconfigs

  - Make axp20x drivers tristate and buildable as modules

  - Drop "_sunxi" substring from identifiers in axp20x-rsb driver


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 gets rid of the extra "struct device *" parameter from
axp20x_match_device().

Patch 3 makes axp20x_match_device() use dev->driver->of_match_table,
so the function can be library-ized without modification.

Patch 4 adds the missing copyright notice for axp20x's original author.

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

Patch 6 cleans up some leftover whitespace issues in axp20x core.

Patch 7 adds an RSB based driver for the AXP223.

Patch 8 adds support for the AXP223 regulators

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

Patch 10 enables the AXP223 PMIC and its regulators for A23/A33 based
Q8 tablet devices.


Regards
ChenYu



Chen-Yu Tsai (10):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Remove second struct device * parameter for
    axp20x_match_device()
  mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
  mfd: axp20x: Add missing copyright notice
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes
  ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  76 +++++++++++++++-
 arch/arm/boot/dts/sun8i-q8-common.dtsi           |  83 +++++++++++++++++-
 drivers/mfd/Kconfig                              |  25 ++++--
 drivers/mfd/Makefile                             |   2 +
 drivers/mfd/axp20x-i2c.c                         | 104 ++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  80 +++++++++++++++++
 drivers/mfd/axp20x.c                             | 105 ++++++-----------------
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++++-
 10 files changed, 425 insertions(+), 94 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.4

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

* [PATCH v7 00/10] mfd: axp20x: Add support for RSB based AXP223
@ 2016-01-13  3:30 ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

Hi everyone,

This is v7 of the AXP223 PMIC series. v7 fixes the address of the AXP223
in the DT. 

Lee, please merge the first 8 patches. Once they're in, Maxime can take
the DTS patches.

Changes since v6:

  - Add copyright notice to axp20x-rsb.c

  - Correct order of header files in axp20x-rsb.c

  - Use generic dev_set_drvdata() instead of sunxi_rsb_device_set_drvdata()

  - Drop file name from file headers

  - Add patch adding missing copyright notice for original axp20x author

Changes since v5:

  - Correct AXP223 address to 0x3a3.

Changes since v4:

  - Get rid of second parameter of axp20x_match_device() (new patch 2)

  - Match against dev->driver->of_match_table, so the entirety of
    axp20x_match_device() can be kept in the core. (new patch 3)

  - Move *_device_id tables to bottom of the driver, right above driver
    declaration. (patch 4 & 6)

  - Remove extra whitespaces while moving i2c specific code (patch 4)

  - Remove leftover whitespace and code style issues in axp20x core
    (new patch 5)

  - Remove extra whitespaces in rsb specific code (patch 6)

Changes since v3:

  - Removed settings for axp223 reg_rtc_ldo from board dts files that
    are already in axp22x.dtsi. The name is kept.

  - Dropped simplefb label and defconfig patches, as they are merged.

Changes since v2:

  - s/It's/Its/ for the commit messages of patches 5 and 7

  - Add Rob's Acked-by for patch 1

Changes since v1:

  - Dropped NMI interrupt controller dts patch (Merged)

  - Change MFD_AXP20X to represent the axp20x core, and drop MFD_AXP20X_CORE
  
  - Keep the axp20x core bits named axp20x.c

  - Add patch 7 to add AXP223 to sun8i-q8-common.dtsi

  - Add patch 8 & 9 to update defconfigs

  - Make axp20x drivers tristate and buildable as modules

  - Drop "_sunxi" substring from identifiers in axp20x-rsb driver


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 gets rid of the extra "struct device *" parameter from
axp20x_match_device().

Patch 3 makes axp20x_match_device() use dev->driver->of_match_table,
so the function can be library-ized without modification.

Patch 4 adds the missing copyright notice for axp20x's original author.

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

Patch 6 cleans up some leftover whitespace issues in axp20x core.

Patch 7 adds an RSB based driver for the AXP223.

Patch 8 adds support for the AXP223 regulators

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

Patch 10 enables the AXP223 PMIC and its regulators for A23/A33 based
Q8 tablet devices.


Regards
ChenYu



Chen-Yu Tsai (10):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Remove second struct device * parameter for
    axp20x_match_device()
  mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
  mfd: axp20x: Add missing copyright notice
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes
  ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  76 +++++++++++++++-
 arch/arm/boot/dts/sun8i-q8-common.dtsi           |  83 +++++++++++++++++-
 drivers/mfd/Kconfig                              |  25 ++++--
 drivers/mfd/Makefile                             |   2 +
 drivers/mfd/axp20x-i2c.c                         | 104 ++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  80 +++++++++++++++++
 drivers/mfd/axp20x.c                             | 105 ++++++-----------------
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++++-
 10 files changed, 425 insertions(+), 94 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.4

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

* [PATCH v7 00/10] mfd: axp20x: Add support for RSB based AXP223
@ 2016-01-13  3:30 ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

This is v7 of the AXP223 PMIC series. v7 fixes the address of the AXP223
in the DT. 

Lee, please merge the first 8 patches. Once they're in, Maxime can take
the DTS patches.

Changes since v6:

  - Add copyright notice to axp20x-rsb.c

  - Correct order of header files in axp20x-rsb.c

  - Use generic dev_set_drvdata() instead of sunxi_rsb_device_set_drvdata()

  - Drop file name from file headers

  - Add patch adding missing copyright notice for original axp20x author

Changes since v5:

  - Correct AXP223 address to 0x3a3.

Changes since v4:

  - Get rid of second parameter of axp20x_match_device() (new patch 2)

  - Match against dev->driver->of_match_table, so the entirety of
    axp20x_match_device() can be kept in the core. (new patch 3)

  - Move *_device_id tables to bottom of the driver, right above driver
    declaration. (patch 4 & 6)

  - Remove extra whitespaces while moving i2c specific code (patch 4)

  - Remove leftover whitespace and code style issues in axp20x core
    (new patch 5)

  - Remove extra whitespaces in rsb specific code (patch 6)

Changes since v3:

  - Removed settings for axp223 reg_rtc_ldo from board dts files that
    are already in axp22x.dtsi. The name is kept.

  - Dropped simplefb label and defconfig patches, as they are merged.

Changes since v2:

  - s/It's/Its/ for the commit messages of patches 5 and 7

  - Add Rob's Acked-by for patch 1

Changes since v1:

  - Dropped NMI interrupt controller dts patch (Merged)

  - Change MFD_AXP20X to represent the axp20x core, and drop MFD_AXP20X_CORE
  
  - Keep the axp20x core bits named axp20x.c

  - Add patch 7 to add AXP223 to sun8i-q8-common.dtsi

  - Add patch 8 & 9 to update defconfigs

  - Make axp20x drivers tristate and buildable as modules

  - Drop "_sunxi" substring from identifiers in axp20x-rsb driver


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 gets rid of the extra "struct device *" parameter from
axp20x_match_device().

Patch 3 makes axp20x_match_device() use dev->driver->of_match_table,
so the function can be library-ized without modification.

Patch 4 adds the missing copyright notice for axp20x's original author.

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

Patch 6 cleans up some leftover whitespace issues in axp20x core.

Patch 7 adds an RSB based driver for the AXP223.

Patch 8 adds support for the AXP223 regulators

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

Patch 10 enables the AXP223 PMIC and its regulators for A23/A33 based
Q8 tablet devices.


Regards
ChenYu



Chen-Yu Tsai (10):
  mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
  mfd: axp20x: Remove second struct device * parameter for
    axp20x_match_device()
  mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
  mfd: axp20x: Add missing copyright notice
  mfd: axp20x: Split the driver into core and i2c bits
  mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
  mfd: axp20x: Add support for RSB based AXP223 PMIC
  regulator: axp20x: Support new AXP223 PMIC
  ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator
    nodes
  ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes

 Documentation/devicetree/bindings/mfd/axp20x.txt |   7 +-
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts   |  76 +++++++++++++++-
 arch/arm/boot/dts/sun8i-q8-common.dtsi           |  83 +++++++++++++++++-
 drivers/mfd/Kconfig                              |  25 ++++--
 drivers/mfd/Makefile                             |   2 +
 drivers/mfd/axp20x-i2c.c                         | 104 ++++++++++++++++++++++
 drivers/mfd/axp20x-rsb.c                         |  80 +++++++++++++++++
 drivers/mfd/axp20x.c                             | 105 ++++++-----------------
 drivers/regulator/axp20x-regulator.c             |   3 +
 include/linux/mfd/axp20x.h                       |  34 +++++++-
 10 files changed, 425 insertions(+), 94 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c
 create mode 100644 drivers/mfd/axp20x-rsb.c

-- 
2.6.4

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

* [PATCH v7 01/10] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

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>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.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.4

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

* [PATCH v7 01/10] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

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>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@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.4

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

* [PATCH v7 01/10] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 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>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Lee Jones <lee.jones@linaro.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.4

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

* [PATCH v7 02/10] mfd: axp20x: Remove second struct device * parameter for axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

The first argument passed to axp20x_match_device(), struct axp20x_dev *,
already contains a pointer to the device. By rearranging some code,
moving the assignment of the pointer before axp20x_match_device() is
called, we can eliminate the second parameter.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 9842199e2e6c..685a78614f83 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -606,8 +606,9 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+static int axp20x_match_device(struct axp20x_dev *axp20x)
 {
+	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
 	const struct of_device_id *of_id;
 
@@ -673,14 +674,14 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 	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);
 
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
 	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
 	if (IS_ERR(axp20x->regmap)) {
 		ret = PTR_ERR(axp20x->regmap);
-- 
2.6.4

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

* [PATCH v7 02/10] mfd: axp20x: Remove second struct device * parameter for axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

The first argument passed to axp20x_match_device(), struct axp20x_dev *,
already contains a pointer to the device. By rearranging some code,
moving the assignment of the pointer before axp20x_match_device() is
called, we can eliminate the second parameter.

Suggested-by: Andy Shevchenko <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/mfd/axp20x.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 9842199e2e6c..685a78614f83 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -606,8 +606,9 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+static int axp20x_match_device(struct axp20x_dev *axp20x)
 {
+	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
 	const struct of_device_id *of_id;
 
@@ -673,14 +674,14 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 	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);
 
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
 	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
 	if (IS_ERR(axp20x->regmap)) {
 		ret = PTR_ERR(axp20x->regmap);
-- 
2.6.4

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

* [PATCH v7 02/10] mfd: axp20x: Remove second struct device * parameter for axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

The first argument passed to axp20x_match_device(), struct axp20x_dev *,
already contains a pointer to the device. By rearranging some code,
moving the assignment of the pointer before axp20x_match_device() is
called, we can eliminate the second parameter.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 9842199e2e6c..685a78614f83 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -606,8 +606,9 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev)
+static int axp20x_match_device(struct axp20x_dev *axp20x)
 {
+	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
 	const struct of_device_id *of_id;
 
@@ -673,14 +674,14 @@ static int axp20x_i2c_probe(struct i2c_client *i2c,
 	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);
 
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
 	axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg);
 	if (IS_ERR(axp20x->regmap)) {
 		ret = PTR_ERR(axp20x->regmap);
-- 
2.6.4

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

* [PATCH v7 03/10] mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

In axp20x_match_device(), match the of_device_id table bound to the
device driver instead of pointing to axp20x_of_match directly. This
will allow us to keep axp20x_match_device() unmodified when we expand
the axp20x driver into multiple ones covering different interface
types.

of_device_get_match_data() cannot be used here as we need to know if
it failed to get a match, or if the match data value just happened to
be 0, as it is for the AXP152.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 685a78614f83..3e186f2dcac3 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -613,7 +613,7 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 	const struct of_device_id *of_id;
 
 	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
+		of_id = of_match_device(dev->driver->of_match_table, dev);
 		if (!of_id) {
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
-- 
2.6.4

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

* [PATCH v7 03/10] mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

In axp20x_match_device(), match the of_device_id table bound to the
device driver instead of pointing to axp20x_of_match directly. This
will allow us to keep axp20x_match_device() unmodified when we expand
the axp20x driver into multiple ones covering different interface
types.

of_device_get_match_data() cannot be used here as we need to know if
it failed to get a match, or if the match data value just happened to
be 0, as it is for the AXP152.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 685a78614f83..3e186f2dcac3 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -613,7 +613,7 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 	const struct of_device_id *of_id;
 
 	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
+		of_id = of_match_device(dev->driver->of_match_table, dev);
 		if (!of_id) {
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
-- 
2.6.4

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

* [PATCH v7 03/10] mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device()
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

In axp20x_match_device(), match the of_device_id table bound to the
device driver instead of pointing to axp20x_of_match directly. This
will allow us to keep axp20x_match_device() unmodified when we expand
the axp20x driver into multiple ones covering different interface
types.

of_device_get_match_data() cannot be used here as we need to know if
it failed to get a match, or if the match data value just happened to
be 0, as it is for the AXP152.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 685a78614f83..3e186f2dcac3 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -613,7 +613,7 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 	const struct of_device_id *of_id;
 
 	if (dev->of_node) {
-		of_id = of_match_device(axp20x_of_match, dev);
+		of_id = of_match_device(dev->driver->of_match_table, dev);
 		if (!of_id) {
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
-- 
2.6.4

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

When the driver was merged, the original author did not include a proper
copyright notice. This patch adds the notice, backdated to when the
driver was merged.

Cc: Carlo Caione <carlo@caione.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

New patch in v7.

---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3e186f2dcac3..cec51e689d1d 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * Copyright (C) 2014 Carlo Caione
+ *
  * Author: Carlo Caione <carlo@caione.org>
  *
  * This program is free software; you can redistribute it and/or modify
-- 
2.6.4

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

When the driver was merged, the original author did not include a proper
copyright notice. This patch adds the notice, backdated to when the
driver was merged.

Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---

New patch in v7.

---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3e186f2dcac3..cec51e689d1d 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * Copyright (C) 2014 Carlo Caione
+ *
  * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
  *
  * This program is free software; you can redistribute it and/or modify
-- 
2.6.4

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

When the driver was merged, the original author did not include a proper
copyright notice. This patch adds the notice, backdated to when the
driver was merged.

Cc: Carlo Caione <carlo@caione.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

New patch in v7.

---
 drivers/mfd/axp20x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3e186f2dcac3..cec51e689d1d 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -5,6 +5,8 @@
  * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
  * as well as configurable GPIOs.
  *
+ * Copyright (C) 2014 Carlo Caione
+ *
  * Author: Carlo Caione <carlo@caione.org>
  *
  * This program is free software; you can redistribute it and/or modify
-- 
2.6.4

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

* [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

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

This patch follows the example of mfd/wm831x and splits it into
an interface independent core, and an i2c specific glue layer.
MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
symbols, allowing the driver to be built as modules.

Whitespace and other style errors in the moved i2c specific code
have been fixed. Included but unused header files are removed as
well.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

Changes since v6:

  - Drop filenames from file headers

---
 drivers/mfd/Kconfig        |  14 +++---
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
 include/linux/mfd/axp20x.h |  33 +++++++++++++-
 5 files changed, 161 insertions(+), 81 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4d92df6ef9fe..804cd3dcce32 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -91,14 +91,18 @@ config MFD_BCM590XX
 	  Support for the BCM590xx PMUs from Broadcom
 
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	tristate
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
-	depends on I2C=y
+
+config MFD_AXP20X_I2C
+	tristate "X-Powers AXP series PMICs with I2C"
+	select MFD_AXP20X
+	select REGMAP_I2C
+	depends on I2C
 	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 power
+	  management ICs (PMICs) controlled with I2C.
 	  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 a8b76b81b467..a6913007d667 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..b1b865822c07
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2014 Carlo Caione
+ *
+ * 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.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+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;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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 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_i2c_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_i2c_acpi_match);
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x-i2c",
+		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index cec51e689d1d..8e569bcfe3bc 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1,10 +1,12 @@
 /*
- * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
+ * MFD core 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 file contains the interface independent core functions.
+ *
  * Copyright (C) 2014 Carlo Caione
  *
  * Author: Carlo Caione <carlo@caione.org>
@@ -15,18 +17,15 @@
  */
 
 #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
@@ -378,32 +377,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,
@@ -608,7 +581,7 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x)
+int axp20x_match_device(struct axp20x_dev *axp20x)
 {
 	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
@@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 
 	return 0;
 }
+EXPORT_SYMBOL(axp20x_match_device);
 
-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;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	ret = axp20x_match_device(axp20x);
-	if (ret)
-		return ret;
-
-	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;
 	}
 
@@ -704,8 +657,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;
 	}
 
@@ -714,38 +667,25 @@ 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;
 }
+EXPORT_SYMBOL(axp20x_device_probe);
 
-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);
+EXPORT_SYMBOL(axp20x_device_remove);
 
 MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
 MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
+
+/**
+ * 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.4

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

* [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

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

This patch follows the example of mfd/wm831x and splits it into
an interface independent core, and an i2c specific glue layer.
MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
symbols, allowing the driver to be built as modules.

Whitespace and other style errors in the moved i2c specific code
have been fixed. Included but unused header files are removed as
well.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---

Changes since v6:

  - Drop filenames from file headers

---
 drivers/mfd/Kconfig        |  14 +++---
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
 include/linux/mfd/axp20x.h |  33 +++++++++++++-
 5 files changed, 161 insertions(+), 81 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4d92df6ef9fe..804cd3dcce32 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -91,14 +91,18 @@ config MFD_BCM590XX
 	  Support for the BCM590xx PMUs from Broadcom
 
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	tristate
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
-	depends on I2C=y
+
+config MFD_AXP20X_I2C
+	tristate "X-Powers AXP series PMICs with I2C"
+	select MFD_AXP20X
+	select REGMAP_I2C
+	depends on I2C
 	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 power
+	  management ICs (PMICs) controlled with I2C.
 	  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 a8b76b81b467..a6913007d667 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..b1b865822c07
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2014 Carlo Caione
+ *
+ * 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.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+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;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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 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_i2c_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_i2c_acpi_match);
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x-i2c",
+		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index cec51e689d1d..8e569bcfe3bc 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1,10 +1,12 @@
 /*
- * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
+ * MFD core 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 file contains the interface independent core functions.
+ *
  * Copyright (C) 2014 Carlo Caione
  *
  * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
@@ -15,18 +17,15 @@
  */
 
 #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
@@ -378,32 +377,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,
@@ -608,7 +581,7 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x)
+int axp20x_match_device(struct axp20x_dev *axp20x)
 {
 	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
@@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 
 	return 0;
 }
+EXPORT_SYMBOL(axp20x_match_device);
 
-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;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	ret = axp20x_match_device(axp20x);
-	if (ret)
-		return ret;
-
-	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;
 	}
 
@@ -704,8 +657,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;
 	}
 
@@ -714,38 +667,25 @@ 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;
 }
+EXPORT_SYMBOL(axp20x_device_probe);
 
-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);
+EXPORT_SYMBOL(axp20x_device_remove);
 
 MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
 MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
+
+/**
+ * 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.4

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

* [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

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

This patch follows the example of mfd/wm831x and splits it into
an interface independent core, and an i2c specific glue layer.
MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
symbols, allowing the driver to be built as modules.

Whitespace and other style errors in the moved i2c specific code
have been fixed. Included but unused header files are removed as
well.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

Changes since v6:

  - Drop filenames from file headers

---
 drivers/mfd/Kconfig        |  14 +++---
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
 include/linux/mfd/axp20x.h |  33 +++++++++++++-
 5 files changed, 161 insertions(+), 81 deletions(-)
 create mode 100644 drivers/mfd/axp20x-i2c.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 4d92df6ef9fe..804cd3dcce32 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -91,14 +91,18 @@ config MFD_BCM590XX
 	  Support for the BCM590xx PMUs from Broadcom
 
 config MFD_AXP20X
-	bool "X-Powers AXP20X"
+	tristate
 	select MFD_CORE
-	select REGMAP_I2C
 	select REGMAP_IRQ
-	depends on I2C=y
+
+config MFD_AXP20X_I2C
+	tristate "X-Powers AXP series PMICs with I2C"
+	select MFD_AXP20X
+	select REGMAP_I2C
+	depends on I2C
 	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 power
+	  management ICs (PMICs) controlled with I2C.
 	  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 a8b76b81b467..a6913007d667 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
new file mode 100644
index 000000000000..b1b865822c07
--- /dev/null
+++ b/drivers/mfd/axp20x-i2c.c
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2014 Carlo Caione
+ *
+ * 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.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+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;
+
+	axp20x->dev = &i2c->dev;
+	axp20x->irq = i2c->irq;
+	dev_set_drvdata(axp20x->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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 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_i2c_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_i2c_acpi_match);
+
+static struct i2c_driver axp20x_i2c_driver = {
+	.driver = {
+		.name	= "axp20x-i2c",
+		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index cec51e689d1d..8e569bcfe3bc 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1,10 +1,12 @@
 /*
- * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
+ * MFD core 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 file contains the interface independent core functions.
+ *
  * Copyright (C) 2014 Carlo Caione
  *
  * Author: Carlo Caione <carlo@caione.org>
@@ -15,18 +17,15 @@
  */
 
 #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
@@ -378,32 +377,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,
@@ -608,7 +581,7 @@ static void axp20x_power_off(void)
 		     AXP20X_OFF);
 }
 
-static int axp20x_match_device(struct axp20x_dev *axp20x)
+int axp20x_match_device(struct axp20x_dev *axp20x)
 {
 	struct device *dev = axp20x->dev;
 	const struct acpi_device_id *acpi_id;
@@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
 
 	return 0;
 }
+EXPORT_SYMBOL(axp20x_match_device);
 
-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;
-
-	axp20x->i2c_client = i2c;
-	axp20x->dev = &i2c->dev;
-	dev_set_drvdata(axp20x->dev, axp20x);
-
-	ret = axp20x_match_device(axp20x);
-	if (ret)
-		return ret;
-
-	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;
 	}
 
@@ -704,8 +657,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;
 	}
 
@@ -714,38 +667,25 @@ 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;
 }
+EXPORT_SYMBOL(axp20x_device_probe);
 
-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);
+EXPORT_SYMBOL(axp20x_device_remove);
 
 MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
 MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
+
+/**
+ * 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.4

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

* [PATCH v7 06/10] mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

This fixes some leftover code style issues in the axp20x core.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 8e569bcfe3bc..3054ea4b95e8 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -593,14 +593,14 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
 		}
-		axp20x->variant = (long) of_id->data;
+		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;
+		axp20x->variant = (long)acpi_id->driver_data;
 	}
 
 	switch (axp20x->variant) {
@@ -634,7 +634,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		return -EINVAL;
 	}
 	dev_info(dev, "AXP20x variant %s found\n",
-		axp20x_model_names[axp20x->variant]);
+		 axp20x_model_names[axp20x->variant]);
 
 	return 0;
 }
@@ -654,7 +654,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
 	}
 
 	ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
-			axp20x->nr_cells, NULL, 0, NULL);
+			      axp20x->nr_cells, NULL, 0, NULL);
 
 	if (ret) {
 		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
-- 
2.6.4

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

* [PATCH v7 06/10] mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

This fixes some leftover code style issues in the axp20x core.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/mfd/axp20x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 8e569bcfe3bc..3054ea4b95e8 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -593,14 +593,14 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
 		}
-		axp20x->variant = (long) of_id->data;
+		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;
+		axp20x->variant = (long)acpi_id->driver_data;
 	}
 
 	switch (axp20x->variant) {
@@ -634,7 +634,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		return -EINVAL;
 	}
 	dev_info(dev, "AXP20x variant %s found\n",
-		axp20x_model_names[axp20x->variant]);
+		 axp20x_model_names[axp20x->variant]);
 
 	return 0;
 }
@@ -654,7 +654,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
 	}
 
 	ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
-			axp20x->nr_cells, NULL, 0, NULL);
+			      axp20x->nr_cells, NULL, 0, NULL);
 
 	if (ret) {
 		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
-- 
2.6.4

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

* [PATCH v7 06/10] mfd: axp20x: Whitespace, open parenthesis alignment code style fixes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

This fixes some leftover code style issues in the axp20x core.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/axp20x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 8e569bcfe3bc..3054ea4b95e8 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -593,14 +593,14 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 			dev_err(dev, "Unable to match OF ID\n");
 			return -ENODEV;
 		}
-		axp20x->variant = (long) of_id->data;
+		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;
+		axp20x->variant = (long)acpi_id->driver_data;
 	}
 
 	switch (axp20x->variant) {
@@ -634,7 +634,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		return -EINVAL;
 	}
 	dev_info(dev, "AXP20x variant %s found\n",
-		axp20x_model_names[axp20x->variant]);
+		 axp20x_model_names[axp20x->variant]);
 
 	return 0;
 }
@@ -654,7 +654,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
 	}
 
 	ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
-			axp20x->nr_cells, NULL, 0, NULL);
+			      axp20x->nr_cells, NULL, 0, NULL);
 
 	if (ret) {
 		dev_err(axp20x->dev, "failed to add MFD devices: %d\n", ret);
-- 
2.6.4

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

* [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

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

Changes since v6:

  - Drop filename from file header
  - Use generic dev_set_drvdata()
  - Properly sort #include statements
  - Add copyright notice

---
 drivers/mfd/Kconfig        | 11 +++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  2 ++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 95 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 804cd3dcce32..13c565103e96 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	tristate "X-Powers AXP series PMICs with RSB"
+	select MFD_AXP20X
+	depends on SUNXI_RSB
+	help
+	  If you say Y here you get support for the X-Powers AXP series power
+	  management ICs (PMICs) controlled with RSB.
+	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..28c20247c112
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2015 Chen-Yu Tsai
+ *
+ * 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/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/sunxi-rsb.h>
+
+static int axp20x_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;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	dev_set_drvdata(&rdev->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static const struct of_device_id axp20x_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
+
+static struct sunxi_rsb_driver axp20x_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-rsb",
+		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
+	},
+	.probe	= axp20x_rsb_probe,
+	.remove	= axp20x_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3054ea4b95e8..a57d6e940610 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 00697c6ad8b0..d82e7d51372b 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.4

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

* [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

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

Changes since v6:

  - Drop filename from file header
  - Use generic dev_set_drvdata()
  - Properly sort #include statements
  - Add copyright notice

---
 drivers/mfd/Kconfig        | 11 +++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  2 ++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 95 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 804cd3dcce32..13c565103e96 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	tristate "X-Powers AXP series PMICs with RSB"
+	select MFD_AXP20X
+	depends on SUNXI_RSB
+	help
+	  If you say Y here you get support for the X-Powers AXP series power
+	  management ICs (PMICs) controlled with RSB.
+	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..28c20247c112
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2015 Chen-Yu Tsai
+ *
+ * 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/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/sunxi-rsb.h>
+
+static int axp20x_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;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	dev_set_drvdata(&rdev->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static const struct of_device_id axp20x_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
+
+static struct sunxi_rsb_driver axp20x_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-rsb",
+		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
+	},
+	.probe	= axp20x_rsb_probe,
+	.remove	= axp20x_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3054ea4b95e8..a57d6e940610 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 00697c6ad8b0..d82e7d51372b 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.4

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

* [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 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>
---

Changes since v6:

  - Drop filename from file header
  - Use generic dev_set_drvdata()
  - Properly sort #include statements
  - Add copyright notice

---
 drivers/mfd/Kconfig        | 11 +++++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/axp20x.c       |  2 ++
 include/linux/mfd/axp20x.h |  1 +
 5 files changed, 95 insertions(+)
 create mode 100644 drivers/mfd/axp20x-rsb.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 804cd3dcce32..13c565103e96 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
 	  components like regulators or the PEK (Power Enable Key) under the
 	  corresponding menus.
 
+config MFD_AXP20X_RSB
+	tristate "X-Powers AXP series PMICs with RSB"
+	select MFD_AXP20X
+	depends on SUNXI_RSB
+	help
+	  If you say Y here you get support for the X-Powers AXP series power
+	  management ICs (PMICs) controlled with RSB.
+	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
new file mode 100644
index 000000000000..28c20247c112
--- /dev/null
+++ b/drivers/mfd/axp20x-rsb.c
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ *
+ * Copyright (C) 2015 Chen-Yu Tsai
+ *
+ * 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/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/sunxi-rsb.h>
+
+static int axp20x_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;
+
+	axp20x->dev = &rdev->dev;
+	axp20x->irq = rdev->irq;
+	dev_set_drvdata(&rdev->dev, axp20x);
+
+	ret = axp20x_match_device(axp20x);
+	if (ret)
+		return ret;
+
+	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_rsb_remove(struct sunxi_rsb_device *rdev)
+{
+	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
+
+	return axp20x_device_remove(axp20x);
+}
+
+static const struct of_device_id axp20x_rsb_of_match[] = {
+	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
+
+static struct sunxi_rsb_driver axp20x_rsb_driver = {
+	.driver = {
+		.name	= "axp20x-rsb",
+		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
+	},
+	.probe	= axp20x_rsb_probe,
+	.remove	= axp20x_rsb_remove,
+};
+module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 3054ea4b95e8..a57d6e940610 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
 	"AXP202",
 	"AXP209",
 	"AXP221",
+	"AXP223",
 	"AXP288",
 };
 
@@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 00697c6ad8b0..d82e7d51372b 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.4

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

* [PATCH v7 08/10] regulator: axp20x: Support new AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

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>
Reviewed-by: Mark Brown <broonie@kernel.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.4

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

* [PATCH v7 08/10] regulator: axp20x: Support new AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

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>
Reviewed-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@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.4

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

* [PATCH v7 08/10] regulator: axp20x: Support new AXP223 PMIC
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 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>
Reviewed-by: Mark Brown <broonie@kernel.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.4

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

* [PATCH v7 09/10] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

This board has a X-Powers AXP223 PMIC connected via RSB. Its 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 | 76 +++++++++++++++++++++++++-
 1 file changed, 73 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..8af38a9719ca 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,76 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.4

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

* [PATCH v7 09/10] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

This board has a X-Powers AXP223 PMIC connected via RSB. Its 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 | 76 +++++++++++++++++++++++++-
 1 file changed, 73 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..8af38a9719ca 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,76 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.4

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

* [PATCH v7 09/10] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

This board has a X-Powers AXP223 PMIC connected via RSB. Its 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 | 76 +++++++++++++++++++++++++-
 1 file changed, 73 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..8af38a9719ca 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,76 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic at 3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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-name = "vcc-rtc";
 };
 
 &uart0 {
-- 
2.6.4

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

* [PATCH v7 10/10] ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

A23/A33 Q8 tablets have an X-Powers AXP223 PMIC connected via RSB. Its
regulators provide power to various parts of the SoC and the board.

Also add lcd regulator supply for simplefb and update the existing
vmmc-supply for mmc0.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-q8-common.dtsi | 83 +++++++++++++++++++++++++++++++++-
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-q8-common.dtsi b/arch/arm/boot/dts/sun8i-q8-common.dtsi
index 1a69231d2da5..9d2b7e2f5975 100644
--- a/arch/arm/boot/dts/sun8i-q8-common.dtsi
+++ b/arch/arm/boot/dts/sun8i-q8-common.dtsi
@@ -56,7 +56,6 @@
 		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
 		default-brightness-level = <8>;
 		enable-gpios = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
-		/* backlight is powered by AXP223 DC1SW */
 	};
 
 	chosen {
@@ -67,7 +66,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -92,6 +91,82 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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_dc1sw {
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-lcd";
+};
+
+&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-name = "vcc-rtc";
 };
 
 &r_uart {
@@ -99,3 +174,7 @@
 	pinctrl-0 = <&r_uart_pins_a>;
 	status = "okay";
 };
+
+&simplefb_lcd {
+	vcc-lcd-supply = <&reg_dc1sw>;
+};
-- 
2.6.4

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

* [PATCH v7 10/10] ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: Lee Jones, Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

A23/A33 Q8 tablets have an X-Powers AXP223 PMIC connected via RSB. Its
regulators provide power to various parts of the SoC and the board.

Also add lcd regulator supply for simplefb and update the existing
vmmc-supply for mmc0.

Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-q8-common.dtsi | 83 +++++++++++++++++++++++++++++++++-
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-q8-common.dtsi b/arch/arm/boot/dts/sun8i-q8-common.dtsi
index 1a69231d2da5..9d2b7e2f5975 100644
--- a/arch/arm/boot/dts/sun8i-q8-common.dtsi
+++ b/arch/arm/boot/dts/sun8i-q8-common.dtsi
@@ -56,7 +56,6 @@
 		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
 		default-brightness-level = <8>;
 		enable-gpios = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
-		/* backlight is powered by AXP223 DC1SW */
 	};
 
 	chosen {
@@ -67,7 +66,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -92,6 +91,82 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic@3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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_dc1sw {
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-lcd";
+};
+
+&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-name = "vcc-rtc";
 };
 
 &r_uart {
@@ -99,3 +174,7 @@
 	pinctrl-0 = <&r_uart_pins_a>;
 	status = "okay";
 };
+
+&simplefb_lcd {
+	vcc-lcd-supply = <&reg_dc1sw>;
+};
-- 
2.6.4

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

* [PATCH v7 10/10] ARM: dts: sun8i: q8-common: Add AXP223 PMIC device and regulator nodes
@ 2016-01-13  3:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-13  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

A23/A33 Q8 tablets have an X-Powers AXP223 PMIC connected via RSB. Its
regulators provide power to various parts of the SoC and the board.

Also add lcd regulator supply for simplefb and update the existing
vmmc-supply for mmc0.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-q8-common.dtsi | 83 +++++++++++++++++++++++++++++++++-
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-q8-common.dtsi b/arch/arm/boot/dts/sun8i-q8-common.dtsi
index 1a69231d2da5..9d2b7e2f5975 100644
--- a/arch/arm/boot/dts/sun8i-q8-common.dtsi
+++ b/arch/arm/boot/dts/sun8i-q8-common.dtsi
@@ -56,7 +56,6 @@
 		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
 		default-brightness-level = <8>;
 		enable-gpios = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
-		/* backlight is powered by AXP223 DC1SW */
 	};
 
 	chosen {
@@ -67,7 +66,7 @@
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8>;
-	vmmc-supply = <&reg_vcc3v0>;
+	vmmc-supply = <&reg_dcdc1>;
 	bus-width = <4>;
 	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
 	cd-inverted;
@@ -92,6 +91,82 @@
 
 &r_rsb {
 	status = "okay";
+
+	axp22x: pmic at 3a3 {
+		compatible = "x-powers,axp223";
+		reg = <0x3a3>;
+		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_dc1sw {
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "vcc-lcd";
+};
+
+&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-name = "vcc-rtc";
 };
 
 &r_uart {
@@ -99,3 +174,7 @@
 	pinctrl-0 = <&r_uart_pins_a>;
 	status = "okay";
 };
+
+&simplefb_lcd {
+	vcc-lcd-supply = <&reg_dc1sw>;
+};
-- 
2.6.4

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  8:36     ` Carlo Caione
  0 siblings, 0 replies; 63+ messages in thread
From: Carlo Caione @ 2016-01-13  8:36 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Wed, Jan 13, 2016 at 4:30 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.
>
> Cc: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---

Acked-by: Carlo Caione <carlo@caione.org>

Thanks!

-- 
Carlo Caione

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  8:36     ` Carlo Caione
  0 siblings, 0 replies; 63+ messages in thread
From: Carlo Caione @ 2016-01-13  8:36 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Lee Jones, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Wed, Jan 13, 2016 at 4:30 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.
>
> Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---

Acked-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>

Thanks!

-- 
Carlo Caione

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-13  8:36     ` Carlo Caione
  0 siblings, 0 replies; 63+ messages in thread
From: Carlo Caione @ 2016-01-13  8:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 13, 2016 at 4:30 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.
>
> Cc: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---

Acked-by: Carlo Caione <carlo@caione.org>

Thanks!

-- 
Carlo Caione

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-25 14:39     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 14:39 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.

This is very wordy. 

"Supply a backdated copyright notice."

> Cc: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> New patch in v7.
> 
> ---
>  drivers/mfd/axp20x.c | 2 ++
>  1 file changed, 2 insertions(+)

Patch looks fine though:

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3e186f2dcac3..cec51e689d1d 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -5,6 +5,8 @@
>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>   * as well as configurable GPIOs.
>   *
> + * Copyright (C) 2014 Carlo Caione
> + *
>   * Author: Carlo Caione <carlo@caione.org>
>   *
>   * This program is free software; you can redistribute it and/or modify

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-25 14:39     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 14:39 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.

This is very wordy. 

"Supply a backdated copyright notice."

> Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> 
> New patch in v7.
> 
> ---
>  drivers/mfd/axp20x.c | 2 ++
>  1 file changed, 2 insertions(+)

Patch looks fine though:

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

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3e186f2dcac3..cec51e689d1d 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -5,6 +5,8 @@
>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>   * as well as configurable GPIOs.
>   *
> + * Copyright (C) 2014 Carlo Caione
> + *
>   * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>   *
>   * This program is free software; you can redistribute it and/or modify

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

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-25 14:39     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> When the driver was merged, the original author did not include a proper
> copyright notice. This patch adds the notice, backdated to when the
> driver was merged.

This is very wordy. 

"Supply a backdated copyright notice."

> Cc: Carlo Caione <carlo@caione.org>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> New patch in v7.
> 
> ---
>  drivers/mfd/axp20x.c | 2 ++
>  1 file changed, 2 insertions(+)

Patch looks fine though:

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3e186f2dcac3..cec51e689d1d 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -5,6 +5,8 @@
>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>   * as well as configurable GPIOs.
>   *
> + * Copyright (C) 2014 Carlo Caione
> + *
>   * Author: Carlo Caione <carlo@caione.org>
>   *
>   * This program is free software; you can redistribute it and/or modify

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
  2016-01-25 14:39     ` Lee Jones
  (?)
@ 2016-01-25 15:29       ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-01-25 15:29 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

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

Hi Lee,

On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."
> 
> > Cc: Carlo Caione <carlo@caione.org>
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> > ---
> > 
> > New patch in v7.
> > 
> > ---
> >  drivers/mfd/axp20x.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Patch looks fine though:
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>

How do you want to merge these patches ?

AFAIK, it's mostly MFD patches that could go through your tree, so
feel free to apply them, I'll apply the DT parts.

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-25 15:29       ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-01-25 15:29 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

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

Hi Lee,

On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."
> 
> > Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> > Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> > ---
> > 
> > New patch in v7.
> > 
> > ---
> >  drivers/mfd/axp20x.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Patch looks fine though:
> 
> Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

How do you want to merge these patches ?

AFAIK, it's mostly MFD patches that could go through your tree, so
feel free to apply them, I'll apply the DT parts.

Thanks!
Maxime

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-25 15:29       ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-01-25 15:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,

On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."
> 
> > Cc: Carlo Caione <carlo@caione.org>
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> > ---
> > 
> > New patch in v7.
> > 
> > ---
> >  drivers/mfd/axp20x.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Patch looks fine though:
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>

How do you want to merge these patches ?

AFAIK, it's mostly MFD patches that could go through your tree, so
feel free to apply them, I'll apply the DT parts.

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/20160125/c6069823/attachment-0001.sig>

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

* Re: [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-25 16:03     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:03 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> The axp20x driver assumes the device is i2c based. This is not the
> case with later chips, which use a proprietary 2 wire serial bus
> by Allwinner called "Reduced Serial Bus".
> 
> This patch follows the example of mfd/wm831x and splits it into
> an interface independent core, and an i2c specific glue layer.
> MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
> symbols, allowing the driver to be built as modules.
> 
> Whitespace and other style errors in the moved i2c specific code
> have been fixed. Included but unused header files are removed as
> well.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> Changes since v6:
> 
>   - Drop filenames from file headers
> 
> ---
>  drivers/mfd/Kconfig        |  14 +++---
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
>  include/linux/mfd/axp20x.h |  33 +++++++++++++-
>  5 files changed, 161 insertions(+), 81 deletions(-)
>  create mode 100644 drivers/mfd/axp20x-i2c.c

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 4d92df6ef9fe..804cd3dcce32 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -91,14 +91,18 @@ config MFD_BCM590XX
>  	  Support for the BCM590xx PMUs from Broadcom
>  
>  config MFD_AXP20X
> -	bool "X-Powers AXP20X"
> +	tristate
>  	select MFD_CORE
> -	select REGMAP_I2C
>  	select REGMAP_IRQ
> -	depends on I2C=y
> +
> +config MFD_AXP20X_I2C
> +	tristate "X-Powers AXP series PMICs with I2C"
> +	select MFD_AXP20X
> +	select REGMAP_I2C
> +	depends on I2C
>  	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 power
> +	  management ICs (PMICs) controlled with I2C.
>  	  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 a8b76b81b467..a6913007d667 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
> new file mode 100644
> index 000000000000..b1b865822c07
> --- /dev/null
> +++ b/drivers/mfd/axp20x-i2c.c
> @@ -0,0 +1,104 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2014 Carlo Caione
> + *
> + * 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.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +
> +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;
> +
> +	axp20x->dev = &i2c->dev;
> +	axp20x->irq = i2c->irq;
> +	dev_set_drvdata(axp20x->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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 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_i2c_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_i2c_acpi_match);
> +
> +static struct i2c_driver axp20x_i2c_driver = {
> +	.driver = {
> +		.name	= "axp20x-i2c",
> +		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index cec51e689d1d..8e569bcfe3bc 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1,10 +1,12 @@
>  /*
> - * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
> + * MFD core 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 file contains the interface independent core functions.
> + *
>   * Copyright (C) 2014 Carlo Caione
>   *
>   * Author: Carlo Caione <carlo@caione.org>
> @@ -15,18 +17,15 @@
>   */
>  
>  #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
> @@ -378,32 +377,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,
> @@ -608,7 +581,7 @@ static void axp20x_power_off(void)
>  		     AXP20X_OFF);
>  }
>  
> -static int axp20x_match_device(struct axp20x_dev *axp20x)
> +int axp20x_match_device(struct axp20x_dev *axp20x)
>  {
>  	struct device *dev = axp20x->dev;
>  	const struct acpi_device_id *acpi_id;
> @@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(axp20x_match_device);
>  
> -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;
> -
> -	axp20x->i2c_client = i2c;
> -	axp20x->dev = &i2c->dev;
> -	dev_set_drvdata(axp20x->dev, axp20x);
> -
> -	ret = axp20x_match_device(axp20x);
> -	if (ret)
> -		return ret;
> -
> -	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;
>  	}
>  
> @@ -704,8 +657,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;
>  	}
>  
> @@ -714,38 +667,25 @@ 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;
>  }
> +EXPORT_SYMBOL(axp20x_device_probe);
>  
> -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);
> +EXPORT_SYMBOL(axp20x_device_remove);
>  
>  MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
>  MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
> +
> +/**
> + * 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 */

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

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

* Re: [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-25 16:03     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:03 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> The axp20x driver assumes the device is i2c based. This is not the
> case with later chips, which use a proprietary 2 wire serial bus
> by Allwinner called "Reduced Serial Bus".
> 
> This patch follows the example of mfd/wm831x and splits it into
> an interface independent core, and an i2c specific glue layer.
> MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
> symbols, allowing the driver to be built as modules.
> 
> Whitespace and other style errors in the moved i2c specific code
> have been fixed. Included but unused header files are removed as
> well.
> 
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> ---
> 
> Changes since v6:
> 
>   - Drop filenames from file headers
> 
> ---
>  drivers/mfd/Kconfig        |  14 +++---
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
>  include/linux/mfd/axp20x.h |  33 +++++++++++++-
>  5 files changed, 161 insertions(+), 81 deletions(-)
>  create mode 100644 drivers/mfd/axp20x-i2c.c

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

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 4d92df6ef9fe..804cd3dcce32 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -91,14 +91,18 @@ config MFD_BCM590XX
>  	  Support for the BCM590xx PMUs from Broadcom
>  
>  config MFD_AXP20X
> -	bool "X-Powers AXP20X"
> +	tristate
>  	select MFD_CORE
> -	select REGMAP_I2C
>  	select REGMAP_IRQ
> -	depends on I2C=y
> +
> +config MFD_AXP20X_I2C
> +	tristate "X-Powers AXP series PMICs with I2C"
> +	select MFD_AXP20X
> +	select REGMAP_I2C
> +	depends on I2C
>  	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 power
> +	  management ICs (PMICs) controlled with I2C.
>  	  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 a8b76b81b467..a6913007d667 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
> new file mode 100644
> index 000000000000..b1b865822c07
> --- /dev/null
> +++ b/drivers/mfd/axp20x-i2c.c
> @@ -0,0 +1,104 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2014 Carlo Caione
> + *
> + * 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.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +
> +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;
> +
> +	axp20x->dev = &i2c->dev;
> +	axp20x->irq = i2c->irq;
> +	dev_set_drvdata(axp20x->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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 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_i2c_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_i2c_acpi_match);
> +
> +static struct i2c_driver axp20x_i2c_driver = {
> +	.driver = {
> +		.name	= "axp20x-i2c",
> +		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index cec51e689d1d..8e569bcfe3bc 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1,10 +1,12 @@
>  /*
> - * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
> + * MFD core 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 file contains the interface independent core functions.
> + *
>   * Copyright (C) 2014 Carlo Caione
>   *
>   * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> @@ -15,18 +17,15 @@
>   */
>  
>  #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
> @@ -378,32 +377,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,
> @@ -608,7 +581,7 @@ static void axp20x_power_off(void)
>  		     AXP20X_OFF);
>  }
>  
> -static int axp20x_match_device(struct axp20x_dev *axp20x)
> +int axp20x_match_device(struct axp20x_dev *axp20x)
>  {
>  	struct device *dev = axp20x->dev;
>  	const struct acpi_device_id *acpi_id;
> @@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(axp20x_match_device);
>  
> -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;
> -
> -	axp20x->i2c_client = i2c;
> -	axp20x->dev = &i2c->dev;
> -	dev_set_drvdata(axp20x->dev, axp20x);
> -
> -	ret = axp20x_match_device(axp20x);
> -	if (ret)
> -		return ret;
> -
> -	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;
>  	}
>  
> @@ -704,8 +657,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;
>  	}
>  
> @@ -714,38 +667,25 @@ 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;
>  }
> +EXPORT_SYMBOL(axp20x_device_probe);
>  
> -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);
> +EXPORT_SYMBOL(axp20x_device_remove);
>  
>  MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
>  MODULE_AUTHOR("Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>");
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
> +
> +/**
> + * 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 */

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

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

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

* [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits
@ 2016-01-25 16:03     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:

> The axp20x driver assumes the device is i2c based. This is not the
> case with later chips, which use a proprietary 2 wire serial bus
> by Allwinner called "Reduced Serial Bus".
> 
> This patch follows the example of mfd/wm831x and splits it into
> an interface independent core, and an i2c specific glue layer.
> MFD_AXP20X and the new MFD_AXP20X_I2C are changed to tristate
> symbols, allowing the driver to be built as modules.
> 
> Whitespace and other style errors in the moved i2c specific code
> have been fixed. Included but unused header files are removed as
> well.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> Changes since v6:
> 
>   - Drop filenames from file headers
> 
> ---
>  drivers/mfd/Kconfig        |  14 +++---
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x-i2c.c   | 104 +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  90 +++++++--------------------------------
>  include/linux/mfd/axp20x.h |  33 +++++++++++++-
>  5 files changed, 161 insertions(+), 81 deletions(-)
>  create mode 100644 drivers/mfd/axp20x-i2c.c

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 4d92df6ef9fe..804cd3dcce32 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -91,14 +91,18 @@ config MFD_BCM590XX
>  	  Support for the BCM590xx PMUs from Broadcom
>  
>  config MFD_AXP20X
> -	bool "X-Powers AXP20X"
> +	tristate
>  	select MFD_CORE
> -	select REGMAP_I2C
>  	select REGMAP_IRQ
> -	depends on I2C=y
> +
> +config MFD_AXP20X_I2C
> +	tristate "X-Powers AXP series PMICs with I2C"
> +	select MFD_AXP20X
> +	select REGMAP_I2C
> +	depends on I2C
>  	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 power
> +	  management ICs (PMICs) controlled with I2C.
>  	  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 a8b76b81b467..a6913007d667 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -107,6 +107,7 @@ 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_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-i2c.c b/drivers/mfd/axp20x-i2c.c
> new file mode 100644
> index 000000000000..b1b865822c07
> --- /dev/null
> +++ b/drivers/mfd/axp20x-i2c.c
> @@ -0,0 +1,104 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2014 Carlo Caione
> + *
> + * 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.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +
> +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;
> +
> +	axp20x->dev = &i2c->dev;
> +	axp20x->irq = i2c->irq;
> +	dev_set_drvdata(axp20x->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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 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_i2c_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_i2c_acpi_match);
> +
> +static struct i2c_driver axp20x_i2c_driver = {
> +	.driver = {
> +		.name	= "axp20x-i2c",
> +		.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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index cec51e689d1d..8e569bcfe3bc 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1,10 +1,12 @@
>  /*
> - * axp20x.c - MFD core driver for the X-Powers' Power Management ICs
> + * MFD core 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 file contains the interface independent core functions.
> + *
>   * Copyright (C) 2014 Carlo Caione
>   *
>   * Author: Carlo Caione <carlo@caione.org>
> @@ -15,18 +17,15 @@
>   */
>  
>  #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
> @@ -378,32 +377,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,
> @@ -608,7 +581,7 @@ static void axp20x_power_off(void)
>  		     AXP20X_OFF);
>  }
>  
> -static int axp20x_match_device(struct axp20x_dev *axp20x)
> +int axp20x_match_device(struct axp20x_dev *axp20x)
>  {
>  	struct device *dev = axp20x->dev;
>  	const struct acpi_device_id *acpi_id;
> @@ -665,38 +638,18 @@ static int axp20x_match_device(struct axp20x_dev *axp20x)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(axp20x_match_device);
>  
> -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;
> -
> -	axp20x->i2c_client = i2c;
> -	axp20x->dev = &i2c->dev;
> -	dev_set_drvdata(axp20x->dev, axp20x);
> -
> -	ret = axp20x_match_device(axp20x);
> -	if (ret)
> -		return ret;
> -
> -	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;
>  	}
>  
> @@ -704,8 +657,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;
>  	}
>  
> @@ -714,38 +667,25 @@ 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;
>  }
> +EXPORT_SYMBOL(axp20x_device_probe);
>  
> -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);
> +EXPORT_SYMBOL(axp20x_device_remove);
>  
>  MODULE_DESCRIPTION("PMIC MFD core driver for AXP20X");
>  MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index b24c771cebd5..00697c6ad8b0 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 (.dev 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);
> +
> +/**
> + * 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 */

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

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

* Re: [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-25 16:04     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:04 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring

On Wed, 13 Jan 2016, 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>
> ---
> 
> Changes since v6:
> 
>   - Drop filename from file header
>   - Use generic dev_set_drvdata()
>   - Properly sort #include statements
>   - Add copyright notice
> 
> ---
>  drivers/mfd/Kconfig        | 11 +++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  2 ++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 95 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c

Acked-by: Lee Jones <lee@kernel.org>

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 804cd3dcce32..13c565103e96 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	tristate "X-Powers AXP series PMICs with RSB"
> +	select MFD_AXP20X
> +	depends on SUNXI_RSB
> +	help
> +	  If you say Y here you get support for the X-Powers AXP series power
> +	  management ICs (PMICs) controlled with RSB.
> +	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..28c20247c112
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,80 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2015 Chen-Yu Tsai
> + *
> + * 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/mfd/axp20x.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/sunxi-rsb.h>
> +
> +static int axp20x_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;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	dev_set_drvdata(&rdev->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static const struct of_device_id axp20x_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
> +
> +static struct sunxi_rsb_driver axp20x_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-rsb",
> +		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
> +	},
> +	.probe	= axp20x_rsb_probe,
> +	.remove	= axp20x_rsb_remove,
> +};
> +module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3054ea4b95e8..a57d6e940610 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index 00697c6ad8b0..d82e7d51372b 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,
>  };

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

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

* Re: [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-25 16:04     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:04 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring

On Wed, 13 Jan 2016, 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>
> ---
> 
> Changes since v6:
> 
>   - Drop filename from file header
>   - Use generic dev_set_drvdata()
>   - Properly sort #include statements
>   - Add copyright notice
> 
> ---
>  drivers/mfd/Kconfig        | 11 +++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  2 ++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 95 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c

Acked-by: Lee Jones <lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 804cd3dcce32..13c565103e96 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	tristate "X-Powers AXP series PMICs with RSB"
> +	select MFD_AXP20X
> +	depends on SUNXI_RSB
> +	help
> +	  If you say Y here you get support for the X-Powers AXP series power
> +	  management ICs (PMICs) controlled with RSB.
> +	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..28c20247c112
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,80 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2015 Chen-Yu Tsai
> + *
> + * 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/mfd/axp20x.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/sunxi-rsb.h>
> +
> +static int axp20x_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;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	dev_set_drvdata(&rdev->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static const struct of_device_id axp20x_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
> +
> +static struct sunxi_rsb_driver axp20x_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-rsb",
> +		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
> +	},
> +	.probe	= axp20x_rsb_probe,
> +	.remove	= axp20x_rsb_remove,
> +};
> +module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3054ea4b95e8..a57d6e940610 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index 00697c6ad8b0..d82e7d51372b 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,
>  };

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

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

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

* [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC
@ 2016-01-25 16:04     ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-25 16:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 13 Jan 2016, 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>
> ---
> 
> Changes since v6:
> 
>   - Drop filename from file header
>   - Use generic dev_set_drvdata()
>   - Properly sort #include statements
>   - Add copyright notice
> 
> ---
>  drivers/mfd/Kconfig        | 11 +++++++
>  drivers/mfd/Makefile       |  1 +
>  drivers/mfd/axp20x-rsb.c   | 80 ++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mfd/axp20x.c       |  2 ++
>  include/linux/mfd/axp20x.h |  1 +
>  5 files changed, 95 insertions(+)
>  create mode 100644 drivers/mfd/axp20x-rsb.c

Acked-by: Lee Jones <lee@kernel.org>

> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 804cd3dcce32..13c565103e96 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -107,6 +107,17 @@ config MFD_AXP20X_I2C
>  	  components like regulators or the PEK (Power Enable Key) under the
>  	  corresponding menus.
>  
> +config MFD_AXP20X_RSB
> +	tristate "X-Powers AXP series PMICs with RSB"
> +	select MFD_AXP20X
> +	depends on SUNXI_RSB
> +	help
> +	  If you say Y here you get support for the X-Powers AXP series power
> +	  management ICs (PMICs) controlled with RSB.
> +	  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 a6913007d667..caea6637d5e8 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)	+= axp20x.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-rsb.c b/drivers/mfd/axp20x-rsb.c
> new file mode 100644
> index 000000000000..28c20247c112
> --- /dev/null
> +++ b/drivers/mfd/axp20x-rsb.c
> @@ -0,0 +1,80 @@
> +/*
> + * 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.
> + *
> + * Copyright (C) 2015 Chen-Yu Tsai
> + *
> + * 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/mfd/axp20x.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/regmap.h>
> +#include <linux/slab.h>
> +#include <linux/sunxi-rsb.h>
> +
> +static int axp20x_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;
> +
> +	axp20x->dev = &rdev->dev;
> +	axp20x->irq = rdev->irq;
> +	dev_set_drvdata(&rdev->dev, axp20x);
> +
> +	ret = axp20x_match_device(axp20x);
> +	if (ret)
> +		return ret;
> +
> +	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_rsb_remove(struct sunxi_rsb_device *rdev)
> +{
> +	struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev);
> +
> +	return axp20x_device_remove(axp20x);
> +}
> +
> +static const struct of_device_id axp20x_rsb_of_match[] = {
> +	{ .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match);
> +
> +static struct sunxi_rsb_driver axp20x_rsb_driver = {
> +	.driver = {
> +		.name	= "axp20x-rsb",
> +		.of_match_table	= of_match_ptr(axp20x_rsb_of_match),
> +	},
> +	.probe	= axp20x_rsb_probe,
> +	.remove	= axp20x_rsb_remove,
> +};
> +module_sunxi_rsb_driver(axp20x_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/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 3054ea4b95e8..a57d6e940610 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = {
>  	"AXP202",
>  	"AXP209",
>  	"AXP221",
> +	"AXP223",
>  	"AXP288",
>  };
>  
> @@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		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/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index 00697c6ad8b0..d82e7d51372b 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,
>  };

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
  2016-01-25 14:39     ` Lee Jones
  (?)
@ 2016-01-26  1:34       ` Chen-Yu Tsai
  -1 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-26  1:34 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones@linaro.org> wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>
>> When the driver was merged, the original author did not include a proper
>> copyright notice. This patch adds the notice, backdated to when the
>> driver was merged.
>
> This is very wordy.
>
> "Supply a backdated copyright notice."

Fine with me. Would you like me to send another version?

ChenYu

>> Cc: Carlo Caione <carlo@caione.org>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>
>> New patch in v7.
>>
>> ---
>>  drivers/mfd/axp20x.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
> Patch looks fine though:
>
> Acked-by: Lee Jones <lee.jones@linaro.org>
>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index 3e186f2dcac3..cec51e689d1d 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -5,6 +5,8 @@
>>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>>   * as well as configurable GPIOs.
>>   *
>> + * Copyright (C) 2014 Carlo Caione
>> + *
>>   * Author: Carlo Caione <carlo@caione.org>
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-26  1:34       ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-26  1:34 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>
>> When the driver was merged, the original author did not include a proper
>> copyright notice. This patch adds the notice, backdated to when the
>> driver was merged.
>
> This is very wordy.
>
> "Supply a backdated copyright notice."

Fine with me. Would you like me to send another version?

ChenYu

>> Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> ---
>>
>> New patch in v7.
>>
>> ---
>>  drivers/mfd/axp20x.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
> Patch looks fine though:
>
> Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index 3e186f2dcac3..cec51e689d1d 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -5,6 +5,8 @@
>>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>>   * as well as configurable GPIOs.
>>   *
>> + * Copyright (C) 2014 Carlo Caione
>> + *
>>   * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-26  1:34       ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-01-26  1:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones@linaro.org> wrote:
> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>
>> When the driver was merged, the original author did not include a proper
>> copyright notice. This patch adds the notice, backdated to when the
>> driver was merged.
>
> This is very wordy.
>
> "Supply a backdated copyright notice."

Fine with me. Would you like me to send another version?

ChenYu

>> Cc: Carlo Caione <carlo@caione.org>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>
>> New patch in v7.
>>
>> ---
>>  drivers/mfd/axp20x.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
> Patch looks fine though:
>
> Acked-by: Lee Jones <lee.jones@linaro.org>
>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index 3e186f2dcac3..cec51e689d1d 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -5,6 +5,8 @@
>>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
>>   * as well as configurable GPIOs.
>>   *
>> + * Copyright (C) 2014 Carlo Caione
>> + *
>>   * Author: Carlo Caione <carlo@caione.org>
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead
> Linaro.org ? Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-26  8:37         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-26  8:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

On Tue, 26 Jan 2016, Chen-Yu Tsai wrote:

> On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> >
> >> When the driver was merged, the original author did not include a proper
> >> copyright notice. This patch adds the notice, backdated to when the
> >> driver was merged.
> >
> > This is very wordy.
> >
> > "Supply a backdated copyright notice."
> 
> Fine with me. Would you like me to send another version?

No, I will fix this for you.

> >> Cc: Carlo Caione <carlo@caione.org>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >>
> >> New patch in v7.
> >>
> >> ---
> >>  drivers/mfd/axp20x.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >
> > Patch looks fine though:
> >
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> >
> >> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> >> index 3e186f2dcac3..cec51e689d1d 100644
> >> --- a/drivers/mfd/axp20x.c
> >> +++ b/drivers/mfd/axp20x.c
> >> @@ -5,6 +5,8 @@
> >>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> >>   * as well as configurable GPIOs.
> >>   *
> >> + * Copyright (C) 2014 Carlo Caione
> >> + *
> >>   * Author: Carlo Caione <carlo@caione.org>
> >>   *
> >>   * This program is free software; you can redistribute it and/or modify
> >

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-26  8:37         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-26  8:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

On Tue, 26 Jan 2016, Chen-Yu Tsai wrote:

> On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> >
> >> When the driver was merged, the original author did not include a proper
> >> copyright notice. This patch adds the notice, backdated to when the
> >> driver was merged.
> >
> > This is very wordy.
> >
> > "Supply a backdated copyright notice."
> 
> Fine with me. Would you like me to send another version?

No, I will fix this for you.

> >> Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> >> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> >> ---
> >>
> >> New patch in v7.
> >>
> >> ---
> >>  drivers/mfd/axp20x.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >
> > Patch looks fine though:
> >
> > Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> >
> >> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> >> index 3e186f2dcac3..cec51e689d1d 100644
> >> --- a/drivers/mfd/axp20x.c
> >> +++ b/drivers/mfd/axp20x.c
> >> @@ -5,6 +5,8 @@
> >>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> >>   * as well as configurable GPIOs.
> >>   *
> >> + * Copyright (C) 2014 Carlo Caione
> >> + *
> >>   * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> >>   *
> >>   * This program is free software; you can redistribute it and/or modify
> >

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

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-01-26  8:37         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-01-26  8:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 26 Jan 2016, Chen-Yu Tsai wrote:

> On Mon, Jan 25, 2016 at 10:39 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> >
> >> When the driver was merged, the original author did not include a proper
> >> copyright notice. This patch adds the notice, backdated to when the
> >> driver was merged.
> >
> > This is very wordy.
> >
> > "Supply a backdated copyright notice."
> 
> Fine with me. Would you like me to send another version?

No, I will fix this for you.

> >> Cc: Carlo Caione <carlo@caione.org>
> >> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >>
> >> New patch in v7.
> >>
> >> ---
> >>  drivers/mfd/axp20x.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >
> > Patch looks fine though:
> >
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> >
> >> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> >> index 3e186f2dcac3..cec51e689d1d 100644
> >> --- a/drivers/mfd/axp20x.c
> >> +++ b/drivers/mfd/axp20x.c
> >> @@ -5,6 +5,8 @@
> >>   * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> >>   * as well as configurable GPIOs.
> >>   *
> >> + * Copyright (C) 2014 Carlo Caione
> >> + *
> >>   * Author: Carlo Caione <carlo@caione.org>
> >>   *
> >>   * This program is free software; you can redistribute it and/or modify
> >

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
  2016-01-25 15:29       ` Maxime Ripard
  (?)
@ 2016-02-10 16:14         ` Lee Jones
  -1 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-10 16:14 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

On Mon, 25 Jan 2016, Maxime Ripard wrote:
> On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> > 
> > > When the driver was merged, the original author did not include a proper
> > > copyright notice. This patch adds the notice, backdated to when the
> > > driver was merged.
> > 
> > This is very wordy. 
> > 
> > "Supply a backdated copyright notice."
> > 
> > > Cc: Carlo Caione <carlo@caione.org>
> > > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> > > ---
> > > 
> > > New patch in v7.
> > > 
> > > ---
> > >  drivers/mfd/axp20x.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > 
> > Patch looks fine though:
> > 
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> 
> How do you want to merge these patches ?
> 
> AFAIK, it's mostly MFD patches that could go through your tree, so
> feel free to apply them, I'll apply the DT parts.

Apologies for the delay, I've been super busy.

Yes, please take the ARM patches, I'll take the rest.

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-10 16:14         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-10 16:14 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Mon, 25 Jan 2016, Maxime Ripard wrote:
> On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> > 
> > > When the driver was merged, the original author did not include a proper
> > > copyright notice. This patch adds the notice, backdated to when the
> > > driver was merged.
> > 
> > This is very wordy. 
> > 
> > "Supply a backdated copyright notice."
> > 
> > > Cc: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> > > Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> > > ---
> > > 
> > > New patch in v7.
> > > 
> > > ---
> > >  drivers/mfd/axp20x.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > 
> > Patch looks fine though:
> > 
> > Acked-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
> How do you want to merge these patches ?
> 
> AFAIK, it's mostly MFD patches that could go through your tree, so
> feel free to apply them, I'll apply the DT parts.

Apologies for the delay, I've been super busy.

Yes, please take the ARM patches, I'll take the rest.

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

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-10 16:14         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-10 16:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 25 Jan 2016, Maxime Ripard wrote:
> On Mon, Jan 25, 2016 at 02:39:57PM +0000, Lee Jones wrote:
> > On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> > 
> > > When the driver was merged, the original author did not include a proper
> > > copyright notice. This patch adds the notice, backdated to when the
> > > driver was merged.
> > 
> > This is very wordy. 
> > 
> > "Supply a backdated copyright notice."
> > 
> > > Cc: Carlo Caione <carlo@caione.org>
> > > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> > > ---
> > > 
> > > New patch in v7.
> > > 
> > > ---
> > >  drivers/mfd/axp20x.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > 
> > Patch looks fine though:
> > 
> > Acked-by: Lee Jones <lee.jones@linaro.org>
> 
> How do you want to merge these patches ?
> 
> AFAIK, it's mostly MFD patches that could go through your tree, so
> feel free to apply them, I'll apply the DT parts.

Apologies for the delay, I've been super busy.

Yes, please take the ARM patches, I'll take the rest.

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
  2016-01-25 14:39     ` Lee Jones
  (?)
@ 2016-02-11 15:24       ` Lee Jones
  -1 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-11 15:24 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree, linux-arm-kernel, linux-kernel,
	linux-sunxi, Hans de Goede, Mark Brown, Andy Shevchenko,
	Rob Herring, Carlo Caione

On Mon, 25 Jan 2016, Lee Jones wrote:

> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."

Can you re-submit this set with this fixed and the Acks you collected?

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

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

* Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-11 15:24       ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-11 15:24 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Mon, 25 Jan 2016, Lee Jones wrote:

> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."

Can you re-submit this set with this fixed and the Acks you collected?

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

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

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

* [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-11 15:24       ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-02-11 15:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 25 Jan 2016, Lee Jones wrote:

> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
> 
> > When the driver was merged, the original author did not include a proper
> > copyright notice. This patch adds the notice, backdated to when the
> > driver was merged.
> 
> This is very wordy. 
> 
> "Supply a backdated copyright notice."

Can you re-submit this set with this fixed and the Acks you collected?

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

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

* Re: [linux-sunxi] Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
  2016-02-11 15:24       ` Lee Jones
  (?)
@ 2016-02-12  2:04         ` Chen-Yu Tsai
  -1 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-02-12  2:04 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Thu, Feb 11, 2016 at 11:24 PM, Lee Jones <lee.jones@linaro.org> wrote:
> On Mon, 25 Jan 2016, Lee Jones wrote:
>
>> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>>
>> > When the driver was merged, the original author did not include a proper
>> > copyright notice. This patch adds the notice, backdated to when the
>> > driver was merged.
>>
>> This is very wordy.
>>
>> "Supply a backdated copyright notice."
>
> Can you re-submit this set with this fixed and the Acks you collected?

Just did. Hopefully you'll see it in your inbox, and not your spam folder.

Thanks
ChenYu

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

* Re: Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-12  2:04         ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-02-12  2:04 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chen-Yu Tsai, Maxime Ripard, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Hans de Goede, Mark Brown,
	Andy Shevchenko, Rob Herring, Carlo Caione

On Thu, Feb 11, 2016 at 11:24 PM, Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Mon, 25 Jan 2016, Lee Jones wrote:
>
>> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>>
>> > When the driver was merged, the original author did not include a proper
>> > copyright notice. This patch adds the notice, backdated to when the
>> > driver was merged.
>>
>> This is very wordy.
>>
>> "Supply a backdated copyright notice."
>
> Can you re-submit this set with this fixed and the Acks you collected?

Just did. Hopefully you'll see it in your inbox, and not your spam folder.

Thanks
ChenYu

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

* [linux-sunxi] Re: [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice
@ 2016-02-12  2:04         ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-02-12  2:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 11, 2016 at 11:24 PM, Lee Jones <lee.jones@linaro.org> wrote:
> On Mon, 25 Jan 2016, Lee Jones wrote:
>
>> On Wed, 13 Jan 2016, Chen-Yu Tsai wrote:
>>
>> > When the driver was merged, the original author did not include a proper
>> > copyright notice. This patch adds the notice, backdated to when the
>> > driver was merged.
>>
>> This is very wordy.
>>
>> "Supply a backdated copyright notice."
>
> Can you re-submit this set with this fixed and the Acks you collected?

Just did. Hopefully you'll see it in your inbox, and not your spam folder.

Thanks
ChenYu

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

end of thread, other threads:[~2016-02-12  2:04 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13  3:30 [PATCH v7 00/10] mfd: axp20x: Add support for RSB based AXP223 Chen-Yu Tsai
2016-01-13  3:30 ` Chen-Yu Tsai
2016-01-13  3:30 ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 01/10] mfd: axp20x: Add AXP223 to list of supported PMICs in DT bindings Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 02/10] mfd: axp20x: Remove second struct device * parameter for axp20x_match_device() Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 03/10] mfd: axp20x: use dev->driver->of_match_table in axp20x_match_device() Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 04/10] mfd: axp20x: Add missing copyright notice Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  8:36   ` Carlo Caione
2016-01-13  8:36     ` Carlo Caione
2016-01-13  8:36     ` Carlo Caione
2016-01-25 14:39   ` Lee Jones
2016-01-25 14:39     ` Lee Jones
2016-01-25 14:39     ` Lee Jones
2016-01-25 15:29     ` Maxime Ripard
2016-01-25 15:29       ` Maxime Ripard
2016-01-25 15:29       ` Maxime Ripard
2016-02-10 16:14       ` Lee Jones
2016-02-10 16:14         ` Lee Jones
2016-02-10 16:14         ` Lee Jones
2016-01-26  1:34     ` Chen-Yu Tsai
2016-01-26  1:34       ` Chen-Yu Tsai
2016-01-26  1:34       ` Chen-Yu Tsai
2016-01-26  8:37       ` Lee Jones
2016-01-26  8:37         ` Lee Jones
2016-01-26  8:37         ` Lee Jones
2016-02-11 15:24     ` Lee Jones
2016-02-11 15:24       ` Lee Jones
2016-02-11 15:24       ` Lee Jones
2016-02-12  2:04       ` [linux-sunxi] " Chen-Yu Tsai
2016-02-12  2:04         ` Chen-Yu Tsai
2016-02-12  2:04         ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 05/10] mfd: axp20x: Split the driver into core and i2c bits Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-25 16:03   ` Lee Jones
2016-01-25 16:03     ` Lee Jones
2016-01-25 16:03     ` Lee Jones
2016-01-13  3:30 ` [PATCH v7 06/10] mfd: axp20x: Whitespace, open parenthesis alignment code style fixes Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 07/10] mfd: axp20x: Add support for RSB based AXP223 PMIC Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-25 16:04   ` Lee Jones
2016-01-25 16:04     ` Lee Jones
2016-01-25 16:04     ` Lee Jones
2016-01-13  3:30 ` [PATCH v7 08/10] regulator: axp20x: Support new " Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 09/10] ARM: dts: sun8i: sinlinx-sina33: Add AXP223 PMIC device and regulator nodes Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30 ` [PATCH v7 10/10] ARM: dts: sun8i: q8-common: " Chen-Yu Tsai
2016-01-13  3:30   ` Chen-Yu Tsai
2016-01-13  3:30   ` 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.