Commit graph

64 commits

Author SHA1 Message Date
Vicki Pfau
4eeffda8ef power: Replace LenovoWmiTdpLimiter with FirmwareAttributeTdpLimiter
It seems several devices use a firmware-attribute interface to do TDP limiting.
This turns LenovoWmiTdpLimiter into a generic interface that can be configured
to use an arbitrary firmware-attribute name and check for an arbitrary power
profile.
2025-05-13 18:03:02 -07:00
Vicki Pfau
752fe5df6a clippy: Fix warnings 2025-05-13 16:36:19 -07:00
Vicki Pfau
0f156ef49f manager/user: Emit signals when we change properties 2025-05-08 17:48:38 -07:00
Vicki Pfau
65a81cee47 power: Add LowPowerMode1 service
Add a new service to limit the platform TDP while handles are still held. This
feature is currently limited to the Steam Deck.
2025-04-30 18:53:08 -07:00
Vicki Pfau
c8eb661bec manager/user: Dynamically add or remove the TdpLimit1 interface if needed 2025-04-11 18:43:30 -07:00
Vicki Pfau
6086e23cc8 power: Add Lenovo WMI-based TDP limiting 2025-04-09 17:50:48 -07:00
Vicki Pfau
a3125be955 power: Refactor TDP limiting to allow for different backends 2025-04-09 17:50:36 -07:00
Vicki Pfau
45edfe2c7c power: Add interface for accessing platform-profiles 2025-04-09 17:50:33 -07:00
Vicki Pfau
81f3bde783 Run cargo fmt 2025-03-24 19:38:30 -07:00
Vicki Pfau
93a78041fb power: Change range values from tuple to RangeInclusive 2025-03-20 17:34:57 -07:00
Vicki Pfau
d5f4de72ca power: Simplify platform config test 2025-03-20 17:25:17 -07:00
Vicki Pfau
a957591193 Revert "power: Use VID:PID combination to get GPU clock ranges"
This reverts commit 8c52189d98.
2025-03-20 15:39:12 -07:00
Vicki Pfau
0f2ace9940 power: Don't clone config.battery_charge_limit 2025-03-19 20:31:01 -07:00
Vicki Pfau
8c52189d98 power: Use VID:PID combination to get GPU clock ranges 2025-03-13 16:30:08 -07:00
Vicki Pfau
7d8bd602a7 hardware: Split out device type detection, add initial identification of Legion Go S 2025-03-11 17:35:52 -07:00
Vicki Pfau
91890e5948 manager/user: Add BatteryChargeLimit1 interface (#12) 2025-01-21 17:31:51 -08:00
Vicki Pfau
b71ccfcc92 Use num_enum instead of home-rolled TryFrom definitions 2024-09-19 20:20:17 -07:00
Vicki Pfau
bdd095860e power: Allow returned GPU clocks range to overridden by a platform config 2024-09-06 16:35:18 -07:00
Vicki Pfau
7c3f2baa05 power: Expose TDP limit range as platform config 2024-09-06 16:35:18 -07:00
Vicki Pfau
127eab4863 Fix some clippy::pedantic warnings 2024-08-30 16:52:17 -07:00
Vicki Pfau
f2cf6d87fe manager/user: Make GPU interfaces optional 2024-08-13 20:16:14 -07:00
Vicki Pfau
53754680c1 power: Make test::setup return a Result 2024-08-13 20:15:10 -07:00
Vicki Pfau
4f3a5547d6 manager/user: Move relevant methods to GpuPerformanceLevel1, update as specified 2024-08-06 19:15:40 -07:00
Vicki Pfau
fc25da30af manager/user: Move relevant methods to GpuPowerProfile1, update as specified 2024-08-06 19:15:40 -07:00
Vicki Pfau
fb58cd8772 Run cargo fmt 2024-08-02 18:12:25 -07:00
Vicki Pfau
cf9253a709 power: Query GPU clock range from pp_dpm_sclk 2024-08-02 17:22:21 -07:00
Vicki Pfau
6867c4e870 power: Remove inline GPU clock range check, sysfs writes enforce it 2024-08-02 17:21:31 -07:00
Vicki Pfau
fd6d9cbfe0 power: Simplify GPU power profiles parsing with regex 2024-08-02 17:21:29 -07:00
Vicki Pfau
4efb3572ec power: Simplify GPUPowerProfile definition with strum 2024-07-31 20:40:27 -07:00
Vicki Pfau
126f912781 power: Fix GPUPerformanceLevel enum to match amdgpu definition 2024-07-30 20:33:37 -07:00
Vicki Pfau
8412adcd4a power: Clean up CPU sysfs property reading 2024-07-24 21:20:15 -07:00
Vicki Pfau
ffcd702172 Run clang fmt 2024-07-24 21:18:19 -07:00
Vicki Pfau
3c2dd55f87 power: Add basic tests for CPUScalingGovernor getters 2024-07-24 21:17:48 -07:00
Vicki Pfau
deb8cf620f power: Add basic tests for GPUPowerProfile getters 2024-07-24 20:01:02 -07:00
Jeremy Whiting
b54cb5638a Use Strum for GPUPerformanceLevel.
Can't use it with GPUPowerProfile because one of the sysfs
strings starts with a '3' digit.
2024-06-28 22:52:41 +00:00
Vicki Pfau
336fe1d3be Run cargo fmt 2024-06-28 15:51:27 -07:00
Vicki Pfau
5e8b4160d2 power: Combine GPU prefix lookups into simpler helpers
Previously we had two diferent lookup functions for finding the GPU in
/sys/class/drm/card* and /sys/class/hwmon/hwmon*, but for the former we only
used paths under it in device/. In both these cases, the device/ directory is a
symbolic link to the same directory, so in the case of one AMD GPU in a
machine, these operations were equivalent.

This MR removes the /sys/class/drm version as well as refactoring some of the
utility code to reduce code duplication.
2024-06-28 15:11:50 -07:00
Jeremy Whiting
93e153079d Rework the CPUGovernors enum a bit.
Change to CPUScalingGovernors and use strum
crate to remove some cruft.
2024-06-28 08:59:11 -06:00
Jeremy Whiting
7f9d25074e Add CPU Scheduler Governors.
Add a new enumeration for cpu scheduler governors.
Adds a property to get the available governors as a map of
value to strings similar to how we expose GPU Power Profiles.
Adds another property to get and set the current governor which
is applied to all cpus when set.
2024-06-28 08:59:08 -06:00
Jeremy Whiting
0759ff7077 Add gpu power profile(s) properties.
Add profiles property to give back available
profiles on this device.
Add profile property to get and set current gpu
power profile.
Filter possible properties when on deck.
Get current profile based on position of * character.
Get card0 path based on which cardX has vendor 0x1002
Add some basic tests.
TODO:
Possibly cache available properties instead of fetching repeatedly.
2024-06-05 15:36:41 -06:00
Vicki Pfau
788cf884bf Run cargo fmt 2024-05-30 16:54:14 -07:00
Vicki Pfau
922ba006ae power: Improve GPU test reliability 2024-05-30 01:41:20 -07:00
Vicki Pfau
98f402c33c power: Add enum round-trip tests 2024-05-24 15:10:45 -07:00
Vicki Pfau
b7b09e6c17 power: Move GPUPerformanceLevel::to_string to Display::fmt 2024-05-22 18:57:16 -07:00
Vicki Pfau
20227416e1 power: Make GPUPerformanceLevel::from_str implementation consistent with others 2024-05-13 18:55:38 -07:00
Vicki Pfau
e25b1a7ca7 steamosctl: Use GPUPerformanceLevel where applicable 2024-05-13 18:55:38 -07:00
Jeremy Whiting
f3e5c8b576 Use hwmon to determine which sysfs path to use for gpu/power bits.
Instead of always using /sys/class/drm/card0 based paths, use
/sys/class/hwmon looking for amdgpu name file to determine where
to look.
Fixes reading TDPLimit, GPUPerformanceLevel and ManualGPUClock
in cases where sysfs uses card1 or other paths.
NOTE: Using wrong cardX path is a bug and will be fixed, but
this makes steamos-manager a bit more resilient to those bugs.
2024-05-01 21:17:45 -06:00
Vicki Pfau
fc77feef2a power: Return 0 if no GPU clock can be found 2024-05-01 19:13:03 -07:00
Vicki Pfau
a182d580fd power: Idiom fix 2024-04-16 18:44:59 -07:00
Vicki Pfau
f004035f7f power: Make sure to flush writes before dropping the files 2024-04-16 18:41:04 -07:00