[PATCH 0/8] Adding generic suspend/resume infrasturcture.


From: Dirk Brandewie <dirk.j.brandewie(a)intel.com>

Since this change set was loosely based on my RFC on the subject prior
to release it is worth bringing the orginal design into this thread.

Given that most/all platforms we are targeting will care deeply about
power consumption this patch set changes the device model to *require*
that every driver do something about suspend/resume even it is just
providing a null implementation if there is nothing the device needs
to do during a suspend/resume cycle.

This patch does the following things:
Adds suspend/resume to *all* devices.

Provides a null suspend/resume implementation that can be used by
*all* drivers.

Provides an interface for the power management infrastrcuture (PMI) to
call suspend/resume on the device without needing to know the type
of the device.

Provides an interface where the PMI can register callbacks with the
driver to be called when suspend has completed and resume has
started. These call backs allow the PMI to do any processing
required to complete the suspend/resume of the device. e.g. clock
control, power to IP block. This is needed since there may be
multiple devices attached to a single clock or power island which
can only be disabled once all attached devices are suspended and
must be turned on prior to the first device resuming.

This keeps *all* the information about a device in one place. Forces
all drivers to support the suspend/resume interface.

This will require that all the current drivers be updated to support
the new interface. Now is the right time to do this before we get a
*bunch* more drivers added to the tree.

Patch 1 adds a PM enabled version of DEVICE_INIT() which is only there
to keep things building while the drivers are being updated. Once all
the drivers have been updated we can remove the extra macro with a
single tree wide change.

The API to suspend/resume all devices in the system was meant to show
how the PMI might want to suspend all devices and is not complete
since there is no error handling. After thinking about it more it is
not clear to me that we should provide this convienence API.

The changes to the GPIO interface and driver are meant to illustrate
the changes that will need to be applied to all the drivers in the

Dirk Brandewie (8):
device: Add suspend/resume api functions to device structure
device: Add _null_suspend_resume() function
device: Add generic device_{suspend, resume}() API
device: Add API to suspend/resume all devices in the system.
device: pm: Add API for power management entity to register pm
gpio: Remove suspend/resume from GPIO API
gpio: gpio_dw: Use generic suspend suspend/resume API
gpio: gpio_dw: Add suport for device_register_pm_ops()

drivers/gpio/gpio_dw.c | 48 ++++++++++++++++----
drivers/gpio/gpio_dw.h | 2 +
include/device.h | 109 +++++++++++++++++++++++++++++++++++++++++++++
include/gpio.h | 27 -----------
include/pm.h | 25 +++++++++++
kernel/nanokernel/device.c | 40 +++++++++++++++++
6 files changed, 216 insertions(+), 35 deletions(-)
create mode 100644 include/pm.h