Skip to contentSkip to conversation

sunxi: axp2xx: disable ldoio0/1 at boot

PATCH New Hans de Goede 2 participants 2 messages Sep 12, 2016 X-powers multifunction PMIC device drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sunxi: axp2xx: disable ldoio0/1 at boot

When cold-booting the ldoio0/1 regulators are always off / the gpios are always at tristate. But when re-booting from android these are sometimes on. Disable them at axp_init time (iow as early as possible) to remove this difference between a cold boot and a reboot.

---
Changes in v2:
-Do not or pmic_bus_write results together

---
 drivers/power/axp209.c | 16 ++++++++++++++++
 drivers/power/axp221.c | 12 ++++++++++++
 2 files changed, 28 insertions(+)
drivers/power/axp209.c +16 -0
index fc162a1..731b75e 100644
@@ -167,6 +167,22 @@ int axp_init(void)
 			return rc;
 	}
 
+	/*
+	 * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting
+	 * from android these are sometimes on.
+	 */
+	rc = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT);
+	if (rc)
+		return rc;
+
+	rc = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
+	if (rc)
+		return rc;
+
+	rc = pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT);
+	if (rc)
+		return rc;
+
 	return 0;
 }
 
drivers/power/axp221.c +12 -0
index 727ab09..109d3f4 100644
@@ -223,6 +223,18 @@ int axp_init(void)
 	if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
 		return -ENODEV;
 
+	/*
+	 * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting
+	 * from android these are sometimes on.
+	 */
+	ret = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT);
+	if (ret)
+		return ret;
+
+	ret = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/1 sunxi: axp2xx: disable ldoio0/1 at boot

Quoted 7 lines · Hans de Goede

When cold-booting the ldoio0/1 regulators are always off / the gpios are always at tristate. But when re-booting from android these are sometimes on. Disable them at axp_init time (iow as early as possible)
to remove this difference between a cold boot and a reboot.