x86: sandbox: pch: Add a CONFIG option for PCH
[oweals/u-boot.git] / drivers / power / axp221.c
index 727ab098068fe485d49e35d44549d402e06de3ef..c440047d36fe50669b820d499c39e28908ccd462 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * AXP221 and AXP223 driver
  *
@@ -6,8 +7,6 @@
  *
  * (C) Copyright 2014 Hans de Goede <hdegoede@redhat.com>
  * (C) Copyright 2013 Oliver Schinagl <oliver@schinagl.nl>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -223,6 +222,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;
 }