msm_fb: display: perform data flush for each data path separately

Performing data flush on stage commit causes some frame updates to be
missed waiting for stage commit, this can lead to old data being
overwritten while it's being displayed causing visible corruption.
Change flush to happen on each frame update to corruptions.

CRs-Fixed: 341262
Change-Id: If91800068d2bfd5a2e43fe3e2a96c457e173763d
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit b55ba7924350f847b3ca9abf1c7c0c3fd9146b98)
(cherry picked from commit c14e2c43c169285ad5a51a806b420e2bfd52a356)
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_fb: display: call mdp_pipe_ctrl() with correct block name

Mdp_pipe_ctrl() needs to be called symmetrically within same
block name for both ON and OFF operation so that mdp clock will
be turned off after OFF operation.

CRs-fixed: 338802
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
(cherry picked from commit 8d19d0d22e03dba3b2b08356bc18ed1b2987e70c)

Change-Id: I3b8931bece932e7644abba0ca0ef5b8fe617ff57
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Don't control rot_axi_clk explicitly

It is now controlled implicitly along with the rotator core clock
for all SoCs.

Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: add check for buffers boundaries

check that offset is within the range of buffer to avoid possible
access to other memory regions.

Change-Id: I37f49b0c95cc9bf79a09c7b0fa04f1135b691a5d
CRs-Fixed: 308058
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: fix the rotation issue on 8960 V2

8960 V2 contains different version from V1, until we
have the proper soc check in the board file to modify
the rotator device version disabling the check in the
rotator driver. It won't have any side effects.

Signed-off-by: Nagamalleswararao Ganji <nganji@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: ion support in rotator driver

Add support for ion memory heaps in the rotator
driver

Change-Id: Id844050871e4aaa7fa0e0fc9d69646d6d9875b85
Signed-off-by: Nagamalleswararao Ganji <nganji@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Replace clk_set_min_rate() with clk_set_rate()

The rotator driver requests exact rates.  There is no need to call
the clk_set_min_rate() API, which will soon be removed altogether.
Call clk_set_rate() instead.

Change-Id: Ica9cb30f85132e92a00b0000eea498c47645b697
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: add downscale support in rotator

Rotator is capable of performing 1/2, 1/4 and 1/8 down scaling. Add
downscale_ratio parameter to provide support for this feature.

CRs-Fixed: 315874
Change-Id: I57dc3456ccc9bec2a125750b3e9909ffcbaf45f6
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Fix rotator YCrCb planar formats unexpected output

Rotator expects planar input in YCbCr order, wrong color can be seen
on ouput image when given YCrCb because the chromninance planes picked
are not correct. Swap Cb and Cr plane addresses to output correct image.

Change-Id: Ia05ab704d18da4aac49e63fb805c40a95ea51a33
CRs-Fixed: 327956
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Add bus scaling support

Add bus scaling support to rotator driver

Change-Id: I53faf6070a9dc6d6359b6d58cb7cb618217ee8c0
Signed-off-by: Nagamalleswararao Ganji <nganji@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Add pseudo-planar output for interleaved format.

Rotator gives pseudo-planar H2V1 output for interleaved
H2V1 input format.

Change-Id: I2a7af3243dfb1175ea14d6649b4cec87029fec38
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
(cherry picked from commit 732dcd668ffa9c2160fca0c34d21107be7a37cda)
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_fb: display: decrease file->f_count when play

Frame buffer's (fb0) f_count needed to be decreased after both
overlay play and rotation so that fb0 can be closed and display
will be blanked out after system suspended.

CRs-fixed: 336254
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
(cherry picked from commit beaa9356713db6949eefa32ed329bf87a3461842)

Change-Id: Ibaeb537bffedc473b6ce49531385aed3b791710d
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: provide dst format based on src format

Some rotator output formats differ from input, these mappings used to be
handled in userspace, but to avoid issues this is now done in driver.

CRs-fixed: 339114,337040
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit fd81fe0e21ae87f38d7afcf4bb8ce7d5ca8101ff)

Change-Id: I7b7f36d97d3bb2fb04e89d57b8f11e8aa65b18c1
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Add rotator hardware version check for YCrCb planar inputs

For YCrCb planar inputs chrominance order is dependent on rotator hardware
version. Add hardware check to swap Cb and Cr for 7x30 and 8x60 rotators.

CRs-fixed: 339114,337040
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
(cherry picked from commit befc1d5dbb5fd0698faad15ef57180f670533f0e)

Change-Id: I0930143a2d78ae45e3e9bbf80ed533286d28fb7f
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_rotator: add rotator ref count to cleanup code

Perform cleanup of rotator sessions only if reference count reaches 0,
this avoids closing rotator sessions from sibling threads.

Change-Id: I83add90cc04faa90c372dde09a096c7a07be528a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit cea80ac8448ded8bbba56f1eb219857526270874)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: update user session parameters for all rotator start calls

Session parameters hold the dst format of rotator output, this is
currently passed to userspace only on new session, if session is reused
with different format session not updated and can cause incorrect
display output configuration.

CRs-Fixed: 349903
Change-Id: I5dd3f277b0d5fac145c805f4898c799ef4fb1b94
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit c56399542e5a015f2f10cdc443365167a5f17f2a)
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: rotator: Call S/W reset on AXI bus error interrupts

Call Rotator S/W Reset when AXI bus error interrupts are
seen during a rotate request

CRs-fixed: 341947
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
(cherry picked from commit 30cf3eba95df9c6bf90f77b7f4ce40307d106e5d)

Change-Id: I4e0cd0b58fcf6a54301b875925354f8648cec5fb
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_fb: display: fix hdmi connection crash on 8660

Crash happens because RGB pipe is not completely setup when initializing
the base layer pipe. HDMI crash no longer happens after initializing RGB
pipe correctly.

Change-Id: Iff2e989db95b86fd81afc7e04d12d3d8f099acd7
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_fb: display: flush base layer pipe when solid fill is enabled

Need to flush bgpipe with solid fill format to avoid fetching from
bg pipe when its contents are not displayed. Also add other missing
flushes.

CRs-Fixed: 342961

(cherry picked from commit 49d80c675077701580b65edaa4839ae04cbda37e)

Conflicts:

	drivers/video/msm/mdp4_overlay_dtv.c

Change-Id: I3d03330b04cd506c1129785c6811488ea8857e3f
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm_fb: display: initialize is_flag variable

This local variable needs to have init value, otherwize it is always
true, possible for mdp4_overlay_perf_level to return incorrect value.

CRs-fixed: 338543
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit e5c9f6e5f9fe550e228cc5b34dbde086b151a613)

Change-Id: Ie8d93808f7f07b6606bbf421dd57a58b7ed50142
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>