sunxi: axp2xx: disable ldoio0/1 at boot
authorHans de Goede <hdegoede@redhat.com>
Mon, 12 Sep 2016 07:52:52 +0000 (09:52 +0200)
committerHans de Goede <hdegoede@redhat.com>
Sat, 17 Sep 2016 12:37:39 +0000 (14:37 +0200)
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>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
drivers/power/axp209.c
drivers/power/axp221.c

index fc162a149eb37d4edf1aa1d4ee911c3afb904f86..731b75e50a04924a1c61ce4dada402f2cca0f64e 100644 (file)
@@ -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;
 }
 
index 727ab098068fe485d49e35d44549d402e06de3ef..109d3f468631d213e480c006f4796497c6df8680 100644 (file)
@@ -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;
 }