linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs
@ 2016-12-09 11:04 Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible Quentin Schulz
                   ` (13 more replies)
  0 siblings, 14 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

The X-Powers AXP209 and AXP20X PMICs are able to set a limit for the
VBUS power supply for both max current and min voltage supplied. This
series of patch adds the possibility to set these limits from sysfs.

Also, the AXP223 PMIC shares most of its behaviour with the AXP221 but
the former can set the VBUS power supply max current to 100mA, unlike
the latter. The AXP223 VBUS power supply driver used to probe on the
AXP221 compatible. This series of patch introduces a new compatible for
the AXP223 to be able to set the current max limit to 100mA.

With that new compatible, boards having the AXP223 see their DT updated
to use the VBUS power supply driver with the correct compatible.

This series of patch also migrates from of_device_is_compatible function
to the data field of of_device_id to identify the compatible used to
probe. This improves the code readability.

Mostly cosmetic changes in v2 and adding volatile and writeable regs to
AXP20X and AXP22X MFD cells for the VBUS power supply driver.

Quentin Schulz (11):
  power: supply: axp20x_usb_power: use of_device_id data field instead
    of device_is_compatible
  mfd: axp20x: add volatile and writeable reg ranges for VBUS power
    supply driver
  power: supply: axp20x_usb_power: set min voltage and max current from
    sysfs
  Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
  power: supply: axp20x_usb_power: add 100mA max current limit for
    AXP223
  mfd: axp20x: add separate MFD cell for AXP223
  ARM: dtsi: add DTSI for AXP223
  ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI
  ARM: dts: sun8i-a33-sinlinx-sina33: use AXP223 DTSI
  ARM: dts: sun8i-r16-parrot: use AXP223 DTSI
  ARM: dtsi: sun8i-reference-design-tablet: use AXP223 DTSI

 .../bindings/power/supply/axp20x_usb_power.txt     |   5 +
 arch/arm/boot/dts/axp223.dtsi                      |  58 +++++++++++
 arch/arm/boot/dts/sun8i-a33-olinuxino.dts          |   2 +-
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts     |   2 +-
 arch/arm/boot/dts/sun8i-r16-parrot.dts             |   2 +-
 .../boot/dts/sun8i-reference-design-tablet.dtsi    |   2 +-
 drivers/mfd/axp20x.c                               |  32 +++++-
 drivers/power/supply/axp20x_usb_power.c            | 116 ++++++++++++++++++---
 8 files changed, 197 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/boot/dts/axp223.dtsi

-- 
2.9.3

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

* [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-14 15:38   ` Chen-Yu Tsai
  2016-12-09 11:04 ` [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver Quentin Schulz
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

This replaces calls to of_device_is_compatible to check data field of
of_device_id matched when probing the driver.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---
 drivers/power/supply/axp20x_usb_power.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 6af6feb..8985646 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -17,6 +17,7 @@
 #include <linux/mfd/axp20x.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
 #include <linux/regmap.h>
@@ -45,6 +46,7 @@ struct axp20x_usb_power {
 	struct device_node *np;
 	struct regmap *regmap;
 	struct power_supply *supply;
+	int axp20x_id;
 };
 
 static irqreturn_t axp20x_usb_power_irq(int irq, void *devid)
@@ -86,8 +88,7 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 
 		switch (v & AXP20X_VBUS_CLIMIT_MASK) {
 		case AXP20X_VBUC_CLIMIT_100mA:
-			if (of_device_is_compatible(power->np,
-					"x-powers,axp202-usb-power-supply")) {
+			if (power->axp20x_id == AXP202_ID) {
 				val->intval = 100000;
 			} else {
 				val->intval = -1; /* No 100mA limit */
@@ -130,8 +131,7 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 
 		val->intval = POWER_SUPPLY_HEALTH_GOOD;
 
-		if (of_device_is_compatible(power->np,
-				"x-powers,axp202-usb-power-supply")) {
+		if (power->axp20x_id == AXP202_ID) {
 			ret = regmap_read(power->regmap,
 					  AXP20X_USB_OTG_STATUS, &v);
 			if (ret)
@@ -214,11 +214,12 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 	if (!power)
 		return -ENOMEM;
 
+	power->axp20x_id = (int)of_device_get_match_data(&pdev->dev);
+
 	power->np = pdev->dev.of_node;
 	power->regmap = axp20x->regmap;
 
-	if (of_device_is_compatible(power->np,
-			"x-powers,axp202-usb-power-supply")) {
+	if (power->axp20x_id == AXP202_ID) {
 		/* Enable vbus valid checking */
 		ret = regmap_update_bits(power->regmap, AXP20X_VBUS_MON,
 					 AXP20X_VBUS_MON_VBUS_VALID,
@@ -235,8 +236,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 
 		usb_power_desc = &axp20x_usb_power_desc;
 		irq_names = axp20x_irq_names;
-	} else if (of_device_is_compatible(power->np,
-			"x-powers,axp221-usb-power-supply")) {
+	} else if (power->axp20x_id == AXP221_ID) {
 		usb_power_desc = &axp22x_usb_power_desc;
 		irq_names = axp22x_irq_names;
 	} else {
@@ -273,9 +273,13 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id axp20x_usb_power_match[] = {
-	{ .compatible = "x-powers,axp202-usb-power-supply" },
-	{ .compatible = "x-powers,axp221-usb-power-supply" },
-	{ }
+	{
+		.compatible = "x-powers,axp202-usb-power-supply",
+		.data = (void *)AXP202_ID,
+	}, {
+		.compatible = "x-powers,axp221-usb-power-supply",
+		.data = (void *)AXP221_ID,
+	}, { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
 
-- 
2.9.3

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

* [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-14 15:43   ` Chen-Yu Tsai
  2016-12-09 11:04 ` [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs Quentin Schulz
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

The X-Powers AXP20X and AXP22X PMICs allow to choose the maximum voltage
and minimum current delivered by the VBUS power supply.

This adds the register used by the VBUS power supply driver to the range
of volatile and writeable regs ranges.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

added in v2

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

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ba130be..6ee2cc6 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -65,12 +65,14 @@ static const struct regmap_access_table axp152_volatile_table = {
 
 static const struct regmap_range axp20x_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+	regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
 	regmap_reg_range(AXP20X_RDC_H, AXP20X_OCV(AXP20X_OCV_MAX)),
 };
 
 static const struct regmap_range axp20x_volatile_ranges[] = {
 	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_USB_OTG_STATUS),
+	regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
 	regmap_reg_range(AXP20X_CHRG_CTRL1, AXP20X_CHRG_CTRL2),
 	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
 	regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
@@ -91,11 +93,13 @@ static const struct regmap_access_table axp20x_volatile_table = {
 /* AXP22x ranges are shared with the AXP809, as they cover the same range */
 static const struct regmap_range axp22x_writeable_ranges[] = {
 	regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
+	regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
 	regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
 };
 
 static const struct regmap_range axp22x_volatile_ranges[] = {
 	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
+	regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
 	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
 	regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE),
 	regmap_reg_range(AXP20X_FG_RES, AXP20X_FG_RES),
-- 
2.9.3

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

* [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-14 15:45   ` Chen-Yu Tsai
  2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

AXP20X and AXP22X PMICs allow setting the min voltage and max current of
VBUS power supply. This adds entries in sysfs to allow to do so.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

v2:
 - moving defines from header mfd/axp20x.h to the driver,
 - adding two functions to reduce indentation in axp20x_usb_power_set_property,
 - adding new define for VBUS register VHOLD bits offset,
 - switching return values in case of invalid value from 0 to -EINVAL,

 drivers/power/supply/axp20x_usb_power.c | 81 +++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 8985646..9e3f4ae 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -31,6 +31,8 @@
 #define AXP20X_USB_STATUS_VBUS_VALID	BIT(2)
 
 #define AXP20X_VBUS_VHOLD_uV(b)		(4000000 + (((b) >> 3) & 7) * 100000)
+#define AXP20X_VBUS_VHOLD_MASK		GENMASK(5, 3)
+#define AXP20X_VBUS_VHOLD_OFFSET	3
 #define AXP20X_VBUS_CLIMIT_MASK		3
 #define AXP20X_VBUC_CLIMIT_900mA	0
 #define AXP20X_VBUC_CLIMIT_500mA	1
@@ -155,6 +157,81 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 	return 0;
 }
 
+static int axp20x_usb_power_set_voltage_min(struct axp20x_usb_power *power,
+					    int intval)
+{
+	int val;
+
+	switch (intval) {
+	case 4000000:
+	case 4100000:
+	case 4200000:
+	case 4300000:
+	case 4400000:
+	case 4500000:
+	case 4600000:
+	case 4700000:
+		val = (intval - 4000000) / 100000;
+		return regmap_update_bits(power->regmap,
+					  AXP20X_VBUS_IPSOUT_MGMT,
+					  AXP20X_VBUS_VHOLD_MASK,
+					  val << AXP20X_VBUS_VHOLD_OFFSET);
+	default:
+		return -EINVAL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
+					    int intval)
+{
+	int val;
+
+	switch (intval) {
+	case 100000:
+		if (power->axp20x_id == AXP221_ID)
+			return -EINVAL;
+	case 500000:
+	case 900000:
+		val = (900000 - intval) / 400000;
+		return regmap_update_bits(power->regmap,
+					  AXP20X_VBUS_IPSOUT_MGMT,
+					  AXP20X_VBUS_CLIMIT_MASK, val);
+	default:
+		return -EINVAL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_usb_power_set_property(struct power_supply *psy,
+					 enum power_supply_property psp,
+					 const union power_supply_propval *val)
+{
+	struct axp20x_usb_power *power = power_supply_get_drvdata(psy);
+
+	switch (psp) {
+	case POWER_SUPPLY_PROP_VOLTAGE_MIN:
+		return axp20x_usb_power_set_voltage_min(power, val->intval);
+
+	case POWER_SUPPLY_PROP_CURRENT_MAX:
+		return axp20x_usb_power_set_current_max(power, val->intval);
+
+	default:
+		return -EINVAL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_usb_power_prop_writeable(struct power_supply *psy,
+					   enum power_supply_property psp)
+{
+	return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN ||
+	       psp == POWER_SUPPLY_PROP_CURRENT_MAX;
+}
+
 static enum power_supply_property axp20x_usb_power_properties[] = {
 	POWER_SUPPLY_PROP_HEALTH,
 	POWER_SUPPLY_PROP_PRESENT,
@@ -178,7 +255,9 @@ static const struct power_supply_desc axp20x_usb_power_desc = {
 	.type = POWER_SUPPLY_TYPE_USB,
 	.properties = axp20x_usb_power_properties,
 	.num_properties = ARRAY_SIZE(axp20x_usb_power_properties),
+	.property_is_writeable = axp20x_usb_power_prop_writeable,
 	.get_property = axp20x_usb_power_get_property,
+	.set_property = axp20x_usb_power_set_property,
 };
 
 static const struct power_supply_desc axp22x_usb_power_desc = {
@@ -186,7 +265,9 @@ static const struct power_supply_desc axp22x_usb_power_desc = {
 	.type = POWER_SUPPLY_TYPE_USB,
 	.properties = axp22x_usb_power_properties,
 	.num_properties = ARRAY_SIZE(axp22x_usb_power_properties),
+	.property_is_writeable = axp20x_usb_power_prop_writeable,
 	.get_property = axp20x_usb_power_get_property,
+	.set_property = axp20x_usb_power_set_property,
 };
 
 static int axp20x_usb_power_probe(struct platform_device *pdev)
-- 
2.9.3

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

* [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (2 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-12 15:51   ` Maxime Ripard
                     ` (2 more replies)
  2016-12-09 11:04 ` [PATCH v2 05/11] power: supply: axp20x_usb_power: add 100mA max current limit for AXP223 Quentin Schulz
                   ` (9 subsequent siblings)
  13 siblings, 3 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

This adds the "x-powers,axp223-usb-power-supply" to the list of
compatibles for AXP20X VBUS power supply driver.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

v2:
 - adding small explanation on AXP223 variation compared to the AXP221,

 Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
index f1d7bee..ba8d35f 100644
--- a/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
+++ b/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
@@ -3,6 +3,11 @@ AXP20x USB power supply
 Required Properties:
 -compatible: One of: "x-powers,axp202-usb-power-supply"
                      "x-powers,axp221-usb-power-supply"
+                     "x-powers,axp223-usb-power-supply"
+
+The AXP223 PMIC shares most of its behaviour with the AXP221 but has slight
+variations such as the former being able to set the VBUS power supply max
+current to 100mA, unlike the latter.
 
 This node is a subnode of the axp20x PMIC.
 
-- 
2.9.3

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

* [PATCH v2 05/11] power: supply: axp20x_usb_power: add 100mA max current limit for AXP223
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (3 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 06/11] mfd: axp20x: add separate MFD cell " Quentin Schulz
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

The X-Powers AXP223 shares most of its behaviour with the AXP221 PMIC
but allows the VBUS power supply max current to be set to 100mA (like
the AXP209 PMIC).

This basically adds a new compatible to the VBUS power supply driver and
adds a check on the compatible when setting current max limit.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/power/supply/axp20x_usb_power.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 9e3f4ae..1bcb025 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -90,11 +90,10 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 
 		switch (v & AXP20X_VBUS_CLIMIT_MASK) {
 		case AXP20X_VBUC_CLIMIT_100mA:
-			if (power->axp20x_id == AXP202_ID) {
-				val->intval = 100000;
-			} else {
+			if (power->axp20x_id == AXP221_ID)
 				val->intval = -1; /* No 100mA limit */
-			}
+			else
+				val->intval = 100000;
 			break;
 		case AXP20X_VBUC_CLIMIT_500mA:
 			val->intval = 500000;
@@ -317,7 +316,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 
 		usb_power_desc = &axp20x_usb_power_desc;
 		irq_names = axp20x_irq_names;
-	} else if (power->axp20x_id == AXP221_ID) {
+	} else if (power->axp20x_id == AXP221_ID ||
+		   power->axp20x_id == AXP223_ID) {
 		usb_power_desc = &axp22x_usb_power_desc;
 		irq_names = axp22x_irq_names;
 	} else {
@@ -360,6 +360,9 @@ static const struct of_device_id axp20x_usb_power_match[] = {
 	}, {
 		.compatible = "x-powers,axp221-usb-power-supply",
 		.data = (void *)AXP221_ID,
+	}, {
+		.compatible = "x-powers,axp223-usb-power-supply",
+		.data = (void *)AXP223_ID,
 	}, { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
-- 
2.9.3

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

* [PATCH v2 06/11] mfd: axp20x: add separate MFD cell for AXP223
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (4 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 05/11] power: supply: axp20x_usb_power: add 100mA max current limit for AXP223 Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-12 15:51   ` Maxime Ripard
  2017-01-04  9:45   ` Lee Jones
  2016-12-09 11:04 ` [PATCH v2 07/11] ARM: dtsi: add DTSI " Quentin Schulz
                   ` (7 subsequent siblings)
  13 siblings, 2 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

The AXP223 shares most of its logic with the AXP221 but has some
differences for the VBUS power supply driver. Thus, to probe the driver
with the correct compatible, the AXP221 and the AXP223 now have separate
MFD cells.

AXP221 MFD cells are renamed from axp22x_cells to axp221_cells to avoid
confusion.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---

v2:
 - correct indentation,
 - renaming axp22x_cells to axp221_cells to avoid confusion between axp22x,
axp221 and axp223

 drivers/mfd/axp20x.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 6ee2cc6..b31f123 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -591,7 +591,22 @@ static struct mfd_cell axp20x_cells[] = {
 	},
 };
 
-static struct mfd_cell axp22x_cells[] = {
+static struct mfd_cell axp221_cells[] = {
+	{
+		.name		= "axp20x-pek",
+		.num_resources	= ARRAY_SIZE(axp22x_pek_resources),
+		.resources	= axp22x_pek_resources,
+	}, {
+		.name		= "axp20x-regulator",
+	}, {
+		.name		= "axp20x-usb-power-supply",
+		.of_compatible	= "x-powers,axp221-usb-power-supply",
+		.num_resources	= ARRAY_SIZE(axp22x_usb_power_supply_resources),
+		.resources	= axp22x_usb_power_supply_resources,
+	},
+};
+
+static struct mfd_cell axp223_cells[] = {
 	{
 		.name			= "axp20x-pek",
 		.num_resources		= ARRAY_SIZE(axp22x_pek_resources),
@@ -600,7 +615,7 @@ static struct mfd_cell axp22x_cells[] = {
 		.name			= "axp20x-regulator",
 	}, {
 		.name		= "axp20x-usb-power-supply",
-		.of_compatible	= "x-powers,axp221-usb-power-supply",
+		.of_compatible	= "x-powers,axp223-usb-power-supply",
 		.num_resources	= ARRAY_SIZE(axp22x_usb_power_supply_resources),
 		.resources	= axp22x_usb_power_supply_resources,
 	},
@@ -793,9 +808,14 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
 		break;
 	case AXP221_ID:
+		axp20x->nr_cells = ARRAY_SIZE(axp221_cells);
+		axp20x->cells = axp221_cells;
+		axp20x->regmap_cfg = &axp22x_regmap_config;
+		axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
+		break;
 	case AXP223_ID:
-		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
-		axp20x->cells = axp22x_cells;
+		axp20x->nr_cells = ARRAY_SIZE(axp223_cells);
+		axp20x->cells = axp223_cells;
 		axp20x->regmap_cfg = &axp22x_regmap_config;
 		axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
 		break;
-- 
2.9.3

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

* [PATCH v2 07/11] ARM: dtsi: add DTSI for AXP223
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (5 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 06/11] mfd: axp20x: add separate MFD cell " Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 08/11] ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI Quentin Schulz
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

The AXP223 shares most of its logic with the AXP221 but it has some
differences for the VBUS driver.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---

v2:
 - adding small explanation of AXP223 variation compared to AXP221,

 arch/arm/boot/dts/axp223.dtsi | 58 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp223.dtsi

diff --git a/arch/arm/boot/dts/axp223.dtsi b/arch/arm/boot/dts/axp223.dtsi
new file mode 100644
index 0000000..b91b6c1
--- /dev/null
+++ b/arch/arm/boot/dts/axp223.dtsi
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016 Free Electrons
+ *
+ * Quentin Schulz <quentin.schulz@free-electrons.com>
+ *
+ * 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.
+ */
+
+/*
+ * AXP223 Integrated Power Management Chip
+ * http://www.x-powers.com/product/AXP22X.php
+ * http://dl.linux-sunxi.org/AXP/AXP223-en.pdf
+ *
+ * The AXP223 shares most of its logic with the AXP221 but it has some
+ * differences, for the VBUS driver for example.
+ */
+
+#include "axp22x.dtsi"
+
+&usb_power_supply {
+	compatible = "x-powers,axp223-usb-power-supply";
+};
-- 
2.9.3

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

* [PATCH v2 08/11] ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (6 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 07/11] ARM: dtsi: add DTSI " Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 09/11] ARM: dts: sun8i-a33-sinlinx-sina33: " Quentin Schulz
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

Previously, the Olimex A33-OlinuXino used everything declared in AXP221
DTSI while it has an AXP223 PMIC.

This corrects that so the Olimex A33-OlinuXino can get some features the
AXP223 has (at the moment, ability to have 100mA as maximal current on
VBUS power supply).

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
index 9ea637e..3e8f2ec 100644
--- a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
+++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
@@ -126,7 +126,7 @@
 	};
 };
 
-#include "axp22x.dtsi"
+#include "axp223.dtsi"
 
 &reg_aldo1 {
 	regulator-always-on;
-- 
2.9.3

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

* [PATCH v2 09/11] ARM: dts: sun8i-a33-sinlinx-sina33: use AXP223 DTSI
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (7 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 08/11] ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 10/11] ARM: dts: sun8i-r16-parrot: " Quentin Schulz
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

Previously, the Sinlinx SinA33 used everything declared in AXP221 DTSI
while it has an AXP223 PMIC.

This corrects that so the Sinlinx SinA33 can get some features the
AXP223 has (at the moment, ability to have 100mA as maximal current on
VBUS power supply).

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
index fef6abc..1fc459c 100644
--- a/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
+++ b/arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts
@@ -145,7 +145,7 @@
 	};
 };
 
-#include "axp22x.dtsi"
+#include "axp223.dtsi"
 
 &reg_aldo1 {
 	regulator-always-on;
-- 
2.9.3

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

* [PATCH v2 10/11] ARM: dts: sun8i-r16-parrot: use AXP223 DTSI
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (8 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 09/11] ARM: dts: sun8i-a33-sinlinx-sina33: " Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-09 11:04 ` [PATCH v2 11/11] ARM: dtsi: sun8i-reference-design-tablet: " Quentin Schulz
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

Previously, the Allwinner Parrot R16 used everything declared in AXP221
DTSI while it has an AXP223 PMIC.

This corrects that so the Allwinner Parrot R16 can get some features the
AXP223 has (at the moment, ability to have 100mA as maximal current on
VBUS power supply).

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-r16-parrot.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun8i-r16-parrot.dts b/arch/arm/boot/dts/sun8i-r16-parrot.dts
index 47553e5..6afdba3 100644
--- a/arch/arm/boot/dts/sun8i-r16-parrot.dts
+++ b/arch/arm/boot/dts/sun8i-r16-parrot.dts
@@ -209,7 +209,7 @@
 	};
 };
 
-#include "axp22x.dtsi"
+#include "axp223.dtsi"
 
 &reg_aldo1 {
 	regulator-always-on;
-- 
2.9.3

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

* [PATCH v2 11/11] ARM: dtsi: sun8i-reference-design-tablet: use AXP223 DTSI
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (9 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 10/11] ARM: dts: sun8i-r16-parrot: " Quentin Schulz
@ 2016-12-09 11:04 ` Quentin Schulz
  2016-12-12  8:07 ` [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-09 11:04 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: Quentin Schulz, linux-pm, devicetree, linux-kernel,
	linux-arm-kernel, thomas.petazzoni

Previously, the sun8i tablets used everything declared in AXP221 DTSI
while they have an AXP223 PMIC.

This corrects that so the sun8i tablets can get some features the AXP223
has (at the moment, ability to have 100mA as maximal current on VBUS
power supply).

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi b/arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi
index 08cd001..ea79c33 100644
--- a/arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi
+++ b/arch/arm/boot/dts/sun8i-reference-design-tablet.dtsi
@@ -136,7 +136,7 @@
 	};
 };
 
-#include "axp22x.dtsi"
+#include "axp223.dtsi"
 
 &reg_aldo1 {
 	regulator-always-on;
-- 
2.9.3

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

* Re: [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (10 preceding siblings ...)
  2016-12-09 11:04 ` [PATCH v2 11/11] ARM: dtsi: sun8i-reference-design-tablet: " Quentin Schulz
@ 2016-12-12  8:07 ` Quentin Schulz
  2016-12-17 15:54 ` Sebastian Reichel
  2017-01-12  9:28 ` Maxime Ripard
  13 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-12  8:07 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones
  Cc: linux-pm, devicetree, linux-kernel, linux-arm-kernel, thomas.petazzoni

Hi all,

I forgot to add a question to my cover letter so here it is:

The X-Powers AXP209 and AXP223 PMICs allow to not limit the maximal
current for the VBUS power supply.[1]
(If a Chinese-speaking person could check it's the same for the AXP221
that would be great also[2]).

In the get_property (axp20x_usb_power_get_property) of the power supply
driver, I see that we use -1 as value for "no limit". Should we use the
same (-1) value for the set_property (axp20x_usb_power_set_property) to
disable max current limit?

[1] http://dl.linux-sunxi.org/AXP/AXP209_Datasheet_v1.0en.pdf page 33,
REG 30H, BITS 0 & 1
[2]
http://dl.linux-sunxi.org/AXP/AXP221%20Datasheet%20V1.2%2020130326%20.pdf
page 33, REG 30H, BITS 0 & 1 => 不限流 is written for when the BIT(1) is
set.

Thanks,
Quentin

On 09/12/2016 12:04, Quentin Schulz wrote:
> The X-Powers AXP209 and AXP20X PMICs are able to set a limit for the
> VBUS power supply for both max current and min voltage supplied. This
> series of patch adds the possibility to set these limits from sysfs.
> 
> Also, the AXP223 PMIC shares most of its behaviour with the AXP221 but
> the former can set the VBUS power supply max current to 100mA, unlike
> the latter. The AXP223 VBUS power supply driver used to probe on the
> AXP221 compatible. This series of patch introduces a new compatible for
> the AXP223 to be able to set the current max limit to 100mA.
> 
> With that new compatible, boards having the AXP223 see their DT updated
> to use the VBUS power supply driver with the correct compatible.
> 
> This series of patch also migrates from of_device_is_compatible function
> to the data field of of_device_id to identify the compatible used to
> probe. This improves the code readability.
> 
> Mostly cosmetic changes in v2 and adding volatile and writeable regs to
> AXP20X and AXP22X MFD cells for the VBUS power supply driver.
> 
> Quentin Schulz (11):
>   power: supply: axp20x_usb_power: use of_device_id data field instead
>     of device_is_compatible
>   mfd: axp20x: add volatile and writeable reg ranges for VBUS power
>     supply driver
>   power: supply: axp20x_usb_power: set min voltage and max current from
>     sysfs
>   Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
>   power: supply: axp20x_usb_power: add 100mA max current limit for
>     AXP223
>   mfd: axp20x: add separate MFD cell for AXP223
>   ARM: dtsi: add DTSI for AXP223
>   ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI
>   ARM: dts: sun8i-a33-sinlinx-sina33: use AXP223 DTSI
>   ARM: dts: sun8i-r16-parrot: use AXP223 DTSI
>   ARM: dtsi: sun8i-reference-design-tablet: use AXP223 DTSI
> 
>  .../bindings/power/supply/axp20x_usb_power.txt     |   5 +
>  arch/arm/boot/dts/axp223.dtsi                      |  58 +++++++++++
>  arch/arm/boot/dts/sun8i-a33-olinuxino.dts          |   2 +-
>  arch/arm/boot/dts/sun8i-a33-sinlinx-sina33.dts     |   2 +-
>  arch/arm/boot/dts/sun8i-r16-parrot.dts             |   2 +-
>  .../boot/dts/sun8i-reference-design-tablet.dtsi    |   2 +-
>  drivers/mfd/axp20x.c                               |  32 +++++-
>  drivers/power/supply/axp20x_usb_power.c            | 116 ++++++++++++++++++---
>  8 files changed, 197 insertions(+), 22 deletions(-)
>  create mode 100644 arch/arm/boot/dts/axp223.dtsi
> 

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

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

* Re: [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
  2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
@ 2016-12-12 15:51   ` Maxime Ripard
  2016-12-12 18:44   ` Rob Herring
  2016-12-14 16:12   ` Chen-Yu Tsai
  2 siblings, 0 replies; 25+ messages in thread
From: Maxime Ripard @ 2016-12-12 15:51 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: sre, robh+dt, mark.rutland, wens, linux, lee.jones, linux-pm,
	devicetree, linux-kernel, linux-arm-kernel, thomas.petazzoni

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

On Fri, Dec 09, 2016 at 12:04:12PM +0100, Quentin Schulz wrote:
> This adds the "x-powers,axp223-usb-power-supply" to the list of
> compatibles for AXP20X VBUS power supply driver.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

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

Thanks,
Maxime

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

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

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

* Re: [PATCH v2 06/11] mfd: axp20x: add separate MFD cell for AXP223
  2016-12-09 11:04 ` [PATCH v2 06/11] mfd: axp20x: add separate MFD cell " Quentin Schulz
@ 2016-12-12 15:51   ` Maxime Ripard
  2017-01-04  9:45   ` Lee Jones
  1 sibling, 0 replies; 25+ messages in thread
From: Maxime Ripard @ 2016-12-12 15:51 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: sre, robh+dt, mark.rutland, wens, linux, lee.jones, linux-pm,
	devicetree, linux-kernel, linux-arm-kernel, thomas.petazzoni

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

On Fri, Dec 09, 2016 at 12:04:14PM +0100, Quentin Schulz wrote:
> The AXP223 shares most of its logic with the AXP221 but has some
> differences for the VBUS power supply driver. Thus, to probe the driver
> with the correct compatible, the AXP221 and the AXP223 now have separate
> MFD cells.
> 
> AXP221 MFD cells are renamed from axp22x_cells to axp221_cells to avoid
> confusion.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> Acked-by: Chen-Yu Tsai <wens@csie.org>

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

Thanks,
Maxime

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

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

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

* Re: [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
  2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
  2016-12-12 15:51   ` Maxime Ripard
@ 2016-12-12 18:44   ` Rob Herring
  2016-12-14 16:12   ` Chen-Yu Tsai
  2 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2016-12-12 18:44 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: sre, mark.rutland, wens, linux, maxime.ripard, lee.jones,
	linux-pm, devicetree, linux-kernel, linux-arm-kernel,
	thomas.petazzoni

On Fri, Dec 09, 2016 at 12:04:12PM +0100, Quentin Schulz wrote:
> This adds the "x-powers,axp223-usb-power-supply" to the list of
> compatibles for AXP20X VBUS power supply driver.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> ---
> 
> v2:
>  - adding small explanation on AXP223 variation compared to the AXP221,
> 
>  Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt | 5 +++++
>  1 file changed, 5 insertions(+)

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

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

* Re: [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible
  2016-12-09 11:04 ` [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible Quentin Schulz
@ 2016-12-14 15:38   ` Chen-Yu Tsai
  0 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2016-12-14 15:38 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, Chen-Yu Tsai,
	Russell King, Maxime Ripard, Lee Jones, open list:THERMAL,
	devicetree, linux-kernel, linux-arm-kernel, Thomas Petazzoni

On Fri, Dec 9, 2016 at 7:04 PM, Quentin Schulz
<quentin.schulz@free-electrons.com> wrote:
> This replaces calls to of_device_is_compatible to check data field of
> of_device_id matched when probing the driver.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

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

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

* Re: [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver
  2016-12-09 11:04 ` [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver Quentin Schulz
@ 2016-12-14 15:43   ` Chen-Yu Tsai
  2016-12-19 12:28     ` Quentin Schulz
  0 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2016-12-14 15:43 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, Chen-Yu Tsai,
	Russell King, Maxime Ripard, Lee Jones, open list:THERMAL,
	devicetree, linux-kernel, linux-arm-kernel, Thomas Petazzoni

On Fri, Dec 9, 2016 at 7:04 PM, Quentin Schulz
<quentin.schulz@free-electrons.com> wrote:
> The X-Powers AXP20X and AXP22X PMICs allow to choose the maximum voltage
> and minimum current delivered by the VBUS power supply.
>
> This adds the register used by the VBUS power supply driver to the range
> of volatile and writeable regs ranges.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> ---
>
> added in v2
>
>  drivers/mfd/axp20x.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index ba130be..6ee2cc6 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -65,12 +65,14 @@ static const struct regmap_access_table axp152_volatile_table = {
>
>  static const struct regmap_range axp20x_writeable_ranges[] = {
>         regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),

This is already covered by the previous entry.

>         regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
>         regmap_reg_range(AXP20X_RDC_H, AXP20X_OCV(AXP20X_OCV_MAX)),
>  };
>
>  static const struct regmap_range axp20x_volatile_ranges[] = {
>         regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_USB_OTG_STATUS),
> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),

And I'm not sure why you specify it as volatile? The PMIC doesn't change any
of the bits in this register on its own.

Same for the AXP22x bits. So basically I think you don't need this patch.

ChenYu

>         regmap_reg_range(AXP20X_CHRG_CTRL1, AXP20X_CHRG_CTRL2),
>         regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
>         regmap_reg_range(AXP20X_ACIN_V_ADC_H, AXP20X_IPSOUT_V_HIGH_L),
> @@ -91,11 +93,13 @@ static const struct regmap_access_table axp20x_volatile_table = {
>  /* AXP22x ranges are shared with the AXP809, as they cover the same range */
>  static const struct regmap_range axp22x_writeable_ranges[] = {
>         regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
>         regmap_reg_range(AXP20X_DCDC_MODE, AXP22X_BATLOW_THRES1),
>  };
>
>  static const struct regmap_range axp22x_volatile_ranges[] = {
>         regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
>         regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
>         regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE),
>         regmap_reg_range(AXP20X_FG_RES, AXP20X_FG_RES),
> --
> 2.9.3
>

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

* Re: [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs
  2016-12-09 11:04 ` [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs Quentin Schulz
@ 2016-12-14 15:45   ` Chen-Yu Tsai
  0 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2016-12-14 15:45 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, Chen-Yu Tsai,
	Russell King, Maxime Ripard, Lee Jones, open list:THERMAL,
	devicetree, linux-kernel, linux-arm-kernel, Thomas Petazzoni

On Fri, Dec 9, 2016 at 7:04 PM, Quentin Schulz
<quentin.schulz@free-electrons.com> wrote:
> AXP20X and AXP22X PMICs allow setting the min voltage and max current of
> VBUS power supply. This adds entries in sysfs to allow to do so.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

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

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

* Re: [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
  2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
  2016-12-12 15:51   ` Maxime Ripard
  2016-12-12 18:44   ` Rob Herring
@ 2016-12-14 16:12   ` Chen-Yu Tsai
  2 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2016-12-14 16:12 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, Chen-Yu Tsai,
	Russell King, Maxime Ripard, Lee Jones, open list:THERMAL,
	devicetree, linux-kernel, linux-arm-kernel, Thomas Petazzoni

On Fri, Dec 9, 2016 at 7:04 PM, Quentin Schulz
<quentin.schulz@free-electrons.com> wrote:
> This adds the "x-powers,axp223-usb-power-supply" to the list of
> compatibles for AXP20X VBUS power supply driver.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> ---
>
> v2:
>  - adding small explanation on AXP223 variation compared to the AXP221,
>
>  Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
> index f1d7bee..ba8d35f 100644
> --- a/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
> +++ b/Documentation/devicetree/bindings/power/supply/axp20x_usb_power.txt
> @@ -3,6 +3,11 @@ AXP20x USB power supply
>  Required Properties:
>  -compatible: One of: "x-powers,axp202-usb-power-supply"
>                       "x-powers,axp221-usb-power-supply"
> +                     "x-powers,axp223-usb-power-supply"
> +
> +The AXP223 PMIC shares most of its behaviour with the AXP221 but has slight
> +variations such as the former being able to set the VBUS power supply max
> +current to 100mA, unlike the latter.

I actually wanted this in the commit log, but this works too.

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

>
>  This node is a subnode of the axp20x PMIC.
>
> --
> 2.9.3
>

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

* Re: [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (11 preceding siblings ...)
  2016-12-12  8:07 ` [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
@ 2016-12-17 15:54 ` Sebastian Reichel
  2017-01-12  9:28 ` Maxime Ripard
  13 siblings, 0 replies; 25+ messages in thread
From: Sebastian Reichel @ 2016-12-17 15:54 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: robh+dt, mark.rutland, wens, linux, maxime.ripard, lee.jones,
	linux-pm, devicetree, linux-kernel, linux-arm-kernel,
	thomas.petazzoni

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

Hi Quentin,

On Fri, Dec 09, 2016 at 12:04:08PM +0100, Quentin Schulz wrote:
> The X-Powers AXP209 and AXP20X PMICs are able to set a limit for the
> VBUS power supply for both max current and min voltage supplied. This
> series of patch adds the possibility to set these limits from sysfs.
> 
> Also, the AXP223 PMIC shares most of its behaviour with the AXP221 but
> the former can set the VBUS power supply max current to 100mA, unlike
> the latter. The AXP223 VBUS power supply driver used to probe on the
> AXP221 compatible. This series of patch introduces a new compatible for
> the AXP223 to be able to set the current max limit to 100mA.
> 
> With that new compatible, boards having the AXP223 see their DT updated
> to use the VBUS power supply driver with the correct compatible.
> 
> This series of patch also migrates from of_device_is_compatible function
> to the data field of of_device_id to identify the compatible used to
> probe. This improves the code readability.
> 
> Mostly cosmetic changes in v2 and adding volatile and writeable regs to
> AXP20X and AXP22X MFD cells for the VBUS power supply driver.
> 
> Quentin Schulz (11):
>   power: supply: axp20x_usb_power: use of_device_id data field instead
>     of device_is_compatible
>   mfd: axp20x: add volatile and writeable reg ranges for VBUS power
>     supply driver
>   power: supply: axp20x_usb_power: set min voltage and max current from
>     sysfs
>   Documentation: DT: binding: axp20x_usb_power: add axp223 compatible
>   power: supply: axp20x_usb_power: add 100mA max current limit for
>     AXP223
>   mfd: axp20x: add separate MFD cell for AXP223
>   ARM: dtsi: add DTSI for AXP223
>   ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI
>   ARM: dts: sun8i-a33-sinlinx-sina33: use AXP223 DTSI
>   ARM: dts: sun8i-r16-parrot: use AXP223 DTSI
>   ARM: dtsi: sun8i-reference-design-tablet: use AXP223 DTSI

Thanks for your patchset. We are currently in the merge
window and patches 1 & 3-5 will appear in linux-next once
4.10-rc1 has been tagged by Linus Torvalds.

Until then I queued them into this branch:

https://git.kernel.org/cgit/linux/kernel/git/sre/linux-power-supply.git/log/?h=for-next-next

-- Sebastian

-- Sebastian

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

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

* Re: [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver
  2016-12-14 15:43   ` Chen-Yu Tsai
@ 2016-12-19 12:28     ` Quentin Schulz
  0 siblings, 0 replies; 25+ messages in thread
From: Quentin Schulz @ 2016-12-19 12:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Sebastian Reichel, Rob Herring, Mark Rutland, Russell King,
	Maxime Ripard, Lee Jones, open list:THERMAL, devicetree,
	linux-kernel, linux-arm-kernel, Thomas Petazzoni

Hi Chen-Yu,

On 14/12/2016 16:43, Chen-Yu Tsai wrote:
> On Fri, Dec 9, 2016 at 7:04 PM, Quentin Schulz
> <quentin.schulz@free-electrons.com> wrote:
>> The X-Powers AXP20X and AXP22X PMICs allow to choose the maximum voltage
>> and minimum current delivered by the VBUS power supply.
>>
>> This adds the register used by the VBUS power supply driver to the range
>> of volatile and writeable regs ranges.
>>
>> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
>> ---
>>
>> added in v2
>>
>>  drivers/mfd/axp20x.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index ba130be..6ee2cc6 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -65,12 +65,14 @@ static const struct regmap_access_table axp152_volatile_table = {
>>
>>  static const struct regmap_range axp20x_writeable_ranges[] = {
>>         regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE),
>> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
> 
> This is already covered by the previous entry.
> 
>>         regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES),
>>         regmap_reg_range(AXP20X_RDC_H, AXP20X_OCV(AXP20X_OCV_MAX)),
>>  };
>>
>>  static const struct regmap_range axp20x_volatile_ranges[] = {
>>         regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_USB_OTG_STATUS),
>> +       regmap_reg_range(AXP20X_VBUS_IPSOUT_MGMT, AXP20X_VBUS_IPSOUT_MGMT),
> 
> And I'm not sure why you specify it as volatile? The PMIC doesn't change any
> of the bits in this register on its own.
> 

I got things mixed up between the work on the battery driver I'll soon
send (which actually needs updated reg ranges) and this VBUS driver.
Sorry for that.

> Same for the AXP22x bits. So basically I think you don't need this patch.
> 

Indeed. Should I send a v3 to remove this patch or is it fine for you to
ignore this one?

Thanks!
Quentin

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

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

* Re: [PATCH v2 06/11] mfd: axp20x: add separate MFD cell for AXP223
  2016-12-09 11:04 ` [PATCH v2 06/11] mfd: axp20x: add separate MFD cell " Quentin Schulz
  2016-12-12 15:51   ` Maxime Ripard
@ 2017-01-04  9:45   ` Lee Jones
  1 sibling, 0 replies; 25+ messages in thread
From: Lee Jones @ 2017-01-04  9:45 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: sre, robh+dt, mark.rutland, wens, linux, maxime.ripard, linux-pm,
	devicetree, linux-kernel, linux-arm-kernel, thomas.petazzoni

On Fri, 09 Dec 2016, Quentin Schulz wrote:

> The AXP223 shares most of its logic with the AXP221 but has some
> differences for the VBUS power supply driver. Thus, to probe the driver
> with the correct compatible, the AXP221 and the AXP223 now have separate
> MFD cells.
> 
> AXP221 MFD cells are renamed from axp22x_cells to axp221_cells to avoid
> confusion.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> v2:
>  - correct indentation,
>  - renaming axp22x_cells to axp221_cells to avoid confusion between axp22x,
> axp221 and axp223
> 
>  drivers/mfd/axp20x.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 6ee2cc6..b31f123 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -591,7 +591,22 @@ static struct mfd_cell axp20x_cells[] = {
>  	},
>  };
>  
> -static struct mfd_cell axp22x_cells[] = {
> +static struct mfd_cell axp221_cells[] = {
> +	{
> +		.name		= "axp20x-pek",
> +		.num_resources	= ARRAY_SIZE(axp22x_pek_resources),
> +		.resources	= axp22x_pek_resources,
> +	}, {
> +		.name		= "axp20x-regulator",
> +	}, {
> +		.name		= "axp20x-usb-power-supply",
> +		.of_compatible	= "x-powers,axp221-usb-power-supply",
> +		.num_resources	= ARRAY_SIZE(axp22x_usb_power_supply_resources),
> +		.resources	= axp22x_usb_power_supply_resources,
> +	},
> +};
> +
> +static struct mfd_cell axp223_cells[] = {
>  	{
>  		.name			= "axp20x-pek",
>  		.num_resources		= ARRAY_SIZE(axp22x_pek_resources),
> @@ -600,7 +615,7 @@ static struct mfd_cell axp22x_cells[] = {
>  		.name			= "axp20x-regulator",
>  	}, {
>  		.name		= "axp20x-usb-power-supply",
> -		.of_compatible	= "x-powers,axp221-usb-power-supply",
> +		.of_compatible	= "x-powers,axp223-usb-power-supply",
>  		.num_resources	= ARRAY_SIZE(axp22x_usb_power_supply_resources),
>  		.resources	= axp22x_usb_power_supply_resources,
>  	},
> @@ -793,9 +808,14 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip;
>  		break;
>  	case AXP221_ID:
> +		axp20x->nr_cells = ARRAY_SIZE(axp221_cells);
> +		axp20x->cells = axp221_cells;
> +		axp20x->regmap_cfg = &axp22x_regmap_config;
> +		axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
> +		break;
>  	case AXP223_ID:
> -		axp20x->nr_cells = ARRAY_SIZE(axp22x_cells);
> -		axp20x->cells = axp22x_cells;
> +		axp20x->nr_cells = ARRAY_SIZE(axp223_cells);
> +		axp20x->cells = axp223_cells;
>  		axp20x->regmap_cfg = &axp22x_regmap_config;
>  		axp20x->regmap_irq_chip = &axp22x_regmap_irq_chip;
>  		break;

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

* Re: [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs
  2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
                   ` (12 preceding siblings ...)
  2016-12-17 15:54 ` Sebastian Reichel
@ 2017-01-12  9:28 ` Maxime Ripard
  2017-01-21  1:10   ` Chen-Yu Tsai
  13 siblings, 1 reply; 25+ messages in thread
From: Maxime Ripard @ 2017-01-12  9:28 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: sre, robh+dt, mark.rutland, wens, linux, lee.jones, linux-pm,
	devicetree, linux-kernel, linux-arm-kernel, thomas.petazzoni

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

On Fri, Dec 09, 2016 at 12:04:08PM +0100, Quentin Schulz wrote:
> The X-Powers AXP209 and AXP20X PMICs are able to set a limit for the
> VBUS power supply for both max current and min voltage supplied. This
> series of patch adds the possibility to set these limits from sysfs.
> 
> Also, the AXP223 PMIC shares most of its behaviour with the AXP221 but
> the former can set the VBUS power supply max current to 100mA, unlike
> the latter. The AXP223 VBUS power supply driver used to probe on the
> AXP221 compatible. This series of patch introduces a new compatible for
> the AXP223 to be able to set the current max limit to 100mA.
> 
> With that new compatible, boards having the AXP223 see their DT updated
> to use the VBUS power supply driver with the correct compatible.
> 
> This series of patch also migrates from of_device_is_compatible function
> to the data field of of_device_id to identify the compatible used to
> probe. This improves the code readability.
> 
> Mostly cosmetic changes in v2 and adding volatile and writeable regs to
> AXP20X and AXP22X MFD cells for the VBUS power supply driver.

Applied all the DT patches. I also fixed all the prefixes. Please make
sure to look at what prefixes are used by a given subsystem next time.

Thanks!
Maxime

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

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

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

* Re: [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs
  2017-01-12  9:28 ` Maxime Ripard
@ 2017-01-21  1:10   ` Chen-Yu Tsai
  0 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2017-01-21  1:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Quentin Schulz, Sebastian Reichel, Rob Herring, Mark Rutland,
	Chen-Yu Tsai, Russell King, Lee Jones, open list:THERMAL,
	devicetree, linux-kernel, linux-arm-kernel, Thomas Petazzoni

Hi,

On Thu, Jan 12, 2017 at 5:28 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Fri, Dec 09, 2016 at 12:04:08PM +0100, Quentin Schulz wrote:
>> The X-Powers AXP209 and AXP20X PMICs are able to set a limit for the
>> VBUS power supply for both max current and min voltage supplied. This
>> series of patch adds the possibility to set these limits from sysfs.
>>
>> Also, the AXP223 PMIC shares most of its behaviour with the AXP221 but
>> the former can set the VBUS power supply max current to 100mA, unlike
>> the latter. The AXP223 VBUS power supply driver used to probe on the
>> AXP221 compatible. This series of patch introduces a new compatible for
>> the AXP223 to be able to set the current max limit to 100mA.
>>
>> With that new compatible, boards having the AXP223 see their DT updated
>> to use the VBUS power supply driver with the correct compatible.
>>
>> This series of patch also migrates from of_device_is_compatible function
>> to the data field of of_device_id to identify the compatible used to
>> probe. This improves the code readability.
>>
>> Mostly cosmetic changes in v2 and adding volatile and writeable regs to
>> AXP20X and AXP22X MFD cells for the VBUS power supply driver.
>
> Applied all the DT patches. I also fixed all the prefixes. Please make
> sure to look at what prefixes are used by a given subsystem next time.

I'm not seeing the DT patches. FYI the old DT does not work with the
new kernel driver updates. Because of the new AXP223 specific compatible
for the usb-power-supply, the updated mfd driver cannot match the old
device node, and the probe will fail at

        if (!of_device_is_available(pdev->dev.of_node))
                return -ENODEV;

I don't see an easy way out of this though. The mfd_cell structure only
takes one compatible string.

Regards
ChenYu

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

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

end of thread, other threads:[~2017-01-21  1:11 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09 11:04 [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 01/11] power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible Quentin Schulz
2016-12-14 15:38   ` Chen-Yu Tsai
2016-12-09 11:04 ` [PATCH v2 02/11] mfd: axp20x: add volatile and writeable reg ranges for VBUS power supply driver Quentin Schulz
2016-12-14 15:43   ` Chen-Yu Tsai
2016-12-19 12:28     ` Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 03/11] power: supply: axp20x_usb_power: set min voltage and max current from sysfs Quentin Schulz
2016-12-14 15:45   ` Chen-Yu Tsai
2016-12-09 11:04 ` [PATCH v2 04/11] Documentation: DT: binding: axp20x_usb_power: add axp223 compatible Quentin Schulz
2016-12-12 15:51   ` Maxime Ripard
2016-12-12 18:44   ` Rob Herring
2016-12-14 16:12   ` Chen-Yu Tsai
2016-12-09 11:04 ` [PATCH v2 05/11] power: supply: axp20x_usb_power: add 100mA max current limit for AXP223 Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 06/11] mfd: axp20x: add separate MFD cell " Quentin Schulz
2016-12-12 15:51   ` Maxime Ripard
2017-01-04  9:45   ` Lee Jones
2016-12-09 11:04 ` [PATCH v2 07/11] ARM: dtsi: add DTSI " Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 08/11] ARM: dts: sun8i-a33-olinuxino: use AXP223 DTSI Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 09/11] ARM: dts: sun8i-a33-sinlinx-sina33: " Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 10/11] ARM: dts: sun8i-r16-parrot: " Quentin Schulz
2016-12-09 11:04 ` [PATCH v2 11/11] ARM: dtsi: sun8i-reference-design-tablet: " Quentin Schulz
2016-12-12  8:07 ` [PATCH v2 00/11] add support for VBUS max current and min voltage limits AXP20X and AXP22X PMICs Quentin Schulz
2016-12-17 15:54 ` Sebastian Reichel
2017-01-12  9:28 ` Maxime Ripard
2017-01-21  1:10   ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).