msm: kgsl: Move the pdata structure from the public API header

The pdata structure and associated structs have no business being
in msm_kgsl.h.  Move them to include/mach/kgsl.h where they can
thrive in a non-userspace facing environment.

Change-Id: Ic0dedbadfe0d3d7d44f50c8a9a7f4cc59057d44b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064-gpu.c
	arch/arm/mach-msm/board-8930-gpu.c
	arch/arm/mach-msm/board-8930.c
mmi: update kgsl header location

Change-Id: I457b6b4814fac640bbc97f9de340c20315a20f1c
msm: kgsl: Move SOC based chip ID to the board files

Move almost all of the SOC based GPU identification code out
of the KGSL driver and into the board files.  This cleans up
the GPU side and reduces our usage of the cpu_is and machine_is
macros.

Change-Id: Ic0dedbad34eb034316b7baabf05aa7f8e8aa9ced
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064-gpu.c
	arch/arm/mach-msm/board-8930-gpu.c
	drivers/gpu/msm/adreno.c
msm: socinfo: Add socinfo support for 8625

Currently the socid that will be returned is dummy, fixed to 127.

Change-Id: Ifd145a9c50a641743309776b0b66516d2dddf60c
Signed-off-by: Taniya Das <tdas@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/include/mach/socinfo.h
	arch/arm/mach-msm/socinfo.c
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>
msm: kgsl: Need to explicitly halt the ME on stop

it seems even if gpu requests for power rail off, modem might not
process this request as it leads to turn off power rail for mdp in
the case of 7x27a/8x25. This issue specific to 7x27a, since we do
soft reset the GPU on sleep/wake. In the case of suspend/resume,
the powerail is effectively off across the device.

Change-Id: Iad898da67b34e265b2447013c4250ba04a59c0cd
Signed-off-by: Rammohan Basavaraju <rammoh@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Update pagetable on context destruction for A20x

Ensure that pagetable is updated during context destruction. This
resolves stability issues during Camera launch/exit scenarios. Applies
only to A20x GPUs. This change is already done for Z180 device.

Change-Id: I978cbce49ed2b45be0209c2939b1b8423c68d5ec
CRs-fixed: 381875
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Add new sysfs node to list GPU clock frequencies

Add a new sysfs node to communicate available GPU clock frequencies
to userspace for the power daemons.

Change-Id: I2479217aa797e2066cc50476ef7f73c5cae8aebe
Signed-off-by: Anshuman Dani <adani@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Enable GPU DCVS by default where possible

If a platform has Trustzone support, enable GPU DCVS
automatically without checking the individual soc info
value.

Change-Id: Ie8d965f8d73283a7f3bf55dedc44d550db2408b8
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_pwrscale_trustzone.c
msm: kgsl: Don't report io_busy for msm policy

Turn io_fraction to 100 so that the kernel
wait_io_interruptible call is not required for io_busy
reporting while using msm policy. Msm policy uses its
own schema to capture busy events.

Change-Id: Iddb63552305974ce4a12446117f27d07b7201387
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Ensure correct enable sequence for 2D core clock

Calling clk_set_rate() for both AXI & 2D core clocks without putting
them in async mode causes 2D core hang. Since AXI & 2D core clocks
are in sync mode, ensure that clk_set_rate() is called only for AXI
& 2D core clock is enabled only after it is prepared.

Change-Id: I4634e2342d62ce16ad7afc748b10b0573fbfd913
CRs-fixed: 385393
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Do not save context if it is being destroyed

No need to save a context if it is being destroyed since
it will no longer be used at all. This is better for
performance and also avoids the use of legacy kgsl
context save code for contexts that use preambles

Change-Id: I19a64e82188b4132f353bb61c21e4ed2281092fc
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Increase REG_RBBM_CNTL value to 0xFFFF for A20X

Increase number of clocks that RBBM will wait before de-asserting
the Register Clock Active signal. This fixes kernel panics during
stability tests on multiple devices

Change-Id: I6f7f8bb17cfd9c5beed0fd21d56ab6ab9fd40195
Signed-off-by: Rammohan Basavaraju <rammoh@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Pass multiple register sets to the snapshot register dump

Expand the snapshot register dump helper function to support multiple
sets of registers.  This will be useful for derivative GPUS that
use a global subset of registers and add a few new ones.  This will
not be useful for chipsets that have extensive changes to existing
registers.

Change-Id: Ic0dedbad05bcc3b5a3a0cc933659959965ff5817
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno_a3xx_snapshot.c
msm: kgsl: unprepare clocks when we move from NAP to SLEEP

The existing code leaves clks prepared when we transition from
NAP to SLEEP. We fail to reach Vdd_min as voltage scaling has
moved to prepare/unprepare.

Change-Id: I509f4c6bd217ead985890147819236dd2c5d03ce
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Do not allocate space in ringbuffer for hung context

If a hang is detected when allocating space in ringbuffer and
if the context for which the space is being allocated is hung
then do not allocate space at all.

Change-Id: Ia5ade2341fe5016119d8c140413860420c5c3a3d
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: In kgsl release do not idle if device is in HUNG state

When recovery fails we are in HUNG state and clocks are turned off,
If a client closes kgsl device, driver release gets called and
we will try to idle the device which leads to accessing GPU registers
without clock being on. This leads to excessive kernel logging
"kgsl_pre_hwaccess hw access while clocks off from state HUNG"
and this eventually leads to watchdog.

CRs-fixed: 397149
Change-Id: Iac720bef5d811269417ec1e5a346c95ce5a4324f
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: set io_fraction to max for msm policy

io_fraction is set to max so that io_wait gets reported
for DCVS so that MP decision won't offline cores
during GPU activity.

Change-Id: I39db72dd9c443069675a8a1b1f4e17d8928625b8
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Set sysfs max clock for devices with no power scale policy

When the sysfs entry for max clock is updated, set it immediately for the
devices that has no power scale policy. This prevents the device from
running with undesired clock.

Change-Id: I3211234f6d2afe4c2de115dace70b332d2b30f21
CRs-fixed: 408963
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: Always reset global ts_cmp_enable on GPU interrupts

Always rest the ts_cmp_enable when an interrupt is received
from the GPU.  This keeps legacy code that is not using
per context timestamps correctly updated.  No effect is
seen with mainline code using per context timestamps.

CRs-fixed: 418172
Change-Id: I7f29086d4885571bdb165c0e759dc6ffc40b554f
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno_a3xx.c