ENGR00320048 ARM:imx6sl:Ensure that bandgap is not disabled in LDO-enabled mode

The main bandgap is required for regulation in LDO-enabled mode.
Ensure that the main bandgap is only disabled in LDO-bypass mode
when entering low power IDLE.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
ENGR00320554: ARM: imx: drop unncessary PL310 errata

The PL310 integrated on i.MX6 series and VF610 are revision r3p1 and
later.  Per ARM PL310 errata document, 588369 is fixed in r2p0 and
727915 is fixed in r3p1.  Neither is needed for i.MX6 or VF610.  So
let's drop them.

Signed-off-by: Richard Liu <r66033@freescale.com>
Acked-by: Jason Liu <r64343@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
ENGR00306992-2 gpu:gpu2d may cause bus hang in some corner case

Vivante patch name:
fix_fsl_2d_base_on_p13.v2.rls.diff

-Updated the outstanding request limit to 12.
-Refined the 2D chip feature check.
-Refine the 2D cache flush operation
(avoid FE and PE access memory through the same port).
-Enable cache flush for filterblt.
-Dynamic enabling SPLIT_RECT by checking chip feature(disable for us)
-Use brush stretch blt for clear operation.
-Enable SplitFilterBlit to workaround the 2d hang issue in filterblit case.
-Refine 2d line operation.

Date: May 05, 2014
Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit 479b9125caefc45451aa1c4a1b7f2704b57831fa)
ENGR00300876 [#ccc] Fix flick issue in GAL2D compositor

Move wl_surface_commit to work thread.
Fix memory leak in wl_egl_window_resize.

Date: Jul 10, 2014
Signed-off-by Yong Gan <yong.gan@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit c114ec8a4c74fc2a2d0f64c60031c66d2225ff83)
ENGR00307848 MXC IPUv3 fb: Fix MXCFB_CSC_UPDATE ioctl()

Add a missing 'break' in the MXCFB_CSC_UPDATE case in mxcfb_ioctl(),
to prevent it to always return EINVAL (Invalid argument).

Acked-by: Liu Ying <Ying.Liu@freescale.com>
Signed-off-by: Julien Olivain <julien.olivain@freescale.com>
ENGR00306397 [#1118] use BUG_ON to check if GPU clock is off

Access GPU register will cause system hang(bus lock-up) without log when clock is off,
GPU kernel BUG_ON is added to check if GPU clock is off when read & write GPU registers,

GPU clock issue can be easily identified with the detailed kernel panic log as below:

kernel BUG at drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c:2423!
Unable to handle kernel NULL pointer dereference at virtual address 0000000
...
[<c0050008>] (__bug+0x1c/0x28) from [<c046bb3c>] (gckOS_ReadRegisterEx+0xbc/0xdc)
[<c046bb3c>] (gckOS_ReadRegisterEx+0xbc/0xdc) from [<c047eab4>] (gckHARDWARE_QueryIdle+0x4c/0xbc)
[<c047eab4>] (gckHARDWARE_QueryIdle+0x4c/0xbc) from [<c0475e0c>] (_TryToIdleGPU+0x70/0x12c)

Mutex protection is not necessary for interrupt handling, because GPU clock is only turned off
by interrupt worker thread during clock gating.

Date: Apr 11, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 50c3767eb19bb22f395215755dac220f4bbb2f14)
(cherry picked from commit faf4eb3fd5a66661782f8d0395a27016d7a8fc52)
(cherry picked from commit f8a666c09cd714a609812552b73603d23879b10f)
ENGR00308233-2 [#791]Refine wclip workaround algorithm 001

Vivante patch name:0001-more-refinements-for-wclip-issue

Date: Apr 14, 2014

Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit 807330b464a55be19d4d5117e5f6b161f00a2f88)
(cherry picked from commit ebced57ab02386cbc00d550b03e9546e07f1db8d)
ENGR00308233-3 [#791]Refine wclip workaround algorithm 002

Vivante patch name:0002-more-refinements-for-wclip-issue

Date: Apr 14, 2014

Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit e25208c14fcfae452ebd378e33c671a8366ee55a)
(cherry picked from commit c7d1eab0815f6034b78263e7c994179e3b897d1c)
ENGR00308233-4 [#791]Refine wclip workaround algorithm 003

Vivante patch name:000e-more-refinements-for-wclip-issue

Date: Apr 14, 2014

Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit 3fae441a3b6a40e4981473bf967c121e22a9eda7)
(cherry picked from commit 46dcad78113f8c4757d8bb36a91f865ac6bc5afb)
ENGR00310166 [#1157] disable GPU recovery function

Disable GPU auto recovery so that GPU can dump the stack.
GPU support auto recovery function, when GPU meet some issue
it will try to do recovery, but most of cases GPU can't really
recovery, we do find some cases GPU can recovery for example
some 2D hang, but customer is not accept such recovery, so show
the GPU stack dump and find the root cause is the correct way.

Date: Apr 24, 2014

Signed-off-by: Richard Liu <r66033@freescale.com>
(cherry picked from commit 888c79ab0f114b7b259266fc82c1399cbb926faf)
(cherry picked from commit 8a213f47050eb49da70877090e07323b530bf147)
(cherry picked from commit 6f779e52e7678aaab198ea4caa9bac1e686a44eb)
ENGR00309915 [#1087] enhanced video memory mutex

this patch can fix NULL pointer issue in GPU kernel driver with the following log

[<7f240438>] (gckEVENT_AddList+0x0/0x810 [galcore]) from [<7f239ebc>] (gckCOMMAND_Commit+0xf28/0x118c [galcore])
[<7f238f94>] (gckCOMMAND_Commit+0x0/0x118c [galcore]) from [<7f2362dc>] (gckKERNEL_Dispatch+0x120c/0x24e4 [galcore])
[<7f2350d0>] (gckKERNEL_Dispatch+0x0/0x24e4 [galcore]) from [<7f222280>] (drv_ioctl+0x390/0x540 [galcore])
[<7f221ef0>] (drv_ioctl+0x0/0x540 [galcore]) from [<800facd0>] (vfs_ioctl+0x30/0x44)

The false code is at 0x217bc where the 0-pointer happens (r3 = 0)

gcuVIDMEM_NODE_PTR node = (gcuVIDMEM_NODE_PTR)(gcmUINT64_TO_PTR(Record->info.u.FreeVideoMemory.node));
   217b8:                e5953028             ldr           r3, [r5, #40]         ; 0x28

                if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
   217bc:                e5932000             ldr           r2, [r3]
   217c0:                e5922000             ldr           r2, [r2]
   217c4:                e152000a             cmp       r2, sl
                {
                     gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(Event->kernel,

Date: Apr 23, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit fcde214d8c793d4dd785e47175b5833f1f3f5f1f)
(cherry picked from commit 952142648d76fce2663ef649d9f988f1b7809815)
(cherry picked from commit 9d7b33678f1f944f75644e958c3ceeb7f2e4bac9)
ENGR00308899 [#1087] enhanced GPU database protection

the potential risk is found in special case when application exit,
deleting record will cause the unexpected issue when process database is destoryed without atom protection

the enhanced database patch should be applied to avoid the unexpected kernel issue

Date: Apr 17, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit e799c1ae023264c0e1e1e41d448e30e2304944e1)
(cherry picked from commit 7eb5273b6dd61d61c2ffe778bdb6d5032bbc1aa0)
(cherry picked from commit ae4ba121bb72164183d7a47eb8a7c3ea316f6204)
ENGR00312477 [#1162] fixed gpu lower memory killer

mutex operation is performed in gckKERNEL_QueryProcessDB
remove spinlock for gckKERNEL_QueryProcessDB to avoid scheduling issue

Date: May 08, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 554581201c0a1c2c7caddad5750b1fd678e09c8c)
(cherry picked from commit 78ecaf1c6475ee188a6a2a1dfbe954e457a28997)
(cherry picked from commit 6837de20c0ce171bc16c7d779d6ac177b53d5529)
ENGR00314119 [#1183] fixed database mutex multi-lock issue

The abnormal flow with the monkey test freeze problem is as below:
gckKERNEL_DestroyProcessDB--> aquire mutex --> gckCOMMAND_Detach(gckEVENT_FreeContiguousMemory) -->
___RemoveRecordFromProcessDB --> gckKERNEL_RemoveProcessDB --> aquire the same mutex

the fix is to disable mutex lock when perform record destory operations

Date: May 19, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 8d62ea9a655f1bb0ca86af222de7625abc8d2bc8)
(cherry picked from commit cd5a9a37525d4d2f79b6013f4bd93779b900b854)
(cherry picked from commit 31d6a06da4cf9beacd9b1ba7a7e67d41cee18f7d)
ENGR00313862 [#1173] fix android cts testThroughput fail

fix android.media.cts.PresentationSyncTest#testThroughput cts fail,
root cause is dequeueBuffer and queueBuffer in Surface will acquire
the same mutex and in GPU driver dequeueBuffer and queueBuffer is work
at asynchronous mode, so queueBuffer maybe blocked by dequeueBuffer
and dequeueBuffer will return after 16ms (vsync time).

Date: May 16, 2014
Signed-off-by: Richard Liu <r66033@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit e62993b346e418f08cb88d25303a0541653a5468)
(cherry picked from commit cb850fe07a406ecd4610b985b23b55b37dcdb703)
ENGR00315583 [#1209] fix random data corruption in GPU memory

GPU memory node should not be used after node structure is destoryed,
that will cause random GPU memory data corruption issue in Android platform.

the issue can be reproduced when run cts -p android.opengl repeatly(more than 100 times)

Date: May 28, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 36dbe12f0dbd01dd7ef10b52a9c508fa5d7d19d0)
(cherry picked from commit c81d392b824699088f88d4552cb1935d94d89dc3)
ENGR00316978 [#1162] force_sig crash in GPU lower memory killer

it is caused when multiple threads try to kill same one process,
the global semaphore is used to avoid this conflict.

Date: Jun 05, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 48c860eba3aae80c85587a37a858082b3a8b7b08)
(cherry picked from commit d6acc3d27428be0d0b4682ab86b76de03c54efab)
ENGR00325794 [#1087] fix video memory mutex sharing issue

the root cause is video memory mutex is not global variable,
it will cause video memory managment problem with mixed 2D/3D/VG.

kernel panic with multiple instances stress test running glesx_viv.sh.

Date: Jul 31, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 02bdc91149f077aba37c790aca1e59041d473f71)
(cherry picked from commit 26c25e084b4137bf19aaa20e5075bb3c16096066)
(cherry picked from commit 94c683128e5b7b2d2aaa92de28a32500926b0fad)
ENGR00322632 [#1243] fix memory type to avoid overwriting issue

fix invalid access issue in GPU kernel triggered with the certain condition,
memory extensive type exceed 256 and will cause memory overwriting issue

Date: Jul 14, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
(cherry picked from commit 0db530ceadb9e1559793c725d4ab576370ffb1c2)
ENGR00322672 [#1244] avoid system freeze when dump GPU state without valid clock & power

GPU recovery is disabled by default, GPU kernel driver will dump hardware status,
but if GPU clock & power is truned off, system will get frozen unexpectedly.

this fix is to avoid system freeze by detecting clock & power state.

Date: Jul 14, 2014
Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Shawn Guo
(cherry picked from commit 05fd7bf5615a9ccde4af97ff7dcae3e7e2c9a86a)
(cherry picked from commit 7c094ccb55e4a70ada5d7c2df8b6d3816956333a)