cpufreq: create a helper function to get CPU utilization. Picked from @stratosk

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq.c
mako_hotplug: instead of calculating the load every sample (which is kinda expensive) we can use the governors load calculation instead of trying to recreate the same thing (adding unecessary overhead). Also cleanup some code.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	arch/arm/kernel/mako_hotplug.c
cpufreq: export the cpu load across cores to the policy struct. On Performance governor let's emulate a constant 100% load (in this Kernel's case it will make all cores online, which is kinda the purpose of a performance governor isn't it?).

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_interactive.c
	drivers/cpufreq/cpufreq_ondemand.c
mako_hotplug: we're getting the load from the governors, no need to increment the counter by 2 and we can increase the threshold to 70 to balance things out.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	arch/arm/kernel/mako_hotplug.c
msm: kgsl: Do not detect faults when GPU core is idle

Do not detect GPU faults when GPU hardware status is idle,
this leads to incorrect fault detection.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	drivers/gpu/msm/adreno.h

Change-Id: I7a9f8c49eb819241698f99fd50aaed400aadd4f4
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
(cherry picked from commit 8002a0061d3ccfeccb93af50bce4ef44977845af)
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:
	drivers/gpu/msm/adreno.c
	drivers/gpu/msm/adreno_dispatch.c
Revert "sched: Call the notify_on_migrate notifier chain for wakeups as well"

This reverts commit 64e40752ce4daf530af61475579c008437e91c90.
Revert "sched: window-based load stats for tasks"

This reverts commit bff23f43e8dee579859d116e7874ad1ac75e8dbb.
Revert "sched: Make scheduler aware of cpu frequency state"

This reverts commit d28da46bd51c4816a6d58bc532243ac1d8827a37.
Revert "cpufreq: cpu-boost: Handle wakeup hints received for foreground tasks"

This reverts commit 4f1c9ba43f0c608c760497df222ebc11ff504c22.
Revert "cpufreq: cpu-boost: Introduce scheduler assisted load based syncs"

This reverts commit 173102ca4f4de4b2bef2fb7172c3184a50a1e297.

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

Conflicts:
	drivers/input/touchscreen/touchboost.c
mako_hotplug: fix a bug where cores would get stuck online caused by a wrong if check during an input boost case.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
soc: qcom: smd: Validate read and write addresses

The address from which data has to be read and the address to which the
SMD data has to be written is calculated based on the head and tail
indices for that SMD FIFO. If the indices are corrupted, then the
calculated pointer may be outside of the FIFO and may even be outside of
the range of SMEM.

Validate the read and write addresses to be with in the limits of
receive and send FIFO limits respectively.

CRs-Fixed: 550527
Change-Id: Ie5578f6aee73ea2b1435fea7c2a0a6dda14bff82
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: interactive: go back to pre 61acc402730fb09644334a4ab0509e70ae4f5eba version.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_interactive.c
input: touchboost: go back to pre 61acc402730fb09644334a4ab0509e70ae4f5eba

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	drivers/input/touchscreen/touchboost.c
cpufreq: interactive: remove problematic code.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: interactive: export cpu load.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cpufreq: interactive: restructure CPUFREQ_GOV_LIMITS

The cpufreq_interactive_timer gets cancelled and rescheduled
whenever the cpufreq_policy is changed. When the cpufreq policy is
changed at a rate faster than the sampling_rate of the interactive
governor, then the governor misses to change the target frequency
for long duration. The patch removes the need of cancelling the
timers when policy->min is changed.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Change-Id: I7862f1c8022a3b98a890e7537f93d02010e86764
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: MassStash <MassStash@gmail.com>

Conflicts:
	drivers/cpufreq/cpufreq_interactive.c
input: touchboost: fix merge derp.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Revert "cpufreq: ondemand: Remove sync thread feature"

This reverts commit df5f0cb65895ce3a954464c39e4119eb0979dbe7.
cpufreq: interactive: Optimize sync_freq implementation

Don't let frequency drop below sync_freq if either load or
frequency among other cpus is above a certain threshold,
not necessarily both.

Change-Id: Iada28e08e812498e16d5189b309a7314f88814dd
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>