cpuidle: idle2: v0.210 standalone patch
Contains squashed commit of: v0.201, v0.202, v0.210 patches.

cpuidle: idle2: v0.210
Implement DEEP-IDLE TOP ON state for use when bluetooth or GPS is active
Many micro-optimisations of functions and variables to speed up the hot paths
Changed some debug printk to KERN_DEBUG.

cpuidle: idle2: v0.202
Fix issue where IDLE2 mode would not be entered after antutu had been ran.
Issue was related to power gating checks from deep-idle which I implemented
in v0.200. These checks are not needed, and cause this issue due to the
S5PV210_PD_CAM power domain not being gated after antutu and some other
benchmarks have been ran.

v0.201 is a complete rewrite of the majority of the idle2 codebase.
2 idle states have now been fully implemented and are available at all times.
The states are IDLE and IDLE2, which is DEEP-IDLE TOP OFF.
DEEP-IDLE TOP ON is not implemented, as it has no benefit.

The hot code paths are now more optimised and faster.
Workqueues are used to inform idle2 of events from other subsystems,
such as audio, usb connected and bluetooth.
PM notifiers are used to notify idle2 of a suspend, although it should
never get into a situation where it is working at the same time as the
system is suspending.

Add code to disable cpufreq and lock the CPU at 800MHz when the conditions
are right to enter IDLE2. This appears to save a lot more power.
Add earlysuspend hook back in to ensure the above doesn't occur whilst the
screen is on.

Adjust exit latency to 400 as that is the max specified in the TRM. Also
reduce residency time to 2000 as that seems like a more reasonable figure.
Remove s5p_idle2 function from asm and use generic flush_cache_all()
and cpu_do_idle() calls instead. The only asm left now is the register
save and restore code.

The IDLE2 mode will only be activated when audio has been playing back
for more than 30 seconds, the device is not connected to USB, bluetooth is
not active (it can be enabled, but not be actively working) various clocks
are gated (in practice, this means that the screen has to be off), certain
subsystems are not active and there are no interrupts pending.

The early suspend and late resume hooks have been removed as they are not
required, as have the suspend and resume hooks.

Many of the idle2 specific functions have been split into idle2.h to keep
them separate from the stock code.

IDLE2 can be disabled with the following command:
echo 1 > /sys/module/cpuidle/parameters/idle2_disabled

Stats can be obtained from the standard cpuidle interface, which, for
IDLE2 is located at:
/sys/devices/system/cpu/cpu0/cpuidle/state1
net: wireless: bcmdhd: Fill station_info packet fields

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
USB: gadget: f_audio_source: Fix error handling and increase packet size

Fixes watchdog reset on USB disconnect
Larger packet size fixes performance in fullspeed mode

Signed-off-by: Mike Lockwood <lockwood@google.com>
scripts/Kbuild.include: Fix portability problem of "echo -e"

"echo -e" is a GNU extension. When cross-compiling the kernel on a
BSD-like operating system (Mac OS X in my case), this doesn't work.

One could install a GNU version of echo, put that in the $PATH before
the system echo and use "/usr/bin/env echo", but the solution with
printf is simpler.

Since it is no disadvantage on Linux, I hope that gets accepted even if
cross-compiling the Linux kernel on another Unix operating system is
quite a rare use case.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Andreas Bießmann <andreas@biessmann.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
cpuidle: idle2: v0.211
Fixed issue causing ANR in systemui due to timing of disabling of IDLE2 mode
when late_resume is called. We now disable *before* the suspend status is
changed.
Issue introduced in v0.210 due to code optimisations making the IDLE2 code
too fast, which is ironic.
cpuidle: idle2: v0.212
Restore idle2_cpufreq_lock code to v0.210 version.
Few more micro-optimisations
cpuidle: idle2: v0.213
Add missing ifdef for IDLE2 in earlysuspend.
Move idle2 calls from samsung to core
Calls placed in samsung.c were interfering with display intitialisation
for some users.
Reduce loop iterations in s5p_init_remap()
Previously we were looping 15 times, and as there are only 5 items in
the struct it is a bit pointless. Reduce it to 5.
Refactor code slightly, remove some pointless duplicated tests from the
hot paths.
Don't disallow TOP ON when TOP OFF is enabled, allow cpuidle to choose
appropriate idle method.
Place idle states in the correct order. They should be placed highest to
lowest, but they were not.
Set target_residency of normal WFI to 1us. Any other value really doesn't
make sense. The CPU should be in WFI for as much time as possible when it is
awake, and WFI is cheap and saves power, so lets use it more.
Adjust target_residency of TOP OFF and TOP ON, so all 3 states are used.
s5pvXXX: cpufreq: Fix 2 section mismatch warnings
bcm4329: Disable -Werror (enables building with GCC 4.6.x)
s5pv210: Fix section mismatch warning
s5pv210: rfkill: Fix section mismatch warning
samsung: regs-serial: Fix: warning: 'struct uart_port' declared inside parameter list arch/arm/plat-samsung/include/plat/regs-serial.h:284:27: warning: 'struct uart_port' declared inside parameter list [enabled by default] arch/arm/plat-samsung/include/plat/regs-serial.h:284:27: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
iosched: tweak deadline for flash usage
sound: wm8994: Voodoo sound v10 - Squashed commit of:

commit 57494c162df513dcc04065acfb34b68cd8b8da68
Author: SIMOND François <francois@lienweb.fr>
Date:   Mon Dec 19 12:55:33 2011 +0100

    Voodoo Sound: update source code for ICS kernel sources

commit ba7e0d3d2d42db104a10940ed1b373de9f5e5434
Author: SIMOND François <francois@lienweb.fr>
Date:   Fri Jul 8 16:51:42 2011 +0200

    Voodoo sound: driver v10

    Improvement:
    - HW EQ support: smooth activation/deactivation and gain changes

    Bugfixes:
    - HP volume smoothing loop on low levels with negative digital offsets
    - wm8994_write logging on Nexus S

    New supported devices:

    - Galaxy Tab 7" Gingerbread Kernels support (based on M180S)
    - Galaxy Tab 10.1 - beta

commit ced38fcf6fad9feb063272187542f605601df6ff
Author: SIMOND François <francois@lienweb.fr>
Date:   Wed Jun 15 16:30:14 2011 +0200

    Voodoo sound: fix wm8994_write logging routine missing register/value for Nexus S-based kernels

commit 5af820a283a0ad61886582051102cc7843659561
Author: SIMOND François <francois@lienweb.fr>
Date:   Fri May 20 08:43:01 2011 +0200

    Voodoo sound: driver v9

    New features

    - advanced logging controllable via debug_log infos: 1, verbose: 2
    - implements hardware EQ
    - implements hardware stereo expansion effect
    - new concept: digital_gain:
    	makes room for effects with negative gains
    	avoid saturation using hardware DRC as limiter
    	act as compresser+limiter with positive gains
    	(gain unit is mili-decibels, min -71625, max 36000)
    	negative digital_gain are analog compensated if possible
    - super smooth headphone amp volume changes

    New supported device

    - Compatible with M110S Gingerbread kernel sources

commit 72fdd557b06ac983cdb8412512bc696df2b7da75
Author: SIMOND François <francois@lienweb.fr>
Date:   Mon Apr 25 06:49:14 2011 +0200

    Voodoo sound: driver v8

    - Fixes DAC direct not being applied in several situations
    - Fixes 1 channel only on Captivate headphone+mic calls
    - Add full support for Samsung Gingerbread kernels
      including complete FM radio tunings

commit cd929a8f9046b4f1be8af2c9d090a0ad1b3dde9e
Author: SIMOND François <francois@lienweb.fr>
Date:   Mon Mar 28 07:05:04 2011 +0200

    Voodoo sound: update to driver v7
    - definite fix for DAC direct call issue
    - reshaped source code (Linux Coding Style!)
    - less hooks in pre-existing driver

commit 9847bed9d3a9484bfdd72ee8ad5737bd317f8b0a
Author: SIMOND François <francois@lienweb.fr>
Date:   Thu Mar 24 09:10:43 2011 +0100

    Voodoo sound: modularization-related change and path management improvements

commit 681c3e013cc811a1cde65c1d54858c9ba59ffa0f
Author: SIMOND François <francois@lienweb.fr>
Date:   Mon Mar 21 06:25:43 2011 +0100

    Voodoo sound: bump version to v6

commit cf36abb84b15dff206a1a4d19f0b7ef7c09bfa7f
Author: SIMOND François <francois@lienweb.fr>
Date:   Fri Mar 18 02:39:58 2011 +0100

    Voodoo sound: apply speaker tuning control only when active path is speaker, fix reversed is_path(SPEAKER) logic

commit 3a1659a99ca9f3cfa8ab5271b886940fdb7bd725
Author: SIMOND François <francois@lienweb.fr>
Date:   Thu Mar 17 07:40:08 2011 +0100

    Voodoo sound: update to driver v5

    - New speaker tuning mode for music using different
      hardware EQ settings than stock ones
    - Microphone presets now supported on Nexus S.
    - Microphone presets balanced and loud reworked
      with lower background noise and higher dynamic range
      for balanced: -2dB noise, +6dB dynamic range.
    - New DAC direct option: reduces distortion and improves
      SNR by a small margin (bypass usless analog channel mixer)
    - Anti-jitter mode on by default.
    - Same exact source is now used on each device supported
      (still: only useful code is compiled in via ifdefs)
    - ability to fully disable/re-enable the driver and
      its sysfs interface: 0 or 1 in
      /sys/class/misc/voodoo_sound_control/enable
    - refactored source code

commit d1d535e2fd3aaf359d181fd48762fe2e4a2c1cfb
Author: SIMOND François <francois@lienweb.fr>
Date:   Mon Jan 31 05:43:30 2011 +0100

    Voodoo sound: driver v4 for Nexus S. Microphone presets feature deactivated: needs some fine adjustement for the code & hardware
i2c: s3c2410: Add NULL pointer check in s3c24xx_i2c_irq
Getting reports of Oopses occasionally with a NULL pointer dereference
always in the same function. I believe in some circumstances *dev_id is NULL
which is causing said issue, so check before use and bail if NULL.
s5pv210: herring: Reduce MFC, FIMC and JPEG memory usage (noobnl)
drivers: mfc50: Hack for bigmem
cpufreq: interactive: Enable input boost by default
net: bcmdhd: Add CONFIG_DHD_DISABLE_PM_MAX
This disabled PM_MAX which is invoked when the device is in early suspend.
PM_MAX causes wifi speeds to drop dramatically, so not ideal for cifs,
adb wireless or file transfers whilst the screen is off.
If this works like the bcm4329 one, it won't cause additional battery usage.
crespo: add customised defconfig based on herring_defconfig