Introduce a dynamic hotplug driver (rebased)

CPUs proportional to load.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>

mach-msm: dyn_hotplug: Schedule driver work only on CPU0

CPU0 is always online.
So, schedule driver's work only on CPU0 to avoid migration
to other CPUs.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Offline the CPU with the lowest current frequency

Thanks to Skkip for the idea.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Fix CPU freq stats on calling down_all

Also call up_all and down_all from set_min_online and set_max_online
only if the driver is enabled.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Number of online CPUs have to be above min_online

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Add some comments

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Add max_online parameter

Add max_online tunable (default value 4) to control the max possible
online CPUs.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Add checks in parameters set

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Remove debug info

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Use enabled flag to protect enable/disable ops

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Change method of online/offline cores

Fixes cpufreq stats breakage.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Delay online next core

Bring online next core after 1sec.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Unregister early suspend on module exit

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Add module parameters to control driver

Add module parameters for
- up_threshold
- enabled
- min_online

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Increase up_threshold to 25

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Add new line in pr_debug

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Check if CPU is online/offline before hotplug

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Online all CPUs on resume

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Check for valid return of cpufreq_get_policy

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Prevent immediate online of a CPU

When a CPU goes offline we should wait at least 1 sec before online it
again.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: dyn_hotplug: Clean up properly on exit

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
mach-msm: Introduce Dynamic hotplug driver for mako