From 5fc6eec0444a62f7a596240b200dd837059dba70 Mon Sep 17 00:00:00 2001
From: huangcm <1263938474@qq.com>
Date: Thu, 03 Jul 2025 02:59:43 +0000
Subject: [PATCH] feat(longan): add uart7 & 5000mA bat

---
 longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts                            |   40 +++++++-----
 longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/a133-kickpi-axp707-bat-5000mA.dtsi |  114 ++++++++++++++++++++++++++++++++++++++
 longan/brandy/brandy-2.0/u-boot-2018/board/sunxi/power_manage.c                      |    4 +
 longan/device/config/chips/a133/configs/c3/kickpi-k5.fex                             |    2 
 4 files changed, 141 insertions(+), 19 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 cc1a6dd..622dcfb 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
@@ -476,6 +476,7 @@
 		pmu_set_sys_mode(0);
 	}
 
+#if 0    
     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 &&
@@ -489,8 +490,9 @@
             pmu_set_sys_mode(0);
         }
     }
+#endif
 
-	switch (val) {
+    switch (val) {
 	case AXP_BOOT_SOURCE_BUTTON:
 		strncpy(bootreason, "button", sizeof("button"));
 		break;
diff --git a/longan/device/config/chips/a133/configs/c3/kickpi-k5.fex b/longan/device/config/chips/a133/configs/c3/kickpi-k5.fex
index 1046126..d2cb8c1 100755
--- a/longan/device/config/chips/a133/configs/c3/kickpi-k5.fex
+++ b/longan/device/config/chips/a133/configs/c3/kickpi-k5.fex
@@ -881,4 +881,4 @@
 keep-power-in-suspend	=
 ignore-pm-notify	=
 ;max-frequency	        = 150000000
-min-frequency = 150000
+min-frequency = 50000000
diff --git a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
index 683f3e4..35b6b40 100755
--- a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
+++ b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
@@ -401,8 +401,8 @@
 					pmu_ac_vol = <4600>;
 					pmu_ac_cur = <3000>;
 
-					// wakeup_ac_in;
-					// wakeup_ac_out;
+					wakeup_ac_in;
+					wakeup_ac_out;
 				};
 
 				usb_power_supply: usb_power_supply {
@@ -414,8 +414,8 @@
 					pmu_usbad_vol = <4600>;
 					pmu_usbad_cur = <2500>;
 
-					// wakeup_usb_in;
-					// wakeup_usb_out;
+					wakeup_usb_in;
+					wakeup_usb_out;
 				};
 
 				battery_power_supply: battery-power-supply {
@@ -490,7 +490,7 @@
 					pmu_bat_temp_para16 = <66>;
 
 					wakeup_bat_out;
-					/* wakeup_bat_in; */
+					wakeup_bat_in;
 					/* wakeup_bat_charging; */
 					/* wakeup_bat_charge_over; */
 					/* wakeup_low_warning1; */
@@ -1315,6 +1315,10 @@
 		uart4: uart@05001000 {
 			status = "okay";
 		};
+
+        uart7: uart@07080000 {
+            status = "okay";
+        };
 	};
 	gpu: gpu@0x01800000 {
 			gpu_idle = <1>;/*ic version ctrl*/
@@ -1390,17 +1394,17 @@
 				linux,default_trigger = "default-on";
 			};
 
-			PL2 {
-				label = "PL2";
-				gpios = <&r_pio PL 2 1 0 1 0>;
-				linux,default_trigger = "default-on";
-			};
+			// PL2 {
+			// 	label = "PL2";
+			// 	gpios = <&r_pio PL 2 1 0 1 0>;
+			// 	linux,default_trigger = "default-on";
+			// };
 
-			PL3 {
-				label = "PL3";
-				gpios = <&r_pio PL 3 1 0 1 0>;
-				linux,default_trigger = "default-on";
-			};
+			// PL3 {
+			// 	label = "PL3";
+			// 	gpios = <&r_pio PL 3 1 0 1 0>;
+			// 	linux,default_trigger = "default-on";
+			// };
 
 			PL4 {
 				label = "PL4";
@@ -1444,9 +1448,11 @@
    	rx-delay = <7>;
 };
 
-#include "lcd-lvds-7-1024-600.dtsi"
+//#include "lcd-lvds-7-1024-600.dtsi"
 //#include "lcd-lvds-21-1920-1080.dtsi"
 //#include "lcd-mipi-10-800-1280-v1.dtsi"
-//#include "lcd-mipi-10-800-1280-v2.dtsi"
+#include "lcd-mipi-10-800-1280-v2.dtsi"
 //#include "lcd-mipi-8-800-1280.dtsi"
 //#include "lcd-mipi-5-720-1280.dtsi"
+
+#include "a133-kickpi-axp707-bat-5000mA.dtsi"
diff --git a/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/a133-kickpi-axp707-bat-5000mA.dtsi b/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/a133-kickpi-axp707-bat-5000mA.dtsi
new file mode 100644
index 0000000..bc33032
--- /dev/null
+++ b/longan/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/a133-kickpi-axp707-bat-5000mA.dtsi
@@ -0,0 +1,114 @@
+&battery_power_supply {
+    status = "okay";
+
+    pmu_chg_ic_temp = <0>;
+    pmu_battery_rdc= <100>;
+    pmu_battery_cap = <5000>;
+    pmu_runtime_chgcur = <1000>;
+    pmu_suspend_chgcur = <2000>;
+    pmu_shutdown_chgcur = <2000>;
+    pmu_init_chgvol = <4204>;
+    pmu_battery_warning_level1 = <15>;
+    pmu_battery_warning_level2 = <0>;
+    pmu_chgled_func = <1>;
+    pmu_chgled_type = <0>;
+    ocv_coulumb_100 = <1>;
+
+    /* 3.1328 */
+    pmu_bat_para1 = <0>;
+    /* 3.2736 */
+    pmu_bat_para2 = <0>;
+    /* 3.3440 */
+    pmu_bat_para3 = <0>;
+    /* 3.4144 */
+    pmu_bat_para4 = <0>;
+    /* 3.4848 */
+    pmu_bat_para5 = <1>;
+    /* 3.5552 */
+    pmu_bat_para6 = <3>;
+    /* 3.5904 */
+    pmu_bat_para7 = <6>;
+    /* 3.6080 */
+    pmu_bat_para8 = <8>;
+    /* 3.6256 */
+    pmu_bat_para9 = <10>;
+    /* 3.6432 */
+    pmu_bat_para10 = <12>;
+    /* 3.6608 */
+    pmu_bat_para11 = <15>;
+    /* 3.6960 */
+    pmu_bat_para12 = <21>;
+    /* 3.7312 */
+    pmu_bat_para13 = <29>;
+    /* 3.7664 */
+    pmu_bat_para14 = <36>;
+    /* 3.8016 */
+    pmu_bat_para15 = <41>;
+    /* 3.8192 */
+    pmu_bat_para16 = <43>;
+    /* 3.8368 */
+    pmu_bat_para17 = <45>;
+    /* 3.8544 */
+    pmu_bat_para18 = <47>;
+    /* 3.8720 */
+    pmu_bat_para19 = <49>;
+    /* 3.9072 */
+    pmu_bat_para20 = <53>;
+    /* 3.9424 */
+    pmu_bat_para21 = <57>;
+    /* 3.9776 */
+    pmu_bat_para22 = <63>;
+    /* 4.0128 */
+    pmu_bat_para23 = <70>;
+    /* 4.0480 */
+    pmu_bat_para24 = <74>;
+    /* 4.0832 */
+    pmu_bat_para25 = <79>;
+    /* 4.1184 */
+    pmu_bat_para26 = <83>;
+    /* 4.1360 */
+    pmu_bat_para27 = <87>;
+    /* 4.1536 */
+    pmu_bat_para28 = <90>;
+    /* 4.1888 */
+    pmu_bat_para29 = <94>;
+    /* 4.224 */
+    pmu_bat_para30 = <100>;
+    /* 4.2592 */
+    pmu_bat_para31 = <100>;
+    /* 4.2944 */
+    pmu_bat_para32 = <100>;
+
+    pmu_bat_temp_enable = <0>;
+    pmu_bat_charge_ltf = <1105>;
+    pmu_bat_charge_htf = <121>;
+    pmu_bat_shutdown_ltf = <1381>;
+    pmu_bat_shutdown_htf = <89>;
+    pmu_bat_temp_para1 = <2814>;
+    pmu_bat_temp_para2 = <2202>;
+    pmu_bat_temp_para3 = <1737>;
+    pmu_bat_temp_para4 = <1381>;
+    pmu_bat_temp_para5 = <1105>;
+    pmu_bat_temp_para6 = <890>;
+    pmu_bat_temp_para7 = <722>;
+    pmu_bat_temp_para8 = <484>;
+    pmu_bat_temp_para9 = <332>;
+    pmu_bat_temp_para10 = <233>;
+    pmu_bat_temp_para11 = <196>;
+    pmu_bat_temp_para12 = <166>;
+    pmu_bat_temp_para13 = <141>;
+    pmu_bat_temp_para14 = <121>;
+    pmu_bat_temp_para15 = <89>;
+    pmu_bat_temp_para16 = <66>;
+
+    wakeup_bat_out;
+    /* wakeup_bat_in; */
+    /* wakeup_bat_charging; */
+    /* wakeup_bat_charge_over; */
+    /* wakeup_low_warning1; */
+    /* wakeup_low_warning2; */
+    /* wakeup_bat_untemp_work; */
+    /* wakeup_bat_ovtemp_work; */
+    /* wakeup_bat_untemp_chg; */
+    /* wakeup_bat_ovtemp_chg; */
+};
\ No newline at end of file

--
Gitblit v1.6.2