ASoC: wcd9xxx: Avoid enabling button polling from event notify handler

During insertion, it is possible that recording is already
enabled from handset which will switch to headset. During
POST_MICBIAS_2_ON event, though button polling is not actually
enabled, due to polling_active becomes true, the event
notification handler pauses and re-starts button polling.
This could lead to unknown state for button polling state
machine.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Add check_fast mode to raise freqs faster

It takes too long to scale from min_freq to max_freq. If you ignore
go_hispeed, then it takes over 100ms to step up through all the
frequencies. Even with go_hispeed, I think I figured it was 90ms to go
from idle to max speed.

The core of the problem is that a cpu_load << 100% is meaningful for
scaling.  As that load approaches 100% though, this estimate becomes
meaningless.

Here "meaningful" means that the speed adjusted load is a good approximation
of the total processing work needed and therefore good for estimating the
target frequency.

At 100% it is not meaningful because either it is a perfect estimate (had
we been running faster there is no more work we would have done) or off by
a factor of max_freq/min_freq in the worst case.

This patch recognizes this case and scales more aggressively.  At the same
time it also re-estimates in a shorter time to correct over/under scaling.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Disable idle notifier

Instead, just always poll using the timer.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
out: audio: Add Low Latency policy and New rates

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Best of all worlds

* We already have optimizations bt different pro
  developers. This patch just stitches all together.
* Needs to be tested. DO NOT MERGE without userspace
  changes.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Add NULL checks

An failed device start is bad enough, don't crash the device.
Non-negative errors look a bit funny, though.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
lowmemorykiller: Sanitize OOM for screen on/off

* Avoid using memcpy if screen on/off values are same.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: Skip building perf debug

* Reduces non-important cruft.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
hammerhead: Rewrite memory reservation

* Get rid of membanks.
* Move to proper address.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
defconfig: Refresh and test few changes

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

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
crypto: lzo - try kmalloc() before vmalloc()

zswap allocates one LZO context per online cpu.

Using vmalloc() for small (16KB) memory areas has drawback of slowing
down /proc/vmallocinfo and /proc/meminfo reads, TLB pressure and poor
NUMA locality, as default NUMA policy at boot time is to interleave
pages :

edumazet:~# grep lzo /proc/vmallocinfo | head -4
0xffffc90006062000-0xffffc90006067000   20480 lzo_init+0x1b/0x30 pages=4 vmalloc N0=2 N1=2
0xffffc90006067000-0xffffc9000606c000   20480 lzo_init+0x1b/0x30 pages=4 vmalloc N0=2 N1=2
0xffffc9000606c000-0xffffc90006071000   20480 lzo_init+0x1b/0x30 pages=4 vmalloc N0=2 N1=2
0xffffc90006071000-0xffffc90006076000   20480 lzo_init+0x1b/0x30 pages=4 vmalloc N0=2 N1=2

This patch tries a regular kmalloc() and fallback to vmalloc in case
memory is too fragmented.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm/mpm-of.c: gcc 4.9.x fix up

Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
net: wireless: bcmdhd: Fix Batch scan get bug

Legacy Batch scan code would issue mutex unlock w/o a lock

bug: 17021370

Signed-off-by: Ashwin <ashwin.bhat@broadcom.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: cpu-boost: Export wakeup_boost

* This is needed to unify boost functions in cpu boost
  and hotplug drivers.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: hotplug: Use wakeup_boost hint and other fixes

* In current scenario, we boost (turn all cores online)
  whenever LCD turns on. This is really not required when
  we have good hotplug mechanism in place. The mechanism
  should detect load and put appropriate cpus online.
* Boosting CPUs each time will increase battery consumption
  (maybe not so much but we should prevent this)
* So boost CPUs and apply downlock only in two cases viz.
  hotplug was suspended and user requested wakeup_boost
  via cpu-boost driver from userspace.
* Also, it is observed that suspend_defer_time is not
  working as required. It should suspend as soon as defer
  time is completed. Therefore, make use of separate freezable
  workqueue to do this smoothly.
* Organize sequence for initiating and cancelling work.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Use wakeup_boost hint

* In current scenario, we boost (turn all cores online)
  whenever LCD turns on. This is really not required when
  we have good hotplug mechanism in place. The mechanism
  should detect load and put appropriate cpus online.
* Boosting CPUs each time will increase battery consumption
  (maybe not so much but we should prevent this)
* So boost CPUs and apply downlock only in two cases viz.
  hotplug was suspended and user requested wakeup_boost
  via cpu-boost driver from userspace.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
intelli_plug: Fixes for suspend/resume work rare issues

* It is observed that suspend_defer_time is not
  working as required. It should suspend as soon as defer
  time is completed. Therefore, make use of separate freezable
  workqueue to do this smoothly.
* Organize sequence for initiating and cancelling work.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cfg80211: mlme: Silently ignore duplicate management registrations

Instead of erroring out, just ignore the call

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: qcom: qdsp6v2: fix crash due to asynchronous read/write

Whenever an async read command is issued to dsp when
the driver is not enabled, there is a crash in userspace.
The read command is disallowed in the driver and an error
is propagated to userspace which results in the crash.
The driver is re-enabled in a subsequent asynchronous write
command anyway, so the async read command can be allowed.
Ensure that read is allowed by removing a superfluous check.

Signed-off-by: Satya Krishna Pindiproli <satyak@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>