Commit graph

83 commits

Author SHA1 Message Date
Mario Limonciello
d08683ecf1 Add support for turning on/off upower at runtime
This will allow DE environments to decide whether they want to allow
actions and profiles to dynamically change from the battery level or
AC adapter presence.
2025-02-07 19:29:41 -06:00
Mario Limonciello
30ea6f6610 trivial: add fix for pylint scope issue 2025-02-07 19:27:29 -06:00
Mario Limonciello
faad209f7b amdgpu_dpm: Default to opt-in (disabled)
While in power-saver mode the clock changes are reported to be too
aggressive for some users requested behavior.

Change the action to opt-in so that users that want to use it
can still enable it.

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/164
2025-02-07 19:27:29 -06:00
Mario Limonciello
a4b9c168ef Add command line arguments to enable/disable actions with dbus interface 2025-02-07 19:27:29 -06:00
Mario Limonciello
6f6d536a8a Add a new SetActionEnabled D-Bus API to turn on/off actions 2025-02-07 19:27:29 -06:00
Mario Limonciello
1b2c889b19 trivial: integration tests: Add helpers for checking if actions enabled or disabled 2025-02-07 19:27:29 -06:00
Mario Limonciello
9a69829ee1 trivial: change blocklist test to use default enabled action trickle_charge instead 2025-02-07 19:27:29 -06:00
Marco Trevisan (Treviño)
ce414c784c integration-tests: Wait for holds to disappear with a lambda 2025-02-08 00:44:57 +00:00
Marco Trevisan (Treviño)
9ab472e665 integration-tests: Ignore vainishing hold test on legacy interface
For some reason it seems to hang when repeated in CI (only), so let's
ignore it for now instead of blocking on it.
2025-02-08 00:44:57 +00:00
Marco Trevisan (Treviño)
a2e418b87f tests: Skip permissions tests if chattr falis 2025-02-08 00:44:57 +00:00
Rogerio Alves
34275b1fef trivial: fixes unknown option value for pylint < 3.3.0
The too-many-positional-arguments warning introduced in commit 4a367430
caused a regression in pylint-integration-tests for versions of pylint < 3.3.0,
as these versions do not support the too-many-positional-arguments check.

Added disable=unknown-option-value to the pylint disable line for compatibility
with pylint < 3.3.0, avoiding test failures.

Kept disable=too-many-positional-arguments for pylint >= 3.3.0, since the
function exceeds the maximum allowed positional arguments (R0917) and may cause
lint errors.

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/174
2025-01-06 21:15:11 -03:00
Mario Limonciello
095085599c trivial: handle a daemon crash when invalid properties are requested 2024-12-28 02:18:35 +00:00
Mario Limonciello
10aa0f2322 Allow amd-pstate to change modes at runtime
Rather than checking for active mode at startup and then never checking
it again check the mode when trying to write a value.

If it's not active, log something to the journal. This is intentionally
not failing because users could still have an ACPI platform-profile change
occur.

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/168
2024-12-26 17:07:19 +00:00
Mario Limonciello
4a367430e8 trivial: ignore too many positional arguments in tests 2024-12-26 11:02:53 -06:00
Mario Limonciello
96e1a8a20b amd-pstate: drop detection for client vs server
PPD doesn't force the SoC to active mode or to load.

As the policy of whether amd-pstate is loaded is controlled by the
kernel having another policy whether power-profiles-daemon isn't
necessary.
2024-09-10 10:58:27 -05:00
Mario Limonciello
21b58819ed action-amdgpu-dpm: Don't override user settings for dpm if set to manual 2024-09-05 18:56:15 -05:00
Marco Trevisan (Treviño)
e687484acd integration-tests: Simplify changing battery percentage
Just change the percentage, being the only thing we care about.

It also fixes a race in my setup on this test
2024-09-03 03:10:17 +02:00
Mario Limonciello
f98766fa1d Add support for setting DPM level on APUs
When in power-saver set DPM clocks explicitly down to "low".

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/158
2024-08-30 03:22:53 +02:00
Mario Limonciello
c180150896 Add debug knobs for upower and logind 2024-07-30 05:21:46 +00:00
Mario Limonciello
0ce9b63d47 amdgpu_panel_power: Add support for progressive ABM levels
More users use power saver as their default value than expected, and
so ABM is a more negative experience for some of them.

Instead of a table of values, use "progressive" values that change
based on battery life.

The selected values:
* Balanced + AC:
  ABM 0
* Balanced + battery:
  >= 30% battery
    ABM 0
  < 30% battery
    ABM 1
* Power Saver + AC:
  ABM 0
* Power Saver + battery:
  >= 50% battery
    ABM 0
  30-49% battery
    ABM 1
  20-30% battery
    ABM 2
  <20% battery
    ABM 3
2024-07-30 00:18:25 -05:00
Mario Limonciello
5eb1248927 amd-pstate: Program minimum frequency to lowest non-linear frequency
Although the system will save more power at lower frequency, AMD SoCs
have a point when they can operate most efficiently called the lowest
non-linear frequency.

Program the minimum frequency to this value in balanced and performance
modes to improve responsiveness.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
2024-07-02 23:14:55 -05:00
Mario Limonciello
05867e84a4 amd-pstate: Add support for core performance boost
Apply core performance boost in balanced and performance and
disable it when in power saver.
2024-06-21 14:56:58 -05:00
Mario Limonciello
2e00350f92 trivial: Don't assume that turbo_pct is present
According to kernel documentation this file is only exposed if
the value will be the same for all CPUs.

"This attribute is present only if the value exposed by it is the same for all of the CPUs in the system."
Link: https://www.kernel.org/doc/html/v6.9-rc1/admin-guide/pm/intel_pstate.html
2024-04-06 15:05:11 -05:00
Marco Trevisan (Treviño)
a86b9cda94 ppd-utils: Use simpler write without extra copies
Simplify our writing function by just using pure C open/write calls
since we don't really need to be able to create files.

In fact this made possible to spot a test issue where a file was not
present and in fact in some scenarios we had random valgrind errors in
CI.

Plus, since we just need to write the contents as it is, we can avoid
extra buffers.
2024-04-03 23:28:26 +00:00
Mario Limonciello
9dc15cef70 Add --driver-block and --action-block arguments
These will set the environment variables accordingly to block drivers
or actions from loading.
2024-04-03 19:55:41 +00:00
Mario Limonciello
acd40e54ca Distinguish differently between -v and -vv
Set the default log level to MESSAGE.
If launched with -v, upgrade to INFO.
If launched with -vv, upgrade to DEBUG.
2024-04-03 19:55:41 +00:00
Marco Trevisan (Treviño)
2fb8f83d4b integration-tests: Use clearer logic to run initial condition check 2024-04-03 21:52:44 +02:00
Marco Trevisan (Treviño)
fb1039f9da integration-tests: Add more debugging bits if we can't connect to server 2024-04-03 21:49:18 +02:00
Mario Limonciello
4b172671cc Add unit tests for upower starting after ppd 2024-04-03 13:55:02 -05:00
Mario Limonciello
3b4249d8e9 intel-pstate: Use different EPP/EPB values for battery and AC.
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/145
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/71
2024-04-03 13:34:00 -05:00
Marco Trevisan (Treviño)
96eef4b8eb tests: Write daemon stderr to system stderr 2024-04-03 20:15:17 +02:00
Marco Trevisan (Treviño)
fd8f6a0f3c integration-tests: Add test for resuming state after suspend on intel 2024-04-03 20:15:17 +02:00
Marco Trevisan (Treviño)
928c4611d8 power-profiles-daemon: Only update battery value when it actually did
We might have notified the drivers even for no actual changes, so
let's refactor the code so that we only notify them when we really have
a battery state change.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
ae3a30da98 integration-tests: Use a lambda for assert_eventually messages
In this way we can show the actual value after we've finished the check
instead of the one that was read initially.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
df534c3911 integration-tests: Add ability to check if a condition persists
assert_eventually() can check if a condition eventually is true, but
this could change after a while. So add another function that allows
to check if a condition persists for a given time.
2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
d3199b3203 integration-tests: Simulate OnBattery changes while the daemon is running 2024-04-03 20:10:34 +02:00
Marco Trevisan (Treviño)
cf4321c85b integration-tests: Use start_dbus_template everywhere
As it handles auto-cleanup better
2024-04-03 20:10:34 +02:00
Mario Limonciello
2ec541edc0 trivial: tests: write out dytc_lapmode atomically 2024-04-02 14:15:53 -05:00
Marco Trevisan (Treviño)
e10516c348 integration-tests: Use automatic cleanups for stopping daemon and services
We were stopping the daemon manually while this is already something done
by the teardown function.

So let's leave this being automatically handled.
2024-04-02 20:06:14 +02:00
Mario Limonciello
2c5d8f2c2d trivial: don't destroy test bed until last step of tearDown 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
42f45ee6e1 powerprofilesctl: Proxy more signals to called process 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
0c80ae1108 powerprofilesctl: Use posix-compliant exit codes on signals
Do not return the python exit code when the launched process exit
because of a signal, but instead expose it as it is.
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
15c74efc7e powerprofilesctl: Exit with launched process exit code
This is a regression of commit 18a9c6668, due to the fact that the
argparse func return value is simply ignored.

So let's just exit directly with the provided return value in such case.
2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
9bc5643950 src/powerprofilesctl: Fail if a launch unknown argument is before than command 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
acd17bd066 powerprofilesctl: Throw an unrecognized arguments error on on launch-commands 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
8574070267 tests/integration-tests: Ensure that the launch arguments are respected 2024-04-01 21:58:47 +00:00
Marco Trevisan (Treviño)
8da511916f tests: Add support for collecting python coverage data
We have a python script for the control tool so let's use that to
monitor the powerprofilesctl coverage
2024-04-01 18:04:32 +02:00
Marco Trevisan (Treviño)
b4d5a045d0 tests/integration-tests: Add a function to get powerprofilesctl path 2024-04-01 15:57:05 +02:00
Mario Limonciello
87fea13806 Pass all unknown arguments to the launch command
Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/144
2024-03-26 15:56:16 -05:00
Mario Limonciello
bdc60171e5 amd-pstate: Transition between balanced_power and balanced_performance
When the system is on AC and profile is balanced put the EPP value
of balanced_performance.
When the system is on battery and profile is balanced put the EPP value
of balanced_power.
2024-03-02 16:23:47 +00:00