From 511b111543524704f6182b374e489f5d0e51db8c Mon Sep 17 00:00:00 2001 From: huangcm <1263938474@qq.com> Date: Fri, 11 Apr 2025 08:00:37 +0000 Subject: [PATCH] fix(battery): fix suspend err & add usb en --- longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c b/longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c index 23ba577..da87f35 100644 --- a/longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c +++ b/longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c @@ -454,6 +454,7 @@ char bootreason[16] = {0}; int ret = 0, bat_exist = 0; int dcin_exist = pmu_get_reg_value(AXP81X_STATUS); + int sys_mode = 0; ret = script_parser_fetch(FDT_PATH_POWER_SPLY, "battery_exist", &bat_exist, 1); if (ret < 0) { @@ -470,7 +471,8 @@ val = gd->pmu_saved_status; #endif #endif - printf("kickpi pmu_get_sys_mode = %d\n", pmu_get_sys_mode()); + sys_mode = pmu_get_sys_mode(); + printf("kickpi pmu_get_sys_mode = %d\n", sys_mode); if ((val == -1) && (pmu_get_sys_mode() == SUNXI_CHARGING_FLAG)) { val = AXP_BOOT_SOURCE_CHARGER; pmu_set_sys_mode(0); @@ -478,11 +480,16 @@ if (bat_exist == 1) { /* When the battery exists, it can only be turned on by power key */ - if (pmu_axp707_get_poweron_source() != AXP_BOOT_SOURCE_BUTTON) { + if (pmu_axp707_get_poweron_source() != AXP_BOOT_SOURCE_BUTTON && + sys_mode != 66 ) { val = AXP_BOOT_SOURCE_CHARGER; - pmu_set_sys_mode(0); + pmu_set_sys_mode(66); printf("kickpi[bat_exist] not power key up when boot on \n"); } + + if (sys_mode == 66) { + pmu_set_sys_mode(0); + } } switch (val) { -- Gitblit v1.6.2