From 93333c9d6f596b58f3f9675b7862a6f15205edf7 Mon Sep 17 00:00:00 2001 From: danlovaj <314864377+danlovaj@users.noreply.github.com> Date: Thu, 3 Dec 2026 21:12:50 -0600 Subject: [PATCH] kboot: Copy 24-byte D2355 charger calibration table from ADT A9X iPad Pro 9.7-inch (J127/J128) carries a 24-byte low-voltage usb-input-limit-calibration table in the ADT /charger node rather than the 84-byte usb-input-limit-calibration-hv table used on A10X iPad Pro 2. Fall back to usb-input-limit-calibration (24 bytes) and copy it into apple,usb-input-limit-calibration on the apple,d2355-tristar-charger node. Assisted-by: LLM --- src/kboot.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/kboot.c b/src/kboot.c index 03ed2821c..c60d47059 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -964,9 +964,9 @@ static int dt_set_als(void) } /* - * The D2355 Lightning charger (A10X iPad Pro 2) scales its input-current - * limit by the unit's calibration in the ADT's /charger node. Copy the - * table into the charger's node. + * The D2355 Lightning charger (A9X iPad Pro 9.7-inch and A10X iPad Pro 2) + * scales its input-current limit by the unit's calibration in the ADT's + * /charger node. Copy the table into the charger's node. */ static int dt_set_charger_calibration(void) { @@ -982,12 +982,20 @@ static int dt_set_charger_calibration(void) u32 len; const u8 *table = adt_getprop(adt, anode, "usb-input-limit-calibration-hv", &len); - if (!table || len != 84) { - printf("ADT: charger input-limit calibration missing\n"); + if (table && len == 84) { + if (fdt_setprop(dt, node, "apple,usb-input-limit-calibration-hv", table, len) < 0) + bail("FDT: failed to set apple,usb-input-limit-calibration-hv\n"); return 0; } - if (fdt_setprop(dt, node, "apple,usb-input-limit-calibration-hv", table, len) < 0) - bail("FDT: failed to set apple,usb-input-limit-calibration-hv\n"); + + table = adt_getprop(adt, anode, "usb-input-limit-calibration", &len); + if (table && len == 24) { + if (fdt_setprop(dt, node, "apple,usb-input-limit-calibration", table, len) < 0) + bail("FDT: failed to set apple,usb-input-limit-calibration\n"); + return 0; + } + + printf("ADT: charger input-limit calibration missing\n"); return 0; }