aarron-lee / SimpleDeckyTDP

(Formerly Simple) TDP plugin for alternative AMD PC handhelds
Other
37 stars 6 forks source link

Per-game AC power profiles conflict with LeGo Charge Limit #36

Closed Shaunathanz closed 2 weeks ago

Shaunathanz commented 3 weeks ago

SimpleDeckyTDP 0.3.6 Scaling driver amd-pstate-epp LegionGoRemapper 0.2.7 Bazzite 20240706.0 Lenovo Legion Go

I don't know if this was always an issue or a new one, but I noticed some subpar performance while playing plugged in to the charger. I realized that the per game AC profile was alternating between the AC and battery profiles. I realized that the charge limit from LegionGoRemapper toggles charging on and off to keep the battery at 80% and that was triggering the different AC profiles in SimpleDeckyTDP. I assume that there are limitations to what information you can access from a decky plugin, but ideally we want to prefer the AC profile if plugged in, not necessarily only when power is being delivered. Alternatively maybe checking if the battery limit is enabled for LegionGoRemapper could alter what profile is selected in SimpleDeckyTDP.

aarron-lee commented 3 weeks ago

So this is a known issue that I currently don't have a solution for.

SimpleDeckyTDP relies on Steam's AC power notifier, which means Steam is telling SDTDP that the device is/isn't on AC power.

The AC power toggling on/off is because Lenovo implemented the charging limits in an odd way on the Legion Go, where it will toggle charging on/off once it hits 80%.

The proper fix would be for Lenovo to issue a bios update that resolves this weird behavior.

That being said, I might be able to push an update that helps mitigate the issue. However, it will never be fully resolved unless Lenovo pushes a fix.

aarron-lee commented 2 weeks ago

@Shaunathanz I might be able to create an alternative implementation of AC power profiles specifically for the LGO, but I'll need some help from you.

Could you run this in terminal, and see if it behaves as expected?

watch -n 0.5 cat /sys/class/power_supply/ACAD/online

it should always be 1 while on AC power, 0 for battery. If this behavior is consistent and non-jittery, I should be able to enable a workaround in SDTDP.

I currently won't have access to my LGO for a long time, so I can't test it.

Shaunathanz commented 2 weeks ago

@aarron-lee I can test for sure, not a problem.

I can confirm that the behavior is non-jittery and consistent, whether battery limit is enabled or not the command returns 1 while plugged in and 0 when on battery.

Thanks for going above and beyond for that device specifically. I know the onus is really on Lenovo to fix it but they don't exactly seem to be in a rush to support the device even for basic things like driver updates for Windows users so the battery limit re-implementation seems like a stretch to me unfortunately

aarron-lee commented 2 weeks ago

Here's a manual SDTDP build that has the workaround implementation for the LGO. Could you try testing and see if it's more stable?

SimpleDeckyTDP.tar.gz

Install instructions:

Note that there will be no visual differences in the plugin, it automatically swaps to the custom implementation if it's supported.

One way to tell it's working is that the SDTDP AC power profile indicator should change slightly faster than Steam's AC power indicator when plugging/unplugging power

Shaunathanz commented 2 weeks ago

Initial impressions are looking very promising! The plugin is behaving as expected, responding almost immediately to the act of plugging in the charger or disconnecting it, even with the battery limit enabled. I would like to spend more time with it before declaring it absolutely stable but so far so good.

One thing I can't do until tomorrow is test on a non Legion Go to make sure that still works.

aarron-lee commented 2 weeks ago

One thing I can't do until tomorrow is test on a non Legion Go to make sure that still works.

On a non-Legion Go, it should gracefully fallback to the old implementation that relies on the Steam AC power notifier.

A quick sanity check on non-Legion Go hardware would be appreciated.

aarron-lee commented 2 weeks ago

@Shaunathanz let me know if you encounter any issue. from my testing so far on other devices, it seems to be stable and working well. If it's working well for you too, i'll queue it up in an official release.

Shaunathanz commented 2 weeks ago

I think it's safe to pull the trigger

aarron-lee commented 2 weeks ago

released in v0.3.8.

Feel free to comment here, or reopen the issue if you notice any problems