diff --git a/NOTICE b/NOTICE index a8032af705..291a238fc4 100644 --- a/NOTICE +++ b/NOTICE @@ -13,6 +13,13 @@ Where this tree comes from: In the repository: +- Jesvi-iOS (github.com/jesvi-eulah/Jesvi-iOS, iOS 16.5 on the Galaxy S20 on the HakiOS base, by jesvi-eulah): its kernel + files (xnu/hakios.patch, xnu/files/) are under the Apple Public Source License 2.0, the rest under MIT (its LICENSE). Scion + takes from it with its owner's approval (26 November 2026), its authors' names kept on the commits that carry its work and + each source commit named. The MAX77705 charger guard's "in use" (SIOP) and "a computer on the link" limits + (docs/devices/starlte-charging.md) follow its docs/devices/x1slte/charging-samsung.md (fc07d1b) and its charger commits + 3a4db07, fb882cf and a57b321; no code of it is copied there, and the values are the S9's own. + - XNU (Apple): the kernel sources are fetched by xnu/apply.sh from github.com/apple-oss-distributions/xnu; our patch and files are a derivative work under the Apple Public Source License 2.0 (LICENSE.APSL). - ios-on-pixel-10 (TheAndersMadsen; Scion-Project/scion-blazer): devices/blazer/carried/ holds kernel-side files that are its diff --git a/configs/boot-args.lst b/configs/boot-args.lst index 6f817d0a52..39fbff3614 100644 --- a/configs/boot-args.lst +++ b/configs/boot-args.lst @@ -382,10 +382,12 @@ mali_nap_us k mali_pll k mali_trace k max77705 k +max77705_chg k max77705_diag k max77705_fg_s k max77705_haptic k max77705_ipclk k +max77705_siop k max77705_steps k max77705_usbsw k max77705_wdt k diff --git a/configs/common_defconfig b/configs/common_defconfig index d67eb532c1..ace94e3630 100644 --- a/configs/common_defconfig +++ b/configs/common_defconfig @@ -2,7 +2,7 @@ # HakiOS common defconfig: every setting there is, with what it does. # Made by tools/hakios-config.py listing common -o ; the values are the ones that file sets, and tests/CI check that it names every symbol. # -# 784 symbols in 20 groups; 54 are set, 45 of them drivers built in. +# 786 symbols in 20 groups; 54 are set, 45 of them drivers built in. # # @@ -142,7 +142,7 @@ CONFIG_HAKIOS_BATTGUARD=y # the Galaxy S9's CPU frequency governor (cpufreq_gov=1): both clusters' rates moved with the load through ACPM's ... [hakios.exynos_cpufreq.c, hakios.scion_gov.c; requires CONFIG_HAKIOS_EXYNOS_ACPM] # CONFIG_HAKIOS_EXYNOS_CPUFREQ is not set -# the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read (never written) over CMGP's HSI2C and ... [hakios.max77705.c; requires CONFIG_HAKIOS_EXYNOS_HSI2C, CONFIG_HAKIOS_BATTERY] +# the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read over CMGP's HSI2C and handed to ... [hakios.max77705.c; requires CONFIG_HAKIOS_EXYNOS_HSI2C, CONFIG_HAKIOS_BATTERY] CONFIG_HAKIOS_MAX77705=y # the Galaxy S9's temperatures: the Exynos 9810's TMU (BIG, LITTLE, G3D, ISP), read with each sensor's fuses (tmu=1), ... [hakios.exynos_tmu.c; requires CONFIG_HAKIOS_EXYNOS_POWEROFF] @@ -861,7 +861,7 @@ CONFIG_GPU=y # CONFIG_VBLUR is not set # -# Audio and battery (67) +# Audio and battery (69) # # the audio DSP; the battery level in the UI and charging state come through it [needs fw-audio/ from the phone] @@ -990,6 +990,9 @@ CONFIG_SOUND=4 # read by hakios.max77705.c (kernel) # CONFIG_MAX77705 is not set +# read by hakios.max77705_guard.h (kernel) +# CONFIG_MAX77705_CHG is not set + # read by hakios.max77705.c (kernel) # CONFIG_MAX77705_DIAG is not set @@ -1002,6 +1005,9 @@ CONFIG_SOUND=4 # read by hakios.max77705.c (kernel) # CONFIG_MAX77705_IPCLK is not set +# the guard's in-use limit (SIOP) off; it is on with the guard unless this says 0 +# CONFIG_MAX77705_SIOP is not set + # read by hakios.max77705.c (kernel) # CONFIG_MAX77705_STEPS is not set diff --git a/configs/symbols.tsv b/configs/symbols.tsv index 0ec0ff3acc..e4701716ac 100644 --- a/configs/symbols.tsv +++ b/configs/symbols.tsv @@ -364,10 +364,12 @@ MALI_NAP_US arg mali_nap_us GPU and display k hakios.mali.c poll interval for a MALI_PLL arg mali_pll GPU and display k hakios.mali.c leave PLL_G3D as the boot set it; the step stops if it is not running MALI_TRACE arg mali_trace GPU and display k hakios.mali.c one line per job: "tl: j SEQ f|v q QUEUED b BEGAN e ENDED", in microseconds MAX77705 arg max77705 Audio and battery k hakios.max77705.c +MAX77705_CHG arg max77705_chg Audio and battery k hakios.max77705_guard.h MAX77705_DIAG arg max77705_diag Audio and battery k hakios.max77705.c MAX77705_FG_S arg max77705_fg_s Audio and battery k hakios.max77705.c the gauge's short line (only reads) MAX77705_HAPTIC arg max77705_haptic Audio and battery k hakios.max77705.c MAX77705_IPCLK arg max77705_ipclk Audio and battery k hakios.max77705.c +MAX77705_SIOP arg max77705_siop Audio and battery k hakios.max77705_guard.h the guard's in-use limit (SIOP) off; it is on with the guard unless this says 0 MAX77705_STEPS arg max77705_steps Audio and battery k hakios.max77705.c MAX77705_USBSW arg max77705_usbsw Audio and battery k hakios.max77705.c MAX77705_WDT arg max77705_wdt Audio and battery k hakios.max77705.c the charger's watchdog kicked, only while it is on (see the top of this file) diff --git a/docs/boot-args.md b/docs/boot-args.md index 723a849aa4..212860a665 100644 --- a/docs/boot-args.md +++ b/docs/boot-args.md @@ -2,7 +2,7 @@ Made by `tools/boot-args.py --markdown`; CI fails if it is out of date with the source (`tools/boot-args.py --check`). -Every argument that the kernel, the loader or user space of this port reads, and which file reads it. **725 arguments**: 617 read by the kernel, 24 by the loader, 102 by user space (one is read in more than one place). +Every argument that the kernel, the loader or user space of this port reads, and which file reads it. **727 arguments**: 619 read by the kernel, 24 by the loader, 102 by user space (one is read in more than one place). This is a catalogue of what exists and who reads it, not a manual. What an argument means is in the head of the file that reads it. The stable switches have a symbol in the configuration (`tools/hakios-config.py help SYMBOL`, `docs/configs.md`); the rest are the knobs of bring-up (a driver's steps, pauses, traces, test modes) and can change with the driver. Any of them can be given in a configuration with `CONFIG_BOOTARGS="name=value ..."`, which checks that each name is in this list. What the arguments of the two Metal paths do: [Metal on the Adreno](reference/metal.md#boot-arguments). @@ -249,7 +249,7 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke | `soc_pas_mpss` | K | `hakios.mpss.c` | `CONFIG_SOC_PAS_MPSS` | | | `soc_smem` | K | `hakios.mpss.c`, `hakios.socinfo.c` | `CONFIG_SOC_SMEM` | | -## Audio and battery (68) +## Audio and battery (70) | Argument | Layer | Read by | Configuration | Set by | |---|---|---|---|---| @@ -294,10 +294,12 @@ Layers: **K** the kernel, **L** the loader, **U** user space (through `sysctl ke | `cs47l93_hp_vol` | K | `hakios.cs47l93.c` | `CONFIG_CS47L93_HP_VOL` | | | `cs47l93_mic_vol` | K | `hakios.cs47l93.c` | `CONFIG_CS47L93_MIC_VOL` | | | `max77705` | K | `hakios.max77705.c` | `CONFIG_MAX77705` | | +| `max77705_chg` | K | `hakios.max77705_guard.h` | `CONFIG_MAX77705_CHG` | | | `max77705_diag` | K | `hakios.max77705.c` | `CONFIG_MAX77705_DIAG` | | | `max77705_fg_s` | K | `hakios.max77705.c` | `CONFIG_MAX77705_FG_S` | | | `max77705_haptic` | K | `hakios.max77705.c` | `CONFIG_MAX77705_HAPTIC` | | | `max77705_ipclk` | K | `hakios.max77705.c` | `CONFIG_MAX77705_IPCLK` | | +| `max77705_siop` | K | `hakios.max77705_guard.h` | `CONFIG_MAX77705_SIOP` | | | `max77705_steps` | K | `hakios.max77705.c` | `CONFIG_MAX77705_STEPS` | | | `max77705_usbsw` | K | `hakios.max77705.c` | `CONFIG_MAX77705_USBSW` | | | `max77705_wdt` | K | `hakios.max77705.c` | `CONFIG_MAX77705_WDT` | | diff --git a/docs/devices/starlte-charging.md b/docs/devices/starlte-charging.md new file mode 100644 index 0000000000..c7a08708fc --- /dev/null +++ b/docs/devices/starlte-charging.md @@ -0,0 +1,83 @@ +# Galaxy S9 charging under iOS 16.5: the charger guard (`max77705_chg=`) + +26 November 2026. Off by default. Not yet run on a phone: everything below is written from Samsung's numbers and checked +on a computer (`tools/max77705-charge-test.sh`), not seen on an S9. + +The iOS 16.5 kernel's MAX77705 driver (`drivers/power/max77705/hakios.max77705.c`, `max77705=1`) only reads the charger, +apart from the watchdog kick (`max77705_wdt=1`). Whatever S-Boot left in the charger stays: on a computer's charging port +that is Samsung's CDP group (1500 mA in, 1500 mA charge, measured on phone 2), and whatever S-Boot picks on a wall charger. +With the guard on, the kernel sets the charger to Samsung's own S9 limits for the charger type at 5 V, and applies +Samsung's temperature rules, which nothing in the chip knows (the battery's thermistor is on the AP's ADC). + +The rules are the ones the iOS 27 kernel's guard follows: [docs/ios27/CHARGING.md](../ios27/CHARGING.md) has every fact and +where it comes from. The code that asks them is `drivers/power/max77705/hakios.max77705_guard.h`; the rules are +`hakios.max77705_charge.h`. + +## Boot arguments + +| argument | what happens | +|---|---| +| (none), `max77705_chg=0` | as before: nothing written but the watchdog kick with `max77705_wdt=1` | +| `max77705_chg=1` | read only. Every 5 s: the MUIC's charger type, the charger's state and settings, the battery's thermistor. The log says what the guard would write (`max77705: chg: would: ...`) whenever its decision changes | +| `max77705_chg=2` | the guard: as 1, and it writes (below) | +| `max77705_siop=0` | with the guard: the in-use limit off (it is on by default) | + +S9 (starlte) only. On the S9+ or the Note9 the guard says it is for the S9 and does nothing (their limits differ). + +## What is written (`max77705_chg=2`), and why those values + +Charger at I2C 0x69 on CMGP USI03's HSI2C. Each write only when the value differs, only the bits named, read back: + +| register | bits | value | source | +|---|---|---|---| +| CNFG_09 0xC0 | [6:0] input limit, (code+1) x 25 mA | SDP 475 mA (code 0x12), CDP 1500 (0x3B), DCP 1800 (0x47), unknown 500 (0x13) | `cable-info` current groups of `exynos9810-starlte_eur_open_26.dts` (USB group_12, CDP group_3, TA default, TIMEOUT group_1) | +| CNFG_02 0xB9 | [5:0] charge current, code x 50 mA | SDP 550 (0x0B), CDP 1500 (0x1E), DCP 2100 (0x2A), unknown 500 (0x0A); 700 (0x0E) at 15.0 C and down | the same groups; `swelling_low_temp_current` 700 | +| CNFG_00 0xB7 | bit 0, charger on/off | off: battery 41.0 C and up (on at 39.0 C), 5.0 C and down (on at 10.0 C), no thermistor reading, full (on at 4280 mV or 98 %), session time over (SDP 36000 s, CDP/DCP 18000 s) | `swelling_*`, `recharge_condition_*`, `*_charging_total_time` | +| CNFG_06 0xBD | [1:0] WDTCLR = 01 | the charger's watchdog kicked every poll while CNFG_00's WDTEN is on | Samsung's `max77705_chg_set_wdtmr_kick()` | + +On top, and only ever lower: + +- **In use (SIOP)**: while the panel is lit, or its level is not known yet, 1200 mA in and 1000 mA charge (S9 DTS: + `battery,siop_input_limit_current = <1200>`, `siop_charging_limit_current = <1000>`). Samsung applies these when its + thermal service lowers `siop_level`; here the panel's brightness (`hakios_panel_level()`, 0 = dark) stands in for "in use". +- **A computer on the USB link** (the gadget configured by a host): at most the CDP's 1500/1500 mA, whatever the MUIC called + the port (a Mac's port was seen detected as a wall charger, and a Mac cut its port when a phone drew 1.7-2.0 A). + +Latched off (charging off until the cable is pulled): battery 45.0 C or more, a chip fault (VBUS over-voltage, no or dead +battery, the timer's fault, thermal shutdown), the float voltage reading above 4350 mV, or a limit that does not read back +as written. + +Never written: the float voltage (CNFG_04), the timers (CNFG_01), CHGPROT (if CNFG_06 [3:2] is not 11 the guard writes +nothing and says so), CNFG_00's mode bits (bit 0 only, and only while the mode is 4 or 5: never in OTG), any other +charger register, the gauge, the MUIC (no opcode: no AFC, the D+/D- switch untouched), the PMIC, anything non-volatile. +Nothing is written without VBUS or after a failed read. + +AFC (9 V) is not in this change. It will be a separate boot argument, off by default, after 5 V has been seen on a phone. + +## Test plan (an S9, iOS 16.5 image) + +You need: the image built from this branch, the USB console or the loader's log, a Samsung wall charger (any; 5 V is +all that is asked), the battery under 90 %, room temperature. + +1. Boot with your usual line plus `max77705_chg=1` (read only). In the log: + `max77705: chg: the charger guard, read only, ...` at step 5, then one line per change, for example + `max77705: chg: a wall charger at 5 V (DCP); charging allowed; on, input 1200 mA, charge 1000 mA, in use (SIOP); battery 27.3 C, ...` + and `max77705: chg: would: input limit (CNFG_09): 0x.. -> 0x2f`. Check that the battery temperature is plausible + (not `NOT READ`), and that the type matches the charger (computer port: SDP or CDP; wall charger: DCP). +2. Boot with `max77705_chg=2`. On the wall charger with the screen off for a few minutes, expect + `input limit (CNFG_09): ... -> 0x47, read back 0x47` (1800 mA) and `charge current (CNFG_02): ... -> 0x2a, read back 0x2a` + (2100 mA); with the screen on, 0x2f / 0x14 (1200 / 1000 mA). The battery should rise visibly faster than before at the + same charger. Every 5 minutes: `max77705: chg: N writes, 0 failed, 0 read back differently, 0 refused (locked)`. +3. On the Mac's port: `a computer on the link` once the USB console is configured; never more than 1500/1500 mA. +4. Stop and unplug if: the phone gets hot to hold, the log says `DIFFERS`, `FAILED`, `45 C or more`, `a fault`, or the + percentage falls while plugged in for more than a couple of minutes. Send the log. + +To revert: boot without `max77705_chg=` (or with `max77705_chg=0`). The registers written are volatile: the next boot's +S-Boot sets its own again, and pulling the cable lets the chip's detection start over. + +## Credits + +The SIOP and "a computer on the link" limits are ideas from Jesvi-iOS (github.com/jesvi-eulah/Jesvi-iOS, iOS 16.5 on the +Galaxy S20, by jesvi-eulah; MIT outside its kernel files): `docs/devices/x1slte/charging-samsung.md` (fc07d1b), and the +charging commits 3a4db07, fb882cf and a57b321 of `xnu/files/bsd/dev/redwood_max77705.c` (APSL-2.0). No code of it is copied; +the values here are the S9's, from Samsung's S9 device tree. See NOTICE. diff --git a/docs/reference/drivers.md b/docs/reference/drivers.md index d2171617ba..d4e6d1cd3a 100644 --- a/docs/reference/drivers.md +++ b/docs/reference/drivers.md @@ -130,7 +130,7 @@ Every driver the kernel can be built with. `CONFIG_HAKIOS_=y` in a defconf | **`HAKIOS_S2MPS18_RTC`**
the Galaxy S9's real-time clock, the S2MPS18 PMIC's RTC read through ACPM at start-up (rtc_pmic=1): the calendar starts at its time when it is valid and not behind epoch=; read only, nothing written to the PMIC | `hakios.s2mps18_rtc.c` | `HAKIOS_EXYNOS_ACPM` | `rtc_pmic=` | | built | | | | built | built | | | **`HAKIOS_BATTGUARD`**
the run handed back to the loader before the battery is flat (battery_stop=) | `hakios.battguard.c` | | `battery_stop=`, `battery_stop_poll=` | | | | | built | | | | | **`HAKIOS_EXYNOS_CPUFREQ`**
the Galaxy S9's CPU frequency governor (cpufreq_gov=1): both clusters' rates moved with the load through ACPM's DVFS, within the limits of Samsung's device tree for the M3s online, and lowered when the TMU reads them hot (gov_policy=3: the scion governor, whose law is hakios.scion_gov.c) | `hakios.exynos_cpufreq.c`
`hakios.scion_gov.c` | `HAKIOS_EXYNOS_ACPM` | `cpufreq_gov=`, `cpufreq_gov_big_dual=`, `cpufreq_gov_big_max=`, `cpufreq_gov_big_min=`, `cpufreq_gov_big_oc=`, `cpufreq_gov_big_quad=`, `cpufreq_gov_big_single=`, `cpufreq_gov_lit_max=` and 17 more | | built | | | | built | built | | -| **`HAKIOS_MAX77705`**
the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read (never written) over CMGP's HSI2C and handed to HakiosBattery, the power source iOS reads (max77705=1; max77705_steps=N, max77705_ipclk=MHz); and its haptic block, the vibration motor for iOS through /dev/hakios-haptic (max77705_haptic=1) | `hakios.max77705.c` | `HAKIOS_EXYNOS_HSI2C`, `HAKIOS_BATTERY` | `max77705=`, `max77705_diag=`, `max77705_fg_s=`, `max77705_haptic=`, `max77705_ipclk=`, `max77705_steps=`, `max77705_usbsw=`, `max77705_wdt=` | | built | | | built | built | built | | +| **`HAKIOS_MAX77705`**
the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read over CMGP's HSI2C and handed to HakiosBattery, the power source iOS reads (max77705=1; max77705_steps=N, max77705_ipclk=MHz); the charger written only by the charger guard, off by default (max77705_chg=2: Samsung's S9 limits at 5 V, the temperature bands, max77705_siop=); and its haptic block, the vibration motor for iOS through /dev/hakios-haptic (max77705_haptic=1) | `hakios.max77705.c` | `HAKIOS_EXYNOS_HSI2C`, `HAKIOS_BATTERY` | `max77705=`, `max77705_diag=`, `max77705_fg_s=`, `max77705_haptic=`, `max77705_ipclk=`, `max77705_steps=`, `max77705_usbsw=`, `max77705_wdt=` | | built | | | built | built | built | | | **`HAKIOS_EXYNOS_TMU`**
the Galaxy S9's temperatures: the Exynos 9810's TMU (BIG, LITTLE, G3D, ISP), read with each sensor's fuses (tmu=1), published as kern.hakios.temp.* and the POCO's kern.hakios.thermal_* (tmu=2), and the run ended or the phone powered off when a zone or the battery is too hot (tmu=3; tmu_stop=, tmu_batt_stop=, tmu_off=1) | `hakios.exynos_tmu.c` | `HAKIOS_EXYNOS_POWEROFF` | `tmu=`, `tmu_batt_stop=`, `tmu_enable=`, `tmu_log=`, `tmu_off=`, `tmu_poll=`, `tmu_stop=`, `tmu_ungate=` | | built | built | | built | built | built | | | **`HAKIOS_EXYNOS_POWEROFF`**
the Galaxy S9 powered off: PS_HOLD let go in the Exynos 9810's PMU, for the TMU's tmu_off=1 and for a halt (halt_off=1: the panel blanked first, DCS display-off and sleep-in through DSIM0; halt_off=2: the APM stopped too) | `hakios.exynos_poweroff.c` | | `halt_off=` | | built | built | built | built | built | built | | diff --git a/drivers/core/hakios.stubs.c b/drivers/core/hakios.stubs.c index 63a63257a8..441b9f340e 100644 --- a/drivers/core/hakios.stubs.c +++ b/drivers/core/hakios.stubs.c @@ -284,6 +284,9 @@ int hakios_scanout_planes(__unused uint64_t upper, __unused uint32_t upper_rowby void hakios_usb_gadget_quiesce(void) {} void hakios_usb_gadget_vbus(bool present); void hakios_usb_gadget_vbus(__unused bool present) {} +/* the charger guard asks whether a computer configured the link: no USB link here, so it cannot know (no) */ +bool hakios_usb_gadget_host(void); +bool hakios_usb_gadget_host(void) { return false; } /* a picture for the USB console (hakios.exynos_camera.c's camshot): no USB link here */ int hakios_usb_picture(uintptr_t rgb, uint32_t width, uint32_t height, const char *what); int hakios_usb_picture(__unused uintptr_t rgb, __unused uint32_t width, __unused uint32_t height, __unused const char *what) { return -1; } diff --git a/drivers/display/panel/hakios.backlight.cpp b/drivers/display/panel/hakios.backlight.cpp index 1e8b2be60f..bd60cfe4d3 100644 --- a/drivers/display/panel/hakios.backlight.cpp +++ b/drivers/display/panel/hakios.backlight.cpp @@ -35,6 +35,7 @@ extern "C" { int hakios_panel_register(const char * name, int (*set)(int level)); int hakios_panel_brightness(int level); +int hakios_panel_level(void); void hakios_backlight_publish(IOService * display); } @@ -77,6 +78,14 @@ hakios_panel_brightness(int level) return error; } +/* the level last taken by the panel, 0-255, or -1 when none has been (no panel driver, or nothing asked yet): for the + * charger's "in use" limit (hakios.max77705.c, max77705_chg=) */ +int +hakios_panel_level(void) +{ + return gPanelLevel; +} + class AppleARMBacklight : public IOService { OSDeclareDefaultStructors(AppleARMBacklight); diff --git a/drivers/map b/drivers/map index 88f111a083..40de47734d 100644 --- a/drivers/map +++ b/drivers/map @@ -75,6 +75,7 @@ power bsd/dev/hakios.battery.c power iokit/Kernel/hakios.battery.cpp power/max77705 bsd/dev/hakios.max77705.c power/max77705 bsd/dev/hakios.max77705_charge.h +power/max77705 bsd/dev/hakios.max77705_guard.h power/exynos bsd/dev/hakios.exynos_cpufreq.c power/exynos bsd/dev/hakios.exynos_cpufreq_ceiling.h power/exynos bsd/dev/hakios.scion_gov.c diff --git a/drivers/power/conf b/drivers/power/conf index f38a9d596b..947c5dbb80 100644 --- a/drivers/power/conf +++ b/drivers/power/conf @@ -55,9 +55,10 @@ driver EXYNOS_CPUFREQ driver MAX77705 file bsd/dev/hakios.max77705.c requires EXYNOS_HSI2C BATTERY - help the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read (never written) over CMGP's - help HSI2C and handed to HakiosBattery, the power source iOS reads (max77705=1; max77705_steps=N, max77705_ipclk=MHz); and its - help haptic block, the vibration motor for iOS through /dev/hakios-haptic (max77705_haptic=1) + help the Galaxy S9's battery: the fuel gauge and charger of its MAX77705, read over CMGP's HSI2C and handed to + help HakiosBattery, the power source iOS reads (max77705=1; max77705_steps=N, max77705_ipclk=MHz); the charger written + help only by the charger guard, off by default (max77705_chg=2: Samsung's S9 limits at 5 V, the temperature bands, + help max77705_siop=); and its haptic block, the vibration motor for iOS through /dev/hakios-haptic (max77705_haptic=1) driver EXYNOS_TMU file bsd/dev/hakios.exynos_tmu.c diff --git a/drivers/power/max77705/hakios.max77705.c b/drivers/power/max77705/hakios.max77705.c index f2618eb600..2e829d212b 100644 --- a/drivers/power/max77705/hakios.max77705.c +++ b/drivers/power/max77705/hakios.max77705.c @@ -5,8 +5,8 @@ * hakios_battery_report() (drivers/power/hakios.battery.c). Only with boot-arg max77705=1: every address below belongs * to this phone. * - * THIS DRIVER ONLY READS THE CHIP, with one exception that is off by default (max77705_wdt=1, below). The MAX77705 is the - * phone's charger: a wrong write there changes how the battery is charged. Nothing else is written to it, not even the latches its interrupt handler would clear on Android (the interrupt + * THIS DRIVER ONLY READS THE CHIP, with two exceptions that are off by default (max77705_wdt=1, below, and the charger + * guard, max77705_chg=2, hakios.max77705_guard.h). The MAX77705 is the phone's charger: a wrong write there changes how the battery is charged. Nothing else is written to it, not even the latches its interrupt handler would clear on Android (the interrupt * registers are not read at all: reading them clears them). What is written is the bus's own: the clock gates of * CMGP's USI03, its mode word, the controller (drivers/soc/exynos/hakios.exynos_hsi2c.c). * @@ -923,6 +923,8 @@ chg_wdt_kick(void) } } +#include "hakios.max77705_guard.h" /* max77705_chg=: the charger guard (after charger_write, chg_wdt_kick) */ + /* max77705_fg_s=S: the gauge's short line (only reads) */ static void fg_short_say(void) @@ -947,7 +949,7 @@ static void battery_thread(void *arg, __unused wait_result_t result) { uint32_t steps = (uint32_t)(uintptr_t)arg, step = 0, failed = 0; - struct hakios_battery_state b; + struct hakios_battery_state b = { 0 }; thread_t thread; uint8_t rev; @@ -1042,6 +1044,7 @@ battery_thread(void *arg, __unused wait_result_t result) if (fg_ticks != 0) { say("max77705: fg: a short gauge line every %u s (max77705_fg_s)\n", fg_ticks * (POLL_MS / 1000)); } + chg_guard_start(); } for (unsigned tick = 0;; tick++) { if (chg_wdt && tick % WDT_KICK_POLLS == 0) { @@ -1058,6 +1061,7 @@ battery_thread(void *arg, __unused wait_result_t result) if (chg_wdt) { say("max77705: wdt: %u kicks, %u with the watchdog off, %u failed\n", wdt_kicks, wdt_skipped, wdt_failed); } + chg_guard_say(); } if (fg_ticks != 0 && tick % fg_ticks == 0) { fg_short_say(); @@ -1065,6 +1069,7 @@ battery_thread(void *arg, __unused wait_result_t result) } else if (++failed == 10) { say("max77705: 10 reads in a row have failed (%x); still trying\n", bus.last_error); } + chg_guard(&b, failed == 0); /* max77705_chg=: nothing without it; nothing written after a failed read */ delay_for_interval(POLL_MS, NSEC_PER_MSEC); } out: diff --git a/drivers/power/max77705/hakios.max77705_charge.h b/drivers/power/max77705/hakios.max77705_charge.h index 3c9a7e67b9..649215cb61 100644 --- a/drivers/power/max77705/hakios.max77705_charge.h +++ b/drivers/power/max77705/hakios.max77705_charge.h @@ -485,4 +485,51 @@ chg_readback_ok(uint8_t wrote, uint8_t read, uint8_t mask) return (wrote & mask) == (read & mask); } +/* ---- the limits on top of the rules (iOS 16.5's guard, hakios.max77705.c max77705_chg=) -------------------------- */ + +/* + * SIOP, Samsung's "phone in use" limit (exynos9810-starlte_eur_open_26.dts: battery,siop_input_limit_current 1200, + * siop_charging_limit_current 1000, siop_hv_input_limit_current 500, siop_hv_charging_limit_current 1000). Samsung applies + * it when its thermal service lowers siop_level below 100; the iOS 16.5 guard applies it while the panel is lit, which + * is at least as often. It only lowers: never above what chg_step() gave. + * The idea of carrying SIOP over is Jesvi-iOS's (docs/devices/x1slte/charging-samsung.md, jesvi-eulah, fc07d1b); the + * numbers are the S9's own, not the S20's. + */ +#define CHG_SIOP_INPUT_MA 1200u +#define CHG_SIOP_CHARGE_MA 1000u +#define CHG_SIOP_HV_INPUT_MA 500u +#define CHG_SIOP_HV_CHARGE_MA 1000u + +static inline void +chg_siop_cap(struct chg_out *o, enum chg_type type) +{ + uint32_t in_max = type == CHG_AFC_9V ? CHG_SIOP_HV_INPUT_MA : CHG_SIOP_INPUT_MA; + uint32_t cc_max = type == CHG_AFC_9V ? CHG_SIOP_HV_CHARGE_MA : CHG_SIOP_CHARGE_MA; + + if (o->input_ma > in_max) { + o->input_ma = in_max; + } + if (o->charge_ma > cc_max) { + o->charge_ma = cc_max; + } +} + +/* + * A computer on the USB link (the gadget configured by a host) is a computer whatever the MUIC called the port: a Mac's + * port was seen detected as a wall charger, and a Mac cut the port, power and data both, when the phone drew 1.7-2.0 A + * (Jesvi-iOS on the S20, jesvi-eulah, 3a4db07 and fb882cf; no 9 V with a computer on the link, a57b321). So: the + * input and the charge current at most the CDP's (Samsung's 1500/1500 mA for the S9) and no 9 V request. Only lowers. + */ +static inline void +chg_host_cap(struct chg_out *o) +{ + if (o->input_ma > chg_limits[CHG_CDP].input_ma) { + o->input_ma = chg_limits[CHG_CDP].input_ma; + } + if (o->charge_ma > chg_limits[CHG_CDP].charge_ma) { + o->charge_ma = chg_limits[CHG_CDP].charge_ma; + } + o->ask_9v = false; +} + #endif /* HAKIOS_MAX77705_CHARGE_H */ diff --git a/drivers/power/max77705/hakios.max77705_guard.h b/drivers/power/max77705/hakios.max77705_guard.h new file mode 100644 index 0000000000..1d0c862c95 --- /dev/null +++ b/drivers/power/max77705/hakios.max77705_guard.h @@ -0,0 +1,207 @@ +/* + * The Galaxy S9's charger guard for the iOS 16.5 kernel (max77705_chg=, max77705_siop=): included by hakios.max77705.c, + * after its bus functions (read8, charger_write, chg_wdt_kick, say, last_adc), whose statics it uses. The rules are + * hakios.max77705_charge.h's (Samsung's numbers for the S9; tools/max77705-charge-test.sh checks them on a computer); + * this file reads the chip, asks the rules, and writes what they say. docs/devices/starlte-charging.md is its guide. + */ +#ifndef HAKIOS_MAX77705_GUARD_H +#define HAKIOS_MAX77705_GUARD_H + +#include "hakios.max77705_charge.h" + +/* + * max77705_chg=N: the charger guard, off by default (1 says, 2 writes); Samsung's charging rules for the S9 (hakios.max77705_charge.h, the + * rules the iOS 27 kernel's guard follows, docs/ios27/CHARGING.md; this is the iOS 16.5 kernel's use of them, + * docs/devices/starlte-charging.md). Galaxy S9 (starlte) only: on the S9+ and the Note9 it says so and does nothing. + * 1 read only: every poll the charger, the MUIC's charger type and the battery's thermistor are read, and the log says + * what would be written ("would: ..."); nothing is written + * 2 the guard: as 1, and the charger is told, at 5 V only (no AFC: no MUIC opcode is sent): + * CNFG_09 (0xC0) [6:0] the input limit, at most Samsung's for the type (SDP 475, CDP 1500, DCP 1800, unknown + * 500 mA), bit 7 kept as read + * CNFG_02 (0xB9) [5:0] the charge current, at most Samsung's (SDP 550, CDP 1500, DCP 2100, unknown 500 mA; + * 700 mA at 15.0 C and down), [7:6] kept as read + * CNFG_00 (0xB7) bit 0 charging off at 41.0 C and up (on again at 39.0 C), at 5.0 C and down (on at 10.0 C), + * without a thermistor reading, when full (on at 4280 mV or 98 %), after the session's time; + * latched off at 45.0 C, on a chip fault, a float above 4350 mV or a read-back that differs. + * Only while CNFG_00's mode is 4 or 5 (buck, or buck and charger): never in OTG or off + * CNFG_06 (0xBD) [1:0] WDTCLR = 01, the charger's watchdog kicked every poll while it is on (as max77705_wdt=1) + * each written only when it differs, each read back; nothing written while CNFG_06's CHGPROT ([3:2]) is not 11 + * (unlocked), nothing at all without VBUS or when a read failed. Never written: the float voltage, the timers, + * CHGPROT, any other register, the gauge, the MUIC, anything non-volatile. + * max77705_siop=0: the guard's in-use limit (SIOP) off; it is on with the guard unless this says 0. + * On top of the rules, only ever lower: max77705_siop=1 (the default with the guard; 0 turns it off) Samsung's "in use" + * limit while the panel is lit or its level is not known (1200 mA in, 1000 mA charge); and a computer on the USB link (the + * gadget configured) holds the limits at the CDP's, 1500/1500 mA, whatever the MUIC called the port. + */ +static uint32_t chg_mode, chg_siop = 1, chg_writes, chg_wfail, chg_differs, chg_refused; +static struct chg_state chg_st; +static struct chg_out chg_last = { .why = WHY_NO_VBUS }; +static bool chg_last_siop, chg_last_host, chg_said, chg_say_would; +static enum chg_type chg_last_type = CHG_TYPES; + +extern int hakios_panel_level(void); /* hakios.backlight.cpp: 0-255, -1 not known */ +extern bool hakios_usb_gadget_host(void); /* hakios.dwc3.c: a host configured the link (the stub: no) */ + +/* one register written (only the bits of mask changed), read back; false if it did not read back as written */ +static bool +chg_set(const char *what, uint8_t reg, uint8_t now, uint8_t mask, uint8_t bits) +{ + uint8_t want = (uint8_t)((now & ~mask) | (bits & mask)), back = 0; + uint32_t e; + + if (want == now) { + return true; + } + if (chg_mode < 2) { + if (chg_say_would) { /* (with each change of the summary line, not every poll) */ + say("max77705: chg: would: %s: %#x -> %#x\n", what, now, want); + } + return true; + } + e = charger_write(reg, want); + if (e == 0) { + e = read8(CHARGER, reg, &back); + } + chg_writes++; + if (e != 0) { + chg_wfail++; + say("max77705: chg: %s: %#x -> %#x: A WRITE OR ITS READ-BACK FAILED (%x)\n", what, now, want, e); + return false; + } + if (!chg_readback_ok(want, back, mask)) { + chg_differs++; + say("max77705: chg: %s: %#x -> %#x, read back %#x: DIFFERS\n", what, now, want, back); + return false; + } + say("max77705: chg: %s: %#x -> %#x, read back %#x\n", what, now, want, back); + return true; +} + +static void +chg_guard(const struct hakios_battery_state *b, bool read_ok) +{ + struct chg_in in = { .read_ok = read_ok }; + struct chg_out o; + uint8_t st1 = 0, cnfg06 = 0, mode; + uint64_t ns; + int level; + bool siop, host, ok; + + if (chg_mode == 0) { + return; + } + absolutetime_to_nanoseconds(mach_absolute_time(), &ns); + in.now_s = (uint32_t)(ns / NSEC_PER_SEC); + if (read_ok) { + in.read_ok = read8(MUIC, MUIC_BC_STATUS, &in.bc) == 0 && read8(MUIC, MUIC_USBC_STATUS1, &st1) == 0 && + read8(CHARGER, CHG_REG_DTLS_00, &in.dtls00) == 0 && read8(CHARGER, CHG_REG_DTLS_01, &in.dtls01) == 0 && + read8(CHARGER, CHG_REG_CNFG_00, &in.cnfg00) == 0 && read8(CHARGER, CHG_REG_CNFG_02, &in.cnfg02) == 0 && + read8(CHARGER, CHG_REG_CNFG_04, &in.cnfg04) == 0 && read8(CHARGER, CHG_REG_CNFG_06, &cnfg06) == 0 && + read8(CHARGER, CHG_REG_CNFG_09, &in.cnfg09) == 0; + } + in.vbadc = st1 >> 4; + in.temp_ok = last_adc >= 0; /* battery_temperature() gives 25 C when the ADC does not answer: not a reading */ + in.temp_dc = b->temperature_hundredths / 10; + in.chg_temp_ok = false; /* (the charger's thermistor only matters for 9 V, which this guard never asks) */ + in.soc = (uint32_t)(b->percent_hundredths < 0 ? 0 : b->percent_hundredths / 100); + in.vcell_mv = (uint32_t)(b->voltage_uv < 0 ? 0 : b->voltage_uv / 1000); + in.afc_wanted = false; + o = chg_step(&chg_st, &in); + level = hakios_panel_level(); + siop = chg_siop != 0 && level != 0; + host = hakios_usb_gadget_host(); + if (o.enable && siop) { + chg_siop_cap(&o, chg_st.type); + } + if (o.enable && host) { + chg_host_cap(&o); + } + o.ask_9v = false; /* 5 V only (no AFC in this kernel yet) */ + o.ask_5v = false; + + chg_say_would = false; + if (!chg_said || chg_st.type != chg_last_type || o.why != chg_last.why || o.enable != chg_last.enable || + o.input_ma != chg_last.input_ma || o.charge_ma != chg_last.charge_ma || siop != chg_last_siop || + host != chg_last_host) { + say("max77705: chg: %s; %s; %s, input %u mA, charge %u mA%s%s; battery %d.%d C%s, %u %%, %u mV; BC_STATUS %#x " + "VBADC %u; CNFG_00 %#x _02 %#x _04 %#x _06 %#x _09 %#x; DTLS %#x %#x\n", + chg_limits[chg_st.type < CHG_TYPES ? chg_st.type : CHG_NONE].name, chg_why_name(o.why), + o.enable ? "on" : "off", o.input_ma, o.charge_ma, siop ? ", in use (SIOP)" : "", host ? ", a computer on the link" : "", + in.temp_dc / 10, (in.temp_dc < 0 ? -in.temp_dc : in.temp_dc) % 10, in.temp_ok ? "" : " (NOT READ)", in.soc, + in.vcell_mv, in.bc, in.vbadc, in.cnfg00, in.cnfg02, in.cnfg04, cnfg06, in.cnfg09, in.dtls00, in.dtls01); + chg_said = true; + chg_last = o; + chg_last_type = chg_st.type; + chg_last_siop = siop; + chg_last_host = host; + chg_say_would = true; + } + /* nothing written without VBUS, after a failed read, or with the charger's settings locked */ + if (!in.read_ok || o.why == WHY_NO_VBUS) { + return; + } + if ((cnfg06 & CHG_CNFG06_CHGPROT_MASK) != CHG_CNFG06_CHGPROT_MASK) { + if (chg_refused++ == 0) { + say("max77705: chg: CNFG_06 %#x: the charger's settings are locked (CHGPROT); nothing written\n", cnfg06); + } + return; + } + mode = in.cnfg00 & 0x0Fu; + ok = true; + if (o.enable && o.input_ma != 0) { + ok = chg_set("input limit (CNFG_09)", CHG_REG_CNFG_09, in.cnfg09, CHG_CNFG09_LIM_MASK, chg_input_code(o.input_ma)) && ok; + } + if (o.enable && o.charge_ma != 0) { + ok = chg_set("charge current (CNFG_02)", CHG_REG_CNFG_02, in.cnfg02, CHG_CNFG02_CC_MASK, chg_charge_code(o.charge_ma)) && ok; + } + if (!ok && chg_mode >= 2) { + chg_st.latched_off = true; + o.enable = false; + say("max77705: chg: a limit did not read back as written: charging off until the cable is pulled\n"); + } + if (mode == 0x4 || mode == 0x5) { + if (o.rearm && chg_mode >= 2) { + /* the watchdog expired with charging wanted: kicked, and charging off and on, as Samsung's driver does */ + chg_wdt_kick(); + (void)chg_set("charging (CNFG_00, re-arm)", CHG_REG_CNFG_00, in.cnfg00, CHG_CNFG00_CHG, 0); + (void)read8(CHARGER, CHG_REG_CNFG_00, &in.cnfg00); + } + if (!chg_set("charging (CNFG_00)", CHG_REG_CNFG_00, in.cnfg00, CHG_CNFG00_CHG, o.enable ? CHG_CNFG00_CHG : 0)) { + chg_st.latched_off = true; + } + } + if (chg_mode >= 2) { + chg_wdt_kick(); + } +} + +/* at step 5: the boot-arguments read, the guard said */ +static void +chg_guard_start(void) +{ + (void)PE_parse_boot_argn("max77705_chg", &chg_mode, sizeof(chg_mode)); + (void)PE_parse_boot_argn("max77705_siop", &chg_siop, sizeof(chg_siop)); + if (chg_mode != 0 && board != &battery_boards[0]) { + say("max77705: chg: max77705_chg=%u is for the Galaxy S9 (its limits are Samsung's for it): not on the %s\n", + chg_mode, board->platform); + chg_mode = 0; + } + if (chg_mode != 0) { + chg_state_reset(&chg_st, 0); + say("max77705: chg: the charger guard, %s (max77705_chg=%u), 5 V only; the in-use limit %s (max77705_siop=%u)\n", + chg_mode >= 2 ? "writing" : "read only, saying what it would write", chg_mode, chg_siop ? "on" : "off", + chg_siop); + } +} + +/* with every 5-minute line */ +static void +chg_guard_say(void) +{ + if (chg_mode != 0) { + say("max77705: chg: %u writes, %u failed, %u read back differently, %u refused (locked); watchdog %u kicks\n", + chg_writes, chg_wfail, chg_differs, chg_refused, wdt_kicks); + } +} + +#endif /* HAKIOS_MAX77705_GUARD_H */ diff --git a/drivers/usb/hakios.dwc3.c b/drivers/usb/hakios.dwc3.c index 561ea6dc9d..6e3a1a936c 100644 --- a/drivers/usb/hakios.dwc3.c +++ b/drivers/usb/hakios.dwc3.c @@ -2095,6 +2095,10 @@ hakios_usb_gadget_vbus(bool present) os_atomic_store(&vbus_report, present ? 1 : 0, release); } +/* a host configured the link: a computer on the cable, whatever the MUIC says (the charger guard, max77705_chg=) */ +bool hakios_usb_gadget_host(void); +bool hakios_usb_gadget_host(void) { return strcmp(usb_state, "configured") == 0; } + /* From the cable and the link's state, decide whether to stop or restart the link. Runs in the poll. */ static void link_watch(void) diff --git a/tools/arch-size.allow b/tools/arch-size.allow index 519b1a40c7..3921f0976f 100644 --- a/tools/arch-size.allow +++ b/tools/arch-size.allow @@ -39,7 +39,7 @@ drivers/modem/hakios.qmi.c 963 drivers/modem/hakios.shannon.c 2927 drivers/net/hakios.net.c 1485 drivers/power/exynos/hakios.exynos_cpufreq.c 2120 # 1531 today, and the growth of open pull request #337 -drivers/power/max77705/hakios.max77705.c 1125 +drivers/power/max77705/hakios.max77705.c 1130 # +5: the charger guard's hooks (max77705_chg=); the guard itself is hakios.max77705_guard.h drivers/soc/exynos/hakios.exynos_acpm.c 881 drivers/soc/exynos/hakios.exynos_m3.c 907 drivers/soc/exynos/hakios.exynos_tee.c 1232 @@ -47,7 +47,7 @@ drivers/storage/hakios.apfs_check.c 1872 drivers/storage/ufs/hakios.ufs.c 3755 drivers/storage/ufs/hakios.ufshc.c 3741 drivers/storage/ufs/hakios.ufshc.lga.h 817 -drivers/usb/hakios.dwc3.c 2298 +drivers/usb/hakios.dwc3.c 2302 # +4: hakios_usb_gadget_host() for the charger guard (a computer on the link) drivers/virtio/hakios.virtio.c 1032 drivers/wifi/brcmfmac/hakios.exynos_pcie.c 999 drivers/wifi/hakios.apple80211.c 844 diff --git a/tools/boot-args.py b/tools/boot-args.py index 8c8bc45b01..8a276713ef 100755 --- a/tools/boot-args.py +++ b/tools/boot-args.py @@ -78,7 +78,7 @@ ("Security stand-ins", r"kern_minimac|miniamfi"), ("Wi-Fi", r"hakios\.(wifi|wlfw|lx|sta|apple80211|exynos_pcie|brcmfmac)\.|^lx_[a-z0-9]+\.c$"), # wifi/lx/*/lx_*.c: the Linux layer ("Cellular", r"hakios\.(mpss|ipa|cell|nas|qmi)\."), - ("Audio and battery", r"hakios\.(adsp|audio|sound|speaker|mic|virtio_sound|battery|battguard|max77705|exynos_abox|max98512|cs47l93|guard)\."), + ("Audio and battery", r"hakios\.(adsp|audio|sound|speaker|mic|virtio_sound|battery|battguard|max77705|max77705_guard|exynos_abox|max98512|cs47l93|guard)\."), ("Cameras", r"hakios\.(camera|exynos_camera)\."), ("Sensors", r"hakios\.ssp\."), ("Touch and buttons", r"hakios\.(goodix|input|buttons|exynos_keys|s6sy761|exynos_hsi2c|virtio_input)\."), diff --git a/tools/max77705_charge_test.c b/tools/max77705_charge_test.c index dc3bc7d4d6..f7ae7af1bc 100644 --- a/tools/max77705_charge_test.c +++ b/tools/max77705_charge_test.c @@ -22,6 +22,8 @@ * (5 V asked, 500 mA) when the battery or the charger's thermistor leaves the band, VBUS leaves 7.5-10.5 V, or a fault; * after a drop or a bad answer not asked again on that cable; asked again after the cable goes and comes; * - the read-back check; + * - the iOS 16.5 guard's limits on top (max77705_chg=2): SIOP (1200/1000 mA, 500/1000 at 9 V) and a computer on the link + * (the CDP's 1500/1500 mA, no 9 V) only ever lower, for every input and charge current; * - a grid over every input that matters: the input limit never above the type's in force, never above 500 mA with * VBUS above 5.5 V outside a 9 V session, 9 V never asked outside every one of its conditions. */ @@ -590,6 +592,45 @@ grid(void) printf("max77705_charge_test: grid of %lu states\n", combos); } +/* SIOP and a computer on the link (iOS 16.5's guard): only ever lower, at Samsung's S9 numbers, and no 9 V with a host */ +static void +caps(void) +{ + for (int t = CHG_SDP; t < CHG_TYPES; t++) { + for (uint32_t in_ma = 0; in_ma <= 3200; in_ma += 25) { + for (uint32_t cc_ma = 0; cc_ma <= 3150; cc_ma += 50) { + struct chg_out o = { .enable = true, .input_ma = in_ma, .charge_ma = cc_ma, .ask_9v = true }; + struct chg_out h = o; + + chg_siop_cap(&o, (enum chg_type)t); + CHECK(o.input_ma <= in_ma && o.charge_ma <= cc_ma, "SIOP raised a limit"); + CHECK(o.input_ma <= (t == CHG_AFC_9V ? 500u : 1200u) && o.charge_ma <= 1000u, + "SIOP type %d: %u/%u", t, o.input_ma, o.charge_ma); + CHECK(o.input_ma == (in_ma < (t == CHG_AFC_9V ? 500u : 1200u) ? in_ma : (t == CHG_AFC_9V ? 500u : 1200u)), + "SIOP lowered more than asked"); + chg_host_cap(&h); + CHECK(h.input_ma <= 1500 && h.charge_ma <= 1500 && !h.ask_9v, "host cap: %u/%u", h.input_ma, h.charge_ma); + CHECK(h.input_ma <= in_ma && h.charge_ma <= cc_ma, "host cap raised a limit"); + } + } + } + { + /* a DCP at 25 C: Samsung's 1800/2100 mA; in use 1200/1000; a computer on the link 1500/1500 */ + struct chg_state s; + struct chg_in in = healthy(BC_DCP, 100); + struct chg_out o; + + chg_state_reset(&s, 100); + o = chg_step(&s, &in); + CHECK(o.enable && o.input_ma == 1800 && o.charge_ma == 2100, "DCP %u/%u", o.input_ma, o.charge_ma); + chg_siop_cap(&o, s.type); + CHECK(o.input_ma == 1200 && o.charge_ma == 1000, "DCP in use %u/%u", o.input_ma, o.charge_ma); + o = chg_step(&s, &in); + chg_host_cap(&o); + CHECK(o.input_ma == 1500 && o.charge_ma == 1500, "DCP with a host %u/%u", o.input_ma, o.charge_ma); + } +} + int main(void) { @@ -601,6 +642,7 @@ main(void) full(); afc(); grid(); + caps(); printf("max77705_charge_test: %lu checks, %lu failures\n", checks, failures); return failures != 0; }