Skip to content

omamobile-device-husky 0.1.18: the charger's options and sleep on the cable, inert - #899

Open
Somnius wants to merge 2 commits into
derekross:mainfrom
Somnius:husky-charger-guard-inert
Open

Somnius wants to merge 2 commits into
derekross:mainfrom
Somnius:husky-charger-guard-inert

Conversation

@Somnius

@Somnius Somnius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

This is the husky package piece @derekross asked for on linux-omarchy-mobile#267, before any float work. It follows #827 for the Pixel 7, with one difference below.

It adds omamobile-charger.conf with the same two lines as the Pixel 7: options max77759_charger default_ilim_ua=500000 temp_guard=1 and softdep max77759_charger pre: max17042_battery. Unlike #827 I kept blacklist max77759_charger in omamobile-max77759.conf, because on husky the kernel already has the pmic@66 node (linux-omarchy-mobile#163, merged), so dropping the blacklist would load the charger at boot. With the blacklist in place the options only apply when a runbook loads it by hand. The other three blacklists stay as they are.

For sleep on the cable there's a small blocker, omamobile-plugged-inhibit: it holds a logind sleep block while max77759-charger is online, since the guard is delayed work and s2idle stops it while the chip keeps charging. It isn't enabled at boot, a udev rule starts it when the charger's power supply shows up, so with the charger blacklisted it never runs. It exits when the charger goes away. It doesn't cover plugging in while the phone is already asleep, and it polls once a second. This is the "keep the phone awake on the cable" option from @derekross's point 4 on linux-omarchy-mobile#266. He hasn't picked one yet, so it's easy to swap for another or drop from this PR.

I left out charge_defender=1 (that comes from the kernel PRs still in review) and an install tcpci_maxim /bin/false line I have on my phone, since #827 has neither. Happy to add them later.

The version is 0.1.18 because #860 and #880 hold 0.1.16 and 0.1.17, so the number is yours to set, @derekross.

Tested: packages/omamobile-device-husky/test/all and tools/pr-check origin/main pass. The test runs the blocker against a fake sysfs file with a stub systemd-inhibit, and I checked it fails when I remove the charger or tcpci_maxim blacklist, drop temp_guard, drop the softdep, or add a second options line.

Not tested: anything on the phone with this package build. The same blocker logic ran on my 8 Pro as a local unit (held the lock on plug, let go on unplug), but that version was enabled at boot, not started by udev.

@derekross derekross left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Lef. This is the piece I asked for on linux-omarchy-mobile#267, and keeping the blacklist is right: I checked that husky's published device tree binds the MAX77759 core at boot, that the charger is a module, and that nothing else in the package loads it, so the two lines and the blocker do nothing until someone runs modprobe by hand. The rule matches the driver's power-supply name, and your test bites: I changed the lock to --mode=delay, made the inner loop never let go, and took ACTION=="add" off the rule, and each one failed a named check.

The blocker is one of the three answers to the question I still owe you on #266 (awake on the cable, wake for it, or say the limit holds only while awake). I lean towards taking it as husky's answer for now, and I'll confirm when I answer on #266: it's the cautious one for a phone whose guard can't see temperature yet, and it runs nowhere until the blacklist goes. For the record, the 7 Pro and the Pixel 7 sleep on the cable under the same guard, with the chip's own JEITA as the backstop (CHG_CNFG_08 bit 2). Do you know what that bit reads on husky as the bootloader leaves it?

Three things before it goes in:

  1. A failed read lets go of the lock. Both loops test = 1, so when cat fails the inner loop ends and the phone may sleep with the chip charging. I tried it with a stand-in: the lock was released within a second of the first failed read. online is two register reads in the driver, so an I2C error does this. Please let go only on a 0 (or when the file is gone), keep holding on an empty or failed read, and add that case to the test.
  2. The comment in omamobile-charger.conf describes the 7 Pro's guard. On husky with a published kernel, a charger loaded by hand gets the gs201 phones' table (until linux-omarchy-mobile#265), a temperature that reads 22.0 C whatever the cell does (until the gauge fix), and the node's 4.20 V, where you measured the charge ending near 82 %. Whoever writes the runbook will read this file first, so please say those three things there and in the README row, with what lifts each.
  3. A run from the package. First remove your own /etc/modprobe.d/omamobile-max77759.conf (it replaces the package's file of the same name and drops the charger's blacklist) and your own blocker unit, and read constant_charge_voltage_max before the cable goes in, as you do now.
    • After a boot: pacman -Q omamobile-device-husky, modprobe -c | grep max77759_charger, lsmod | grep max77759, systemctl is-active omamobile-plugged-inhibit, and tools/phone-smoke.
    • Then with you at the phone, on the 4.20 V float: modprobe max77759_charger, the probe lines, systemctl status omamobile-plugged-inhibit, systemd-inhibit --list, unplug, replug, and a systemctl suspend on the cable that gets refused.

Smaller: the new unit needs its # SPDX-License-Identifier: MIT line like husky's other units; the test's 3 s waits over a 1 s poll are thin for a loaded builder (10 s costs nothing when it passes), and the script and rule aren't husky-specific, so if this becomes the answer for every MAX77759 phone I'll move them somewhere shared.

On the number: #860 and #880 bump this package too, so I'll set the version when I merge. And I saw your question on #761 about 4.20 V against the bootloader's 4.35 V; I'll answer it there with the limits.

@Somnius

Somnius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@derekross thanks, all three fixed in 2e05a3e.

  1. The blocker now lets go only when online reads 0 or the file is gone. An empty or failed read keeps holding. test/all covers both: an empty file and an unreadable one, 3 s each, and the lock is still there. I checked it bites, the old script fails "an empty read keeps the lock".
  2. omamobile-charger.conf and the README row now say what a hand load gets on husky with a published kernel: the gs201 table until linux-omarchy-mobile#265, a temperature stuck at 22.0 C until the gauge fix, and the node's 4.20 V where the charge ends near 82 % until the float gets raised (your limits on Pixel 8 Pro (husky): charging stops at 92 %, the cause and a plan for review #761).
  3. The run from the package I'll do when I'm at the phone. First I remove my own /etc/modprobe.d/omamobile-max77759.conf and my blocker unit, read constant_charge_voltage_max before the cable, then your list.

Also added the SPDX line to the unit and the test waits 10 s now.

On CHG_CNFG_08 bit 2: honestly I haven't read it yet. I'll read it (read only, no writes) in that same run and post what the bootloader leaves there.

@derekross

Copy link
Copy Markdown
Owner

Confirming what I said I leaned towards: keeping the phone awake on the cable is the 8 Pro's answer for now. The three changes above still stand before it merges.

…cable, inert

Ships the charger's two option lines from the Pixel 7 Pro and the Pixel 7
(omarchy-mobile#827): default_ilim_ua=500000 temp_guard=1, with the gauge
loaded first. The charger stays blacklisted in omamobile-max77759.conf, so
on the published kernel the lines only apply to a modprobe by hand.

Also a sleep blocker for the cable: a block inhibitor while
max77759-charger is online, since the temperature guard is delayed work
that s2idle stops. udev starts it when the charger's power supply
appears; it is not enabled at boot, so with the charger blacklisted it
never runs.

Tested: package test/all, including the blocker against a fake sysfs file
and a stub systemd-inhibit; the test fails without the charger or
tcpci_maxim blacklist, without temp_guard, without the softdep, or with a
second options line.
Not tested: anything on a phone. The version is a placeholder for the
maintainer to set.
… the charger's husky limits

The lock goes only on a 0 or when the online file is gone; an empty or
failed read keeps holding, and test/all checks both. The charger's
modprobe file and the README say what a load by hand gets on husky today
(the gs201 table, a 22.0 C temperature, the node's 4.20 V) and what lifts
each. SPDX line on the new unit, and 10 s waits in the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants