Commit graph

71 commits

Author SHA1 Message Date
Bastien Nocera
72b5c548ea docs: Build internal API documentation 2020-09-04 15:57:12 +02:00
Bastien Nocera
42d130494a main: Build a uninstalled solib for gtk-doc 2020-09-04 15:57:12 +02:00
Bastien Nocera
e8b9bc324c data: Also conflict with auto-cpufreq
As it might change the p-state configuration behind us.

See: 74c74b8cf9
2020-09-04 15:57:12 +02:00
Bastien Nocera
8243b945ce tests: Add tests for on-battery P-State driver 2020-09-04 15:10:16 +02:00
Bastien Nocera
3af71eb131 intel-pstate: Monitor battery status to choose right balanced pref
Prefer "balance_performance" p-state preference when the machine is on
mains, and "balance_power" when it's on battery.
2020-09-04 15:10:16 +02:00
Bastien Nocera
cbde91c758 ci: Add upower-glib package to CI 2020-09-04 15:10:16 +02:00
Bastien Nocera
45ccd0b230 tests: Add Intel P-State driver tests 2020-09-04 15:10:16 +02:00
Bastien Nocera
09283442cd main: Add intel_pstate-based driver
Intel's p-state driver provides "Energy vs. Performance" hints that
user-space can use to set a policy for the P-state selection logic.
On all supported Intel systems that should have a range from "power"
to "performance" with steps in between.

Depending on the selected profile, performance or power will be selected
for the equivalent power profile.

See https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#energy-vs-performance-hints
and https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html#turbo-p-states-support

Closes: #13
2020-09-04 15:01:30 +02:00
Bastien Nocera
369723f6d7 utils: Add ppd_utils_write() helper function 2020-09-01 15:58:42 +02:00
Bastien Nocera
85b5dafaa7 fake: Add a way to quit from interactive fake driver 2020-08-13 17:23:50 +02:00
Bastien Nocera
60f875ad60 main: Add --replace and --verbose command-line options 2020-08-13 17:23:50 +02:00
Bastien Nocera
8b3d366219 main: Get rid of "SelectedProfile" property
The original idea was to have a "SelectedProfile" property that would be
settable by the user, but could be different from the "ActiveProfile" if
the hardware's performance mode wasn't available for example.

It turns out that having 2 separate states makes for very confusing UI,
so if the performance profile becomes inhibited and it's the current one,
the active profile will automatically switch to balanced and stay there.
2020-08-12 16:55:58 +02:00
Bastien Nocera
a531044de4 main: Add fake performance driver 2020-08-12 15:31:54 +02:00
Bastien Nocera
f5b489aaf9 tests: Test previous commit fix
Test for "main: Fix PerformanceInhibited property not being up-to-date"
2020-08-12 15:22:41 +02:00
Bastien Nocera
499aaada6c main: Fix PerformanceInhibited property not being up-to-date
When something other than the performance profile was selected, the
PerformanceInhibited property was never set or updated. This meant that
front-ends couldn't make the performance mode temporarily unavailable
to the user.
2020-08-12 15:22:41 +02:00
Bastien Nocera
97f449a497 main: Add "Actions" property
That allows API users to programmatically check whether a particular
functionality is implemented in the daemon, eg. if we wanted to move
GPU performance modes from gamemode to this daemon, gamemode could
query whether that feature was implemented and available in the backend.

Closes: #12
2020-08-12 11:31:34 +02:00
Bastien Nocera
e347845096 main: Rename Inhibited to PerformanceInhibited
Make it clear that we don't expect any profile to ever be inhibited,
apart from the performance profile.
2020-08-10 16:42:07 +02:00
Bastien Nocera
bc2961a406 tests: Test "Fix transitions if one profile is inhibited" 2020-08-10 15:43:20 +02:00
Bastien Nocera
a92150c2b7 main: Fix transitions if one profile is inhibited
When transitioning from one profile to another, we only want to stop the
active profile from changing if the target profile is inhibited, which
it might not be if we want to switch to, say, the power-saver profile.

This was broken since drivers could handle more than one profile.
2020-08-10 15:42:40 +02:00
Bastien Nocera
f65f3cddd5 data: Make service D-Bus activatable 2020-08-10 11:42:31 +02:00
Bastien Nocera
a40954d148 main: Fix fprintf security build warning
../src/ppd-utils.c: In function 'ppd_utils_write_sysfs':
../src/ppd-utils.c:36:3: error: format not a string literal and no format arguments [-Werror=format-security]
   36 |   ret = fprintf (sysfsfp, value);
      |   ^~~
2020-08-07 12:14:28 +02:00
Bastien Nocera
0d7178f9d6 build: Make sure libexecdir is an absolute path 2020-08-07 11:23:06 +02:00
Bastien Nocera
74c74b8cf9 data: Conflict with TLP and tuned
As they might end up touching the same configuration knobs.

Closes: #2
2020-08-06 16:38:31 +02:00
Bastien Nocera
2cdd1e4186 main: Reset all the drivers on startup
Similarly to "main: Initialise state for actions", make sure that the
underlying initial state corresponds to the current profile.
2020-08-06 15:45:53 +02:00
Bastien Nocera
8ae0e14830 main: Add early check to get_driver_for_profile() function 2020-08-06 15:29:05 +02:00
Bastien Nocera
ccebd407c7 main: Verify that profile to activate is valid 2020-08-06 15:26:33 +02:00
Bastien Nocera
1ffbea1905 main: Add helper to verify that PpdProfile is a single profile
In certain places in the codebase, we expect PpdProfile to be a value
representing a single profile, so add a helper that we can use to verify
that.
2020-08-06 15:25:02 +02:00
Bastien Nocera
5a0cbd173f main: Make flags <-> str helpers public 2020-08-06 15:15:53 +02:00
Bastien Nocera
6d245eb7c6 main: Make drivers list an resizable array
As drivers can now handle one or three profiles, we don't need to keep
the same fixed-size array.
2020-08-06 14:50:33 +02:00
Bastien Nocera
fbb55ae078 main: Show Profile before Driver in gdbus output
Show the Profile key before the Driver key in the Profiles property, as
it's slightly clearer to human readers.
2020-08-06 14:43:44 +02:00
Bastien Nocera
b8798b5c20 lenovo-dytc: Handle power-saver profile as well 2020-08-06 14:42:48 +02:00
Bastien Nocera
00fe9ceb14 all: Make profile drivers handle multiple profiles
Rename the profile driver "profile" property to "profiles" to reflect
that drivers can now handle more than one profile.
2020-08-06 14:40:28 +02:00
Bastien Nocera
26af80e115 lenovo-dytc: Some reindentation 2020-08-06 12:37:14 +02:00
Bastien Nocera
0b772f3ddb main: Some reindentation 2020-08-05 19:46:21 +02:00
Bastien Nocera
03c9a37d8b main: Rename PpdProfileDriver to PpdDriver
The "profile" part is redundant, and makes names overly long.
2020-08-05 19:15:48 +02:00
Bastien Nocera
df0cabb9a8 main: Remove profile specificity from profile drivers
Similarly to "main: Remove profile specificity from actions", run
activation on all the drivers when switching profiles, so a driver can
eventually handle multiple profiles.
2020-08-05 17:35:19 +02:00
Bastien Nocera
5a550fcb64 main: Remove ProfileData struct
It only contained a single element, so address the element directly.
2020-08-05 17:14:44 +02:00
Bastien Nocera
91e5f564d2 main: Remove unused per-profile actions member 2020-08-05 17:11:59 +02:00
Bastien Nocera
17b655f9f5 main: Make PpdProfile into a bitmask
So that drivers can support multiple profiles.
2020-08-05 15:29:27 +02:00
Bastien Nocera
6be395152f main: Remove profile property from PpdAction
This is unused now that all actions are activated when switching
profiles.
2020-08-05 11:25:14 +02:00
Bastien Nocera
f0f48abc26 main: Remove profile specificity from actions
Make the actions handle transitions themselves, so they can minimise the
work they have to do when they know both the origin and the target
profiles.
2020-08-05 11:24:06 +02:00
Bastien Nocera
3a84c5b77c utils: Fix implicit declaration
The declaration was still using the old name.

src/ppd-action-trickle-charge.c: In function ‘set_charge_type’:
src/ppd-action-trickle-charge.c:61:5: warning: implicit declaration of function ‘ppd_utils_write_sysfs’ [-Wimplicit-function-declaration]
   61 |     ppd_utils_write_sysfs (dev, CHARGE_TYPE_SYSFS_NAME, charge_type, NULL);
      |     ^~~~~~~~~~~~~~~~~~~~~
2020-08-05 11:24:06 +02:00
Bastien Nocera
c45e572860 trickle-charge: Use new sysfs helper 2020-08-04 15:28:23 +02:00
Bastien Nocera
2b70350dff main: Add sysfs writing utility function 2020-08-04 15:28:23 +02:00
Bastien Nocera
2be3f651cd docs: Fix copyright year 2020-07-24 11:23:44 +02:00
Bastien Nocera
84c6470803 tests: Add trickle-charge action integration test 2020-07-20 17:04:17 +02:00
Bastien Nocera
19835b1f3e main: Add trickle charge action 2020-07-20 17:04:17 +02:00
Bastien Nocera
5078e578bd main: Initialise state for actions
Run "deactivate" on all the actions that don't correspond to the initial
selected profile so that non-power-saving get correctly applied if
they're not the default.
2020-07-20 17:04:17 +02:00
Bastien Nocera
ab360e4498 main: Implement action activation on profile switch 2020-07-17 15:55:41 +02:00
Bastien Nocera
394d84187c main: Register actions 2020-07-17 15:47:37 +02:00