msm thermal: enhancements

-include upstream changes to msm_thermal this time around

1) Smart polling based on temp (poll slower when cooler, faster when
warmer).

2) Added low frequency index so we don't throttle too low and kill
performance. When warming normally (throttle temp is reached) it will
step down by the freq_step until back under control. The lowest
frequency step possible is the specified by the low freq index.

3) Added throttle max (hardcoded at 80C). If it reaches the
throttle max, it will immediately throttle down to the min_freq_index
instead of stepping down 2 frequency steps at a time like when it hits
the throttle temp.

4) Added tuneables

/sys/module/msm_thermal/parameters/throttle_temp
/sys/module/msm_thermal/parameters/min_freq_index
/sys/module/msm_thermal/parameters/thermal_debug

- add board-8960

Conflicts:

	arch/arm/mach-msm/board-8960.c
	drivers/thermal/msm_thermal.c

Signed-off-by: Luis Cruz <ljc2491@gmail.com>

- fix whitespace
arm: Add auto hotplug driver

This driver is simple and cheap and aims to avoid unnecessary hotplug
events and unnecessary task migrations. The design is simple. The value
of nr_running() (which is the current number of runnable threads) is
averaged over X samples by a ringbuffer. If the value is over a
dynamically calculated value, all CPUs are onlined. When the value falls
under another dynamically calculated value, the CPUs are offlined with a
2 second delay. If there is persistent load on the system, the CPUs will
not continually thrash between onlining and offlining and continually
migrate tasks. The number of online CPUs will remain constant until the
load has dropped below the dynamically calculated value. The online and
offline values are dynamically scaled based on the number of CPUs
online, as is the sampling rate of the driver. This aims to reduce the
expense of the driver and also reduce the number of unless hotplug
transitions which could have been avoided had cpufreq been given the
chance to ramp the online CPUs up and deal with the load. This driver
will also offline secondary cores when the screen is turned off,
providing earlysuspend is available.

It also has a module param to set
the minimum number of online CPUs:
/sys/module/auto_hotplug/parameters/min_online_cpus
This value is ignored when the device enters earlysuspend, as the
secondary CPUs are all offlined, but is set again when the screen is
turned back on.
Change dependencies to allow kernel to be built with ARM hotplug,
and without MSM_RUN_QUEUE_STATS. These are only needed for proprietary
mpdecision.
arm: auto hotplug - wrap all pr_info into the existing debug mode so we
don't spam the kernel log
auto_hotplug: enhancements

1) added module params so tuning an be adjusted in userspace and
debugging can easliy be enabled/disabled

/sys/module/auto_hotplug/parameters/debug
(N/Y - turn off/on debugging)

/sys/module/auto_hotplug/parameters/disable_load_threshold
(integer - load at which a CPU is disabled)

/sys/module/auto_hotplug/parameters/enable_load_threshold (integer -
load at which an extra CPU is enabled)

/sys/module/auto_hotplug/parameters/enable_all_load_threshold (integer -
load at wich all CPU's are enabled)

/sys/module/auto_hotplug/parameters/min_sampling_rate
(milliseconds, converted to jiffies at runtime)

2) lowered enable_load_threshold from 225 to 200 for a little more pep.

To-do: add get/set routines to keep values safe and in acceptable ranges
auto_hotplug: enhancements (rev 2)

1) Added ability to change the number of sampling_periods on the fly via
sysfs (while preserving past history).

2) Added get/set for module parameters so user's can't set incorrect or
unreasonable values.

3) Tweaked defaults

4) Don't wait as long to start auto_hotplug (referenced franco's
git). Today's devices are much faster to boot however
if this code is ported to a slower core device, it may need to be
raised.

5) Debug mode tweaks
-Organize and reduce the number of line output.
-Attempt to make output more user friendly for those that aren't
reading the code.
auto_hotplug: enable the min_online_cpus value

Use a module_param_cb to set the minimum number of online CPUs when the
screen is on.

The values are between 1-4.

usage:
echo '1' < /sys/module/auto_hotplug/parameters/min_online_cpus
auto_hotplug: enhancements (rev 3)

1) Added max_online_cpus (1-4) and exposed to sysfs via a module
parameter. Once set, only allow the chosen number of cores to be
online and make sure we compensate for it in the boostpulse function.

2) Make minor tweaks to mathkid's min_online_cpus

-Don't schedule work in the parameter set, just let it be done on the
next poll iteration.

-Misc style changes so that it matches the other code I have been
adding the module.
auto_hotplug: parameter validation for max_online_cpus

If validation fails, set max_online_cpus = CPUS_AVAILABLE instead of
"1"
auto_hotplug: stack the deck on auto_hotplug_late_resume to get things
moving quickly again
auto_hotplug: rev 4 - let's lean a little more towards performance.

This includes:

1) Set DEFAULT_SAMPLING_PERIODS back to 10 (from 12)

2) Set DEFAULT_ENABLE_ALL_LOAD_THRESHOLD to (100 * CPUS)

3) Finally came back and fixed "stack the deck" like I had originally
intended after the quick test.

4) Updated to revision to 4.
cpufreq: interactive: marry governor boostpulse with auto_hotplug
boostpulse.

Limit boosted cores to 2 since that matches with what auto_hotplug
boostpulse brings online. We will boost no more than 2 cores.

Also tweaked some other defaults

Conflicts:

	drivers/cpufreq/cpufreq_interactive.c
Userspace Voltage Control (thanks faux123)

-Changed CONFIG name to my liking
-Fixed spelling in the Kconfig

Conflicts:

	arch/arm/mach-msm/Kconfig
Userspace Voltage Control: tweaked faux's original work

1) Only get/set frequencies that are configured to be used as scaling
frequencies.

2) Lowered min voltage to 600mV in the voltage control interface as well
as in the regulators.

author: motley-git
smp: patches from mainline 3.5 to hopefully help with hotplug
efficiency

Thomas Gleixner's generic-idle patches:

smp: Add task_struct argument to __cpu_up()
Preparatory patch to make the idle thread allocation for secondary
cpus generic.
http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=8239c25f47d2b318156993b15f33900a86ea5e17

smp: Add generic smpboot facility
Start a new file, which will hold SMP and CPU hotplug related generic
infrastructure.
http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=38498a67aa2cf8c80754b8d304bfacc10bc582b5

smp: Provide generic idle thread allocation
All SMP architectures have magic to fork the idle task and to store it
for reusage when cpu hotplug is enabled. Provide a generic
infrastructure for it.
Create/reinit the idle thread for the cpu which is brought up in the
generic code and hand the thread pointer to the architecture code via
__cpu_up().
Note, that fork_idle() is called via a workqueue, because this
guarantees that the idle thread does not get a reference to a user
space VM. This can happen when the boot process did not bring up all
possible cpus and a later cpu_up() is initiated via the sysfs
interface. In that case fork_idle() would be called in the context of
the user space task and take a reference on the user space VM.
http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=29d5e0476e1c4a513859e7858845ad172f560389

arm: Use generic idle thread allocation
http://git.kernel.org/?p=linux/kernel/git/tip/tip.git;a=commit;h=84ec6d5796e095e2f8698bd2b5d33849ed26d9e2
defconfig: set proper min/max speeds

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
d2: update defconfig
really just a localversion rename
renamed after the Replicated Man (fits better; he's and android)
and I'll likely be keeping this one because I <3 Bethesda
Signed-off-by: Luis Cruz <ljc2491@gmail.com>

Conflicts:

	arch/arm/configs/cyanogen_d2att_defconfig
acpuclock-krait: add config option to enable/disable krait min voltage

Signed-off-by: faux123 <reioux@gmail.com>

- Rebased onto 3.4 kernel (vmin is now in krait acpuclock)

Conflicts:

	arch/arm/mach-msm/acpuclock-krait.c
cpufreq: interactive: when input_boost is enabled lets just boost to 702MHz instead of 1512MHz (hispeed_freq).

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

Conflicts:

	drivers/cpufreq/cpufreq_interactive.c

Signed-off-by: Luis Cruz <ljc2491@gmail.com>
cpufreq: interactive: boost cpufreq to 1GHz on input, instead of 702MHz.

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

Conflicts:

	drivers/cpufreq/cpufreq_interactive.c

Signed-off-by: Luis Cruz <ljc2491@gmail.com>