msm_fb: display: return fail if pipe still staged

Pipe is not un-staged from mixer when it is unset.
It expects a pan_display() to un-stage it out of mixer.
Return fail at overlay_set() if pipe was still stage
at mixer.

(cherry picked from commit 4fc9350b124ded06f90c43410c2c0b512681c0db)

Change-Id: I49f0ab340e1d3930fc8e279743e8749e6f0d5726
CRs-fixed: 399193, 393979
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: Handle vsync interrupt properly on MDP 3.03 targets

Handle enabling/disabling the vsync interrupt and mdp clock
enabling/disabling in a better way on MDP 3.03 targets. This
will avoid target crashes due to unclocked register access.

CRs-fixed: 388751
Change-Id: I5c4a409772464ce7d06869374dcba5ad7e335955
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: Return ioctl on vsync interrupt disable

Before the vsync interrupt gets disabled, initialize the completion
structure and then disable the interrupt. This enables the ioctl to
return successfully in all the cases.

Change-Id: I6a7c233f818a773d00497502213d1ecf8fe9dc24
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: Make Vsync IOCTL during disable sequence as NO WAIT

Change to make the vsync IOCTL no wait during the disable sequence.
This is to increase the performance. Handle the synchronization of
vsync interrupt using state variables in drivers from now.

Change-Id: Ia5ec14493f233a95f21d01ea627200a6c278239f
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: Return pan_display call on Vsync interrupt

Till now, the pan_display call returns on DMA_P_DONE interrupt.
For command mode panels, the DMA transfer starts only after the
DMA engine receives a TE signal from the panel. Hence, return
pan_display ioctl on vsync interrupt to improve performance.
We still wait if the previous DMA transfer is not finished at
the beginning of next pan_display.

Change-Id: Ie92bc000a5842aa02a77a08b6bafdc8472bbebbd
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp_dma.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Send vsync events using sysfs for MDP3 targets

Replace sending of vsync timestamp using uevents with sysfs entry
as uevent result in increase in power numbers due to broadcast in
nature.

Change-Id: I22cfbd68c8bcbe4a47e94074393f1cbf79920c58
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb : Add timeout while waiting for vsync event

Avoid eternal wait for vsync event when client tries to
read the corresponding sysfs entry. This will avoid hangs when
client tries to read in corner cases where the Timing
Generator or the clock or IRQ gets disabled.

CRs-fixed: 406752
Change-Id: I773687220b868823a9e4bfdae74361ee6487c5c6
Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dtv.c

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Create sysfs entries in mdp_probe for MDP4 targets

vsync sysfs entries should be created in mdp_probe instead of
creating in panel on. This avoids waiting for the first event
control in framework

Change-Id: I983731481ea89bb7666be5f2a9f75a1e04fd963f
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_dsi_cmd.c
	drivers/video/msm/mdp4_overlay_dtv.c
	drivers/video/msm/msm_fb.h

Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Create sysfs entries in mdp_probe for MDP3 targets

vsync sysfs entries should be created in mdp_probe instead of
creating in panel on. This avoids waiting for the first event
control in framework

Change-Id: I18b05b8d2a65d489afc6e3274ec8dc7a5b9a5f9a
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>