Power Management

Power Management — Power Management related helpers

Functions

Types and Values

Includes

#include <igt.h>

Description

This library provides various helpers to enable power management for, and in some cases subsequently allow restoring the old behaviour of, various external components that by default are set up in a way that interferes with the testing of our power management functionality.

Functions

igt_pm_enable_audio_runtime_pm ()

void
igt_pm_enable_audio_runtime_pm (void);

We know that if we don't enable audio runtime PM, snd_hda_intel will never release its power well refcount, and we'll never reach the LPSP state. There's no guarantee that it will release the power well if we enable runtime PM, but at least we can try.

We don't have any assertions on open since the user may not even have snd_hda_intel loaded, which is not a problem.


igt_pm_enable_sata_link_power_management ()

int8_t *
igt_pm_enable_sata_link_power_management
                               (void);

Enable the min_power policy for SATA link power management. Without this we cannot reach deep runtime power states.

We don't have any assertions on open since the system might not have a SATA host.

Returns

An opaque pointer to the data needed to restore the default values after the test has terminated, or NULL if SATA link power management is not supported. This pointer should be freed when no longer used (typically after having called restore_sata_link_power_management()).


igt_pm_restore_sata_link_power_management ()

void
igt_pm_restore_sata_link_power_management
                               (int8_t *pm_data);

Restore the link power management policies to the values prior to enabling min_power.

Caveat: If the system supports hotplugging and hotplugging takes place during our testing so that the hosts change numbers we might restore the settings to the wrong hosts.

Parameters

pm_data

An opaque pointer with saved link PM policies; If NULL is passed we force enable the "max_performance" policy.

 

igt_setup_runtime_pm ()

bool
igt_setup_runtime_pm (void);

Sets up the runtime PM helper functions and enables runtime PM. To speed up tests the autosuspend delay is set to 0.

Returns

True if runtime pm is available, false otherwise.


igt_restore_runtime_pm ()

void
igt_restore_runtime_pm (void);

Restores the runtime PM configuration as it was before the call to igt_setup_runtime_pm.


igt_get_runtime_pm_status ()

enum igt_runtime_pm_status
igt_get_runtime_pm_status (void);

Returns

The current runtime PM status.


igt_wait_for_pm_status ()

bool
igt_wait_for_pm_status (enum igt_runtime_pm_status status);

Waits until for the driver to switch to into the desired runtime PM status, with a 10 second timeout.

Parameters

status

desired runtime PM status

 

Returns

True if the desired runtime PM status was attained, false if the operation timed out.

Types and Values

enum igt_runtime_pm_status

Symbolic values for runtime PM device status.

Members

IGT_RUNTIME_PM_STATUS_ACTIVE

device is active

 

IGT_RUNTIME_PM_STATUS_SUSPENDED

device is suspended

 

IGT_RUNTIME_PM_STATUS_SUSPENDING

device is in the process of suspending

 

IGT_RUNTIME_PM_STATUS_RESUMING

device is in the process of resuming

 

IGT_RUNTIME_PM_STATUS_UNKNOWN

unknown runtime PM status