msm: kgsl: Initialize the GPU at 320MHz

CRs-fixed: 305411
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Don't count io busy at the lowest power level

If the GPU is running as slowly as possible, it is adding
lots of io busy to the CPU.  This causes the CPU ondemand
algorithm to unneccessarily increase CPU frequency.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: for 8960 turn of clk gating for SX_clk_0

Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Properly handle double mmapped memory

In some situations, the same block of memory is
mapped multiple times.  Properly refcount that mapping
otherwise we could get into a situation where the mem
entry is completely dereferenced before its time.

CRs-fixed: 306942
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Introduce Iommu Code

kgsl now supports the use of 2 types of MMU. One is
the GPU's internal MMU and the other is IOMMU. Both
MMU cannot be active at the same time. The MMU type
can be selected at compile time via config option.
A boot command line parameter can be used to override
the type of MMU selected at compile time.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Cleanup virtual files on module exit

Make sure that all sysfs and debugfs entries
are cleaned up when the driver exits.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Remove WPTR drop prevention workaround

The WPTR drop prevention workaround added earlier is seen to cause
vague GPU hangs while running 3DMM06 app. So removing it.

CRs-Fixed: 309787
Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: load workaround firmware for 8960v2

Change-Id: I3729b4d6f981e9b6202183a1e4614d57a5148062
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
Revert "msm: kgsl: force 8960 v1 & v2 to use adreno220"

This reverts commit 8ad6fed70fbd18f4a061be2b3d749d3692dd7f86.

This is no longer needed now that workaround firmware for
8960v2 is available.

Change-Id: I212b7a7e4ef086b25d01d546df63a64505d8d374
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Debugfs knob to configure wait timeout of adreno device

There are times when the adreno device is heavily loaded. Here, a
predetermined wait timeout value will not be useful. The configurability
introduced with this change will help in understanding the behaviour and
to tune the value. Will also be helpful in quickly identifying problems
that arise when the irqs don't fire.

Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Add a work item for processing expired timestamps

Add a work item to be triggered following a RB complete interrupt
signifying that a timestamp has been processed and retired on
the GPU. To kick things off, this work item is the the new home
for flushing expired memory objects allowing us to get rid of
kgsl_memqueue_drain and its various offspring.

Change-Id: Ic0dedbad853291ae5d05247241f449a7b523e318
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Make sure we are idle before calling pwrscale_idle

Change-Id: Id56d94a1be345c72fa11b1029411d9cb73279729
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: make kgsl msm_bus votes more readable

Change-Id: Ia8de770d0891a078d9b2dc16b8ce541a4820b003
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Add idlestats sleep event notification

Change-Id: Ie632d3f44661575ad8c7b41f064eff5f3b068f62
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>