Skip to contentSkip to conversation

mfd: ax20x: Add axp152 support

PATCH New Hans de Goede 4 participants 11 messages Jun 23, 2015 – Jul 9, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover mfd: ax20x: Add axp152 support

Hi Lee, Maxime,

Here is a small patch-series adding mfd support for the AXP152, this gives us power-off and power-button capabilities on the AXP152 as those parts are compatible with the AXP20x PMIC-s.

Lee, if you can review and merge the actual mfd patch, then Maxime can pick up the dts patches once the mfd bits are merged.

Regards,

Hans

#1 lore raw

PATCH 1/3 mfd: ax20x: Add axp152 support

From: Michal Suchanek <[email protected]>

The axp152 is a stripped down version of the axp202 pmic with the battery charging function removed as it is intended for top-set boxes.

---
 Documentation/devicetree/bindings/mfd/axp20x.txt |  4 +-
 drivers/mfd/axp20x.c                             | 92 ++++++++++++++++++++++++
 include/linux/mfd/axp20x.h                       | 61 +++++++++++++++-
 3 files changed, 155 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/axp20x.txt +3 -1
index 753f14f..4181122 100644
@@ -1,12 +1,14 @@
 AXP family PMIC device tree bindings
 
 The axp20x family current members :
+axp152 (X-Powers)
 axp202 (X-Powers)
 axp209 (X-Powers)
 axp221 (X-Powers)
 
 Required properties:
-- compatible: "x-powers,axp202", "x-powers,axp209", "x-powers,axp221"
+- compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
+	      "x-powers,axp221"
 - reg: The I2C slave address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
drivers/mfd/axp20x.c +92 -0

146 lines not on this page · raw message

include/linux/mfd/axp20x.h +60 -1

91 lines not on this page · raw message

Signature · 1 line
2.3.6
#2 lore raw

PATCH 1/3 mfd: ax20x: Add axp152 support

Hello,

there is a typo in the subject.

ax20x: -> axp20x:

Thanks

Michal

#3 lore raw

PATCH 1/3 mfd: ax20x: Add axp152 support

In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

The axp152 is a stripped down version of the axp202 pmic with the battery charging function removed as it is intended for top-set boxes.

---
 Documentation/devicetree/bindings/mfd/axp20x.txt |  4 +-

This should be in a separate patch.

Quoted 14 lines
 drivers/mfd/axp20x.c                             | 92 ++++++++++++++++++++++++
 include/linux/mfd/axp20x.h                       | 61 +++++++++++++++-
 3 files changed, 155 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/axp20x.txt +1 -0
index 753f14f..4181122 100644
@@ -1,12 +1,14 @@
 AXP family PMIC device tree bindings
 
 The axp20x family current members :
+axp152 (X-Powers)
 axp202 (X-Powers)

Documentation/devicetree/bindings/mfd/axp20x.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/mfd/axp20x.txt +2 -1
 axp209 (X-Powers)
 axp221 (X-Powers)
 
 Required properties:
-- compatible: "x-powers,axp202", "x-powers,axp209", "x-powers,axp221"
+- compatible: "x-powers,axp152", "x-powers,axp202", "x-powers,axp209",
+	      "x-powers,axp221"
 - reg: The I2C slave address for the AXP chip
 - interrupt-parent: The parent interrupt controller
 - interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin

For this patch, when it is separated out:

Quoted 46 lines
drivers/mfd/axp20x.c +25 -0
index ca4a604..49bba28 100644
@@ -30,12 +30,34 @@
 #define AXP20X_OFF	0x80
 
 static const char * const axp20x_model_names[] = {
+	"AXP152",
 	"AXP202",
 	"AXP209",
 	"AXP221",
 	"AXP288",
 };
 
+static const struct regmap_range axp152_writeable_ranges[] = {
+	regmap_reg_range(AXP152_LDO3456_DC1234_CTRL, AXP152_IRQ3_STATE),
+	regmap_reg_range(AXP152_DCDC_MODE, AXP152_PWM1_DUTY_CYCLE),
+};
+
+static const struct regmap_range axp152_volatile_ranges[] = {
+	regmap_reg_range(AXP152_PWR_OP_MODE, AXP152_PWR_OP_MODE),
+	regmap_reg_range(AXP152_IRQ1_EN, AXP152_IRQ3_STATE),
+	regmap_reg_range(AXP152_GPIO_INPUT, AXP152_GPIO_INPUT),
+};
+
+static const struct regmap_access_table axp152_writeable_table = {
+	.yes_ranges	= axp152_writeable_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp152_writeable_ranges),
+};
+
+static const struct regmap_access_table axp152_volatile_table = {
+	.yes_ranges	= axp152_volatile_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(axp152_volatile_ranges),
+};
+
 static const struct regmap_range axp20x_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
@@ -99,6 +121,20 @@ static const struct regmap_access_table axp288_volatile_table = {
 	.n_yes_ranges	= ARRAY_SIZE(axp288_volatile_ranges),
 };
 
+static struct resource axp152_pek_resources[] = {
+	{
+		.name	= "PEK_DBR",

drivers/mfd/axp20x.c static const struct regmap_access_table axp288_volatile_table = { · line 136

Quoted 10 lines
drivers/mfd/axp20x.c +10 -0
+		.start	= AXP152_IRQ_PEK_RIS_EDGE,
+		.end	= AXP152_IRQ_PEK_RIS_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "PEK_DBF",
+		.start	= AXP152_IRQ_PEK_FAL_EDGE,
+		.end	= AXP152_IRQ_PEK_FAL_EDGE,
+		.flags	= IORESOURCE_IRQ,
+	},
+};

DEFINE_RES_*()

After you've fixed this up, please add my:

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

PATCH 2/3 ARM: dts: axp152: Add a dtsi file for the axp152 pmic

In reply to Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

---
 arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp152.dtsi
arch/arm/boot/dts/axp152.dtsi new file +49 -0
new file mode 100644
index 0000000..f90ad6c
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Chen-Yu Tsai
+ *
+ * Chen-Yu Tsai <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+&axp152 {
+	compatible = "x-powers,axp152";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+};
Signature · 1 line
2.3.6
#5 lore raw

PATCH 2/3 ARM: dts: axp152: Add a dtsi file for the axp152 pmic

Hi,

Quoted 10 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

---
 arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp152.dtsi

Unfortunately, Mark expressed clearly that he didn't want such files.

Sorry...

Maxime

Signature · 10 lines
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/20150625/777f18d7/attachment.sig>
#6 lore raw

[linux-sunxi] Re: [PATCH 2/3] ARM: dts: axp152: Add a dtsi file for the axp152 pmic

Hi,

Quoted 8 lines · Maxime Ripard

Hi,

Quoted 5 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

Quoted 7 lines
Quoted 5 lines
---
  arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 49 insertions(+)

create mode 100644 arch/arm/boot/dts/axp152.dtsi

Unfortunately, Mark expressed clearly that he didn't want such files.

That is not how I remember the discussion, he said that he did not consider them useful, we explained why we do consider them useful for the sunxi case and then things went quiet.

And we do already have an axp209.dtsi, and I find having that useful for enabling the regulators on axp209 using boards.

Ultimately it is your call, but I really think we should be consistent and add an axp152.dtsi to mirror how we do things with the axp209.

Regards,

Hans

#7 lore raw

[linux-sunxi] Re: [PATCH 2/3] ARM: dts: axp152: Add a dtsi file for the axp152 pmic

Hi,

Quoted 17 lines · Hans de Goede

Hi,

Quoted 14 lines · Maxime Ripard

Hi,

Quoted 10 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

---
 arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp152.dtsi
Quoted 8 lines
Quoted 1 line

Unfortunately, Mark expressed clearly that he didn't want such files.

That is not how I remember the discussion, he said that he did not consider them useful, we explained why we do consider them useful for the sunxi case and then things went quiet.

And we do already have an axp209.dtsi, and I find having that useful for enabling the regulators on axp209 using boards.

Hmmm, reading this discussion again, it indeed looks like I misremembered what he was saying.

Quoted 2 lines

Ultimately it is your call, but I really think we should be consistent and add an axp152.dtsi to mirror how we do things with the axp209.

Was there any other comments on this serie (and are you going to send a v2?) or should I apply this patch?

Thanks,
Maxime

Signature · 10 lines
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/20150706/92db4319/attachment.sig>
#8 lore raw

[linux-sunxi] Re: [PATCH 2/3] ARM: dts: axp152: Add a dtsi file for the axp152 pmic

Hi,

Quoted 29 lines · Maxime Ripard

Hi,

Quoted 17 lines · Hans de Goede

Hi,

Quoted 14 lines · Maxime Ripard

Hi,

Quoted 10 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

---
  arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 49 insertions(+)

create mode 100644 arch/arm/boot/dts/axp152.dtsi

Quoted 8 lines
Quoted 1 line

Unfortunately, Mark expressed clearly that he didn't want such files.

That is not how I remember the discussion, he said that he did not consider them useful, we explained why we do consider them useful for the sunxi case and then things went quiet.

And we do already have an axp209.dtsi, and I find having that useful for enabling the regulators on axp209 using boards.

Quoted 8 lines

Hmmm, reading this discussion again, it indeed looks like I misremembered what he was saying.

Quoted 2 lines

Ultimately it is your call, but I really think we should be consistent and add an axp152.dtsi to mirror how we do things with the axp209.

Was there any other comments on this serie (and are you going to send a v2?) or should I apply this patch?

There were some comments on the actual mfd bits of this series, and I will send a v2 for that sometime this week. The dts patches however are good to go, so please apply this one.

Regards,

Hans

#9 lore raw

[linux-sunxi] Re: [PATCH 2/3] ARM: dts: axp152: Add a dtsi file for the axp152 pmic

Quoted 38 lines · Hans de Goede

Hi,

Quoted 35 lines · Maxime Ripard

Hi,

Quoted 17 lines · Hans de Goede

Hi,

Quoted 14 lines · Maxime Ripard

Hi,

Quoted 10 lines · Hans de Goede

From: Michal Suchanek <[email protected]>

Add a dtsi file for the axp152 pmic, this mirrors the way things are handled for the axp202 pmic.

---
 arch/arm/boot/dts/axp152.dtsi | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp152.dtsi
Quoted 8 lines
Quoted 1 line

Unfortunately, Mark expressed clearly that he didn't want such files.

That is not how I remember the discussion, he said that he did not consider them useful, we explained why we do consider them useful for the sunxi case and then things went quiet.

And we do already have an axp209.dtsi, and I find having that useful for enabling the regulators on axp209 using boards.

Hmmm, reading this discussion again, it indeed looks like I misremembered what he was saying.

Quoted 2 lines

Ultimately it is your call, but I really think we should be consistent and add an axp152.dtsi to mirror how we do things with the axp209.

Quoted 6 lines
Quoted 2 lines

Was there any other comments on this serie (and are you going to send a v2?) or should I apply this patch?

There were some comments on the actual mfd bits of this series, and I will send a v2 for that sometime this week. The dts patches however are good to go, so please apply this one.

Applied 2 and 3 then. Thanks!

Maxime

Signature · 10 lines
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/20150709/8933a5a6/attachment-0001.sig>
#10 lore raw

PATCH 3/3 ARM: dts: A10s-OLinuxIno: Add a node for axp152 pmic

In reply to Hans de Goede

From: Michal Suchanek <[email protected]>

Add a node for axp152 pmic used on the A10s-OLinuxIno SBC.

---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +7 -0
index a7e19e4..7b26e17 100644
@@ -96,8 +96,15 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c0_pins_a>;
 	status = "okay";
+
+	axp152: pmic at 30 {
+		reg = <0x30>;
+		interrupts = <0>;
+	};
 };
 
+#include "axp152.dtsi"
+
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c1_pins_a>;
Signature · 1 line
2.3.6