whatawurst / android_device_sony_yoshino-common

This is the Android device configuration for the yoshino platform
10 stars 48 forks source link

yoshino-common: Build lineage health HAL and related sepolicies #97

Closed derfelot closed 1 year ago

derfelot commented 1 year ago

Change-Id: I1ca5f25f3a2d8734647b9cc0ff4885b0b817c6ad

derfelot commented 1 year ago

To be merged once merged upstream

SteadyQuad commented 1 year ago

Lineage topic 'charging-control-hal-20' was merged on june 9th. (Some new changes are pending, but mostly tweaks and extra features, nothing blocking.)

derfelot commented 1 year ago

yeah thanks, i saw. I will first try to implement the standard charging_enabled node as was done in tama as well:

https://review.lineageos.org/c/LineageOS/android_kernel_sony_sdm845/+/358900 https://review.lineageos.org/c/LineageOS/android_device_sony_tama-common/+/350767

SteadyQuad commented 1 year ago

I haven't tried that exact approach yet, but months ago I tried an early changeset of the charging-control-hal-20 topic plus /sys/.../charging_enabled configured instead of /sys/.../smart_charging_interruption (the charging_enabled sys node already exists in our kernel iirc). I didn't use any extra kernel patches like the tama change you're quoting, and that early build would 'jitter' around the charging stop percentage: charging service vs health service fighting over whether to start or stop charging, visible in logcat and in the battery icon in the status bar, and a spamload of notifications. Maybe the tama kernel changes prevent that by properly voting.

But I've been running fine with pretty much this current PR only (so with /sys/.../smart_charging_interruption configured for TARGET_HEALTH_CHARGING_CONTROL_PATH) and no kernel changes just fine for at least a month now, so I've left it at that: If it ain't broke...

derfelot commented 1 year ago

Looks like it works. The nice thing about it is that it completely "stops" charging, e.g. the led is also turned off. Before when using the smart_charging_interruption node this wouldn't happen iirc. I think this "jitter" around the target % has been actually addressed in the HAL itself, by including a little buffer between between target % and when charging kicks in again. In my test case, I set the target to 76% where it stopped, then used the phone for a bit while plugged in and it would kick in again as soon as it hit 74%.

Merged with https://github.com/whatawurst/android_device_sony_yoshino-common/pull/101 and https://github.com/whatawurst/android_kernel_sony_msm8998/pull/94