video: msm: Allow DSI commands to timeout

 * Occasionally the power-off command will timeout even though the panel
   actually powers off. Call wait_for_completion with a timeout instead
   so we don't lock up.

Change-Id: I61f584371e7bb09eac654e1f6cadee5bc7b6e7f9
Define timeout.
msm_fb: display: Allow vsync_show_event to timeout

 * Add timout in case vsync interrupt is missed to prevent hang.

Change-Id: I4b615817cc3bab4cb0a5ba1b5da3eb630811bfa0
msm_fb: display: Make sysfs read request interruptible

Change blocking sysfs read request to be interruptible and protect
vsync timestamp value to prevent corruption.

Change-Id: I510d84134b0ab70d17729e8c53c91fa926035142
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
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.

CRs-fixed: 399193, 393979
Change-Id: I562f6e133bb239b30f4f53669dbf1cc5ddf80d02
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: extend mutex protection for mdp pan display

When mdp commits a buffer to play, functions inside pan display, e.g.
mdp4_overlay_mdp_perf_upd are based on the current state of play, so
extending mutex to the scope of pan display to avoid race conditions.

Change-Id: I2e55567fd21de3738be066a2dee298d8122f12a3
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
Fix compile error.
msm_fb: display: check pipes queued before enter wait_for_completion

Timing generator will not be turned on if there are no pipes queued.
Therefore wait_for_completion may never be completed if there have
no pipes queued.

Change-Id: Iafba086e4ba20b31470c9fd385c4f5c474ecadcf
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
video: msm: Reset MDP clock/bw rates during panel on

 * These need to be reset so that the correct rate is calculated on
   wakeup. Without this, underrun will occur.
 * Via Samsung's JB code drop.

Change-Id: I02ab8a220db442c35eb5838ab6a986467d0f44ad
msm_fb: display: wake up system around vsync

To avoid frame drops due to power collapse,
wake up cpu right before vsync.

(cherry picked from commit 37e723cfad97be59d5a28e59220f9dcafe24ce32)

Change-Id: I678071a1f642d96b4a6de2c40c155b156ce7ee61
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
msm: event_timer: Support to add event timers.

Add support to allow drivers to specify future events
that need to be treated as hard deadlines. Upon event timer
expiry the driver will be notified by callback function
that the driver provides.
The pm code can query the earliest event and modify
the event timer accounting for the back off based on the
latency of the low power mode being entered.

Change-Id: Iec26f77de3b826bff456b12f3230268d9bdc2255
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/Kconfig