drivers: video: clean the backlight code

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
staging: android: ashmem: Avoid deadlock with mmap/shrink

Both ashmem_mmap and ashmem_shrink take the ashmem_lock. It may
be possible for ashmem_mmap to invoke ashmem_shrink:

-000|mutex_lock(lock = 0x0)
-001|ashmem_shrink(?, sc = 0x0) <--- try to take ashmem_mutex again
-002|shrink_slab(shrink = 0xDA5F1CC0, nr_pages_scanned = 0, lru_pages
-002|=
-002|124)
-003|try_to_free_pages(zonelist = 0x0, ?, ?, ?)
-004|__alloc_pages_nodemask(gfp_mask = 21200, order = 1, zonelist =
-004|0xC11D0940,
-005|new_slab(s = 0xE4841E80, ?, node = -1)
-006|__slab_alloc.isra.43.constprop.50(s = 0xE4841E80, gfpflags =
-006|2148925462, ad
-007|kmem_cache_alloc(s = 0xE4841E80, gfpflags = 208)
-008|shmem_alloc_inode(?)
-009|alloc_inode(sb = 0xE480E800)
-010|new_inode_pseudo(?)
-011|new_inode(?)
-012|shmem_get_inode(sb = 0xE480E800, dir = 0x0, ?, dev = 0, flags =
-012|187)
-013|shmem_file_setup(?, ?, flags = 187)
-014|ashmem_mmap(?, vma = 0xC5D64210) <---- Acquire ashmem_mutex
-015|mmap_region(file = 0xDF8E2C00, addr = 1772974080, len = 233472,
-015|flags = 57,
-016|sys_mmap_pgoff(addr = 0, len = 230400, prot = 3, flags = 1, fd =
-016|157, pgoff
-017|ret_fast_syscall(asm)
-->|exception
-018|NUR:0x40097508(asm)
---|end of frame

Avoid this deadlock by using mutex_trylock in ashmem_shrink; if the mutex
is already held, do not attempt to shrink.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
rtc: alarm: Proper handling of spinlock

In alarm_shutdown hook, taking interruptible mutex
lock in interrupt disabled context. This patch fixes
alarm_shutdown function to call rtc_read_time and
rtc_set_alarm APIs in interrupt enabled context.

Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mdss: hdmi: sysfs node for hdcp status

The change provides the sysfs node to query hdcp authentication
status. "status" node under hdcp folder will be:
not available: if target doesn't support HDCP
0: inactive
1: authenticating
2: authentication pass
3: authentication fail

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: HDCP Topology

Provide a mechanism to communicate with HDCP manager
to share the downstream KSVs to upstream HDMI devices.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: Proper DDC power off sequence

Shutdown the power for DDC (Display Data Channel) module only
after HDCP (High-bandwidth Digital content Protection) module
has been turned off as HDCP continue to use DDC line until it
is turned off. Also, no need to check for DDC hardware status
on HDCP off as once the cable is disconnected it will not be
updated.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: Avoid unnecessary BCAPS read

Don't read BCAPS (downstream device's capability register) in second
part of authentication to check if the attached downstream device is
a repeater or not. BCAPS register is already read in first part of
authentication. Reuse it's value for this purpose. This avoids any
unnecessary delays and possible arbitration for DDC line between
hardware (for third part of authentication) and software which
sometimes results in HDCP compliance 1A-07 failure or not judged.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: Proper reauth abort

Properly abort reauthentication to avoid HDCP module going into
bad state and work queue deadlock.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: Clear and disable interrupts when HDCP is inactive

When an HDCP interrupt is received while the HDCP session is
inactive, ensure that the interrupt it acknowledged and cleared
to avoid any potential interrupt storms.

Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Fix voice mute issue when EC ref is set

Function voc_set_ext_ec_ref returns 0 on success, handle the
return value of this function appropriately to avoid mute issue.

Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: extra low latency mode change for audio capture

For low latency audio capture sessions adm should be
opened in low latency mode.This change checks for low latency
mode and passes the info to adm.

Signed-off-by: Mingming Yin <mingming@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
smp: Fix idle_thread_init() inline stub

idle_thread_init() does not have arguments.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
smpboot: Remove leftover declaration

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
sched: Remove get_online_cpus() usage

Testing/Modified for 3.4.y from 6acce3ef upstream.

Remove get_online_cpus() usage from the scheduler; there's 4 sites that
use it:

 - sched_init_smp(); where its completely superfluous since we're in
   'early' boot and there simply cannot be any hotplugging.

 - sched_getaffinity(); we already take a raw spinlock to protect the
   task cpus_allowed mask, this disables preemption and therefore
   also stabilizes cpu_online_mask as that's modified using
   stop_machine. However switch to active mask for symmetry with
   sched_setaffinity()/set_cpus_allowed_ptr(). We guarantee active
   mask stability by inserting sync_rcu/sched() into _cpu_down.

 - sched_setaffinity(); we don't appear to need get_online_cpus()
   either, there's two sites where hotplug appears relevant:
    * cpuset_cpus_allowed(); for the !cpuset case we use possible_mask,
      for the cpuset case we hold task_lock, which is a spinlock and
      thus for mainline disables preemption (might cause pain on RT).
    * set_cpus_allowed_ptr(); Holds all scheduler locks and thus has
      preemption properly disabled; also it already deals with hotplug
      races explicitly where it releases them.

 - reinit_sched_domains(); we shouldn't need to hotplug here. In fact,
   this has likely been the thorn in my side, causing mpdecision to
   break on sched_mc_power_savings changes.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(Modified for 3.4.y to include sched_domains())
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
sched: Remove extra put_online_cpus() inside sched_setaffinity()

Commit:

	sched: Remove get_online_cpus() usage

has left one extra put_online_cpus() inside sched_setaffinity(),
remove it to fix the WARN:

   ------------[ cut here ]------------
   WARNING: CPU: 0 PID: 3166 at kernel/cpu.c:84 put_online_cpus+0x43/0x70()
   ...
   [<ffffffff810c3fef>] put_online_cpus+0x43/0x70 [
   [<ffffffff810efd59>] sched_setaffinity+0x7d/0x1f9 [
   ...

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/526DD0EE.1090309@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
sched: Fix endless sync_sched/rcu() loop inside _cpu_down()

Commit:

	sched: Remove get_online_cpus() usage

tries to do sync_sched/rcu() inside _cpu_down() but triggers:

	INFO: task swapper/0:1 blocked for more than 120 seconds.
	...
	[<ffffffff811263dc>] synchronize_rcu+0x2c/0x30
	[<ffffffff81d1bd82>] _cpu_down+0x2b2/0x340
	...

It was caused by that in the rcu boost case we rely on smpboot thread to
finish the rcu callback, which has already been parked before sync in here
and leads to the endless sync_sched/rcu().

This patch exchanges the sequence of smpboot_park_threads() and
sync_sched/rcu() to fix the bug.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/5282EDC0.6060003@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
drivers: wireless: Add option to change WiFi power mode on suspend

When this config is enabled, "wifi_pm" module parameter
is utilized to change power mode of WiFi on suspend
and save more power.

[hammerhead: Makefile is re-structured to compile this config]

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

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