msm_fb: Handle histogram IRQ cleanly during suspend/resume

Currently, if the histogram disable IOCTL comes after panel
is turned off, we early return the IOCTL causing the interrupt
to be left enabled. This causes IPC issues during suspend. Fix
this issue by properly enabling/disabling the histogram interrupt
during suspend/resume scenario.

Change-Id: I4d38776a43ea854aff3c10c8d9d5450af1d98c91
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: Release semaphore when display Unblank fails

When continuous splash is enabled, the display subsystem will be
turned on during first pan display after boot up. During this
process, we acquire a semaphore. Release the semaphore if display
init fails and the function has to return early.

CRs-fixed: 441973
Change-Id: I4c8ba0b5e7710a6f3d409be619d5014b3ee32e5b
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
video: msm: Do not use disable_irq in the spin_lock_irqsave context

Both mdp_isr() and mdp_histogram_disable() uses the same
spin lock mdp_spin_lock variable.  One core waits for disabling
mdp_isr after acquiring mdp_spin_lock and other core in mdp_isr()
waits for spin lock mdp_spin_lock and dead lock between two cores.

Change-Id: I73a10494ab78e92fc88a348aed4f526091b51f89
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
(cherry picked from commit 946ca6389b8f8c70b62a2f1ab4d81b475395f7d8)
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
video: msm: Clear previous histogram data on next startup

Clear the pointer to the userspace histogram struct when histogram is
started. Previously, when the histogram was stopped while a histogram read
was in progress, the pointer was not cleared, causing the next histogram
read to think that someone was already using the histogram.

CRs-Fixed: 361640
Change-Id: If09017149e98b35c49603372c554aa4c97f2de82
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit 19e4b71f617e307cacf0be077e08bec5c37df290)
video: msm: Enable mdp clock for histogram and histLUT

Enable the mdp clock for histogram and histogram LUT to ensure that the
clock remains enabled when they are being accessed.

Change-Id: Ic744f2ee96b64442f23ba19aa1c38552c0dad83a
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit e782ceab26e38590cd49a9bb273da1dbf1984ccd)
msm: display: reset vsync state when display is turned on

In the case that vsync ctrl is unbalanced, vsync IRQ is cleared
in suspend,  vsync cannot be enabled after resume.
Clear the status when display is turned on

CRs-fixed: 449155
Change-Id: I5ecf23053b60d1fbd91f042758d67d39c83ab444
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
sync: Fix race condition between merge and signal

The copied sync_pt was activated immediately. If the sync_pt was
signaled before the entire merge was completed, the new fence's pt_list
could be iterated over while it is still in the process of being
created.

Moving the the sync_pt_activate call for all new sync_pts to after both
the sync_fence_copy_pts and the sync_fence_merge_pts calls ensure that
the pt_list is complete and immutable before it can be reached from the
timeline's active list.

Signed-off-by: Erik Gilling <konkers@android.com>
sync: don't log wait timeouts when timeout = 0

Change-Id: If7542002e10da886af7e7cbc06a0abf023c15893
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
sync: fix timeout = 0 wait behavior

Change-Id: I8b9254e92c26d9f44abbc0c77fb44624de947013
Signed-off-by: Jamie Gennis <jgennis@google.com>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
base: genlock: Add new functions to get the fd

Add new API to get the file descriptor reference to a lock suitable for
sharing with other processes.

Change-Id: I1b61f44b6d5745a628eb98dfdc876767c46552ea
Signed-off-by: Alex Wong <waiw@codeaurora.org>
msm: mdp: Fix reserved field usage

An earlier commit(ec5b2f)increased the number of reserved fields
in the kernel standard fb.h header changing the struct size.
This caused issues with userland applications using the corresponding
bionic header. This patch revert the earlier increas in size
and makes corresponding adjustments to the reserved field usage.
A follow up patch will remove usage of reserved fields entirely.

Change-Id: Ibc2c00de71e5a6d2563a8a8a3e0916d15faef32b
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Arun Kumar K.R <akumarkr@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
msm: display: sync point clean up

Remove unused fence input in mdp_display_commit
structure
Use different timeline name for different fb

Change-Id: I4edd335b36dce057ff3e54302af6088a9cc470ec
Signed-off-by: Ken Zhang <kenz@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c