speaker amp control: initial release for speaker amp control

Signed-off-by: faux123 <reioux@gmail.com>
Squashed neobuddy intelli_plug 5.0
msm: Implement Intelli HotPlug Driver

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Refactor intelli hotplug driver

* Thanks to @dorimanx and @alucard24 for best reference

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Correct exit logic

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Strict mode should dominate eco mode

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_hotplug: Refine and add new functions

* Readd removed touch boost function with boosted CPUs parameters
* Restructure hotplug function to return early if suspended without queuing work
* Add wakeboost feature
* Rectify resume funcion to queue work
* Refine turning CPUs on/off.
* Other minor optimizations/fixes.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_hotplug: Add preventive checks

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Simplify touch boost

* This change is under test.
* Drop boost workqueue.
* Move boost functionality to input_event, makes sense.
* Initialize and terminate mutex properly.
* Add minimum interval to prevent recurring boost.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Use workqueue for touch boost

* Similar to faux version, we will use intelliplug_wq
  for touch boost.
* Implement boost lock, so cores boosted don't go
  offline immediately by hotplug function!

Thanks to @Dorimanx for reporting issue.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Further modifications for boost lock

* Add attribute for boost lock duration.
* Use optimized value for boost lock duration.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Apply boost_lock only to cpu_down

* With intelli_plug, we have cpu_up and cpu_down in single
  function.
* If we use boost_lock in same function, cpu_up is blocked
  as well.
* So separate boost_lock_check and apply it only to
  cpu_down.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Remove a redundant check

* We dont require to check boosted_cpus > 1
  because boosting will never occur for
  touch_boosted_cpus = 1.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Simplify mp_decision

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Clean up and Rearchitect

* Replaced eco_mode_active and strict_mode_active
  with more flexible option max_cpus_online.
* Added min_cpus_online feature.
* Clean up messy persistence logic and added down_lock
  logic.
* Unified cpu_up and cpu_down in separate work struct.
* Removed separate boost function, instead use input_event
  directly to queue boosting work.
* Simplified intelli_plug core functions.
* Renamed touch_boosted_cpus to cpus_boosted. This is
  to match name with similar function in MSM Hotplug.
* Bump to version 4.0

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Rectify hysteresis calculation

* In previous rearchitecture commit, this value
  got derped. Fix it!

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Add max_cpus_online_susp and remove wakeboost

* max_cpus_online_susp is added for same reason and in same
  way as that in MSM Hotplug.
* wakeboost is removed. It was just placebo, never worked
  actually. Also, if we are gonna implement it, we will
  implement it via MSM Limiter driver since our max_freq
  is controlled by that driver.
* Rewrite bits for resume and suspend to make more sense.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Rewrite suspend architecture

* Add support for multiple suspend architectures.
* Add suspend_defer_time attribute.
* Improve driver initialization.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Add profile support for full mode

* Based on https://github.com/faux123/Nexus_5/commit/084e14c00bd1fcc8194149a74a3389b8cfc3d952
* We call it full mode profiles because they are
  useful only when max_cpus_online >= 4.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Refactor and update

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Optimize cpu_down and stop butchering

* In current scenario, if CPU is down locked, we try finding
  next unlocked CPU. This is wasteful; instead break the loop
  wait for next cycle if CPU is down locked.
* Also, add check whether CPU is being boosted or idle.
* Re-organize sequencing of checks before bringing down CPU.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
Enable intelli-hotplug
Revert "intelli_plug: Optimize cpu_down and stop butchering"

This reverts commit dbc187c4a122cea555e17c9a64dae9865ab134f3.
Fix a derp
intelli_plug: Optimize cpu_down and stop butchering

* In current scenario, if CPU is down locked, we try finding
  next unlocked CPU. This is wasteful; instead break the loop
  wait for next cycle if CPU is down locked.
* Also, add check whether CPU is being boosted or idle.
* Re-organize sequencing of checks before bringing down CPU.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>