]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sunxi: Implement poweroff support for axp818 pmic
authorChen-Yu Tsai <wens@csie.org>
Mon, 2 May 2016 02:28:14 +0000 (10:28 +0800)
committerHans de Goede <hdegoede@redhat.com>
Wed, 25 May 2016 15:52:39 +0000 (17:52 +0200)
Adds poweroff support for axp818 pmic.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/power/Kconfig
drivers/power/axp818.c
include/axp818.h

index 02cb8e7ba6874a3a71beb324874480f89bd4ab0e..d1375369c195099af052d4e7490a343e9d73ba04 100644 (file)
@@ -44,6 +44,7 @@ config AXP221_POWER
 config AXP818_POWER
        boolean "axp818 pmic support"
        depends on MACH_SUN8I_A83T
+       select CMD_POWEROFF
        ---help---
        Say y here to enable support for the axp818 pmic found on
        A83T dev board.
index bf6ecd6be59701cd994d4dd1bec66eaabca3d52c..af4d7a69032ad3aa8027b138a85970d82c30d185 100644 (file)
@@ -255,3 +255,14 @@ int axp_init(void)
 
        return 0;
 }
+
+int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       pmic_bus_write(AXP818_SHUTDOWN, AXP818_SHUTDOWN_POWEROFF);
+
+       /* infinite loop during shutdown */
+       while (1) {}
+
+       /* not reached */
+       return 0;
+}
index f7f343a194ab630fc17b3b02e23f8ca366e02ee8..959774c76fa63333b8569efa4235fede2bc50f1b 100644 (file)
@@ -55,6 +55,9 @@
 #define AXP818_ALDO2_CTRL      0x29
 #define AXP818_ALDO3_CTRL      0x2a
 
+#define AXP818_SHUTDOWN                0x32
+#define AXP818_SHUTDOWN_POWEROFF       (1 << 7)
+
 /* For axp_gpio.c */
 #define AXP_POWER_STATUS               0x00
 #define AXP_POWER_STATUS_VBUS_PRESENT          (1 << 5)