video: msm: Adding CSC support for other MDP blocks

Adding support for VG1, VG2, DMA_S and Overlay Mixer 1.

Change-Id: I95a5832a70fd893970e82dadcec1e11ed608d79c
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit fa1de67dbadc084aa9fd6afa5ab4fae335089334)

Conflicts:

	drivers/video/msm/mdp4.h
	drivers/video/msm/mdp4_overlay.c
video: msm: Add Histogram collection framework for MDP blocks

This change expands the previous histogram collection implementation to
support the addition of other MDP blocks that allow for histogram data
collection. The VG1, VG2, DMA-P, and DMA-S histograms are supported using
this new framework (VG pipes only supplying the histogram of luminance).

Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit 1699cf46cae2a3766c1e1e40071f8e343787c40d)

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp4.h
	drivers/video/msm/mdp4_overlay_dsi_video.c

Change-Id: I7868d4e524a6d9c46ab9ca5f97a87e2c8ac02710
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp.c
	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
msm_fb: display: Use FIR (QSEED) for upscaling.

Low resolution UI is observed on HDTV connected with HDMI.
FIR (QSEED) algorithm needs to be used instead of pixel
repetition to improve the performance in case the BYPASS
composition is not used.

CRs-fixed: 332123
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit 4c7ccb31068e6b606520722279fc8add740d7578)

Change-Id: Ib7983ccddb6655a5829f92817881606aac6b633b
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm_fb: display: Add IOMMU support to MDP and rotator driver

Add IOMMU support to MDP and rotator driver for operating with
virtual addresses instead of physical addresses

Change-Id: Ia5afcf33220e0e75e92948649c2bd4d7ef32917d
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>

Conflicts:

	drivers/char/msm_rotator.c
	drivers/video/msm/mdp4.h
	drivers/video/msm/mdp4_overlay_atv.c
	drivers/video/msm/mdp4_overlay_dsi_video.c
	drivers/video/msm/mdp4_overlay_lcdc.c
	drivers/video/msm/mdp_dma.c
	drivers/video/msm/msm_fb.c
msm_fb: Provide IOCTL to configure QSEED tables

Provide sub-operation for MSMFB_MDP_PP IOCTL to configure QSEED tables.
QSEED is used for smoothing, sharpening and scaling of content on video
pipes in MDP.

CRs-Fixed: 351256
Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
(cherry picked from commit 67726da111c4e6e10d21a3759f9f96ae0fefb2c2)

Change-Id: Ic79ed8b8cf3ea945c6f00ebbdf9d3a7886bcd3c0
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm_fb: display: HDMI power reduction at suspend

During suspend, HDMI clocks are still running and power
consumption is high. Usually HPD module is kept on even
when the cable is not connected to sense the cable
re-connect. But cable connect sense is not required when
the device is suspended. This change makes sure that HPD,
along with other HDMI modules, are totally shutdown during
suspend and there is no power consumption by HDMI.

(cherry picked from commit 88ad8a7be06a86104169cf2739c18c7d4409dde6)

Change-Id: I535645fb489cb89c5450f9caa2ba1823190c7456
CRs-fixed: 335821
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>

Conflicts:

	drivers/video/msm/hdmi_msm.c
vidc: Memset only for non secure session.

The buffers are memset only if its a non secure
session.

Change-Id: I9b374d4a46ffdd37147e4888fe81c9a7ff7c59aa
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>

Conflicts:

	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_helper.c
msm_fb: hdmi: HDMI high sleep current

High current is observed during sleep. HDMI PHY needs
to be reset before going into sleep.

CRs-fixed: 336972
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit 56dfb682a5bf274842140716333c791d010e38ef)

Change-Id: Icd6d98db6848993e8b3f554d7f86843a483dcd6c
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm_fb: display: fix dsi_irq race condition

There has race condition that mipi_dsi_disable_irq_nosync() is
called from isr context at one core while mipi_dsi_irq_enable()
is called from thread context at other core. Serialize
mipi_dsi_disable_irq_nosync() with mipi_dsi_irq_enable() by
putting mipi_dsi_disable_irq_nosync() inside scope of
spin_lock(&dsi_mdp_lock).

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

Change-Id: Id8f857608c34848400b237d43886affb03204079
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>

Conflicts:

	drivers/video/msm/mipi_dsi_host.c
msm_fb: display: fix underrun when conecting wifi display

When connecting wifi display underrun can happen if there is no frame
update in other mixers before pipe in mixer2 is staged up. Add logic to
make sure that any pipes that are going to be staged up to mixer2 are
staged down from other mixers first.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit 8d3b0fce866e5f05f18a47bc0cd8f60356dbeb23)

Change-Id: Ia008936e81af9d6ef9fb9050244746e8a7cd1e33
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: vidc: Remove vcd restriction of duplicate input buffer queue

VCD previously had a limitation of not allowing two consecutive
encode_frame calls with the same buffer. This was primarily due to the
handling of buffer_entry elements in the buffer pool.  This commit
removes this restriction by maintaining an internal buffer_entry element
that VCD keep track of.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
(cherry picked from commit 794a9dd1b5c22492ef2ad76e49073c0bc0a2b8f9)

Change-Id: Iadbcae197f4627218440bdf300e43e04e888eaaf
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: vidc: Remove memcpy of sequence header

In secure sessions, we aren't allowed write into secure buffers.  In
these cases, do not copy the sequence header from the internal buffer
into the output buffer. The firmware will prepend the sequence header to
the first I-frame in these cases.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
(cherry picked from commit e39bcd97987388e7e1877efcc895e21c16f27255)

Change-Id: Iafffd9222ed6f96e87f770a280cd84512cd308ed
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: display: increase wfd resolution to 1080p

Wi-fi display can support upto 1080p resolution.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
(cherry picked from commit fa961df92f9d89df20081000f4d451b38ba502f1)

Change-Id: Ib4096165841da2e3e30be7f1511c97dd3b2937cc
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: vidc: Handling secure/non-secure concurrency.

Change-Id: Ief0e56615872b109b9d56fc55d2dc28707c90862
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>

Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>

Conflicts:

	drivers/media/video/msm/wfd/enc-subdev.c
	drivers/media/video/msm/wfd/enc-subdev.h
	drivers/media/video/msm/wfd/wfd-ioctl.c
msm: vidc: Fixes bug in secure enc/dec concurrency

Fixes bug while closing the session when both
secure encoder and secure decoder are running.

Change-Id: I61f72bf13282bed1547fbdad0a3e3aa515e9951c
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>

Conflicts:

	drivers/video/msm/vidc/common/vcd/vcd_api.c
msm:vidc: update default output buffer requirement

Updated the default output buffer requirement to
match worst case requirements. With this change
reconfig will trigger only if the actual buffer
requirement is less than the estimated requirement.

CRs-fixed: 343812
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
(cherry picked from commit 50f02e2345b8a7503c85696b35c2490b3fc53fb0)

Change-Id: I291333003ff441e7734923b188be89a7944c3482
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: Display: Fix reference count for DSI clocks for DSI command mode.

For MIPI DSI command mode panels, clock enable for DSI clocks
is called more than needed. Fix the reference count for these
clocks to turn off the clocks  during suspend state.

CRs-fixed: 339125
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
(cherry picked from commit 3ef84a5ab70bbd65799dbf72b3375b0bc764140d)

Change-Id: I1e64c334087604a341541370f18b7e2027a85c96
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm_fb: HDMI: Disable HDCP interrupts when starting deauthentication

All HDCP interrupts should be disabled at the beginning of HDCP
deauthentication process so that we do not process any redundant
HDCP failure interrupts while deauthentication is underway.

Change-Id: Ib5149460446b6073122a8249807918d5ad06492c
CRs-Fixed: 341921
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit 4f1467897549d41d9dc21886e7bf77bef2a43539)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: vidc: Fixes a bug in firmware download.

Fixes a bug in firmware download for secure
playback.

Change-Id: Ie93361c508f350363ec01f1c807859b6feec0618
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Revert "video: msm: Add Histogram collection framework for MDP blocks"

This reverts commit 28e18c26e2f9c0f0837aaeeb49dd5063eb69148c.