msm: hotplug: Block hotplug removal of CPU0

Hotplug removal of CPU0 is not currently supported. Attempts to
remove it may result in undefined behaviour. Explicitly block
any such attempts before other hotplug notifiers get the chance
to run by setting the notifier priority to INT_MAX.

Change-Id: I9e1f5b4a0db554295a097220417f2bdf4c690f5f
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
ARM: dts: msm: fix wrong command mode panel format.

dsi command packet format has been changed, so revise
command mode dts file accordingly.

Change-Id: I34833c2747eda319c1fd4a0da3f40cb9bf30bbea
Signed-off-by: Ray Zhang <rayzhang@codeaurora.org>
ARM: dts: msm: Enable nt35590's PWM output.

Enable nt35590's PWM output used to drive backlight driver.

Change-Id: I4b629ff391243fa039bbcc395dd76a35d3e73abf
Signed-off-by: Ray Zhang <rayzhang@codeaurora.org>
msm: mdss: cleanup dsi interrupt handling logic

Use reference counting for DSI interrupt enable/disable, masking out
DSI_MDP_DONE interrupt.

Change-Id: I83a8136b8bfeeebd2cbb6a8f711b4dd818f49bd2
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
mdss: dsi_v2: verify return value from dma_cmds_tx

When driver was calling dma_cmds_tx it was not checking the return
value.

Change-Id: Ia8903b71a5162d6290a0c841a7a17409dfdddd43
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: Add error handling in mdss_fb_no_update_notify_timer_cb

Return in case mfd is NULL to avoid NULL pointer dereference.

CRs-Fixed: 563125
Change-Id: I82415ed5f1f7b3d27796e9e3a0c96178aa54bdc5
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: Return suspend without delay in NOTIFY UPDATE

NOTIFY_UPDATE returns Suspend after 4 seconds delay.
Delay would cause HISTOGRAM_STOP ioctl to be called late.

Return suspend case without setting timer for no delay.

Change-Id: I356086de96cab85cd203bf1ad529ecf0b3bbfce3
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
mdss: display: Check for non-zero msleep values for LDOs

Change LDO power on/off sequence to check for
non-zero sleep values to prevent input values
of 0 from sleeping for a jiffy.

Change-Id: I66c0ded92e9c76bd43364de701effa96f0d5c9a5
CRs-Fixed: 514628
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
msm: mdss: restructure rotator code and add mutex for rotator api

The rotator data structure should be maintained in the rotator file
and rotator api calls should be following current ioctls, namely,
rotator_setup follows overlay_set, rotator_play follows overlay_play,
and rotator_unset follows overlay_unset. In this way, rotator code is
modulized and data is isolated easily by adding proper locking.

CRs-fixed: 563019
Change-Id: I3aa0db57d65cf9ae88c7e7cbccb3fa73a25e5902
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm: mdss: do proper error handling in case of rotator setup fail

When rotator setup fails, the session should only be finished internally
if it hasn't been reported to userspace. At the same time, need to
ensure that proper cleanup of rotator list is happening, through
internal release path.

Change-Id: I7a6f46261bf8783547de1c7f7fd6893916b25827
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: move rotator SMP reservation to rotator setup

Shared memory pool (SMP) blocks are limited, in some cases where there
are many overlay pipes used, we may not be able to get enough blocks for
rotator sessions. In such cases fall-back solution must be considered,
however for this to happen this would need to be identified during
rotator session setup. Move logic to do pipe resource reservation in
rotator setup if possible.

Change-Id: I223281fb51b81baf852cac415a8c61c0de35c2c4
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Fix under run on interlace clip play in landscape

Rotator src rect y co-ordinate is getting odd after de-interlace
calculation but mdss expects even.

Change-Id: I124d059c89c51126208ad1de02a9d34d87b0f553
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: kgsl: Sync up to kk_3.5_rb1.15's...

msm: kgsl: Release hang detect performance counters when not in use

If hang detection is disabled via sysfs or ioctl() release the
performance counters that the hang detection uses so the counters
can be available to other consumers.

CRs-fixed: 533729
Change-Id: Ic0dedbad6998bbdab0f088a45c2bbf6e426e232d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: When switching pagetable use current context ID

When we switch pagetables then the pagetable switch commands
should be executed on behalf of the currect active context and
not the context to which we are switching. This is because
until the pagetable switch occurs the GPU will be using the
pagetable of the active context.

CRs-fixed: 574989
Change-Id: I9ca65ea399e39a158dc72adc2c7b661f62f18c93
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Account for fixed perfcounter groups

Most performance counter groups have general purpose counters that
can be programmed to any number of countable types.  That said
some groups have counters with fixed countables.  When reserving those
groups the countable is equal to the register - so when you ask for
countable 0 in VBIF_PWR for example it is expected that will always
match to a certain register.  Add a flag member to the perfcounter
group and declare PWR and VBIF_PWR as fixed groups and handle them
accordingly in adreno_perfcounter_get() so that the correct register
is returned.

CRs-fixed: 582739
Change-Id: Ic0dedbad271c7472efce5f79e9055b7b3d224d17
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Re-enable performance counters

Commit b80b6c9daf379b3784e68 accidently disabled all performance
counters which caused the fault tolerance to falsely trigger more
often.  Re-enable the performance counters and remove duplicate
code to enable the VBIF registers (they are enabled by the
a3xx_perfcounter_enable function).

CRs-fixed: 581430
Change-Id: Ic0dedbad277e796e6b2e7bd8e938cb8afe03207b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Restrict the maximum memory entries for bulk cache sync

Restrict the maximum number of memory entries that can be specified
to a single bulk cache sync call to PAGE_SIZE / sizeof(unsigned int)
so that the allocation can always fit within one page.

CRs-fixed: 578062
Change-Id: Ic0dedbad07e1986cd6ccc5b260ffef82b5adb6d3
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: avoid zero length scatterlist allocation

During sglist allocation we calculate sglen as
per below

sglen_alloc = PAGE_ALIGN(size) >> PAGE_SHIFT;

sglen_alloc can be zero if size falls within the
last page. For example, when size = 0xFFFF_FF7B,
PAGE_ALIGN(0xFFFF_FF7B) will be 0, considering
0x1000 (4kb) PAGE_SIZE. if kzalloc() with
zero size, it will return ZERO_SIZE_PTR which is
not NULL and we always do NULL check. Dereferencing
ZERO_SIZE_PTR will lead to a distinct access fault.

Conflicts:
	drivers/gpu/msm/kgsl_sharedmem.h

Change-Id: Ibcc6198438c13b5111be0faa736328db92511597
CRs-Fixed: 563106
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
msm: kgsl: Don't enable VBIF counters for targets that don't use them

Only targets with separate bus control need the VBIF counters enabled
by default.

Change-Id: I3a7fcedebf7a7cc80bc1bec5a7fd298b49b9b165
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: Prevent device start after it is already started

Check if device is already started in high priority workqueue thread,
this check prevents calling device start after it is already started,
thereby avoiding unpredictable behavior.

Change-Id: Iffcd065f8c02746d168c8e5779d10d4b0e2404a9
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>