ondemand: cpuidle detection

I found a problem with the ondemand governor while in earlysuspend
suspend mode (ondemand keeping the freq close to the max at all times
despite near 0% load). The problem is that the cpu starts to go in
long cpuidle cycles, a sampling_rate of 10000 (usec) is applied only
once in a while and the real sampling_rate becomes 1 second (or more).

So when a wakeup happens we return to the 10000usec sampling rate. The
ondemand sees lots of activity after the wakeup but those "loads" must
be adjusted down if the previous wall_time delta was huge and the
current one is tiny. We're too close to long cpuidle to worry about
the cpu freq anyway and it may be just a jitter load that if we take
into account without adjusting it down, will lead to the next long
cpuidle to be entered at the max freq again, and this repeats forever.

So my solution is to tweak the ondemand to scale down the "load"
according to the decrease in the wall_time delta ratio
(deep_sleep_ratio variable). This allows the CPU to stay at the lowest
freq during the deep sleeps even when the ondemand governor is enabled
and the sampling_rate is set to 10000. (setting the sampling_rate to
values >100000 would also tend to hide the problem but it'd screw the
interactive behavior by running at the lowest frequency for too long
during interactive usage)

During interactive usage with the screen on (not in earlysuspend
mode), or during playback or voip with screen off the deep_sleep_rate
is set to 1 practically all the time so it won't alter the behavior of
the ondemand governor unless the system is very idle (and in turn when
we want it to stay at low freq).

Change-Id: If0391e6d6c41c1c8c9fa590502e88e681a800b04

Signed-off-by: Andrea Arcangeli <andrea@cpushare.com>
usb gadget: use two luns on devices with two cards

  - ported from Codeworkx's smdk4210 patch (https://github.com/CyanogenMod/android_kernel_samsung_smdk4210/commit/7f87bd61861a7c6dfc74c6f113f4df655b8925ff)
  - allows to use both internal and external sd-card as mass-storage on devices with two cards

Change-Id: I3345097081bc1e306b8a63c0ae2b0edcccbff018
Revert "defconfig: enabling VENO as TCP Congestion Control algorithm"

This reverts commit fc2a46d85f5d87d9793d9ac55b4fefcf4f68c4fe.
Revert "staging: android: lowmemorykiller: Change default debug_level to 1"

This reverts commit cffa1c258efa1b5831cf4df23ddc048b2abd7caa.
Revert "staging: android: lowmemorykiller: well-marked debug print"

This reverts commit 1c27a79aaa18c2f8e419fbf338a0523574102ed1.
Revert "mutex: restrict mutex spinning to only one task per mutex"

This reverts commit 3b00c7b7a4d8af64e81cff4924148ffb9d5fdcd4.
Revert "switch the protection of percpu_counter list to spinlock"

This reverts commit 4cb84d606b15f756210c0897791d7e91cfbb187a.
input.c: Disable touch2wake if incall
Revert "f_fs: ffs_func_free: cleanup requests allocated by autoconfig"

This reverts commit 7eb23dd35ee8adfcbe546e41b84417eee80b5708.
Revert "i.MX25 GPT clock fix: ensure correct the clock source"

This reverts commit 0822bbb55bff479e6ba06ae39675bf489a85ec83.
Revert "mutex: Make more scalable by doing less atomic operations"

This reverts commit a99b6a14f9cfe0a58512ed2b88f3d5b77f016e33.
Revert "hrtimer: Prevent enqueue of hrtimer on dead CPU"

This reverts commit f3223b5b874615866dfb20f167cd490e9af7ef91.
Revert "hrtimer: Consider preemption when migrating hrtimer cpu_bases"

This reverts commit 6d8fb5d8af85f7e4f9fb8a0974a6468c9a0091c8.
4412: builtin md4 and dnsresolver

Change-Id: Iab4e05f831e09d6cb2b40a2117accdb5b903a6b2
Merge branch 'test' of github.com:temasek/android_kernel_samsung_smdk4412 into boeffla