* [U-Boot] [PATCH] sunxi: axp2xx: disable ldoio0/1 at boot
@ 2016-09-12 7:55 Hans de Goede
2016-09-12 12:41 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2016-09-12 7:55 UTC (permalink / raw)
To: u-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.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/power/axp209.c | 10 +++++++++-
drivers/power/axp221.c | 9 ++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index fc162a1..998e114 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -167,7 +167,15 @@ int axp_init(void)
return rc;
}
- return 0;
+ /*
+ * 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);
+ rc |= pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
+ rc |= pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT);
+
+ return rc;
}
int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index 727ab09..0d14211 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -223,7 +223,14 @@ int axp_init(void)
if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
return -ENODEV;
- return 0;
+ /*
+ * 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);
+ ret |= pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
+
+ return ret;
}
int axp_get_sid(unsigned int *sid)
--
2.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] sunxi: axp2xx: disable ldoio0/1 at boot
2016-09-12 7:55 [U-Boot] [PATCH] sunxi: axp2xx: disable ldoio0/1 at boot Hans de Goede
@ 2016-09-12 12:41 ` Ian Campbell
2016-09-12 13:24 ` Hans de Goede
0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2016-09-12 12:41 UTC (permalink / raw)
To: u-boot
On Mon, 2016-09-12 at 09:55 +0200, Hans de Goede wrote:
> @@ -223,7 +223,14 @@ int axp_init(void)
> > ? if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
> > ? return -ENODEV;
> ?
> > - return 0;
> > + /*
> > + ?* 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);
> > + ret |= pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
If ret values are errno's (as the context suggests by containing
-ENODEV) then or-ing them together could result in corruption from
combining two distinct errno values.
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] sunxi: axp2xx: disable ldoio0/1 at boot
2016-09-12 12:41 ` Ian Campbell
@ 2016-09-12 13:24 ` Hans de Goede
0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2016-09-12 13:24 UTC (permalink / raw)
To: u-boot
Hi,
On 12-09-16 14:41, Ian Campbell wrote:
> On Mon, 2016-09-12 at 09:55 +0200, Hans de Goede wrote:
>> @@ -223,7 +223,14 @@ int axp_init(void)
>>> if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17))
>>> return -ENODEV;
>>
>>> - return 0;
>>> + /*
>>> + * 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);
>>> + ret |= pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT);
>
> If ret values are errno's (as the context suggests by containing
> -ENODEV) then or-ing them together could result in corruption from
> combining two distinct errno values.
True, v2 coming up ...
Regards,
Hans
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-12 13:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 7:55 [U-Boot] [PATCH] sunxi: axp2xx: disable ldoio0/1 at boot Hans de Goede
2016-09-12 12:41 ` Ian Campbell
2016-09-12 13:24 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.