net: wireless: bcmdhd: Add WIPHY_WOWLAN_ANY support

Change-Id: I4a9de9ab40f6de2e5ef5830529cfb066d6c75b57
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Merge remote-tracking branch 'common/android-3.0' into HEAD

Change-Id: Ia4a2764d995c33c604fa86dd871ffa6ea7922801
msm: kgsl: Configure FT behaviour from sysfs instead of debugfs

FT behaviour is changed to be configured from sysfs
instead of debugfs. Sysfs control gives us the advantage
of configuring FT at bootup and also across bootups.
Persistant configuration across bootups helps
testing by configuring FT once and testing the FT
config across bootups.

Conflicts:

	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_debugfs.c

Change-Id: Ia3378f214371a6a4b9f205f9f884976f58585971
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Allocate space in ringbuffer for EOF commands

When userspace passes end of frame (EOF) flag, ringbuffer is
inserted with EOF marker commands. Allocate ringbuffer space
for EOF marker commands.

CRs-Fixed: 469807
Change-Id: I7de8d1b81d358a8d8753ac84fbdceddad27bb17d
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: use the same logic in adreno_idle and adreno_isidle

These two functions need to agree on the meaning of "idle",
so that calling adreno_isidle() right after an adreno_idle()
will always return true.

Change-Id: I7cddf73773186c3ec8b56c111affacac3b07fcc7
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 5365240cf0abf2d799dd849abca0dc5b46d4b784)
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>

Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: kgsl: Avoid dereferencing NULL pointers

It is possible to drop to the bottom of adreno_ringbuffer_issuecmds
with either context or drawctxt set to NULL. Avoid dereferencing these
variables in the trace call at the bottom of the function.

Change-Id: Ic0dedbadbc7e2c0c4ef85e0d7103e04485ed3e69
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: An error condition could cause an array overflow

In kgsl_setup_pt() if the MMU specific setup_pt function fails
the code will attempt to unwind the setup but it will use an
out of bounds index to do so.

Change-Id: Ic0dedbad8b23f65d4b52cb5ba01810ff26b19b89
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl Check NULL return from kgsl_get_device_from_dev

The function kgsl_get_device_from_dev() might return NULL, which
was not checked in a few places. Check the return value wherever
it is called.

Change-Id: I764b23a7b13acd692ce0e1bf4bd040c7e180c7d8
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Init log levels in device init

Device log levels should be initialized during device initialization,
removing this from debugfs init because customer could disable
debugfs.

Conflicts:

	drivers/gpu/msm/adreno.c
	drivers/gpu/msm/kgsl_debugfs.c

Change-Id: Ie1222be1d421405e0d7481c799045cb9876c2a91
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Init FT log level in device init

Currenlty FT log level is init in debugfs init, debugfs
could be removed from commercial software and we might
miss FT logs, initializing FT log level in device init
prevents this.

Change-Id: If6ea02735dd250ecb7579cc0b485145dddb1b6d6
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: use kgsl_mmu_device_setstate() whenever the gpu is idle

We really don't want new GPU commands or events to be generated
just to manage the iommu while we are idle.

Change-Id: I2e8740bee8c25c93bddc51a90a3370d151aaf558
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 1a3279ee70f72d67c5b259573096a9953257a9b5)
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Hold driver process mutex till sysfs entries deleted

sysfs entries deletion logic is not under the driver
process mutex lock, there was a Camera test case
where a single process was trying to call
kgsl_open/kgsl_release very rapidly from multiple
thread, sometimes sysfs entries remained valid
and kgsl_open was trying to create new sysfs
entries for same process id. This caused
WARNING in kernel logs "sysfs: cannot create
duplicate filename '/devices/virtual/kgsl/kgsl/proc/277'"
This change holds the driver process mutex
lock till sysfs entries are deleted.

Change-Id: I0f66314e704c2b53657961303f76e2bd4f34e5b5
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: Use a read/lock for the context idr

Everybody loves a rcu but in this case we are dangerously mixing rcu's
and atomic operations. Add a read/write lock to explicitly protect the
idr. Also fix a few spots where the idr was used without protection.

Change-Id: Ic2f1e5c45692683b52a9f662ccdd2fb59bc7ae0e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Add a missing refcount put for kgsl_context

Fix a potential memory leak by putting in the missing kgsl_context_put()
in fault trace detect.

Change-Id: Ic0b43c831a88ac3e45bbe484bde843b46b6f09f6
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Try fault tolerance even if there is no active context

No active context means that GPU could have failed when executing
commands that set an active context. In this case there are no bad
commands. This sort of hang can mostly be attributed to power
fluctuations or memory barriers which in all likelyhood can pass
after a reset. So treat no active context as a recoverable hang
scenario as well.

Change-Id: I0481a480bdb895f67daa2ed32df49eb1afe29029
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
msm: kgsl: Remove drawctxt_active from setstate default

drawctxt_active is cleared after the old context is removed
during context switch.  Unfortunately, the context restore calls
adreno_use_default_setstate() which always returns true if
drawctxt_active is NULL, effectively always forcing us down the
software path.

Remove the check - adreno_use_default_setstate() already checks to see
if the GPU is idle and that is a more reliable verification that the
software path is worth going down.

Change-Id: Ic0dedbad57d7783bc23dd925a277a63cd2d78a7e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Fix the KGSL driver to compile when CONFIG_DEBUG_FS=n

Fix a compilation error when CONFIG_DEBUG_FS is disabled. Add an
initialization flag to the process struct rather than rely on a
pointer to the debugfs node which will always be NULL if debugfs
is not available.

CRs-fixed: 542231
Change-Id: Ic0dedbadf0241fd476e56d6e116a811697b38190
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Handle failure of find_process_private()

Handle the case of NULL return from find_process_private() upon
its failure by failing from get_process_private().

CRs-fixed: 542831
Change-Id: I8a365368ecf68f0d1aa01199aca76bc7ac49e154
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Get an active count before snapshotting GPU

Acquire an active count before attempting to capture a snapshot.
Doing so prevents instances of not being able to snapshot because of
switched off clocks.

CRs-fixed: 511878
Change-Id: Ib80b57c127566e274d4018001561f4da7ea38265
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: always check ft and hw gates in kgsl_active_count_get

The device state can fluctuate during recovery and resume, so
it is safer to check the gates unconditionally rather than
trust the state. The gates are left open until recovery
or suspend starts.

Change-Id: Idad91976ceba0904425e54c71faf88b4fccb8fdd
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>