msm: kgsl: Do not ramp to turbo if the screen is off.

Change-Id: I1f6e7a829352c0c5c8f31132bc22ad95ed737e28
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Move the GPU register lists to a common location

Move the GPU register lists to a common location so they can be used
by multiple sub-systems.  To avoid confusion, convert the lists from
byte offsets to dword offsets to match how we do register offsets
throughout the entire driver and in user space.

Change-Id: Ic0dedbad0f320242b77231a444939f9c6d852976
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Don't wake core to check if it is idle.

Scenarios which check for idle and inadvertently turn
on the core when it was off happen fairly frequently.
Fixing this at the root rather than continuing to work
around each one.

Change-Id: Ibddd40bf69352733c8d4779272aa08757981d494
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Decrease the idle_timeout to 50ms

Originally higher due to high latencies.  Now that they've decreased
we can go to SLEEP earlier.

CRs-fixed: 312297
Change-Id: I2a3813b12c0a72f3b75699fcd377508e7eb1044e
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Power scale policy needs at least three power levels.

Since 7x25A supports two power levels, do not allow it to register
with the power scale policy.

Change-Id: I1a77f0aa8e7affa126d7c18cb2d73e8617602dcf
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: call device->irqctrl from start/stop

These functions write registers and so if they are called
from kgsl_pwrctrl_irq() there is a chance that they
might be called when clocks are disabled.

Change-Id: I259d840d9996d424aba3e3481201d49f602637e8
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: only queue work when requested state is none

If another state has been requested, there is no reason
to queue work.

Change-Id: Ifa8d57e523a047bd2021c00732c2fe6a67bd6790
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Collect a sample only if GPU is active

If the device is not in active state, collecting a sample is not
necessary and will cause frequent wake-ups, resulting in higher power
consumption.

Change-Id: Icb4f82b1300cab3b4cc4ed17117a92725a5a11d4
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: No need to expose internal functions.

Change-Id: I8cb98c96ad000d511915ac5c7ac5a57fe59f7556
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: flush device workqueue before stop

Make sure the irq is off, the idle timer is
stopped and the workqueue is flushed before
stopping the device for early suspend, suspend,
last release or hang recovery. There is one case
where the workqueue cannot be flushed, which is from
kgsl_pwrctrl_sleep() when going into SLUMBER
state. This codepath can be called from the
workqueue itself so flushing would deadlock.

Change-Id: I19bcd192845401ac0d94aa60a9252970b634c1ea
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: Modify only the pending idle timer in ISR.

mod_timer reactivates the timer even when timer is deleted using
del_timer_sync. In the ISR we should be modifying only the pending
timer. We deleted the timer using del_timer_sync, if the interrupts
are still enabled, we could be re-enabling the timer in the ISR.

There is a code path in kgsl_suspend device where we delete the timer
but disable IRQ later.This code path seems to be fixed with another
commit.

Change-Id: I1253dd3c774427e725d302d9ba13d87fad10c463
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: only poke once during adreno_idle

The RBBM_STATUS loop is extremely tight and calling
adreno_poke() each time through this loop appears
to cause watchdog bites on 8960.

CRs-Fixed: 324507
Change-Id: I65145ca96f63280179d76abd5320fd201beeeaa7
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
Revert "msm: kgsl: only queue work when requested state is none"

This reverts a87d51a96c03f3ddc4b7435910a4e8d0e80cb8f4
Patch causes increase in power consumption while playing a video.

CRs-fixed: 331854
(cherry picked from commit 03ba25fa5bd44ab589ac40bf79cb5f266a3a9465)

Change-Id: Iaf628ecdbccbd18c2873f6db1a47c02f41c83272
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: remove *MMU type options from Kconfig

Remove the ability to switch between gpummu and iommu via
kernel config. The new decision path is: if kgsl.mmutype is set,
use that. Otherwise if iommu_found() use iommu, and last
but not least use the gpummu.

Change-Id: I6d34baf72da53e566bfa7081c6741f7fd0180aea
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: kgsl: convert sg allocation to vmalloc

kmalloc allocates physically contiguous memory and
may fail for larger allocations due to fragmentation.
The large allocations are caused by the fact that the
scatterlist structure is 24 bytes and the array size
is proportional to the number of pages being mapped.

(cherry picked from commit 28afec421e4c35b295e4ae652febf2fdee13eb88)

Change-Id: I3f5e4cb4fb95388a0b387fd725ecbaf733029452
CRs-fixed: 327066
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>