Testing
Signed-off-by: renderbroken <zkennedy87@gmail.com>
msm: mdss: enable vsync event during continuous splash

Currently when continuous splash screen is enabled the vsync
event reports are delayed until first frame update. This blocks
boot animation. To fix this issue, after user space enables
vsync through vsync_ctrl, mdp driver will start sending vsync
events.

CRs-fixed: 567649
Change-Id: Ifb35e3479805e595d950ab7c38c26de201aa2d16
Signed-off-by: Ray Zhang <rayzhang@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_ctl.c
mdp3: Wait for proper vsync when updating display frame

This fixes an issue where we would report that dma is displaying
new frame, but in fact were really still displaying the old
frame.

Change-Id: I99dc89b2341481ea42f9cce451b9b2833dd1f700
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: Fix race condition for vsync irq enable/disable

Disable and enable of vsync happens in separate thread, which
may lead to a race condition where enable/disable may
happen at the same time and resulting irq in disable state.
Add lock to properly synchronize the enabling/disabling
of vsync interrupts to fix race condition.

Change-Id: Ib52bea5ca7a3612c866a4a962f09725a77e40563
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: set vsync clock rate

Vsync clock rate is not set when vsync clock is enabled.
This cause command mode TE logic not works.

Change-Id: Ibf7dd07e53b2cd76ef30f13133368000c79ae149
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
mdp3: Enable sw vsync when dma is not active

Recently in an attempt to enhance sync event reporting we
prevented sw vsync when dma is turned of from toggleing display
off and on.

Change-Id: I71c9be55d36dc92e513d9f5ead4d1e42157285c6
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: refactor command mode vsync control logic

Current logic is prone to corner case when mdss_mdp_remove_vsync_handler
is called twice: once from mdss_mdp_cmd_stop and again from vsync ctrl
logic. Need to properly identify the second call and avoid resetting the
rdptr ticks which prevent from clocks being turned off properly.

Change-Id: I9eeebd0c16e67a249508980427c81fa2e339edec
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: Turn off backlight while power off

Turn off the backlight while shut down panel as it
could show white flicker depending on the panel.

Change-Id: Ic5d4e97e70c87e5b6e956e27a766136610d6f345
Signed-off-by: Shuo Yan <shuoy@codeaurora.org>
msm: mdss: hdmi: Added gpio for ddc mux selection

Added a gpio for Display Data Channel (ddc) mux selection.

Signed-off-by: Zohaib Alam <zalam@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: hdcp encryption enablement

For hdmi as primary case, enable encryption after
hdcp authentication passes. That is to avoid black
screen before authentication finishes.

Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: turn on DDC when turn on hdmi

When HDMI is primary and at display timeout, DDC is turned off.
When resume, there is no hpd interrupt, need turn on DDC
for HDCP and EDID when turning on HDMI.

Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: hdmi: wait for power off

Fast plug out/in of HDMI cable may result in race condition
between power on and off of HDMI tx core when downstream device
or bridge device is connected. Wait for power off to complete,
if already underway, before power on.

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Initialize kernel space stack variables

This change initializes kernel space stack variables
that are passed between kernel space and user space
using ioctls.
Non initialization of these variables may lead to
leakage of memory values from the kernel stack to
user space.

PS2-3: Correct authorship and date.

Change-Id: I5b45f3a7baf9c538fee2ec356cd8545f8b042b5e
CRs-fixed: 556771,563420
Signed-off-by: Deepak Verma <dverma@codeaurora.org>
msm: mdss: fix race condition between shutdown thread and fb ioctl

Currently all entires into fb driver are synchronized with shutdown
context except fb ioctl context. fb ioctl is an asynchronous entry to
fb driver which can be called simultaneously from two different user
processes. Synchronize these fb ioctls and shutdown context to prevent
race condition.

Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: fix sync fence deadlock when rotator is used

In the current implementation, whenever rotator play is called, it
forces DMA pipes to be released by calling commit on video mode ctl
paths if they are using DMA pipes. Here assumption was that DMA pipes
will either be used in block mode or line mode, all or none. But this
assumption is not valid any more where we can have a use-case where
DMA0 is used for rotator and DMA1 for video mode ctl path. In this
use-case, current implementation can lead to sync fence deadlock. Fix
this by removing obsolete assumption.

Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Validate userspace buffer count

Makesure the number of buffers count is less than
the maximum limit to avoid structure overflow errors.

Signed-off-by: Pachika, Vikas Reddy <vpachi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Validate userspace buffer count before using it

Validate the number of buffers count variable before
using it to avoid structure overflow error.

Signed-off-by: Pachika, Vikas Reddy <vpachi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Return suspend without delay in NOTIFY UPDATE

NOTIFY_UPDATE returns Suspend after 4 seconds delay.
Delay would cause HISTOGRAM_STOP ioctl to be called late.

Return suspend case without setting timer for no delay.

Change-Id: I356086de96cab85cd203bf1ad529ecf0b3bbfce3
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: Add update notify for backlight change in static screen

Previously, the change of backlight sysfs node value will not trigger
notify updates if display is in static screen case. This will cause
delay or wrong configuration for assertive display. This patch fixes
the above issue by adding an update notify if backlight changes when
there are no display updates.

Change-Id: I1475896214a50dc1fa71739aa751b2e626d27adb
Signed-off-by: Ping Li <quicpingli@codeaurora.org>