devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
@ 2016-06-02 17:18 Hans de Goede
  2016-06-02 17:18 ` [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges Hans de Goede
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Hans de Goede @ 2016-06-02 17:18 UTC (permalink / raw)
  To: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree, Hans de Goede

The usb power-supply on the axp22x pmics is mostly identical to the
one on the axp20x pmics. One significant difference is that it cannot
measure / monitor the usb voltage / current.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Use compatible instead of axp20x->variant to detect pmic type
---
 .../bindings/power_supply/axp20x_usb_power.txt     |  3 +-
 drivers/power/axp20x_usb_power.c                   | 92 ++++++++++++++++------
 2 files changed, 71 insertions(+), 24 deletions(-)

diff --git a/Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt b/Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
index 862f4a4..f1d7bee 100644
--- a/Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
+++ b/Documentation/devicetree/bindings/power_supply/axp20x_usb_power.txt
@@ -1,7 +1,8 @@
 AXP20x USB power supply
 
 Required Properties:
--compatible: "x-powers,axp202-usb-power-supply"
+-compatible: One of: "x-powers,axp202-usb-power-supply"
+                     "x-powers,axp221-usb-power-supply"
 
 This node is a subnode of the axp20x PMIC.
 
diff --git a/drivers/power/axp20x_usb_power.c b/drivers/power/axp20x_usb_power.c
index 421a90b..6af6feb 100644
--- a/drivers/power/axp20x_usb_power.c
+++ b/drivers/power/axp20x_usb_power.c
@@ -42,6 +42,7 @@
 #define AXP20X_VBUS_MON_VBUS_VALID	BIT(3)
 
 struct axp20x_usb_power {
+	struct device_node *np;
 	struct regmap *regmap;
 	struct power_supply *supply;
 };
@@ -85,7 +86,12 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 
 		switch (v & AXP20X_VBUS_CLIMIT_MASK) {
 		case AXP20X_VBUC_CLIMIT_100mA:
-			val->intval = 100000;
+			if (of_device_is_compatible(power->np,
+					"x-powers,axp202-usb-power-supply")) {
+				val->intval = 100000;
+			} else {
+				val->intval = -1; /* No 100mA limit */
+			}
 			break;
 		case AXP20X_VBUC_CLIMIT_500mA:
 			val->intval = 500000;
@@ -122,16 +128,19 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
 			break;
 		}
 
-		ret = regmap_read(power->regmap, AXP20X_USB_OTG_STATUS, &v);
-		if (ret)
-			return ret;
+		val->intval = POWER_SUPPLY_HEALTH_GOOD;
 
-		if (!(v & AXP20X_USB_STATUS_VBUS_VALID)) {
-			val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
-			break;
-		}
+		if (of_device_is_compatible(power->np,
+				"x-powers,axp202-usb-power-supply")) {
+			ret = regmap_read(power->regmap,
+					  AXP20X_USB_OTG_STATUS, &v);
+			if (ret)
+				return ret;
 
-		val->intval = POWER_SUPPLY_HEALTH_GOOD;
+			if (!(v & AXP20X_USB_STATUS_VBUS_VALID))
+				val->intval =
+					POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
+		}
 		break;
 	case POWER_SUPPLY_PROP_PRESENT:
 		val->intval = !!(input & AXP20X_PWR_STATUS_VBUS_PRESENT);
@@ -156,6 +165,14 @@ static enum power_supply_property axp20x_usb_power_properties[] = {
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 };
 
+static enum power_supply_property axp22x_usb_power_properties[] = {
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_ONLINE,
+	POWER_SUPPLY_PROP_VOLTAGE_MIN,
+	POWER_SUPPLY_PROP_CURRENT_MAX,
+};
+
 static const struct power_supply_desc axp20x_usb_power_desc = {
 	.name = "axp20x-usb",
 	.type = POWER_SUPPLY_TYPE_USB,
@@ -164,13 +181,25 @@ static const struct power_supply_desc axp20x_usb_power_desc = {
 	.get_property = axp20x_usb_power_get_property,
 };
 
+static const struct power_supply_desc axp22x_usb_power_desc = {
+	.name = "axp20x-usb",
+	.type = POWER_SUPPLY_TYPE_USB,
+	.properties = axp22x_usb_power_properties,
+	.num_properties = ARRAY_SIZE(axp22x_usb_power_properties),
+	.get_property = axp20x_usb_power_get_property,
+};
+
 static int axp20x_usb_power_probe(struct platform_device *pdev)
 {
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 	struct power_supply_config psy_cfg = {};
 	struct axp20x_usb_power *power;
-	static const char * const irq_names[] = { "VBUS_PLUGIN",
-		"VBUS_REMOVAL", "VBUS_VALID", "VBUS_NOT_VALID" };
+	static const char * const axp20x_irq_names[] = { "VBUS_PLUGIN",
+		"VBUS_REMOVAL", "VBUS_VALID", "VBUS_NOT_VALID", NULL };
+	static const char * const axp22x_irq_names[] = {
+		"VBUS_PLUGIN", "VBUS_REMOVAL", NULL };
+	static const char * const *irq_names;
+	const struct power_supply_desc *usb_power_desc;
 	int i, irq, ret;
 
 	if (!of_device_is_available(pdev->dev.of_node))
@@ -185,31 +214,47 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
 	if (!power)
 		return -ENOMEM;
 
+	power->np = pdev->dev.of_node;
 	power->regmap = axp20x->regmap;
 
-	/* Enable vbus valid checking */
-	ret = regmap_update_bits(power->regmap, AXP20X_VBUS_MON,
-		    AXP20X_VBUS_MON_VBUS_VALID, AXP20X_VBUS_MON_VBUS_VALID);
-	if (ret)
-		return ret;
+	if (of_device_is_compatible(power->np,
+			"x-powers,axp202-usb-power-supply")) {
+		/* Enable vbus valid checking */
+		ret = regmap_update_bits(power->regmap, AXP20X_VBUS_MON,
+					 AXP20X_VBUS_MON_VBUS_VALID,
+					 AXP20X_VBUS_MON_VBUS_VALID);
+		if (ret)
+			return ret;
 
-	/* Enable vbus voltage and current measurement */
-	ret = regmap_update_bits(power->regmap, AXP20X_ADC_EN1,
+		/* Enable vbus voltage and current measurement */
+		ret = regmap_update_bits(power->regmap, AXP20X_ADC_EN1,
 			AXP20X_ADC_EN1_VBUS_CURR | AXP20X_ADC_EN1_VBUS_VOLT,
 			AXP20X_ADC_EN1_VBUS_CURR | AXP20X_ADC_EN1_VBUS_VOLT);
-	if (ret)
-		return ret;
+		if (ret)
+			return ret;
+
+		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")) {
+		usb_power_desc = &axp22x_usb_power_desc;
+		irq_names = axp22x_irq_names;
+	} else {
+		dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
+			axp20x->variant);
+		return -EINVAL;
+	}
 
 	psy_cfg.of_node = pdev->dev.of_node;
 	psy_cfg.drv_data = power;
 
-	power->supply = devm_power_supply_register(&pdev->dev,
-					&axp20x_usb_power_desc, &psy_cfg);
+	power->supply = devm_power_supply_register(&pdev->dev, usb_power_desc,
+						   &psy_cfg);
 	if (IS_ERR(power->supply))
 		return PTR_ERR(power->supply);
 
 	/* Request irqs after registering, as irqs may trigger immediately */
-	for (i = 0; i < ARRAY_SIZE(irq_names); i++) {
+	for (i = 0; irq_names[i]; i++) {
 		irq = platform_get_irq_byname(pdev, irq_names[i]);
 		if (irq < 0) {
 			dev_warn(&pdev->dev, "No IRQ for %s: %d\n",
@@ -229,6 +274,7 @@ 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" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
-- 
2.7.4


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

* [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges
  2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
@ 2016-06-02 17:18 ` Hans de Goede
  2016-06-10 14:57   ` Lee Jones
       [not found] ` <1464887936-17020-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2016-06-02 17:18 UTC (permalink / raw)
  To: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree, Hans de Goede

The axp22x pmic has a bunch of volatile registers besides the interrupt
ones, extend axp22x_volatile_ranges with these.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
-Added Chen-Yu's Acked-by
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index e4e3297..ca04361 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -93,7 +93,10 @@ static const struct regmap_range axp22x_writeable_ranges[] = {
 };
 
 static const struct regmap_range axp22x_volatile_ranges[] = {
+	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
 	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),
 };
 
 static const struct regmap_access_table axp22x_writeable_table = {
-- 
2.7.4


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

* [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics
       [not found] ` <1464887936-17020-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-06-02 17:18   ` Hans de Goede
  2016-06-03  1:20     ` Chen-Yu Tsai
  2016-06-10 14:56     ` Lee Jones
  0 siblings, 2 replies; 15+ messages in thread
From: Hans de Goede @ 2016-06-02 17:18 UTC (permalink / raw)
  To: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-pm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
	Hans de Goede

Add axp20x-usb-power-supply for axp22x pmics.

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
Changes in v2:
-Change compatible string for axp22x usb-power-supply cell to match v2 of:
 "power: axp20x_usb: Add support for usb power-supply on axp22x pmics"
---
 drivers/mfd/axp20x.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ca04361..6364dab 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -160,6 +160,11 @@ static struct resource axp20x_usb_power_supply_resources[] = {
 	DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"),
 };
 
+static struct resource axp22x_usb_power_supply_resources[] = {
+	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
+	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
+};
+
 static struct resource axp22x_pek_resources[] = {
 	{
 		.name   = "PEK_DBR",
@@ -527,6 +532,11 @@ static struct mfd_cell axp22x_cells[] = {
 		.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,
 	},
 };
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator
  2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
  2016-06-02 17:18 ` [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges Hans de Goede
       [not found] ` <1464887936-17020-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-06-02 17:18 ` Hans de Goede
  2016-06-03  1:38   ` Chen-Yu Tsai
  2016-06-03  1:39 ` [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Chen-Yu Tsai
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2016-06-02 17:18 UTC (permalink / raw)
  To: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree, Hans de Goede

The axp20x pmics have 2 power inputs, one called ACIN which is intended
for to be supplied via a powerbarrel on the board and one called VBUS
which is intended to be supplied via an otg connector.

In the VBUS case the pmic needs to know if the board is supplying power
to the otg connector, because then it should not take any power from
its VBUS pin. The axp209 pmic has a N_VBUSEN input pin via which the
board can signal to the pmic whether the board is supplying power to the
otg connector or not.

On the axp221/axp223 this pin can alternatively be used as an output
which controls an external regulator which (optionally) supplies
power to the otg connector from the board. When the pin is used as
output it is called DRIVEVBUS in the datasheet.

This commit adds support for the DRIVEVBUS pin as an extra pmic
controlled regulator. Since this is optional a new x-powers,drivebus dt
property is added. When this is present the misc-control register is
written to change the N_VBUSEN input pin to DRIVEVBUS output pin mode and
the extra drivebus regulator is registered with the regulator subsystem.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Rename the dt property to drive-vbus-en
-s/drivebus/drivevbus/
-Add a line describing the drivevbus regulator to the table in
 Documentation/devicetree/bindings/mfd/axp20x.txt
-Set supply_name to drivevbus-supply
---
 Documentation/devicetree/bindings/mfd/axp20x.txt |  6 +++++
 drivers/regulator/axp20x-regulator.c             | 30 ++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
index d20b103..6aca4fe 100644
--- a/Documentation/devicetree/bindings/mfd/axp20x.txt
+++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
@@ -22,6 +22,11 @@ Optional properties:
 		      AXP152/20X: range:  750-1875, Default: 1.5 MHz
 		      AXP22X/80X: range: 1800-4050, Default: 3   MHz
 
+- x-powers,drive-vbus-en: axp221 / axp223 only boolean, set this when the
+                  N_VBUSEN pin is used as an output pin to control an external
+                  regulator to drive the OTG VBus, rather then as an input pin
+                  which signals whether the board is driving OTG VBus or not.
+
 - <input>-supply: a phandle to the regulator supply node. May be omitted if
 		  inputs are unregulated, such as using the IPSOUT output
 		  from the PMIC.
@@ -79,6 +84,7 @@ ELDO3		: LDO		: eldoin-supply		: shared supply
 LDO_IO0		: LDO		: ips-supply		: GPIO 0
 LDO_IO1		: LDO		: ips-supply		: GPIO 1
 RTC_LDO		: LDO		: ips-supply		: always on
+DRIVEVBUS	: Enable output	: drivevbus-supply	: external regulator
 
 AXP809 regulators, type, and corresponding input supply names:
 
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 728be64..3f1bba4 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -36,6 +36,8 @@
 
 #define AXP20X_FREQ_DCDC_MASK		0x0f
 
+#define AXP22X_MISC_N_VBUSEN_FUNC	BIT(4)
+
 #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
 		    _vmask, _ereg, _emask, _enable_val, _disable_val)		\
 	[_family##_##_id] = {							\
@@ -230,6 +232,18 @@ static const struct regulator_desc axp22x_regulators[] = {
 	AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
 };
 
+static const struct regulator_desc axp22x_drivevbus_regulator = {
+	.name		= "drivevbus",
+	.supply_name	= "drivevbus-supply",
+	.of_match	= of_match_ptr("drivevbus"),
+	.regulators_node = of_match_ptr("regulators"),
+	.type		= REGULATOR_VOLTAGE,
+	.owner		= THIS_MODULE,
+	.enable_reg	= AXP20X_VBUS_IPSOUT_MGMT,
+	.enable_mask	= BIT(2),
+	.ops		= &axp20x_ops_sw,
+};
+
 static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
 	REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
 	REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
@@ -411,6 +425,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 	u32 workmode;
 	const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
 	const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
+	bool drivevbus = false;
 
 	switch (axp20x->variant) {
 	case AXP202_ID:
@@ -422,6 +437,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 	case AXP223_ID:
 		regulators = axp22x_regulators;
 		nregulators = AXP22X_REG_ID_MAX;
+		drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
+						  "x-powers,drive-vbus-en");
 		break;
 	case AXP809_ID:
 		regulators = axp809_regulators;
@@ -500,6 +517,19 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 						&dcdc5_name);
 	}
 
+	if (drivevbus) {
+		/* Change N_VBUSEN sense pin to DRIVEVBUS output pin */
+		regmap_update_bits(axp20x->regmap, AXP20X_OVER_TMP,
+				   AXP22X_MISC_N_VBUSEN_FUNC, 0);
+		rdev = devm_regulator_register(&pdev->dev,
+					       &axp22x_drivevbus_regulator,
+					       &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "Failed to register drivevbus\n");
+			return PTR_ERR(rdev);
+		}
+	}
+
 	return 0;
 }
 
-- 
2.7.4


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

* Re: [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics
  2016-06-02 17:18   ` [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics Hans de Goede
@ 2016-06-03  1:20     ` Chen-Yu Tsai
  2016-06-10 14:56     ` Lee Jones
  1 sibling, 0 replies; 15+ messages in thread
From: Chen-Yu Tsai @ 2016-06-03  1:20 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Maxime Ripard, Chen-Yu Tsai, linux-pm,
	linux-arm-kernel, devicetree

On Fri, Jun 3, 2016 at 1:18 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> Add axp20x-usb-power-supply for axp22x pmics.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

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

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

* Re: [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator
  2016-06-02 17:18 ` [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator Hans de Goede
@ 2016-06-03  1:38   ` Chen-Yu Tsai
  2016-06-03 16:59     ` Hans de Goede
  0 siblings, 1 reply; 15+ messages in thread
From: Chen-Yu Tsai @ 2016-06-03  1:38 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Maxime Ripard, Chen-Yu Tsai, linux-pm,
	linux-arm-kernel, devicetree

Hi,

On Fri, Jun 3, 2016 at 1:18 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> The axp20x pmics have 2 power inputs, one called ACIN which is intended
> for to be supplied via a powerbarrel on the board and one called VBUS
> which is intended to be supplied via an otg connector.
>
> In the VBUS case the pmic needs to know if the board is supplying power
> to the otg connector, because then it should not take any power from
> its VBUS pin. The axp209 pmic has a N_VBUSEN input pin via which the
> board can signal to the pmic whether the board is supplying power to the
> otg connector or not.
>
> On the axp221/axp223 this pin can alternatively be used as an output
> which controls an external regulator which (optionally) supplies
> power to the otg connector from the board. When the pin is used as
> output it is called DRIVEVBUS in the datasheet.
>
> This commit adds support for the DRIVEVBUS pin as an extra pmic
> controlled regulator. Since this is optional a new x-powers,drivebus dt
> property is added. When this is present the misc-control register is
> written to change the N_VBUSEN input pin to DRIVEVBUS output pin mode and
> the extra drivebus regulator is registered with the regulator subsystem.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Rename the dt property to drive-vbus-en
> -s/drivebus/drivevbus/
> -Add a line describing the drivevbus regulator to the table in
>  Documentation/devicetree/bindings/mfd/axp20x.txt
> -Set supply_name to drivevbus-supply
> ---
>  Documentation/devicetree/bindings/mfd/axp20x.txt |  6 +++++
>  drivers/regulator/axp20x-regulator.c             | 30 ++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
> index d20b103..6aca4fe 100644
> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
> @@ -22,6 +22,11 @@ Optional properties:
>                       AXP152/20X: range:  750-1875, Default: 1.5 MHz
>                       AXP22X/80X: range: 1800-4050, Default: 3   MHz
>
> +- x-powers,drive-vbus-en: axp221 / axp223 only boolean, set this when the
> +                  N_VBUSEN pin is used as an output pin to control an external
> +                  regulator to drive the OTG VBus, rather then as an input pin
> +                  which signals whether the board is driving OTG VBus or not.

Git complains about space indentation here.

> +
>  - <input>-supply: a phandle to the regulator supply node. May be omitted if
>                   inputs are unregulated, such as using the IPSOUT output
>                   from the PMIC.
> @@ -79,6 +84,7 @@ ELDO3         : LDO           : eldoin-supply         : shared supply
>  LDO_IO0                : LDO           : ips-supply            : GPIO 0
>  LDO_IO1                : LDO           : ips-supply            : GPIO 1
>  RTC_LDO                : LDO           : ips-supply            : always on
> +DRIVEVBUS      : Enable output : drivevbus-supply      : external regulator
>
>  AXP809 regulators, type, and corresponding input supply names:
>
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index 728be64..3f1bba4 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -36,6 +36,8 @@
>
>  #define AXP20X_FREQ_DCDC_MASK          0x0f
>
> +#define AXP22X_MISC_N_VBUSEN_FUNC      BIT(4)
> +
>  #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg,   \
>                     _vmask, _ereg, _emask, _enable_val, _disable_val)           \
>         [_family##_##_id] = {                                                   \
> @@ -230,6 +232,18 @@ static const struct regulator_desc axp22x_regulators[] = {
>         AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
>  };
>
> +static const struct regulator_desc axp22x_drivevbus_regulator = {
> +       .name           = "drivevbus",
> +       .supply_name    = "drivevbus-supply",

The "-supply" suffix is added by the regulator core upon lookup. No need
to add it here. I assume the regulator core won't get confused over a
supply name that's the same as the regulator requesting it.


Otherwise,

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

> +       .of_match       = of_match_ptr("drivevbus"),
> +       .regulators_node = of_match_ptr("regulators"),
> +       .type           = REGULATOR_VOLTAGE,
> +       .owner          = THIS_MODULE,
> +       .enable_reg     = AXP20X_VBUS_IPSOUT_MGMT,
> +       .enable_mask    = BIT(2),
> +       .ops            = &axp20x_ops_sw,
> +};
> +
>  static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
>         REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
>         REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
> @@ -411,6 +425,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>         u32 workmode;
>         const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
>         const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
> +       bool drivevbus = false;
>
>         switch (axp20x->variant) {
>         case AXP202_ID:
> @@ -422,6 +437,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>         case AXP223_ID:
>                 regulators = axp22x_regulators;
>                 nregulators = AXP22X_REG_ID_MAX;
> +               drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
> +                                                 "x-powers,drive-vbus-en");
>                 break;
>         case AXP809_ID:
>                 regulators = axp809_regulators;
> @@ -500,6 +517,19 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>                                                 &dcdc5_name);
>         }
>
> +       if (drivevbus) {
> +               /* Change N_VBUSEN sense pin to DRIVEVBUS output pin */
> +               regmap_update_bits(axp20x->regmap, AXP20X_OVER_TMP,
> +                                  AXP22X_MISC_N_VBUSEN_FUNC, 0);
> +               rdev = devm_regulator_register(&pdev->dev,
> +                                              &axp22x_drivevbus_regulator,
> +                                              &config);
> +               if (IS_ERR(rdev)) {
> +                       dev_err(&pdev->dev, "Failed to register drivevbus\n");
> +                       return PTR_ERR(rdev);
> +               }
> +       }
> +
>         return 0;
>  }
>
> --
> 2.7.4
>

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

* Re: [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
                   ` (2 preceding siblings ...)
  2016-06-02 17:18 ` [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator Hans de Goede
@ 2016-06-03  1:39 ` Chen-Yu Tsai
  2016-06-04 14:01 ` Sebastian Reichel
  2016-06-06 13:26 ` Rob Herring
  5 siblings, 0 replies; 15+ messages in thread
From: Chen-Yu Tsai @ 2016-06-03  1:39 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Maxime Ripard, Chen-Yu Tsai, linux-pm,
	linux-arm-kernel, devicetree

On Fri, Jun 3, 2016 at 1:18 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> The usb power-supply on the axp22x pmics is mostly identical to the
> one on the axp20x pmics. One significant difference is that it cannot
> measure / monitor the usb voltage / current.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

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

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

* Re: [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator
  2016-06-03  1:38   ` Chen-Yu Tsai
@ 2016-06-03 16:59     ` Hans de Goede
  0 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2016-06-03 16:59 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: devicetree, linux-pm, Dmitry Eremin-Solenikov, Lee Jones,
	Sebastian Reichel, Maxime Ripard, David Woodhouse,
	linux-arm-kernel

Hi,

On 03-06-16 03:38, Chen-Yu Tsai wrote:
> Hi,
>
> On Fri, Jun 3, 2016 at 1:18 AM, Hans de Goede <hdegoede@redhat.com> wrote:
>> The axp20x pmics have 2 power inputs, one called ACIN which is intended
>> for to be supplied via a powerbarrel on the board and one called VBUS
>> which is intended to be supplied via an otg connector.
>>
>> In the VBUS case the pmic needs to know if the board is supplying power
>> to the otg connector, because then it should not take any power from
>> its VBUS pin. The axp209 pmic has a N_VBUSEN input pin via which the
>> board can signal to the pmic whether the board is supplying power to the
>> otg connector or not.
>>
>> On the axp221/axp223 this pin can alternatively be used as an output
>> which controls an external regulator which (optionally) supplies
>> power to the otg connector from the board. When the pin is used as
>> output it is called DRIVEVBUS in the datasheet.
>>
>> This commit adds support for the DRIVEVBUS pin as an extra pmic
>> controlled regulator. Since this is optional a new x-powers,drivebus dt
>> property is added. When this is present the misc-control register is
>> written to change the N_VBUSEN input pin to DRIVEVBUS output pin mode and
>> the extra drivebus regulator is registered with the regulator subsystem.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Changes in v2:
>> -Rename the dt property to drive-vbus-en
>> -s/drivebus/drivevbus/
>> -Add a line describing the drivevbus regulator to the table in
>>  Documentation/devicetree/bindings/mfd/axp20x.txt
>> -Set supply_name to drivevbus-supply
>> ---
>>  Documentation/devicetree/bindings/mfd/axp20x.txt |  6 +++++
>>  drivers/regulator/axp20x-regulator.c             | 30 ++++++++++++++++++++++++
>>  2 files changed, 36 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> index d20b103..6aca4fe 100644
>> --- a/Documentation/devicetree/bindings/mfd/axp20x.txt
>> +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt
>> @@ -22,6 +22,11 @@ Optional properties:
>>                       AXP152/20X: range:  750-1875, Default: 1.5 MHz
>>                       AXP22X/80X: range: 1800-4050, Default: 3   MHz
>>
>> +- x-powers,drive-vbus-en: axp221 / axp223 only boolean, set this when the
>> +                  N_VBUSEN pin is used as an output pin to control an external
>> +                  regulator to drive the OTG VBus, rather then as an input pin
>> +                  which signals whether the board is driving OTG VBus or not.
>
> Git complains about space indentation here.
>
>> +
>>  - <input>-supply: a phandle to the regulator supply node. May be omitted if
>>                   inputs are unregulated, such as using the IPSOUT output
>>                   from the PMIC.
>> @@ -79,6 +84,7 @@ ELDO3         : LDO           : eldoin-supply         : shared supply
>>  LDO_IO0                : LDO           : ips-supply            : GPIO 0
>>  LDO_IO1                : LDO           : ips-supply            : GPIO 1
>>  RTC_LDO                : LDO           : ips-supply            : always on
>> +DRIVEVBUS      : Enable output : drivevbus-supply      : external regulator
>>
>>  AXP809 regulators, type, and corresponding input supply names:
>>
>> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
>> index 728be64..3f1bba4 100644
>> --- a/drivers/regulator/axp20x-regulator.c
>> +++ b/drivers/regulator/axp20x-regulator.c
>> @@ -36,6 +36,8 @@
>>
>>  #define AXP20X_FREQ_DCDC_MASK          0x0f
>>
>> +#define AXP22X_MISC_N_VBUSEN_FUNC      BIT(4)
>> +
>>  #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg,   \
>>                     _vmask, _ereg, _emask, _enable_val, _disable_val)           \
>>         [_family##_##_id] = {                                                   \
>> @@ -230,6 +232,18 @@ static const struct regulator_desc axp22x_regulators[] = {
>>         AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
>>  };
>>
>> +static const struct regulator_desc axp22x_drivevbus_regulator = {
>> +       .name           = "drivevbus",
>> +       .supply_name    = "drivevbus-supply",
>
> The "-supply" suffix is added by the regulator core upon lookup. No need
> to add it here. I assume the regulator core won't get confused over a
> supply name that's the same as the regulator requesting it.
>
>
> Otherwise,
>
> Acked-by: Chen-Yu Tsai <wens@csie.org>

Thanks, I'll send a v3 with both issues fixed.

Regards,

Hans

>
>> +       .of_match       = of_match_ptr("drivevbus"),
>> +       .regulators_node = of_match_ptr("regulators"),
>> +       .type           = REGULATOR_VOLTAGE,
>> +       .owner          = THIS_MODULE,
>> +       .enable_reg     = AXP20X_VBUS_IPSOUT_MGMT,
>> +       .enable_mask    = BIT(2),
>> +       .ops            = &axp20x_ops_sw,
>> +};
>> +
>>  static const struct regulator_linear_range axp809_dcdc4_ranges[] = {
>>         REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),
>>         REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),
>> @@ -411,6 +425,7 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>>         u32 workmode;
>>         const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name;
>>         const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name;
>> +       bool drivevbus = false;
>>
>>         switch (axp20x->variant) {
>>         case AXP202_ID:
>> @@ -422,6 +437,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>>         case AXP223_ID:
>>                 regulators = axp22x_regulators;
>>                 nregulators = AXP22X_REG_ID_MAX;
>> +               drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
>> +                                                 "x-powers,drive-vbus-en");
>>                 break;
>>         case AXP809_ID:
>>                 regulators = axp809_regulators;
>> @@ -500,6 +517,19 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>>                                                 &dcdc5_name);
>>         }
>>
>> +       if (drivevbus) {
>> +               /* Change N_VBUSEN sense pin to DRIVEVBUS output pin */
>> +               regmap_update_bits(axp20x->regmap, AXP20X_OVER_TMP,
>> +                                  AXP22X_MISC_N_VBUSEN_FUNC, 0);
>> +               rdev = devm_regulator_register(&pdev->dev,
>> +                                              &axp22x_drivevbus_regulator,
>> +                                              &config);
>> +               if (IS_ERR(rdev)) {
>> +                       dev_err(&pdev->dev, "Failed to register drivevbus\n");
>> +                       return PTR_ERR(rdev);
>> +               }
>> +       }
>> +
>>         return 0;
>>  }
>>
>> --
>> 2.7.4
>>

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

* Re: [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
                   ` (3 preceding siblings ...)
  2016-06-03  1:39 ` [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Chen-Yu Tsai
@ 2016-06-04 14:01 ` Sebastian Reichel
  2016-06-04 14:09   ` Hans de Goede
  2016-06-06 13:26 ` Rob Herring
  5 siblings, 1 reply; 15+ messages in thread
From: Sebastian Reichel @ 2016-06-04 14:01 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

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

Hi,

On Thu, Jun 02, 2016 at 07:18:53PM +0200, Hans de Goede wrote:
> The usb power-supply on the axp22x pmics is mostly identical to the
> one on the axp20x pmics. One significant difference is that it cannot
> measure / monitor the usb voltage / current.

Acked-By: Sebastian Reichel <sre@kernel.org>

What's the merge strategy for this patchset?

-- Sebastian

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

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

* Re: [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  2016-06-04 14:01 ` Sebastian Reichel
@ 2016-06-04 14:09   ` Hans de Goede
  2016-06-10  1:37     ` Sebastian Reichel
  0 siblings, 1 reply; 15+ messages in thread
From: Hans de Goede @ 2016-06-04 14:09 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Lee Jones, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

Hi,

On 04-06-16 16:01, Sebastian Reichel wrote:
> Hi,
>
> On Thu, Jun 02, 2016 at 07:18:53PM +0200, Hans de Goede wrote:
>> The usb power-supply on the axp22x pmics is mostly identical to the
>> one on the axp20x pmics. One significant difference is that it cannot
>> measure / monitor the usb voltage / current.
>
> Acked-By: Sebastian Reichel <sre@kernel.org>
>
> What's the merge strategy for this patchset?

All of the separate bits can be merged separately without
problems, so Lee can take the 2 mfd patches, you can take
the power-supply patch and Mark Brown can take the regulator
patch.

I believe that that is the best merge strategy.

Regards,

Hans

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

* Re: [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
                   ` (4 preceding siblings ...)
  2016-06-04 14:01 ` Sebastian Reichel
@ 2016-06-06 13:26 ` Rob Herring
  5 siblings, 0 replies; 15+ messages in thread
From: Rob Herring @ 2016-06-06 13:26 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Maxime Ripard, Chen-Yu Tsai, linux-pm,
	linux-arm-kernel, devicetree

On Thu, Jun 02, 2016 at 07:18:53PM +0200, Hans de Goede wrote:
> The usb power-supply on the axp22x pmics is mostly identical to the
> one on the axp20x pmics. One significant difference is that it cannot
> measure / monitor the usb voltage / current.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Use compatible instead of axp20x->variant to detect pmic type
> ---
>  .../bindings/power_supply/axp20x_usb_power.txt     |  3 +-

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

>  drivers/power/axp20x_usb_power.c                   | 92 ++++++++++++++++------
>  2 files changed, 71 insertions(+), 24 deletions(-)

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

* Re: [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  2016-06-04 14:09   ` Hans de Goede
@ 2016-06-10  1:37     ` Sebastian Reichel
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Reichel @ 2016-06-10  1:37 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Lee Jones, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

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

Hi,

On Sat, Jun 04, 2016 at 04:09:53PM +0200, Hans de Goede wrote:
> On 04-06-16 16:01, Sebastian Reichel wrote:
> > On Thu, Jun 02, 2016 at 07:18:53PM +0200, Hans de Goede wrote:
> > > The usb power-supply on the axp22x pmics is mostly identical to the
> > > one on the axp20x pmics. One significant difference is that it cannot
> > > measure / monitor the usb voltage / current.
> > 
> > Acked-By: Sebastian Reichel <sre@kernel.org>
> > 
> > What's the merge strategy for this patchset?
> 
> All of the separate bits can be merged separately without
> problems, [...]

OK, I queued the first patch with Rob's Acked-By.

-- Sebastian

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

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

* Re: [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics
  2016-06-02 17:18   ` [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics Hans de Goede
  2016-06-03  1:20     ` Chen-Yu Tsai
@ 2016-06-10 14:56     ` Lee Jones
  2016-06-10 18:47       ` Hans de Goede
  1 sibling, 1 reply; 15+ messages in thread
From: Lee Jones @ 2016-06-10 14:56 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

On Thu, 02 Jun 2016, Hans de Goede wrote:

> Add axp20x-usb-power-supply for axp22x pmics.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Change compatible string for axp22x usb-power-supply cell to match v2 of:
>  "power: axp20x_usb: Add support for usb power-supply on axp22x pmics"
> ---
>  drivers/mfd/axp20x.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index ca04361..6364dab 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -160,6 +160,11 @@ static struct resource axp20x_usb_power_supply_resources[] = {
>  	DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"),
>  };
>  
> +static struct resource axp22x_usb_power_supply_resources[] = {
> +	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
> +	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
> +};
> +
>  static struct resource axp22x_pek_resources[] = {
>  	{
>  		.name   = "PEK_DBR",
> @@ -527,6 +532,11 @@ static struct mfd_cell axp22x_cells[] = {
>  		.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,
>  	},
>  };
>  

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

* Re: [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges
  2016-06-02 17:18 ` [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges Hans de Goede
@ 2016-06-10 14:57   ` Lee Jones
  0 siblings, 0 replies; 15+ messages in thread
From: Lee Jones @ 2016-06-10 14:57 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

On Thu, 02 Jun 2016, Hans de Goede wrote:

> The axp22x pmic has a bunch of volatile registers besides the interrupt
> ones, extend axp22x_volatile_ranges with these.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> ---
> Changes in v2:
> -Added Chen-Yu's Acked-by
> ---
>  drivers/mfd/axp20x.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index e4e3297..ca04361 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -93,7 +93,10 @@ static const struct regmap_range axp22x_writeable_ranges[] = {
>  };
>  
>  static const struct regmap_range axp22x_volatile_ranges[] = {
> +	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
>  	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),
>  };
>  
>  static const struct regmap_access_table axp22x_writeable_table = {

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

* Re: [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics
  2016-06-10 14:56     ` Lee Jones
@ 2016-06-10 18:47       ` Hans de Goede
  0 siblings, 0 replies; 15+ messages in thread
From: Hans de Goede @ 2016-06-10 18:47 UTC (permalink / raw)
  To: Lee Jones
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Maxime Ripard, Chen-Yu Tsai, linux-pm, linux-arm-kernel,
	devicetree

Hi,

On 10-06-16 16:56, Lee Jones wrote:
> On Thu, 02 Jun 2016, Hans de Goede wrote:
>
>> Add axp20x-usb-power-supply for axp22x pmics.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Changes in v2:
>> -Change compatible string for axp22x usb-power-supply cell to match v2 of:
>>  "power: axp20x_usb: Add support for usb power-supply on axp22x pmics"
>> ---
>>  drivers/mfd/axp20x.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>
> Applied, thanks.

Thanks, any chance we can see this show up soonish in :

https://git.kernel.org/cgit/linux/kernel/git/lee/mfd.git/log/?h=for-mfd-next

?

We keep a branch with all the foo-for-next branches relevant for
sunxi merged in for testing and it would be good to get these in there.

Regards,

Hans



>
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index ca04361..6364dab 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -160,6 +160,11 @@ static struct resource axp20x_usb_power_supply_resources[] = {
>>  	DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"),
>>  };
>>
>> +static struct resource axp22x_usb_power_supply_resources[] = {
>> +	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
>> +	DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
>> +};
>> +
>>  static struct resource axp22x_pek_resources[] = {
>>  	{
>>  		.name   = "PEK_DBR",
>> @@ -527,6 +532,11 @@ static struct mfd_cell axp22x_cells[] = {
>>  		.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,
>>  	},
>>  };
>>
>

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

end of thread, other threads:[~2016-06-10 18:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 17:18 [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Hans de Goede
2016-06-02 17:18 ` [PATCH v2 2/4] mfd: axp20x: Extend axp22x_volatile_ranges Hans de Goede
2016-06-10 14:57   ` Lee Jones
     [not found] ` <1464887936-17020-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-06-02 17:18   ` [PATCH v2 3/4] mfd: axp20x: Add axp20x-usb-power-supply for axp22x pmics Hans de Goede
2016-06-03  1:20     ` Chen-Yu Tsai
2016-06-10 14:56     ` Lee Jones
2016-06-10 18:47       ` Hans de Goede
2016-06-02 17:18 ` [PATCH v2 4/4] regulator: axp20x: Add support for the (external) drivebus regulator Hans de Goede
2016-06-03  1:38   ` Chen-Yu Tsai
2016-06-03 16:59     ` Hans de Goede
2016-06-03  1:39 ` [PATCH v2 1/4] power: axp20x_usb: Add support for usb power-supply on axp22x pmics Chen-Yu Tsai
2016-06-04 14:01 ` Sebastian Reichel
2016-06-04 14:09   ` Hans de Goede
2016-06-10  1:37     ` Sebastian Reichel
2016-06-06 13:26 ` Rob Herring

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