msm: mdss: Flush pending clk work before set ctx variable to 0
msm: mdss: Move histogram completion initialization to pp_init

The histogram completion structure only needs to be initialized fully
once, and this can be done when the pp resource structure is created.
Otherwise, when enabling the histograms, it is sufficient to use the
reusable INIT_COMPLETION, in order to avoid any wait_queue errors.

Change-Id: Id4bfb19c91bd5ab07c01a5eb347ba50621fe8a97
Signed-off-by: Benet Clark <benetc@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pp.c
msm: mdss: Move histogram disable complete_all after intr disable

Previously, complete_all was called during histogram disablement before
the histogram interrupts were disabled, which can lead to issues if an
interrupt comes in between complete_all and interrupt disablement. Now
complete_all is called afterwards, which guarantees no more interrupts
will come.

Change-Id: I831a01ce8433470b337a42a644d98ab5807fdbd7
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Fix locking errors in histogram disable

There is a histogram variable that was missing the spinlock while it
was being read. It has been added.

Change-Id: I5f6d4246332a84c6a4cb3503ad7bbfaddb4a0fa8
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Fix locking errors in histogram setup

There is a check on histogram enable in histogram setup that was not
protected by the spinlock. It has been added.

Change-Id: I769422c803bb12de2030115a08d60ad7c7f38f15
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Fix locking error in histogram enable

There was a missing spinlock around the histogram enable which is
necessary. It has been added.

Change-Id: I0c06406682234134260281870b755ed559d34b9e
Signed-off-by: Benet Clark <benetc@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pp.c
msm: mdss: Add missing locks in histogram collection for collect enable

The histogram state and collect enable need a spinlock around them when
being read or written to. There were a couple places where the spinlock
wasn't held when the values were being checked. The number of spinlock
accesses has been reduced in collection as well.

Change-Id: I2f7c200c436ec5e062ba11a8208f88af89b25e2d
Signed-off-by: Benet Clark <benetc@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pp.c
msm: mdss: set pipe to solid fill when releasing it

There are cases where pipe can remain active for additional vsync after
unstaging from mixer, if this ever happens it will keep fetching from
memory. In order to avoid this, we can setup the pipe in solid fill mode
so there is no memory access after pipe is released by software and
avoid potential iommu page fault or underrun since pipe is no longer
considered for bandwidth calculations.

Change-Id: I4b5a5deda8c854c504ef523df434509fa5567186
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
mdss: Notify userspace of changes to blank status

Allow userspace to poll on the blank event to avoid triggering
unnecessary updates, such as when shutting down the device.

CRs-Fixed: 627814
Change-Id: I36bb7845edba14ba0b0ddbe43eaf3d386af2d5f1
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
mdss: Add newline to VSYNC timestamp

This makes sure that the userspace correctly interprets the end
of the vsync timestamp.

Change-Id: I66f9939658b6fb7531468429c1ca3e551a4a285c
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>