Merge interactive governor code from franciscofranco kernel

commit f08871ec5c861fef4cd588e2479543e8a8c928a5
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Fri Nov 9 02:36:38 2012 +0000

    cpufreq: interactive: kick timer on idle exit past expiry - original patch: https://github.com/android/kernel_common/commit/9b29a6d49becf8caf0550373d84a1068c716e891

commit bbd4a79815aa35aa744bb02a73953a48b14cc093
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Fri Nov 9 02:33:20 2012 +0000

    cpufreq: interactive: use deferrable timer by default - original patch: https://github.com/android/kernel_common/commit/0697ab54cab34e099711ceb4b07b2dfc6b507f0d

commit 42063ff31d39b4a50523e427709c98c293619c6d
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Fri Nov 9 02:29:23 2012 +0000

    cpufreq: interactive: pin timers to associated CPU - original patch: https://github.com/android/kernel_common/commit/430d3d4539a0d441679ca32cc7c3876f97a07da6

commit ca6e7e7379837c26d1ddd3752e96ab56b3b5615c
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Mon Nov 5 15:57:51 2012 +0000

    cpufreq: interactive: decrease inpu_bost_freq to 537MHz.

    Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

commit bc4722e7ff1f757d629753920d2dff12592080f4
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Mon Oct 15 17:05:22 2012 +0100

    cpufreq: interactive: fix input_boost_freq type from u64 to unsigned int. Also get rid of boost option, its not needed and its mostly not used. Boostpulse calls cpufreq_interactive_boost when its activated (Tuna PowerHAL takes care of that).

    Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

commit b1e9a92f807f696e93a7bb94b2d22e36a4eaf97a
Author: Todd Poynor <toddpoynor@google.com>
Date:   Wed Oct 3 00:39:56 2012 -0700

    cpufreq: interactive: run at fraction of hispeed_freq when load is low

    When load is below go_hispeed_load, apply the percentage of CPU load to
    a max frequency of hispeed_freq instead of the max speed.  This avoids
    jumping too quickly to hispeed_freq when it is a relatively low
    percentage of max speed.  This also allows go_hispeed_load to be set to
    a high percentage relative to hispeed_freq (as a percentage of max speed,
    again useful when hispeed_freq is a low fraction of max speed), to cap
    larger loads at hispeed_freq.  For example, a load of 60% will typically
    move to 60% of hispeed_freq, not 60% of max speed.  This causes the
    governor to apply two different speed caps, depending on whether load is
    below or above go_hispeed_load.

    Also fix the type of hispeed_freq, which was u64, to match other
    speed data types (and avoid overhead and allow division).

    Change-Id: Ie2d0668be161c074aaad77db2037505431457b3a
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 355f3ba6b8fca9aa4b763a6b9f88b883df8fa7d8
Author: Todd Poynor <toddpoynor@google.com>
Date:   Mon Sep 24 18:03:58 2012 -0700

    cpufreq: interactive: always limit initial speed bump to hispeed

    First bump speed up to hispeed_freq whenever the current speed is below
    hispeed_freq, instead of only when the current speed is the minimum speed.
    The previous code made it too difficult to use hispeed_freq as a common
    intermediate speed on systems that frequently run at speeds between
    minimum and hispeed_freq.

    Change-Id: I04ec30bafabf5741e267ff289209b8c2d846824b
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 84fc996263697be1c0e351514893ccdef272dc74
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Tue Sep 25 19:17:19 2012 +0100

    cpufreq: interactive: add input_boost_freq entry. This entry is the frequency which the CPU will be boosted when the screen is touched. It's user configurable from userspace and it needs to match the entries in the frequency table.

    Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

commit c3177d8de748524119928f6cac3279c396a49457
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Tue Sep 25 19:05:12 2012 +0100

    cpufreq: interactive: change frequency up/down kernel thread priority. Now it has more priority than any user thread which should boost interactivity.

    Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

commit 169de9e5f8786c4e959472ec25c3410e3fc0daa5
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Thu Sep 20 18:54:14 2012 +0100

    cpufreq: separate Interactive governor into two, one with static settings and another one with dynamic settings (it adjusts itself according to load). The new governor is called Dynamic Interactive.

commit 3eeaed1f136fb875308c897547269ddc1dd79b64
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Sun Sep 9 04:05:51 2012 +0100

    cpufreq: interactive: fix compiling errors from the latest commits

commit 1b2504427e56927ce3a58f96d9f63879a42bfe69
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Sun Sep 9 04:01:58 2012 +0100

    cpufreq: interactive: remove input_boost handling - https://github.com/android/kernel_common/commit/4e27eb56e819745a1b184f278d7f3dd3887a456c

commit fcdcacf1b21a6fea102227431e355560d7241103
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Sun Sep 9 03:59:21 2012 +0100

    cpufreq: interactive: handle speed up and down in the realtime task - https://github.com/android/kernel_common/commit/f8aa05d96a0d18416d2627c493f7dc9bc5324901

commit 3bd8110aba8ae54c4429b05b7108e3974f282a67
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Sun Sep 9 03:45:18 2012 +0100

    cpufreq: interactive: keep freezer happy when not current governor - https://github.com/android/kernel_common/commit/5ff8407798f1d8c44f3165bc535676a2a897666b

commit c06658ed2c2a5f8cc3531a4b83acd54200311ed7
Author: franciscofranco <franciscofranco.1990@gmail.com>
Date:   Sun Sep 9 03:43:11 2012 +0100

    cpufreq: interactive: take idle notifications only when active - https://github.com/android/kernel_common/commit/22a51ab6e21de740c1b555f9a03626d28aaebdf3

commit c20ae50d4dd8e9ef0c4501012733405af2766b93
Author: Leonid Iziumtsev <x0153368@ti.com>
Date:   Wed Jul 25 14:46:52 2012 +0300

    cpufreq: interactive governor: Fix not uniform buf filling & memory corruption

    Each CPU has it's own load history buffer, but all they use shared
    <history_load_index> variable, this lead to not uniform filling
    of the cpu's circular buffers. Only about half of buffer is updated
    during each buffer rewriting cycle that obligate governor to use
    outdated data during freq tuning.

    Moreover access to <history_load_index> variable is not atomic, that
    create race conditions. Simultaneous increment could cause situation
    where such check:

            if (++history_load_index == sampling_periods)
                    history_load_index = 0;

    not safe and buffer overflow will not be prevented. That will lead
    to memory corruption.

    To avoid such problems this patch move buffer-index variable to
    <cpufreq_interactive_cpuinfo> structure, which is separate for each CPU.
    Also, buffer overflow checking will be paranoidly changed.

    Change-Id: I333a4462be17816372a7a57529811d87930058c0
    Signed-off-by: Leonid Iziumtsev <x0153368@ti.com>
    (cherry picked from commit befb3fe3e38d88bc1872d99748c246c26406315d)

commit 20d522bb802ed338bcb3d94168cadbce8d52709e
Author: Nicole Chalhoub <n-chalhoub@ti.com>
Date:   Thu Apr 26 18:21:35 2012 +0200

    cpufreq: interactiver governor: Add a time view concept

    CPUFreq governors are always a tradeoff between power vs performance.
    For low power UCs we want to have a less reponsive cpufreq governor that
    does not respond or react to each load pick.
    However when scrolling on the screen or during webbrowsing we need a more
    responsive governor that interact or esponse to each load variation.

    To detect which kind of application we have, we'll rely on the history of
    the load. if the the average over the load history is high that means we
    need to be more responsive so we change the governor paramters in that
    direction.
    if the average over the load history is low thatmeans we are in low power
    UCs so we change the governor parameter to be less responsive

    Change-Id: Ifd55ac4cfbc1bd9eded4ae603b158054c6169e8c
    Signed-off-by: Nicole Chalhoub <n-chalhoub@ti.com>
    Signed-off-by: Taras Kondratiuk <taras@ti.com>
    (cherry picked from commit c9d2e290d40f629306ba4cd020be1d71ed5e1d23)

commit c12914672a97c8a6c3800d52a5c40ac06878d6db
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu May 10 23:28:06 2012 -0700

    cpufreq: interactive: restart above_hispeed_delay at each hispeed load

    Change-Id: I2e5b91d45e8806b0ab94ca2301ed671c9af9ab13
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 5702c9182d292356aba0f0dd6f2f230a7e53fa15
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu May 3 00:16:55 2012 -0700

    cpufreq: interactive: add boost pulse interface

    Change-Id: Icf1e86d2065cc8f0816ba9c6b065eb056d4e8249
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit fd8bc3774515bc6d2af3dfe567f902098cb0dea8
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Apr 26 21:41:40 2012 -0700

    cpufreq: interactive: set floor for boosted speed

    Allow speed to drop to flooor frequency but not below, don't pin
    to speed at last boost.

    Change-Id: I0147c2b7a2e61ba16820605af6baaf09570be787
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 5d61d3a6e2103801565048202999423657b4430a
Author: Todd Poynor <toddpoynor@google.com>
Date:   Mon Apr 23 20:42:41 2012 -0700

    cpufreq: interactive: Add sysfs boost interface for hints from userspace

    The explicit hint on/off version.

    Change-Id: Ibf62b6d45bf6fb8c9c055b9bdaf074ce9374c04f
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 66510aa1148e3457e7d46e0a2582dac7c591b95d
Author: Todd Poynor <toddpoynor@google.com>
Date:   Mon Apr 23 21:22:45 2012 -0700

    cpufreq: interactive: remove unused target_validate_time_in_idle

    Change-Id: I37c5085b91318242612440dfd775ad762996612f
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 2e21b68cd68be556224aee775f67fbbb5d6870a6
Author: Todd Poynor <toddpoynor@google.com>
Date:   Mon Apr 2 17:17:14 2012 -0700

    cpufreq: interactive: Boost frequency on touchscreen input

    Based on previous patches by Tero Kristo <tero.kristo@nokia.com>,
    Brian Steuer <bsteuer@codeaurora.org>,
    David Ng <dave@codeaurora.org>,
    Antti P Miettinen <amiettinen@nvidia.com>, and
    Thomas Renninger <trenn@suse.de>

    Change-Id: Ic55fedcf6f9310f43a7022fb88e23b0392122769
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 85a03bc8bdd9cb45428c794fdec462eb4817ec67
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Apr 20 13:18:32 2012 -0700

    cpufreq: Separate speed target revalidate time and initial set time

    Allow speed drop after min_sample_time elapses from last time
    the current speed was last re-validated as appropriate for
    current load / input boost.

    Allow speed bump after min_sample_time (or above_hispeed_delay)
    elapses from the time the current speed was originally set.

    Change-Id: Ic25687a7a53d25e6544c30c47d7ab6f27a47bee8
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 4e3800ea447962106a962f5279ea508edd6ca160
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Apr 19 12:52:48 2012 -0700

    cpufreq: interactive: based hispeed bump on target freq, not actual

    For systems that set a common speed for all CPUs, checking current
    speed here could bypass the intermediate hispeed bump decision for
    this CPU when another CPU was already at hispeed.  This could
    result in an overly high setting (for all CPUs) in situations
    where all CPUs were about to drop to load levels that map to
    hispeed or below.

    Change-Id: I186f23dcfc5e2b6336cab8b0327f0c8a9a4482bc
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 801cb6260fb5cae3bbc513927b583447c38d9deb
Author: Todd Poynor <toddpoynor@google.com>
Date:   Tue Apr 17 17:39:34 2012 -0700

    cpufreq: interactive: adjust code and documentation to match

    Change-Id: If59c668d514a29febe5c35404fd9d01df8548eb1
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit c2ad521b982d949c5dfabe5ff257bb4f33ca8b51
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Apr 13 20:18:02 2012 -0700

    cpufreq: interactive: configurable delay before raising above hispeed

    Change-Id: I4d6ac40b23a3790d48e30c37408284e9f955e8fa
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit e04e953b657d6e8b4f00b9e341370e339b1a0c97
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Apr 6 19:59:36 2012 -0700

    cpufreq: interactive: don't drop speed if recently at higher load

    Apply min_sample_time to the last time the current target speed
    was originally requested or re-validated as appropriate for the
    current load, not to the time since the current speed was
    originally set.  Avoids periodic dips in speed during bursty
    loads.

    Change-Id: I250bda657985de60373f9897cc41f480664d51a1
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 1c41e01a514bc6b5136fd9040bed5137cfd712a8
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Apr 6 19:50:12 2012 -0700

    cpufreq: interactive: set at least hispeed when above hispeed load

    If load is above go_hispeed_load, always go to at least hispeed_freq,
    even when reducing speed from a higher speed, not just when jumping
    up from minimum speed.  Avoids running at a lower than intended
    speed after a burst of even higher load.

    Change-Id: I5b9d2a15ba25ce609b21bac7c724265cf6838dee
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit e661e9ba37039c77f8e1faaa231d810f12ac0790
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Apr 6 01:13:09 2012 -0700

    cpufreq: interactive: apply intermediate load to max speed not current

    Evaluate spikes in load (below go_hispeed_load) against the maximum
    speed supported by the device, not the current speed (which tends to
    make it too difficult to raise speed to intermediate levels until
    very busy).

    Change-Id: Ib937006abf8bedb60891a739acd733e89b732ae0
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 4d6f3d7209ffa828fad5d5495c1eb8c571d308ad
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Feb 16 16:27:59 2012 -0800

    cpufreq interactive governor: event tracing

    Change-Id: Ic13614a3da2faa2d4bd215ca3eb7191614f0cf66
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 5113cb1203f6f463557d45baa17a6e826adc48aa
Author: Todd Poynor <toddpoynor@google.com>
Date:   Wed Nov 9 16:56:18 2011 -0800

    cpufreq: interactive governor: default 20ms timer

    Change-Id: Ie9952f07b38667f2932474090044195c57976faa
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 96cd2509c44a74039022ce6de382bcec5267331d
Author: Todd Poynor <toddpoynor@google.com>
Date:   Tue Nov 8 19:54:07 2011 -0800

    cpufreq: interactive governor: go to intermediate hi speed before max

    * Add attribute hispeed_freq, which defaults to max.

    * Rename go_maxspeed_load to go_hispeed_load.

    * If hit go_hispeed_load and at min speed, go to hispeed_freq;
      if hit go_hispeed_load and already above min speed go to max
      speed.

    Change-Id: I1050dec5f013fc1177387352ba787a7e1c68703e
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit eb5a34275e731c26cd15570f73796a0dc05c584a
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Nov 3 21:22:54 2011 -0700

    cpufreq: interactive governor: scale to max only if at min speed

    Change-Id: Ieffb2aa56b5290036285c948718be7be0d3af9e8
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit a610c81ee00468c769e883845a68e688b01a7ca0
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Oct 27 18:25:59 2011 -0700

    cpufreq: interactive governor: apply intermediate load on current speed

    Calculate intermediate speed by applyng CPU load to current speed, not
    max speed.

    Change-Id: Idecf598b9a203b07c989c5d9e9c6efc67a1afc2e
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit fe04aa151f7254a38c35d5f1d89fa0d15c3dfce4
Author: Todd Poynor <toddpoynor@google.com>
Date:   Wed Oct 19 13:12:10 2011 -0700

    power: cpufreq interactive governor: use default sample time 20ms

    Lower the default time at which a higher speed is allowed to run
    before lowering based on lower CPU load from 80ms to 20ms.  Most
    Android devices should trade power for performance here,
    although tablets and non-battery-powered devices may want to
    override this default.

    Change-Id: I1a4f7faeca12793c51d5b92db30a63cca8d4f1be
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 2cc01eb245d167c4769dd7de0250ec8e8d3bff98
Author: Todd Poynor <toddpoynor@google.com>
Date:   Sun Oct 16 22:40:29 2011 -0700

    cpufreq: interactive governor: default timer 10ms, maxspeed load 95%

    Modify default timer from 30ms to 10ms, sampling 2 jiffies after
    idle exit on ARM as in Honeycomb.

    Modify default go_maxspeed_load from 85% loaded to 95% loaded, for
    use in phones where power savings is more important (tablets may be
    best served overriding this).

    Change-Id: I3361a6279979bfae1df5262666a2e30ea7a44328
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 3c053e150be20d335725ccd7384643fc8a3eb888
Author: Axel Haslam <axelhaslam@ti.com>
Date:   Wed Oct 5 14:04:57 2011 -0700

    cpufreq: interactive: fix possible Division by zero.

    The following dump was seen sometimes while resuming,
    the only division by zero on this function can happen after
    delta_time is reassigned, since at the start of the
    function, there is jump that protects against values
    less than 1000.

    After that, If delta_time and delta_idle == 0,
    we will hit a div 0

    Division by zero in kernel.
    Backtrace:
    [<c0057184>] (dump_backtrace+0x0/0x110) from [<c05d5ecc>] (dump_stack+0x18/0x1c)
    r6:010f3000 r5:c113dfb0 r4:c004afb0 r3:c6ff0000
    [<c05d5eb4>] (dump_stack+0x0/0x1c) from [<c00572cc>] (__div0+0x1c/0x20)
    [<c00572b0>] (__div0+0x0/0x20) from [<c02195d4>] (Ldiv0+0x8/0x10)
    [<c03dfd64>] (cpufreq_interactive_timer+0x0/0x2c0) from [<c00a7efc>] (run_timer_softirq+0x154/0x260)
    [<c00a7da8>] (run_timer_softirq+0x0/0x260) from [<c00a0c8c>] (__do_softirq+0xc8/0x194)
    [<c00a0bc4>] (__do_softirq+0x0/0x194) from [<c00a1008>] (irq_exit+0xb4/0xb8)
    [<c00a0f54>] (irq_exit+0x0/0xb8) from [<c00584b4>] (ipi_timer+0x44/0x48)
    r4:c004a040 r3:00000001
    [<c0058470>] (ipi_timer+0x0/0x48) from [<c004c3e4>] (do_local_timer+0x68/0x84)
    r5:c004ae2c r4:c07991e8
    [<c004c37c>] (do_local_timer+0x0/0x84) from [<c0052948>] (__irq_svc+0x48/0xe0)

    Change-Id: I639882db67b8d711c5710778ebc212f0f6a998e3

    Acked-by: Nishanth Menon <nm@ti.com>
    Signed-off-by: Axel Haslam <axelhaslam@ti.com>

commit a50b0530418bc4c6446478aa80ecfaa661df7099
Author: Todd Poynor <toddpoynor@google.com>
Date:   Wed Jun 22 14:34:23 2011 -0700

    cpufreq: interactive: Fix handling of SMP where CPUs must scale in tandem

    The interactive governor relies on quirks of the Tegra 2 cpufreq
    implementation for handling SMP systems where the CPUs do not have
    separate rate controls.  It needs to determine the maximum rate
    for all CPUs covered by the policy and set that speed.

    Change-Id: I1ed9fa171e5a9c45a1fa5944e3fa823eb157e81f
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 9549cff379d6ca4640dd71c3e8637d4f0248d8eb
Author: Allen Martin <amartin@nvidia.com>
Date:   Tue Jul 19 14:56:21 2011 -0700

    cpufreq: interactive: fix checkpatch warnings on long lines

    Fix up checkpatch warning introduced by long lines in timer_rate
    patch.

    Change-Id: I22b105dafb1b49390799bb7577464da03f0f8afb
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit adce689ff77b097142cf49e76a232e59126da017
Author: Allen Martin <amartin@nvidia.com>
Date:   Fri Jul 1 11:19:14 2011 -0700

    cpufreq: interactive: cleanup checkpatch warnings

    Cleanup some style warnings reported by checkpatch

    Change-Id: Ie2e6903d52867fb3347e009d7efa3bc4ca755cea
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit 5d14f981eb9da252fa7ae7d5f5e87a7abcd1e602
Author: Allen Martin <amartin@nvidia.com>
Date:   Thu Jun 30 23:54:07 2011 -0700

    cpufreq: interactive: add sysfs control for timer rate

    Add a new sysfs control that tunes the rate of the timer used to
    increase cpu frequency

    Change-Id: I1aa13ae54bb43aff5b3688984d2955f56aae1658
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit 8b12552d248d574b6e333a6e120bccb2abe4010a
Author: Allen Martin <amartin@nvidia.com>
Date:   Thu Jun 30 16:59:19 2011 -0700

    cpufreq: interactive: Add error checking on sysfs interfaces

    This adds better error checking on tunable parameters on sysfs
    interfaces.  Also fixes return value from these functions, previously
    on success they would return 0 which would cause a infinite loop.

    Change-Id: Ic05038492166f8673d007202092471f98a2f0dfa
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit 80e65d97d20da210e2cd04436d64a58cbba0c2be
Author: Allen Martin <amartin@nvidia.com>
Date:   Tue Jun 28 09:58:39 2011 -0700

    cpufreq: interactive: use idle notifier

    Convert interactive governor to use idle notifier instead of
    hooking pm_idle directly.

    Change-Id: I47e007f330468ac559240a0ae8a3cb06a89ccb67
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit 13b2b14fd630a04b83a357c89393f93b3d88108b
Author: Allen Martin <amartin@nvidia.com>
Date:   Tue Jun 28 10:40:30 2011 -0700

    cpufreq: interactive: remove debug trace code

    Remove debug trace code in preparation of upstreaming

    Change-Id: I0905885e75031f5e9d7cb06878fb68c1fd06d4fe
    Signed-off-by: Allen Martin <amartin@nvidia.com>

commit 097d39641dc94f9e5891481e066ef14b12cca408
Author: Todd Poynor <toddpoynor@google.com>
Date:   Mon Jun 6 18:30:23 2011 -0700

    cpufreq interactive: support shared CPU scaling

    Change-Id: Id5267f04067bf023f6b140b4de2e88ef7287e941
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 9b6f4a382dda68d41cbbd739095db3fd36f55f6b
Author: Todd Poynor <toddpoynor@google.com>
Date:   Thu Dec 23 17:33:07 2010 -0800

    cpufreq interactive governor: fix crash on CPU shutdown

    Don't reference the saved copy of the CPU's cpufreq policy
    pointer after the governor has been stopped for the CPU.

    When the governor is stopped for a CPU:

    * Use del_timer_sync() to wait for a currently-running timer
    function to stop.

    * Delete the timer when the governor is stopped for the
    associated CPU, not when the last CPU is stopped.

    * Flush any speed down work ongoing.

    * Reset the timestamp that is used to tell if the timer function
    has had a chance to run since last idle exit.

    Check the governor enabled flag for the CPU before re-arming the
    timer from within the timer function and at idle exit (in case
    stopping the governor at runtime).

    Check the governor enabled flag for the CPU in the worker
    function and thread before using the policy pointer.  (There is
    still a tiny window in the thread that needs more work to close.)

    Change-Id: Ifaddf7a495a8dae15a579a57bdc654f7c47f6ada
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 1c4f95f81916c95b991019107782a2fa002b30bb
Author: Todd Poynor <toddpoynor@google.com>
Date:   Fri Dec 3 11:20:09 2010 -0800

    cpufreq interactive governor save/restore IRQs around cpumask spinlocks

    Need to use irqsave/restore spin locking for cpumasks since these
    are accessed in timers and in thread context.

    Change-Id: I4a53eaf0ced7e73b445feddba90ec11482de9126
    Signed-off-by: Todd Poynor <toddpoynor@google.com>

commit 1dab2597e7d0591c2ee1bde29e8d51e5ba707acb
Author: Mike Chan <mike@android.com>
Date:   Tue Jun 22 11:26:45 2010 -0700

    cpufreq: interactive: New 'interactive' governor

    This governor is designed for latency-sensitive workloads, such as
    interactive user interfaces.  The interactive governor aims to be
    significantly more responsive to ramp CPU quickly up when CPU-intensive
    activity begins.

    Existing governors sample CPU load at a particular rate, typically
    every X ms.  This can lead to under-powering UI threads for the period of
    time during which the user begins interacting with a previously-idle system
    until the next sample period happens.

    The 'interactive' governor uses a different approach. Instead of sampling
    the CPU at a specified rate, the governor will check whether to scale the
    CPU frequency up soon after coming out of idle.  When the CPU comes out of
    idle, a timer is configured to fire within 1-2 ticks.  If the CPU is very
    busy from exiting idle to when the timer fires then we assume the CPU is
    underpowered and ramp to MAX speed.

    If the CPU was not sufficiently busy to immediately ramp to MAX speed, then
    the governor evaluates the CPU load since the last speed adjustment,
    choosing the highest value between that longer-term load or the short-term
    load since idle exit to determine the CPU speed to ramp to.

    A realtime thread is used for scaling up, giving the remaining tasks the
    CPU performance benefit, unlike existing governors which are more likely to
    schedule rampup work to occur after your performance starved tasks have
    completed.

    The tuneables for this governor are:
    /sys/devices/system/cpu/cpufreq/interactive/min_sample_time:
        The minimum amount of time to spend at the current frequency before
        ramping down. This is to ensure that the governor has seen enough
        historic CPU load data to determine the appropriate workload.
        Default is 80000 uS.
    /sys/devices/system/cpu/cpufreq/interactive/go_maxspeed_load
        The CPU load at which to ramp to max speed.  Default is 85.

    Change-Id: Ib2b362607c62f7c56d35f44a9ef3280f98c17585
    Signed-off-by: Mike Chan <mike@android.com>
    Signed-off-by: Todd Poynor <toddpoynor@google.com>
    Bug: 3152864