Contents

setPowerState

Requests a power managed driver to change the power state of its device.

Declaration

virtual IOReturn setPowerState(unsigned long powerStateOrdinal, IOService *whatDevice);

Parameters

  • powerStateOrdinal:

    The number in the power state array of the state the driver is being instructed to switch to.

  • whatDevice:

    A pointer to the power management object which registered to manage power for this device. In most cases, whatDevice will be equal to your driver's own this pointer.

Return Value

The driver must return IOPMAckImplied if it has complied with the request when it returns. Otherwise if it has started the process of changing power state but not finished it, the driver should return a number in microseconds which is an upper limit of the time it needs to finish. Then, when it has completed the power switch, it should call acknowledgeSetPowerState.

Discussion

A power managed driver must override setPowerState to take part in system power management. After a driver registers with power management, the system uses setPowerState to power the device off and on for system sleep and wake. Calls to PMinit and registerPowerDriver enable power management to change a device’s power state using setPowerState. The system calls setPowerState in a clean and separate thread context.

See Also

Miscellaneous