msm: hotplug: Add suspend_defer_time

* After discussions with @franciscofranco, let's use more
  suspend/resume helper LCD notifier, since now we can
  control suspend delay.
* As name suggest, suspend takes are place after some
  delay when screen is turned off. Default - 10 seconds.
* If user resumes device before suspend_defer_time seconds,
  all cores go online as before but suspend work is
  canceled and rescheduling is not done.
* If screen is turned off and suspend_defer_time is exceeded,
  all sibling cores shut down as before. While resuming,
  all cores go online for downlock duration and hotplug
  resumes working.

* Restructure msm_hotplug_mutex and suspended variables.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Use only screen touch event for boost code

[neo: This got removed by mistake.]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
PM: devfreq: Define tunables with a static scope

[neo: Small rectification, removed double static declaration.]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: smp: Revert recent SMP update

Revert "ARM: SoC: convert MSM to SMP operations"
Revert "ARM: smp: remove wrapper functions"
Revert "ARM: smp: Make SMP operations mandatory"

There are no functional advantages that justify diverging from caf branches.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Use load dependent update rates

[neo: Small corrections]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
drivers: video: Separate LCD notifier define

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Add compatibility for other suspend structures

* Thanks to @Dorimanx and @Alucard24
* Some kernels like this one has both LCD Notifier and
  Power Suspend, so prefer LCD Notifier in such case.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: cpu-boost: Implement additional checks

* Return early without calculations if last
  input_boost_work is pending.
* Disable input boost if input_boost_freq value is
  less than or equal to min possible frequency.
* Disable hotplug boost if plug_boost_freq value is
  less than or equal to min possible frequency.
* When we check for current frequency greater than
  boost frequency, also check if boost is removed
  properly or not. If not, do so.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Shrink ifdef usage

* There is no functional change in this commit.
* Add #ifdef wherever required for compilation.
* Shrink where it is already used.
* Reposition suspend_defer_time attribute.

https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/commit/0610ec687e802bc1f2ca94acc6ff19565a202d41

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Add missing ifdef for mutex

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>