CONFIG_PM
option.
pm_register
with the PM subsytem.pm_access
before each hardware access.pm_dev_idle
when the device is not being used.pm_unregister
from the PM
subsystem.pm_register
returns a pointer to a pm_dev
(used thereon by the driver to communicate with the PM), on NULL
if it fails.
It takes three parameters,
pm_dev_t type
, (actually an int).
This specifies the type of the driver that is registering with the PM.
Several types are defined in the header pm.h:
PM_UNKNOWN_DEV, PM_SYS_DEV, PM_PCI_DEV, and a few others.unsigned long id
, an identificator of the driver.pm_callback callback
, the callback driver' method
invoked by the PM to perform requests on the driver. For example
in case of a suspend or a resume.pm_dev
contains
type
, the driver' type;id
, the driver' id;callback
, pointer to the driver' callback;data
, a void * (private data ???);flags
, (not used);state
holds the driver PM D-state;prev_state
, is used to rollback a failed callback;data
, flags
and states are set to 0 by
pm_register
.
pm_callback()
takes three parameters,
dev
, pointer to the pm_dev (associated to the driver);pm_request_t rqst
, the request code. The possible codes
are listed in pm.h:
void * data
, for PM_SUSPEND contains the ACPI D-state.pm_access
is made.
pm_access
and pm_dev_idle
with the pm_dev pointer returned by the pm_register
.
pm_send
, sends a request to a driver;pm_send_all
, sends a request to all drivers;pm_find
, finds a device of the specified type.pm_undo_all
, rollback;__pm_unregister
;
Exercise
apmsleep +00:01
Marco Corvi - 2003