You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
max77759_charger: constant_charge_voltage_max reports millivolts, not microvolts #257
max77759_charger reports constant_charge_voltage_max in millivolts, but the power supply class expects microvolts. On a Pixel 8a (omarchy-mobile#718, BRINGUP-M4 test 45), with the float voltage set to 4.2 V:
The currents next to it are in µA, as expected. The Pixel 7 Pro read 4450 there for its 4.45 V float (cheetah's USB-C-PLAN.md, "the upstream driver reports mV here, not µV"), so it isn't new, and it isn't akita's.
The cause. In drivers/power/supply/max77759_charger.c, chg_cv_prm_ranges is in mV (LINEAR_RANGE(4000, 0x0, 0x32, 10) and LINEAR_RANGE(3800, 0x38, 0x39, 100)). get_float_voltage() returns that value as it is, and max77759_charger_get_property() passes it straight out for POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX. include/linux/power_supply.h says all voltages are in µV unless stated otherwise. The getter is mainline's: it's the same in the v7.3-rc6 import (62b3c799e), before our max77759 commits.
A possible fix: multiply by 1000 in the property path only. get_float_voltage() has a second caller, the probe-time debug line that prints "float voltage %d mV", and that should stay in mV. Since the code is mainline's, the fix could go upstream too.
What depends on today's value. The Pixel 7 Pro's and Pixel 6 Pro's omamobile-charge-guard print this file with an mV suffix (packages/omamobile-device-cheetah and -raven, bin/omamobile-charge-guard). With a fix, they'd print 4450000 mV, so they'd need changing at the same time. The usbc-deadman-phone dump just greps the file, so it isn't affected. Nothing I found uses the value to make a decision.
Found during akita's M4 (omarchy-mobile#718); mentioned in #246's description.
Activity