Repository navigation
Conversation
|
@derekross the failing check is the W=1 build step of |
|
Thank you, @Somnius, for starting this in the kernel and for splitting it so the table comes first with nothing else attached. I checked the husky table against Google's tree ( Two things before it can go in, neither of them a fault in the patch:
One change, please: the message and the comment above Two smaller things you may want in the message:
When this lands it will have a new commit id (kernel PRs are rebase merges), so #266 and #267 will need |
The temperature guard takes its voltage tiers and its charge currents from three constant arrays, the step-charging table of the gs201 phones. The Pixel 8 Pro (husky) has another battery and another table: four tiers, 4.20/4.30/4.35/4.48 V, instead of three. Put the tiers and the currents in a struct guard_table, with the number of tiers in use, and let the driver pick the table at probe. The default table holds the numbers the arrays held, so nothing changes for the Pixel 7 Pro, the Pixel 6 Pro and every other board. A machine compatible with "google,zuma-husky" gets the husky table: the chg-cv-limits and chg-cc-limits of the google,battery node in Google's tree (kernel/devices/google/shusky, branch android-gs-shusky-6.1-android16): dts/zuma-shusky-battery.dtsi for the temperature and voltage limits, dts/zuma-husky-battery.dtsi for the 4950 mAh and the six rows, in percent of that design capacity. The temperature bands are the same in both and stay as they are. The tier and limit arithmetic of the guard work moves into two functions without side effects, guard_next_tier() and guard_limits(), so that it can be tested. The limits from the battery description still cap the float voltage and the charge current, and temp_guard is still off by default. With the husky battery node as it is today, 4.20 V and 1.485 A, the float stays 4.20 V in every band and the current 1.485 A, the lowest row of the husky table being 30 % of 4950 mAh. One case differs from the default table on that board: from 0 to 10 C with the battery at 4.20 V or more the current limit was 495 mA and is 1.485 A now, as the Google table has it. With the battery node's 1.485 A cap, every cell of the husky table that charges comes out at the cap, so the current does not change from band to band. What the table changes is the float per band (4.30 V at 0-10 C and 46-48 C, 4.20 V at 48-55 C), which only shows once the battery node asks for more than 4.20 V, and the one cold cell above. The same Google file also ages the table: google,aact-cc-limits lowers the 20-42 C row with use, and google,aafv-ref-offset lowers the float by up to 100 mV with cycles. That is not done here; it doesn't matter at 4.20 V and 0.3 C. Add KUnit tests, built into the driver with CHARGER_MAX77759_KUNIT_TEST: each band edge, the hysteresis, the tier steps of both tables, both tables against their numbers, and the limits with and without the caps of the battery description. They pass under UML (10 of 10), and the driver builds and links as an arm64 module, W=1 clean, with and without the tests. The MAINTAINERS entry of the driver now matches the test file too. Not run on a phone, neither a Pixel 8 Pro nor a Pixel 7 Pro. The choice of the table by the machine compatible is not covered by the tests. Signed-off-by: Lef <me@lefteros.com>
ed5f2e6 to
0d68188
Compare
|
@derekross done in 0d68188. The message and the comment above I added your two notes to the message too: with the battery node's 1.485 A cap every charging cell comes out at the cap, and the same file ages the table ( The gate fix for the red check is #851, which I updated today: derekross/omarchy-mobile#851 (comment). #266 and #267 are already rebased on this head. |
|
Thank you, @Somnius. The message and the comment now name Google's tree, branch and the two files, and that is the source I checked the table against, so that point is done. Your wording for the cap ("the per-band float only shows once the battery node asks for more than 4.20 V") is better than mine was. Nothing else changed in the code, and the commit builds here at W=1 with and without the tests. Two things are left and both are mine:
When this lands it gets a new commit id, so #266 will need |
@derekross first of three for the 92 % stop on my Pixel 8 Pro (derekross/omarchy-mobile#761). The cause is the bootloader's 4.35 V float that nothing in Linux raises yet. As you said on derekross/omarchy-mobile#272, the raise should come with the charger work in the kernel, so this starts there.
This one only gives husky its own step-charging table: four tiers, 4.20/4.30/4.35/4.48 V, with the currents from the factory device tree's google,battery node, in percent of 4950 mAh. The table is picked at probe by the
google,zuma-huskycompatible. The default table is byte for byte what the three arrays held, so the 7 Pro and 6 Pro don't change. The float doesn't move with this PR, husky still sits at 4.20 V from its battery node, andtemp_guardstays off by default.The one thing that differs on husky: from 0 to 10 C at 4.20 V or more the current limit was 495 mA and is now 1.485 A, as the factory table has it. Details in the commit message.
Tested: 10 KUnit cases under UML, all pass on the current tip (26867fc). The driver object builds for arm64 with W=1 and no warnings on that tip, and checkpatch --strict is clean. Not run on a phone, and the compatible match isn't covered by the tests.
Next two, after this one: the end and start thresholds plus a battery defender like stock's (4.27 V and 35 C for 6 hours, then hold at 80 %), then the husky float raise to 4.45 V with the DONE check last, so the float never goes up before the stop rule is in.