huangcm
2025-04-07 511b111543524704f6182b374e489f5d0e51db8c
fix(battery): fix suspend err & add usb en
3 files modified
24 ■■■■■ changed files
longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c 13 ●●●● patch | view | raw | blame | history
longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts 8 ●●●● patch | view | raw | blame | history
longan/kernel/linux-4.9/kernel/printk/printk.c 3 ●●●● patch | view | raw | blame | history
longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c
....@@ -454,6 +454,7 @@
454454 char bootreason[16] = {0};
455455 int ret = 0, bat_exist = 0;
456456 int dcin_exist = pmu_get_reg_value(AXP81X_STATUS);
457
+ int sys_mode = 0;
457458
458459 ret = script_parser_fetch(FDT_PATH_POWER_SPLY, "battery_exist", &bat_exist, 1);
459460 if (ret < 0) {
....@@ -470,7 +471,8 @@
470471 val = gd->pmu_saved_status;
471472 #endif
472473 #endif
473
- printf("kickpi pmu_get_sys_mode = %d\n", pmu_get_sys_mode());
474
+ sys_mode = pmu_get_sys_mode();
475
+ printf("kickpi pmu_get_sys_mode = %d\n", sys_mode);
474476 if ((val == -1) && (pmu_get_sys_mode() == SUNXI_CHARGING_FLAG)) {
475477 val = AXP_BOOT_SOURCE_CHARGER;
476478 pmu_set_sys_mode(0);
....@@ -478,11 +480,16 @@
478480
479481 if (bat_exist == 1) {
480482 /* When the battery exists, it can only be turned on by power key */
481
- if (pmu_axp707_get_poweron_source() != AXP_BOOT_SOURCE_BUTTON) {
483
+ if (pmu_axp707_get_poweron_source() != AXP_BOOT_SOURCE_BUTTON &&
484
+ sys_mode != 66 ) {
482485 val = AXP_BOOT_SOURCE_CHARGER;
483
- pmu_set_sys_mode(0);
486
+ pmu_set_sys_mode(66);
484487 printf("kickpi[bat_exist] not power key up when boot on \n");
485488 }
489
+
490
+ if (sys_mode == 66) {
491
+ pmu_set_sys_mode(0);
492
+ }
486493 }
487494
488495 switch (val) {
longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
....@@ -1336,10 +1336,10 @@
13361336 pinctrl-names = "default";
13371337 status = "okay";
13381338
1339
- sysled {
1340
- label = "sysled";
1341
- gpios = <&r_pio PL 10 1 0 1 1>;
1342
- linux,default_trigger = "heartbeat";
1339
+ usb2_en {
1340
+ label = "usb2_en";
1341
+ gpios = <&r_pio PL 10 1 0 1 0>;
1342
+ linux,default_trigger = "default-on";
13431343 };
13441344
13451345 spk_en {
longan/kernel/linux-4.9/kernel/printk/printk.c
....@@ -2151,12 +2151,13 @@
21512151 return __add_preferred_console(name, idx, options, NULL);
21522152 }
21532153
2154
-bool console_suspend_enabled = true;
2154
+bool console_suspend_enabled = false;
21552155 EXPORT_SYMBOL(console_suspend_enabled);
21562156
21572157 static int __init console_suspend_disable(char *str)
21582158 {
21592159 console_suspend_enabled = false;
2160
+ // console_suspend_enabled = true;
21602161 return 1;
21612162 }
21622163 __setup("no_console_suspend", console_suspend_disable);