mdss: mdp3: Validate input from userspace

Fully verify that the values from client are safe to use.

Change-Id: I73d6839f5bccd53b8bc2d812dc7673b13735299c
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
mdss: Remove lock from vsync control

The lock protecting the vsync control ioctl is not needed since
the vsync control should take effect immediately and be
asynchronous to the display updates.

Change-Id: I5068246488b7fefec9e11e8422bacbe7489c827f
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: Store AD backlight notification function

Store Assertive Display backlight notification function while locked to
prevent race condition where AD is disabled while lock is released,
setting function pointer to NULL.

Change-Id: I7996a29595854ed8e50d0fff663a779c3ccd388f
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Update screen resolution for Assertive Display

Apply the latest screen resolution to AD hardware so that banding
artifacts are not generated.

Change-Id: I5df8a3de4551c5e45e0e8ff2b21b60549b479788
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Fix possible buffer overflow in ppp

Correct the limit check for the buffer format and avoid the
possible buffer overflow.

CRs-Fixed: 542730
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
Change-Id: I78f86cf8e7dcd0b3f4e124fbbf70353796583a47
msm: mdss: access copy of userspace buf only

Copy buffer data from userspace and access only the
pointer to buffer in kernel memory. Copy back this data
back to user space memory once the operation is completed.
This prevents accessing user space virtual address from
driver.

Change-Id: I319bf08055cdf914803c4a35c5a607f92017d9a0
CRs-Fixed: 520129
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
mdss: display: remove the pwm gpio request from edp backlight

There is no use of the pwm gpio inside the driver so cleaning up the code
and removing it from devicetree.

Change-Id: I72c038f3082aa6ed18ea9142de75faecc1e1e0fd
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
mdss: display: making lpg channel and pwm period as optional

These properties need to be optional and used only when having an embedded
DP monitor, i.e. eDP.

When using the eDP driver with external DP monitor there is no need to
configure the fields for the external backlight since it is done by the
monitor itself.

Change-Id: If1010e99c82e276991f30055140118aba29b0ecd
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
msm: mdss: Revert changes for separating out PP flushes from commits

MDP flush behavior on MSM8974 needs to have single flush in given vsync
cycle, more than one flushes in same vsync cycle can cause unexpected
behavior such as blank screens, incorrect frame updates on LCD or some
visual artifacts. Currently post processing and frame updates have
independent flush mechanisms which in certain cases can cause visual
artifacts or blank screen. So revert changes to independently flush
MDP registers so that post processing piggybacks on flushes for frame
updates.

CRs-Fixed: 494856
Change-Id: Iaa0f6f123487f57abb1b56f7d0946fa3abfe3058
Signed-off-by: Ping Li <quicpingli@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_overlay.c
defconfig: Disable modules whitelist

Change-Id: I8c975d2fe7e58ea54245f395d08d3d965b8fcabe
Debug: This helps debug iommu issue inside mdp ppp.

Print out registers and current buffer start address
with length mapped, when ppp pagefault issue occurs.
Also force kernel panic to be able to retrieve table
from ram dumps.

Change-Id: I94bf1007fc951fbcd30d1c4e464bd6c07fde4905
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: Validate mixer/ctl are not null

mdss_mdp_wb_mixer_destroy could theoretically be
called with null mixer or ctl, which would cause
a null pointer dereference. Adding a check to
prevent this from happening.

Change-Id: I376c449daf05c8ca4ebb789d402575598ee59d86
CRs-Fixed: 551787
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
msm: mdss: Account for null ctl passed to line count

Line count could be passed a null ctl structure,
which would cause a kernel panic. To prevent this,
line count will just return 0 if a null parameter
is passed.

Change-Id: I2b52533e6b67b842542de5b81be5b43fccc364dc
CRs-Fixed: 551701
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
msm: mdss: hdmi: Security check for EDID 3D data parsing

While parsing EDID (Extended display identification data) received
from TV for 3D data and other, proper buffer overflow check is done
to avoid data overflow or overwrite.
Also, replace snprintf with scnprintf for better memory copy results.

CRs-Fixed: 542823
Change-Id: I2603beea6eb88a92b013a1a45d960a4c3ba6c09b
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: hdmi: Proper CEC line busy check

Checks the CEC (Consumer Electronics Control) line for availability
properly so that in case of line being busy it can send re-try
request.

CRs-Fixed: 552367
Change-Id: I75dae23738d791de9a75b78a14e62cd3c40fa2c4
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: hdmi: Proper permissions for CEC logical address

Do not give universal access to CEC (Consumer Electronics Control)
sysfs nodes for logical and physical addresses to avoid unauthorized
access.

CRs-Fixed: 547968
Change-Id: I2ba57f050cc92a361586064dfd5e5659ab07c2f7
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
msm: mdss: Make mdp sync point generic to use

Currently mdp sync point supports buf sync ioctl for
normal mdp overlay operation. So making it more generic
such that it can be used for rotator also.

Change-Id: I04c5f29a5259238ef1de26f6e801269b89cf5fed
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
	drivers/video/msm/mdss/mdss_mdp_overlay.c
prima: fix error MAX_CFG_INI_ITEMS too small, must be at least 336

Change-Id: Ic9d4b5462544a31c550cb533e35505fb0daead06
msm: mdss: Add rotator sync point support in mdss

Currently rotation activities are blocking and hence hurt
the performance. So, make the calls asynchronous and use
sync point to realize this.

Change-Id: I677097fcaf133b0ed67ae94cfeacf3a0a10bc579
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
mdss: ppp: Reset parameters passed into mdp3_start_ppp

mdp3_start_ppp is manipulating some of the parameters passed in.
Within a sw workaround to a hw issue, a blit request can be broken
down and create a need for multiple calls to mdp3_start_ppp. When
this happens, the parameters passed in will be modified and a
snowball effect takes place. To fix this issue we simply reset
parameters before next call to mdp3_start_ppp.

Change-Id: I29888b5f2f07391d3502ae1478068d7bf12805c3
Signed-off-by: Terence Hampson <thampson@codeaurora.org>