mach-tegra: tegra_mpdecision: fix an epic bracket fail, which most likely caused the lockups

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: export lpcpu_hysteresis to sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: suspended worker: check if we CAN switch to lp now

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: lp_cpu_handler: check if we are in lpmode before powering down

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: fix a possibibility where the lpcpu up/down would not respect min delays

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: remove useless mutex locks/unlocks

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: reset lpup hysteresis counter in all other states

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: only catch-up with gov target speed if there is no error

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: use own workqueues

This will alter mpdecision to alloc it's own wq rather than using
the predefined queue which is a shared resource.
Since we are using a lot of delays in here they could slow down
other users of the workqueue, which should be avoided.
Create 2 workqueues to avoid this, one for normal operations and
one for lpcpu checks while suspended. Both threads are not bound
to the issuer CPU (=> high-priority), have rescue worker tasks
and are freezable.
Also destroy the workqueues on exit, and rename tegra_mpdec to
tegra_mpdec_init.

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: fix tegra_mpdec_suspended_work_thread

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: add lpcpu_down hysteresis loop+sysfs

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: the suspend wq task should be non freezable

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: fix sysfs enable/disable

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: if lpcpu fails to come up on ES, schedule lpchecks

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: cancel/resume main work thread on ES/LR

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: lphandler: return error if mutex cannot be locked

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: lphandler: add robustness checks for clks

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: We were paused, even only for a short time

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: adjust delays to fit NVIDIA specifications

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
mach-tegra: tegra_mpdecision: use unique lock names

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