cells: wakelock/earlysuspend virtualization

Wakelock virtualization follows the paradigm described in the "Cells"
paper: http://systems.cs.columbia.edu/files/wpid-cells-sosp2011.pdf
  1. When a wake lock is locked, keep a namespace "token" associated
     with the lock which inicates the context in which the lock was taken.
  2. When unlocked from user context, remove the associated namespace
     token.
  3. When unlocked from interrupt context (or "init namespace"),
     remove _all_ lock tokens.
  4. After a user-context lock or unlock operation, adjust any suspend
     timeout value based only on the locks active in the current namespace.
  5. After an "init namespace" lock/unlock adjust the suspend timeout
     based on the currently active namespace.
  6. On a namespace context switch, reset the suspend timeout based on
     the locks acquired in the newly active namespace.
  7. On a namespace context switch, if there are locks which have been
     acquired in the "init namespace" (interrupt context), assign a
     token which ties those locks to the namespace which is being
     de-activated (see assumption 3).

This scheme makes the following assumptions:
  1. Trust the kernel and its drivers - when something is called from
     interrupt context, just do what it says.
  2. All user-kernel-interrupt locking/unlocking coordination was correct
     and appropriate before virtualization.
  3. When a namespace becomes active, it gains full control of the
     hardware. This particular assumption allows us to avoid having to
     deal with specific corner cases in active/in-active namespace
     switching.

This scheme should accomplish the following goals:
  1. In-active namespaces should NOT be allowed to put the device into
     low-power mode.
  2. In-active namespaces should NOT be allowed to prevent the active
     namespace from putting the device into low power mode.

Change-Id: Ia467f65279a856b908907cfde33b7449ae82a195
Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
cells: fbearlysuspend virtualization

The framebuffer earlysuspend driver presents a sysfs interface to
userspace that allows processes to block until a particular framebuffer
state is valid. For example, a user space read from the
/sys/power/wait_for_fb_sleep file will block until the system is
sleeping and user space should stop drawing activities.

The virtualization of this driver isolates the framebuffer "sleep"
state using device namespaces. However, it is possible for the init
device namespace to wake up or put to sleep the currently active device
namespace.

Change-Id: Iae4cd8bb9276843c9ed02096c3664358b6a66d5e
Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Merge branch 'backup' of github.com:niketkandya/project6998 into backup