cpuidle: idle2: Port of Samsungs LPAUDIO feature to 3.0 kernel The majority of this code is a port from the 2.6.32 P1000 kernel, some of which was required to be rewritten or substantially altered by myself.

Some inspiration was taken from deep idle by ezekeel.

Improvements over deep idle are:
It requires no configuration and is enabled automatically
It does not require the cpu to be at 800MHz for stability

It is not activated itself unless the USB is unplugged, the screen is off and
the PowerManagerService wakelock is held.
  This was a compromise, I wanted an audio wakelock, but as audio uses a partial
  wakelock it isn't visible in the kernel. PowerManagerService deals with the
  partial wakelocks so it is the closest thing to an audio wakelock.

It does not activate itself if USB is plugged in
cpuidle: idle2: Version v0.101 Changed several ints to bools Inlined several regularly called functions Removed i2c and OTG tests Changed to DMA clockgating test code from deep-idle, resolves a bug with the Samsung implementation.
cpuidle: idle2: v0.102 Consistent variable naming Added debug option CONFIG_S5P_IDLE2_DEBUG Changed some more ints to bools
cpuidle: idle2: v0.110 Cleanup asm in idle2.S, use generic platform functions to flush cache / idle Cleanup superfluous imports Fix debug output for wakelock.c
cpuidle: idle2: v0.120 Removed writes to unused S5P_INFORM1 register Removed requirement for has_audio_wake_lock() to return true to enable IDLE2 during early suspend, it will enable regardless now. Optimised code paths in cpuidle.c to branch for the least likely outcome of s5p_idle_bm_check(), the code is optimised for NORMAL idling and will branch for IDLE2. Added my and Samsung copyright notices to files which contain ported code.
cpuidle: idle2: v0.121 My reasoning for the likelihood of s5p_idle_bm_check() was flawed.

I hadn't taken into account the fact that if the screen is off and
there are no wakelocks held that the device will enter suspend which
makes cpuidle irrelevant, so therefore I was optimising a less used
code path which made logical sense when I was writing it initially.
So, switch the likely to unlikely in s5p_enter_idle_bm() and the
unlikely to likely in s5p_idle_bm_check(), which will optimise the
code path for idle2 when the screen is turned off. It will save a
couple of cycles.
cpuidle: idle2: v0.122 Still in the pursuit of making the code cheaper and cleaner. :)

Changed previous_idle_mode to a bool
Changed s5p_setup_idle2() to type void & removed unused ret value
Removed unused i2c entries from check_device_op chk_dev_op
Made warning of bail due to VIC interrupt more descriptive
Removed definition of SLEEP_MODE and IDLE2_MODE from pm.c, they were
only required for the S5P_INFORM1 register which we aren't using now
cpuidle: idle2: v0.130 Bugfix release. Fix issue where bluetooth audio streams die when IDLE2 mode is entered. BT audio requires TOP ON to continue functioning. Check the value of GPIO_BT_HOST_WAKE and set TOP ON or TOP OFF based on that. This is the cheapest method of doing this which doesn't involve additional more expensive function calls. Enabling bluetooth will not impact power saving. This fix will only set TOP ON when bluetooth is active and working, such as streaming audio.

Still in the pursuit of making things cheaper:
Change argument to s5p_set_idle2_lock() from int to bool.