Merge commit 'AU_LINUX_ANDROID_JB_2.5.04.02.01.40.084' into HEAD

Change-Id: Ib94f5c6e762aa0332ecf568a1eb7439a98445ec0
msm: camera: vision mode sensor driver

Required to activate the vision mode in s5k6b2yx sensor.

Change-Id: I56e7c56fed414d030e6e57ff7e15c20a071c5dc6
Signed-off-by: Punit Soni <punits@codeaurora.org>
Signed-off-by: Ninad Patgaonkar <ninadp@codeaurora.org>
(cherry picked from commit edeca65ac41bbf8b1600ea4d345cdbd2e151bdb2)
msm: camera: RDI2 frame divert

Change-Id: I074751a2b51d20ee422a7e13455f4f16e816ad7c
Signed-off-by: Sagar Gore <csgore@codeaurora.org>
(cherry picked from commit 2cd08ce001fb2078146be7034b5df83fc09e5c76)
Update copyright to The Linux Foundation

Change-Id: I849ec885832aba72f3e1c4241525a8c113fe3c75
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
gpu: ion: Request highmem pages for IOMMU heap

When allocating pages for IOMMU heap it is advantageous
to try to allocate pages from highmem in addition to
lowmem since clients using the IOMMU heap can use
either highmem or lowmem.

CRs-fixed: 430457
Change-Id: Ifc794fc344c67dd53d8f7cebf86536ab9d44ed6c
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 193fef0514189aa398d704398a783a595d1d7138)
msm: display: panel frame rate report

Add metadata ioctl for retrieving panel frame rate.
Get ready to remove reserved fields usage.

Change-Id: I51a4aed9d85efd5f83a184100b6a3dc682c7a67c
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
msm: display: release fence when all pipes are unset

When all pipes are unset(or only boarder fill pipe is left),
fence can be released as mdp doesn't use the buffer any more.

Change-Id: Iede361e13b4ea79956375644585a927e6cb8e8d6
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
(cherry picked from commit f77ba6e24c14c613071530ddb786c13dc0d2105d)
msm : mdp: Move wfd state signalling into mdp driver .

Previously the WFD driver was reponsible for signalling the
online/offline events to userspace listeners.  This led to redundant
notifications due to the manner in which the WFD driver is used. The
signalling is better purposed when done from MDP driver.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>

Conflicts:

	include/linux/msm_mdp.h

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
(cherry picked from commit 30b1a99ad6f82b45b71feb3cdb06b831d39ad285)

Change-Id: Ic041c69b626902d48e35a12e69232265961c0bef
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: writeback panel commit should not happen when buffer is NULL.

The change handles the NULL buffer case for writeback panel.
It avoids the H/W commit when buffer is NULL and also adds it to
free queue.

CRs-Fixed: 448340
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_writeback.c

Change-Id: I2c6b3e8ac05151a1616fa5a05410e2922fc8c9e4
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Don't wake up gpu on kgsl_ioctl calls if not necessary

This is Iee3db5401bdad1808a09d104e0daecfc3716cbb4 change ported
manually from the msm-3.4/msm-3.7 branch to the jb_2.5 branch.

The current code wakes up gpu on all kgsl_ioctl() calls that need
to hold device->mutex. However there are some kgsl_ioctl() calls that
don't need that. That fix introduces a bit of info to mark such
functions, and don't wake up gpu calling them to save some power.

Change-Id: I86224d2405c42e3803c7e361c02fe1d02d4cdff1
CRs-Fixed: 438932
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
msm: acpuclock-8064: Lower max L2 speed to 1134MHz

There are some testing showing that L2 at 1188MHz may cause
some stability issue. Therefore, lower the max speed to 1134Mhz.

Change-Id: Iaf57a916ce49e7c31708285e5568690b344ef1e5
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
msm: kgsl: Avoid NULL pointer in adreno setstate functions

Make sure the specified context_id returns a valid context
in adreno_gpummu_setstate and adreno_iommu_setstate and
silently return if it doesn't.

CRs-Fixed: 439367
Change-Id: Ic0dedbad1a91b53f19782b50380bd36842614351
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit 060d7a34db6f9c5e35655cef8c0f936533215bee)
msm: kgsl: Change GPU Fast Hang detection to 50ms

Fast hang detection algorithm is improved to use additional
performance counters to monitor shader processor activity.
Shader processor's active alu cycles, icl0 misses
and fs cflow instructions are added to list of activities
monitored for fast hang detection.

Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit d2063cb34c451eb8ccb5debd252229842ac54027)

Conflicts:

	drivers/gpu/msm/a3xx_reg.h
	drivers/gpu/msm/adreno_a3xx.c

Change-Id: I538f06a178f2829c1b4663b4b929c45ab570ae18
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Ensure context pointer exists before dereferencing

When trying to add commands to the ringbuffer command stream, ensure
that the context point is not NULL before dereferencing it.

Change-Id: I6d8217ed4b180454eb43f2db161c10e86bc207da
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
(cherry picked from commit dc2ebb1ea0271c4ec1a83a991d94d7ae908daea3)
msm: kgsl: Fix guilty context logic for GPU hangs

Always mark GPU contexts that have cause a GPU hang as guilty.
If the GPU context recovered successfully, still mark it as guilty.
This will inform applications that something might have
gone wrong and to take actions to ensure everything is correct.

Also, swap out any active context following a hang.  This will
ensure that any new submissions will force the context to be restored
before it is used.

CRs-fixed: 427603
CRs-fixed: 405434
Change-Id: I6b7cf2b2a680a4691f45535a147ca678a4d961f3
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
(cherry picked from commit ebf8c2d6bb79acaae1545c2860bbdfbd0604b80f)
msm: kgsl: Cleanup memdesc flags

We had a ugly mix of flags from usersapce mixed in with internal flags
and the flags were stored in priv and the internal flags were stored
in flags and general confusion all around.

So, external (user) flags moved to memdesc->flags, internal bits moved
to ->priv and now we are ready to handle the full onslaught of user
specified flags.

Change-Id: Ic0dedbad2236ae353b31e5dcaa6ff551713abaf1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
(cherry picked from commit 1b15b30c8df99833c6930c581d9b83ed0d1f24a9)
msm: kgsl: Add GFP_NORETRY to the page_alloc flags and handle errors

The most important thing for the memory allocator is to not crash
or otherwise behave badly during low memory situations. Adding
GFP_NORETRY keeps the OOM killer from being invoked making the 32MB
padding on the allocation redundant.  Remove the padding, add the flags
and go down the proper error path when alloc_pages() fails.

Change-Id: Ic0dedbadaf86e248b372b22cd3a41a5dabedb82e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit 2253f35ac587f1439144f330425fe25a85a69fb9)
msm: kgsl: Remove support for IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC

All userspace consumers should now be using IOCTL_KGSL_GPUMEM_ALLOC,
so we can safely remove this kludgy and deprecated code.  The structs
and #defines are left in the header to avoid breaking userspace and
to serve as a reminder of the way we were, but any use of
IOCTL_KGSL_SHAREMEM_FROM_VMALLOC will return -ENOTTY.

Change-Id: Ic0dedbad1460acfe28116ee2dbd75faa52b76857
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit c60c975c4ca833a45cde234bbb5dac37f4d2a8ea)
msm: kgsl: Add minimum amount of wait in adreno_waittimestamp

Add minimum amount of wait period in adreno_waittimestamp
to avoid instances of malformed wait period (such as msecs=0)
arguments from userspace and in turn avoid false hang detections.

CRs-fixed: 437738
Change-Id: I5cd40dc7589747e7fffeb6d5cc2001b73d6d845e
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
(cherry picked from commit 7cd21997b8d18e78e81a91985ca44090e9342094)
msm: kgsl: Modify kgsl_mmu_pagefault ftrace event format .

The kgsl_mmu_pagefault event is the only ftrace event with
it's format field being multiline. All other ftrace events
in the kernel have the format field in a single line.
Make the kgsl_mmu_pagefault event format consistent with
all other ftrace events.

Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
(cherry picked from commit 7f72c9bbaddf19728b0757ad54a9f79b8ecdc8e7)

Conflicts:

	drivers/gpu/msm/kgsl_trace.h

Change-Id: Id3b9159c759199f72c595627a82e6be1992747e0
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>