Profile Drivers

Profile Drivers — Profile Drivers

Properties

char * driver-name Read / Write / Construct Only
char * performance-degraded Read / Write
PpdProfile profiles Read / Write / Construct Only

Signals

void probe-request Run Last
void profile-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── PpdDriver

Description

Profile drivers are the implementation of the different profiles for the whole system. A driver will need to implement support power-saver and balanced at a minimum.

All drivers should be derived from either PpdDriverCpu or PpdDriverPlatform

When a driver implements the performance profile, it might set the “performance-degraded” property if the profile isn't running to its fullest performance for any reason, such as thermal limits being reached, or because a part of the user's body is too close for safety, for example.

Functions

Types and Values

struct PpdDriverClass

struct PpdDriverClass {
  GObjectClass   parent_class;

  PpdProbeResult (* probe)            (PpdDriver                   *driver);
  gboolean       (* activate_profile) (PpdDriver                   *driver,
                                       PpdProfile                   profile,
                                       PpdProfileActivationReason   reason,
                                       GError                     **error);
  gboolean       (* power_changed)    (PpdDriver                   *driver,
                                       PpdPowerChangedReason        reason,
                                       GError                     **error);
  gboolean       (* prepare_to_sleep) (PpdDriver                   *driver,
                                       gboolean                     start,
                                       GError                     **error);
  gboolean       (* battery_changed)  (PpdDriver                   *driver,
                                       gdouble                      val,
                                       GError                     **error);
};

New profile drivers should not derive from PpdDriver. They should derive from the child from PpdDriverCpu or PpdDriverPlatform drivers and implement at least one of probe() and activate_profile .

Members

probe ()

Called by the daemon on startup.

 

activate_profile ()

Called by the daemon for every profile change.

 

power_changed ()

Called by the daemon when power adapter status changes

 

prepare_to_sleep ()

   

battery_changed ()

Called by the daemon when the battery level changes.

 

PpdDriver

typedef struct _PpdDriver PpdDriver;

enum PpdProbeResult

Those are the three possible values returned by a driver probe, along with an unset value for convenience.

Members

PPD_PROBE_RESULT_UNSET

unset

 

PPD_PROBE_RESULT_DEFER

driver should be kept alive, as kernel support might appear.

 

PPD_PROBE_RESULT_FAIL

driver failed to load.

 

PPD_PROBE_RESULT_SUCCESS

driver successfully loaded.

 

enum PpdProfileActivationReason

Those are possible reasons for a profile being activated. Based on those reasons, drivers can choose whether or not that changes the effective profile internally.

Members

PPD_PROFILE_ACTIVATION_REASON_INTERNAL

the driver profile changed internally, usually because of a key combination.

 

PPD_PROFILE_ACTIVATION_REASON_RESET

setting profile on startup, or because drivers are getting reprobed.

 

PPD_PROFILE_ACTIVATION_REASON_USER

setting profile because the user requested it.

 

PPD_PROFILE_ACTIVATION_REASON_RESUME

setting profile because preference is lost during suspend.

 

PPD_PROFILE_ACTIVATION_REASON_PROGRAM_HOLD

setting profile because a program requested it through the HoldProfile method.

 

Property Details

The “driver-name” property

  “driver-name”              char *

Profile driver name.

Owner: PpdDriver

Flags: Read / Write / Construct Only

Default value: NULL


The “performance-degraded” property

  “performance-degraded”     char *

Why the performance profile is degraded, if set.

Owner: PpdDriver

Flags: Read / Write

Default value: NULL


The “profiles” property

  “profiles”                 PpdProfile

Profiles implemented by this driver.

Owner: PpdDriver

Flags: Read / Write / Construct Only

Signal Details

The “probe-request” signal

void
user_function (PpdDriver *ppddriver,
               gpointer   user_data)

The driver requested to be reprobed, because it became available.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “profile-changed” signal

void
user_function (PpdDriver *profile,
               PpdProfile arg1,
               gpointer   user_data)

Emitted when the profile was changed from the outside, usually by key combinations implemented in firmware.

Parameters

profile

the updated PpdProfile

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last