msm: mdss: turn off the DSI PHY when powering down the panel

The DSI PHY needs to be powered down to avoid power leakage.

Change-Id: Ideb97293444e8ed4b99ddf2c30a1669bb9237c9c
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: turn off DSI PHY DCDC regulator on 8x10

DSI PHY includes 3 macros: PHY, PLL and DCDC regulator.
Make sure DCDC regulator is turned off to avoid current
leakage.

Change-Id: I544f4537b42254a941adc3b76c02489f6d2751e6
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: parse the DSI command mode panel properties

Add the support to parse the device tree properites for DSI command
mode panels.

Change-Id: I313296531acba23de5fa0d13fa74c5f615ecbdb3
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
mdss: ppp: add sync point to ppp, allowing for async ppp blit

It is a requirement that PPP be async and should use sync points
and fences to wait for buffers and communicate that it is done
using release fence

Change-Id: I35663737dd4bd4a52bb12b2a31ed06f3d5a69f31
Signed-off-by: Terence Hampson <thampson@codeaurora.org>

Conflicts:
	include/linux/msm_mdp.h
msm: mdss: disable irq when display is off on 8x10

Enable the irq when the display is on, and disable it
when the display is off.

Change-Id: Ib164537dd5175cdf5a1779a62c4861bda2647e35
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: cleanup MDP interrupt handling logic

Simplify MDP vsync and dma done interrupt handling logic.

Change-Id: Ieac19ce4c6efc42c6005b2c0cab97be8a67ad263
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
mdss: display: add mdp core clock to dsi clock control

Since mdss interrupts are generated in mdp core clock domain,
mdp clock need to be enabled to have dsi interrupt be delivered
during dsi dcs command send and receive. Request of bus bandwidth
also needed to allow dsi controller to fetch dcs commands over
AXI bus.

CRs-fixed: 516172
Change-Id: I6e10cc5a193c9eb06803637e0432ec72f069377b
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: mdss: Restrict SMP buffer reservation

Given two line latency buffer requirement for performance, in
some cases, three or more SMP blocks get reserved. This happens
typically for the usecases involving higher resolution layers
(e.g. 1080P). For these usecases required number of SMP blocks
exceed total number of SMP blocks available, thus causing SMP
reservation failures. These failures are often encountered in
8x26 target as it has in total, only seven SMP blocks available.

Restrict SMP buffer reservation to two SMP blocks, based on an
optionable device tree property, to be able to support most of
the usecases. This restriction is not applicable to horizontal
flip cases where two line latency buffer reservation is
necessary.

Change-Id: I7d57568b4b2710df0142bbc16749e56a9b492dfe
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Add support for additional pipes of apq8084 MDSS

APQ8084 MDSS has 2 extra pipes compare to MDSS of msm8974. This change
adds support for programming these new pipes and corresponding mixer and
control pipeline changes.

Change-Id: I1406263de703719661789d2f8c6f7c06fc810919
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
mdss: Reduce minimum ib bandwidth

The minimum mdp ib for usecases such as portrait video is
high, causing unnecessary power increase, so it is reduced to a
optimal value for the purpose of both power saving and reducing
chances of underruns.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: change MDP writeback priority

Default priority for writeback is set to lowest, which can lead to other
clients' requests to come before MDP writeback. Change the priority to
P1 to match the rotator fetch QoS settings.

Change-Id: Ia703d1688581a0811502ce00863d1c973d53e749
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Enforce interlaced format w,h alignment

Interlaced formats need to be aligned to multiples of 4 to mainitain
evenness as hardware expects an even source rectangle. Moreover
interlace only works on half of the source rectangle.

Change-Id: I0eb920be87a9b76c6da18fd19566eb5dd090d737
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Avoid enabling both decimation and BWC

Hardware doesn't support BWC decompression and decimation on the
same pipe.

Change-Id: Ie1aa60b104fdab0151def9c0dcd185f7cae7f29a
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Return src format changes during overlay set

Src format changes in overlay due to BWC need to be reflected in
userspace to facilitate proper allocation of input buffer.

Change-Id: I49a5aee97deb26f14b365a093095c47e6dd00fc5
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Support planar output format for rotator

For high end targets planar format as output from the rotator
can be supported as there are more SMP blocks available relatively.
Also, this gives HAL flexibility with the output buffer as currently
its always defaulted to Psuedo Planar.

Change-Id: I0428ea2a227bf73bc4eada0d2533520799321195
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Avoid null pointer dereferences

Null check on mfd param in overlay api needs to be performed
to avoid kernel panic.

CRs-fixed: 498973
Change-Id: If37284ab83bc678714fd8eed20f6adcb689846fa
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: free framebuffer pipes on suspend

When going to suspend, need to clear the frame buffer pipes allocated
since these were allocated by driver. These will get reallocated
automatically on resume.

Change-Id: I3c5697277edfc8f976a0720f5f94f10314f5ebe6
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Reset hardware cursor flag on suspend

Reset hardware cursor enable flag while going
to suspend as cursor address doesn't remain
valid after iommu detaching which create
iommu page fault after resume.

Change-Id: I2fd484de72b62f39cdeaee025995afc975b3ba6e
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: release process resources on fb close

Track overlays/rotator sessions created for each process and make sure
these are released during fb close. This can handle cases where crash
happens on a process that owns the resources, but panel wouldn't be
blanked due to other process still holding a reference to fb.

CRs-Fixed: 511804
Change-Id: Ib3b8b57c871f91c59e1bef36cd94b7d957185050
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
msm: mdss: modify watermark levels when horizontal flip is present

When horizontal flip is present on a particular pipe, one line out of
the shared memory pool is reserved for consuming the line in reverse
direction. When this happens the consumed line does not account in the
watermark threshold and hence the priority levels being programmed would
be based on the remaining memory in which buffer contents are being
fetched. In order to have proper priority mappings, update the watermark
levels to account for this behavior

Change-Id: I80cebccf0083b2e9edcf3bf73818fde160ef9c63
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>