msm_hotplug: add [xXx]
msm_hotplug: Remove lcdnotifier events

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm8974: msm_hotplug: Reduce load constraints

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm8974: msm_hotplug: Fine tune configuration and fixes

* Power up additional cpus earlier
* Power down cpus later
* Keep cpus online at least 5 seconds
* Use proper return values
* Fix store_down_lock_duration()
* Add some more checks
* Cleanup some mess

[neo: This is now in sync with original myfluxi
      but without LCD notifier events.          ]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Revert to original thresholds

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Consider load instead of frequency for slowest cpu

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Protect load stats routine and cleanup

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Cleanup probe function

After performing nicely for over a half year this
actually starts looking almost decent.

[neo: Only required parts]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Fix licensing issue

I have no idea about licensing and I could care less
but this should be correct.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: New capabilities and fixes

* Remove unused import
* Add enable/disable toggle for debugging purpose
* Handling down lock per cpu is more precise. We can now distinguish
  between a regular interval and a generous time online after the last
  input event, where it's likely that the user will interact with the
  UI within then next few seconds again.

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

* Terminate load threshold table - https://github.com/myfluxi/kernel_msm/commit/0d19811cb40dacb7ce669c05dc9115340d0bd25a
* Change attribute names. Thanks @Dorimanx
* Lower load thresholds for more interactive response.
* Change default boosted CPU to 1.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Consider projected load after cpu offlined

Don't offline a cpu if we would drop under the lower
level's up threshold load. Also, add an optional hard
threshold load under which a cpu is never offlined.
Both is especially important for very short forced
online intervals.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Optimize latencies
msm: hotplug: Refactor load calculation

* Move core load calculations to this file and optimize.
* Calculate load based on current policy->max, not cpuinfo.max_freq
  which explains the strange 78% maximum load value before.
* Recalculate thresholds and fast_lane_load accordingly.
* Cleanup some ambiguous namings and other minor stuff.
* EXPORT_SYMBOL_* is useless for static functions.

[ neo:
* Adapt to our changes.
* Use myfluxi's LOAD_BALANCE values which seems conservative but worth a try.
* Do not merge LCD Notifier.
* Leftover cleanup.
* Do not disable RQ_STATS as we need same for Alucard Hotplug for now. ]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Allow to disable the circular stats buffer

This option reduces latency a tiny bit more.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
MSM HotPlug: Allow to use 1 core boost. (disable the tweaks) to save PWR.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Simplify store_history_size()

 [neo: Also add LCD notifier back]

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Always honor the limits

* max_cpus_online and min_cpus_online must be honored before
  cpu_up_work and cpu_down_work respectively.
* Make boosting of CPUs second priority.
* When cpus_boosted is set to 1, do not perform any boost work
  as this value should always be greater than min_cpus_online
* Break out early when target is matched while switching CPUs
  online/offline.

Even after above strict checks, we get spikes in CPU1 with max_cpus_online=1.
This maybe due to CPU Boost driver which is already half broken with CAF updates.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Fix few regressions introduced in previous commit

Thanks @myfluxi for reviewing https://github.com/neobuddy89/hammerhead_kernel_caf/commit/3435c9fc98c71f287bb3256a53cb20921344521c

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Fix firing up all CPUs while resuming

Checks introduced in 3435c9fc98c71f287bb3256a53cb20921344521c  do not let us
fire up all cpus with online_cpu() function if max_cpus_online != 4.

Fix this by letting resume function to online all cpus independently.

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