MobileDevicePM
This page details power management interfaces for devices typically found in a mobile platform such as a phone or a tablet. The analysis is focused primarily on Android kernels, specifically those for the Nexus 4 and Nexus 10 devices, as Android is running on the majority of Linux-based devices currently on the market.
Background Information
A feature of some Android kernels is a partially suspended state which will be referred to as partial suspend in this document. The system is in this state whenever mem has been written to /sys/power/state but wake locks are preventing the kernel from fully suspending. Drivers can register early suspend and late resume handlers which are called when entering and leaving the partial suspend state.
A feature called autosleep was introduced into mainline Linux in version 3.5. This feature is largely similar to the mechanism found in Android except that it lacks support for early suspend and late resume handlers. Some recent Android kernels have started using this feature instead of the Android-specific implementation.
Input Devices
This class primarily covers devices such as touchscreens and buttons, though some other functionality such as headphone jack detection may also be implemented as input devices.
The Linux input subsystem is well established, and Android makes use of it for reporting input events to userspace. PM of input devices is typically based on usage; i.e. the input device remains powered on while userspace has open file descriptors to the device and powered off when all descriptors are closed. Drivers may also implement runtime PM support. However, some drivers utilize early suspend for powering down hardware. In particular the driver for the Nexus 4 touchscreen uses early suspend exclusively for powering down the hardware.
For most input devices it will be sufficient for userspace to close open file descriptors whenever a given device is not being used. An example would be closing the descriptor for the touchscreen device whenever the screen is turned off. However, when running on some Android kernels it may also be necessary to set the kernel into partial suspend.
Backlight
Interfacing with backlights is typically done via established sysfs interfaces located under /sys/class/backlight. Both the Nexus 4 and the Nexus 10 backlight devices conform to this interface. Userspace can thus manage backlight power by utilizing the standard kernel interfaces.
Displays and Video
Note: This area may require more investigation.
Internal Panels
Userspace powers off a display using the FBIOBLANK ioctl for framebuffer devices. This interface appears to be supported in the kernel for both the Nexus 4 and Nexus 10, though in the case of the Nexus 4 the early suspend hanlder in the fb driver does some extra work (which mostly seems to affect video outputs rather than built-in panels).
Runtime suspend may also be supported.
Video Outputs
TODO: Investigate further
The picture here is somewhat muddled. While it appears that FBIOBLANK is also used for video outputs, it doesn't appear that this will always cause all hardware to be powered down.
GPU
TODO
Video Acceleration
TODO
Networking
Wi-Fi
TODO
Bluetooth
TODO
NFC
TODO
Cellular Modem
TODO
Sensors
Compass
TODO
Gyroscope / Accelerometer
TODO
GPS
TODO
Audio
TODO
Camera
TODO
USB
TODO
Vibrator
TODO
Dock
TODO
Power Sources
Battery
TODO
External Power
TODO


