msm: kgsl: remove unneeded idle calls from context create

These idles were necessary when the context switch code
preserved PM_OVERRIDE registers. That was removed some time
ago so now the idles are not needed.

(cherry picked from commit 2794ab6dfe3ae8d88de8bad1022b8b5f2a194041)

Change-Id: I8f168ac6745ad5fa6de0ae41d1e38b9b01e22514
CRs-Fixed: 331325
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Clarify the circumstances to enable SLUMBER state

Use the restore_slumber variable at as low a level as possible
to remove confusion from the state machine.  Also do not let
restore_slumber impact the function of NAP state.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
(cherry picked from commit a985adf60ef350c3924587e7b4d11fb05be453ad)

Conflicts:

	drivers/gpu/msm/kgsl_pwrctrl.c

Change-Id: If88de825949c77306b4c46f02bf2679cc06b9ac8
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
msm: kgsl: Idle the core before changing the gpu clock.

Idle the core before changing the gpu clock as instability
is caused on some platforms on changing the clock freq when
core is busy.

CRs-fixed: 328249
Signed-off-by: Kedar Joshi <kjoshi@codeaurora.org>
(cherry picked from commit c11d098f53dd1fb07ea03475510c29c39b9671ab)

Change-Id: I11fc58128560b131f60a84fc94b8bc48134a9eaa
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/devices-msm7x30.c
msm: kgsl: remove readl/writel use for dma memory

For dma_alloc_coherent() you don't need writel/readl because
it's just a plain old void *. Linux tries very hard to make a
distinction between io memory (void __iomem *) and memory
(void *) so that drivers are portable to architectures that
don't have a way to access registers via pointer dereferences.
You can see http://lwn.net/Articles/102232/ and the Linus rant
http://lwn.net/Articles/102240/ here for more details behind
the motivation.

Change-Id: I3da075c30304e4adf321cfb3edb1baa4a93fc2ce
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Dereference pagetable pointer after checking it's not NULL

The pt pointer was being checked against NULL value after it was
dereferenced

Change-Id: Ifbdeb7bec5e3f28396196d8f55356e5dbf1a2e55
CRs-Fixed: 336516
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit c0f21b6bc1fcb73900ea845e05a42a2de6fd8dde)
msm: kgsl: flush outer cache for alloc_page() pages

The outer cache needs to be flushed for these pages
after they are allocated so that the GPU and CPU
have a consistent view of them.

CRs-Fixed: 346921
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 7018a21bf2b52f1296557d1f6ec9ed64e9169de7)

Change-Id: Id5c11ab8d856fc270330fd3258baa51b8efca192
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: kgsl: Resolve conflicts in state changes

Only check requested state once, and fully transition to that
specific state.  This will resolve any conflicts arising from
changes to the requested_state as the state transition occurs.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
(cherry picked from commit e4a7c1a365ea32aebfe3995e13fc63ca8c2916c5)

Change-Id: I9d351d9d7e479389e473fc6e54d9d06d7ef200b9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: kgsl: fix compile for commit "Resolve conflicts in state changes"
msm: kgsl: Do not dereference pointer before checking against NULL

The pagetable pointer was checked against NULL after being used.
Check against NULL first and then dereference it.

Change-Id: I714de9e3b153f212cb92502a21c7d720dd4e1e37
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: fix cleanup code in kgsl_ioctl_map_user_mem()

ion handles need to be handled differently than pmem or
ashmem handles.

CRs-Fixed: 359268
Change-Id: I20637644f247859245fbba80e5bc6b50fd896403
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 53d4dd028583c3d0a97233d3dff4336ae086ca91)
msm: kgsl: Report error if regulator enable fails

In function kgsl_pwrctrl_pwrrail check if call to enable the
regulator fails or not and report an error message on failure.

CRs-Fixed: 340649
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit e86ba5ca2814cbbcb803c154bda0c14851d33d37)

Change-Id: Id77422bd73c6a0f5f8106834419cfa13e8e807bd
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>