]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/gpio/sunxi_gpio.c
power: axp221: Virtual VBUS detect and enable GPIOs to replace separate logic
[karo-tx-uboot.git] / drivers / gpio / sunxi_gpio.c
index 62960929ade9cca68185f758d482928aef0fec4f..670af0c383c5d981043873be9a9348e5613c7e6f 100644 (file)
@@ -21,6 +21,9 @@
 #ifdef CONFIG_AXP209_POWER
 #include <axp209.h>
 #endif
+#ifdef CONFIG_AXP221_POWER
+#include <axp221.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -125,6 +128,12 @@ int sunxi_name_to_gpio(const char *name)
 #ifdef AXP_GPIO
        if (strncasecmp(name, "AXP0-", 5) == 0) {
                name += 5;
+               if (strcmp(name, "VBUS-DETECT") == 0)
+                       return SUNXI_GPIO_AXP0_START +
+                               SUNXI_GPIO_AXP0_VBUS_DETECT;
+               if (strcmp(name, "VBUS-ENABLE") == 0)
+                       return SUNXI_GPIO_AXP0_START +
+                               SUNXI_GPIO_AXP0_VBUS_ENABLE;
                pin = simple_strtol(name, &eptr, 10);
                if (!*name || *eptr)
                        return -1;