cpufreq: cpuboost: Always consider current policy max

We fixed calculations in the scheduler in 58cd101c69c508a448a03fc480ceb35f0da12386.
Now repeat this in the cpu-boost driver.
msm: lpm_levels: Fix incorrect computation of next wakeup time

The next event timer wakeup was incorrectly computed when the hard timer
event doesn't exist. Fix by ensuring the next wakeup is computed only
when a timer event is valid

Change-Id: I40c1f372f84d8f43b2101e37dcfb592193d4b2e0
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
sched: Fix memory leakage in build_sched_groups()

In build_sched_groups() we don't need to call get_group() for cpus
which are already covered in previous iterations. Calling get_group()
would mark the group used and eventually leak it since we wouldn't
connect it and not find it again to free it.

This will happen only in cases where sg->cpumask contained more than
one cpu (For any topology level). This patch would free sg's memory
for all cpus leaving the group leader as the group isn't marked used
now.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
lcd_notify: Add missing code
Signed-off-by: renderbroken <zkennedy87@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>
mm: page-writeback.c: local functions should not be exposed globally

The function global_dirtyable_memory is only referenced in this file and
should be marked static to prevent it from being exposed globally.

This quiets the sparse warning:

warning: symbol 'global_dirtyable_memory' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
MPDEC: Initial Port of Showp's MPDEC
Signed-off-by: renderbroken <zkennedy87@gmail.com>
Merge branch 'kk-test' into mpdec-test

Conflicts:
	arch/arm/mach-msm/msm_hotplug.c

Signed-off-by: renderbroken <zkennedy87@gmail.com>
cpufreq: sync interactive with CM sources and finetune it for Moto G's CPU
cpu: add new hotplug module with a more simplified algorithm (thanks to Bleechd0se)
Thanks Alin.p for making this work without haivn g to make changes for get_couidle_time

Conflicts:
	arch/arm/configs/render_defconfig

Signed-off-by: renderbroken <zkennedy87@gmail.com>
msm: mdss: fix sync fence deadlock when rotator is used

In the current implementation, whenever rotator play is called, it
forces DMA pipes to be released by calling commit on video mode ctl
paths if they are using DMA pipes. Here assumption was that DMA pipes
will either be used in block mode or line mode, all or none. But this
assumption is not valid any more where we can have a use-case where
DMA0 is used for rotator and DMA1 for video mode ctl path. In this
use-case, current implementation can lead to sync fence deadlock. Fix
this by removing obsolete assumption.

Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: kgsl: enable CPU IRQ while suspending context

Make sure that CPU interrupt is enabled before calling adreno
suspend_context when moving from NAP/SLEEP to SUSPEND state.
We send commands to GPU in adreno_drawctxt_switch() which will generate
GPU interrupt. Since CPU interrupt is not enabled, adreno_idle() will
fail because pending interrupt will not be served by CPU this causes
false GPU hang.

Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: kgsl: don't use sscanf()

Friends do not let friends use sscanf().

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
workqueue: set delayed_work->timer function on initialization

delayed_work->timer.function is currently initialized during
queue_delayed_work_on().  Export delayed_work_timer_fn() and set
delayed_work timer function during delayed_work initialization
together with other fields.

This ensures the timer function is always valid on an initialized
delayed_work.  This is to help mod_delayed_work() implementation.

To detect delayed_work users which diddle with the internal timer,
trigger WARN if timer function doesn't match on queue.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	kernel/workqueue.c

Signed-off-by: renderbroken <zkennedy87@gmail.com>
workqueue: Remove panic

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm_hotplug: Disabled by default
Signed-off-by: renderbroken <zkennedy87@gmail.com>
MPDEC: Adjustments
Signed-off-by: renderbroken <zkennedy87@gmail.com>
msm: hotplug: Use correct variable type

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "msm: hotplug: Try conservative load scale"

This reverts commit df893d1ff59ffc01dc70f1c474f01e7e09625278.
msm: hotplug: One doesnt enter fast lane that easy

This help to make fast_lane function that turn on all CORES on high load
little more smart. As small spikes on low freq can generate 100% load value
but freq is 300Mhz and we dont need all cores online!

So enable that TURBO function match only when 2 conditions!

load >= 95
cur_freq on cpu 0 >= 998400

[Render: Modified for Moto G]

[ neo: Code style improvement.
  Thanks @Dorimanx and @Alucard24 ]

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

Conflicts:
	arch/arm/mach-msm/msm_hotplug.c

Signed-off-by: renderbroken <zkennedy87@gmail.com>