Writing Device Drivers

Power Management Dependencies

Some devices should be powered down only when other devices are also powered down. For example, if removable-media devices such as CD-ROM drives or Zip drives are allowed to power down by themselves, functionality associated with their current state, such as the ability to eject a CD or to respond when a new Zip disk is inserted, may be lost.

One way to prevent a device from powering down independently is to make the device dependent on another device that is likely to remain powered on while its functionality is required. Typically, the device is made dependent upon a frame buffer, because a monitor is generally on whenever a user is utilizing a system.

The power.conf(4) file specifies the dependencies among devices. (A parent node in the device tree implicitly depends upon its children. This dependency is handled automatically by the power management framework.) You can specify a particular dependency with a power.conf(4) entry of this form:


device-dependency dependent_phys_path phys_path

where dependent_phys_path is the device that is kept powered up (such as the CD-ROM drive) and phys_path is the device whose power state it depends on (such as the frame buffer).

Because it would be burdensome to add an entry to power.conf for every new device plugged into the system, another syntax enables you to indicate dependency in a more general fashion:


device-dependency-property property phys_path

Such an entry mandates that any device that exports the property property will be dependent upon the device named by phys_path. Because this dependency applies especially to removable-media devices, /etc/power.conf includes the following line by default:


device_dependent-property  removable-media  /dev/fb

to signal that any device exporting the removable-media property will not be powered down unless the console frame buffer is also powered down.

For more information, see the power.conf(4) and removable-media(9P) man pages.