add tegra_mpdecision

This squashed commit adds tegra_mpdecision, an alternative hotplug manager for nvidia
multicore cpus with a low power core.

Squashed commits:
--------------------
removing NVIDIA cpu workqueue changes to the linux kernel base

Signed-off-by: showp1984 <showp1984@gmail.com>

mach-tegra: add mpdecision makefile and Kconfig hooks

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: add tegra mpdecision with better hotplug management (needs a lot of work)

Currently done:
Copied over from my pyramid kernel.
Renamed everything according to it's new function.
updated the header.
changed get_rate function to tegra specific one (untested).

What needs to be done:
make it quadcore compatible (or cpu number independent)
lp cluster switching
finetuning
etc...

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: remove scroff_single_core and add TODOs to screen on/off

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix some last compile errors/warnings

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: don't allow tegra_auto_hotplug & tegra_mpdecision at the same time

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add debug output

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: make mpdecision independent of the number of available cores (dual/quad)

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: rename cpu locks

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: make tegra_mpdec_work_thread independent of the number of available cores (dual/quad)

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: adjust startdelay and fixup a latenight-error

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_sleep_stats: fix runqueue stats info

Replace tegra_sleep_stats.c with the qualcom original (which it was
derived from anyway) and fix the tick-sched hooks which were not
present at all.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: make debug output more compact

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix some late-night-errors

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: decrease decision delay

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix debug #if

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: update core data on first call

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: don't let the workthread run if we are still paused

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: restore rudimentary screen on/off function. (!watch the TODOs!)

This send all cpus that are online & mpdecision to sleep when the
screen is deactivated and wakes mpdecision when the screen is activated
again.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: get tegra cpu clocks during init (cpu, g, lp)

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add lp cpu handler

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add initial lpcpu decision making (needs work)

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add lpcpu hysteresis protection

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add screen on/off lpcpu handling

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix kmsg output and add ninjacore to cpumask

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: adjust hysteresis loop for lpcpu

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: we have to be idle if lpcpu is already up and cpu0 is < idle_top_freq

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: only show an additional message if an error is encountered

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: replace lp_up helper with native function

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: remove lpcpu up hysteresis loop for now

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix readability

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: move gmode switch if freq is too high to mpdecision

also update debug messages to prevent spamming our log too much.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: we only need hysteresis protection for lcpu up

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: increase hysteresis limit and add comment

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add lpcpu time on & modify debug messages

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: cut the refresh rate in half

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add comment to clarify delay settings

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: update header to include full feature list

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: reduce idle freq to 475000

This also is the max frequency of the low power (ninja) core,
so it makes only sense.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: export the new, larger nwns/twts arrays to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: finetune hotplug values (nwns)

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: debug messages should show cpu0 offline if lp is online

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix disabling mpdecision over sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: reset lpcpu status on resume too

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix being stuck in lpcpu

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: fix compiling without tegra_mpdecision

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: Kconfig: switch dependencies and positions so that autoconf shows mpdecision first

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: adjust hotplug values

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: reduce delay to 150ms, also update lpcpu up/down

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: ammend comments

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: lower hysteresis loop count by 1

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: Don't switch to gmode while suspended

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: tegra_mpdecision: add suspended workqueue to switch back to lp

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

Conflicts:

	arch/arm/mach-tegra/cpu-tegra.c
	arch/arm/mach-tegra/tegra_sleep_stats.c
	drivers/base/cpu.c

Change-Id: Ice63c09e79a760a7c6a4b448a23b7ee718161c6f

defconfig: enable tegra_mpdecision, disable nvidia hotplug

Change-Id: I93e742d4f2ae679c46408fa3820b266a6a70dde8
Signed-off-by: Dennis Rassmann <showp1984@gmail.com>

mach-tegra: Makefile: build tegra_sleep_stats when compiling mpdecision

Change-Id: I9dddd52aa399efccefb393669b8e6d27677fb0e2
Signed-off-by: Dennis Rassmann <showp1984@gmail.com>