msm: mdss: enable overfetch in dual pipe scenarios

Overfetch is disabled on the borders of videos to avoid picking up
padding which may result in greenish border on right and bottom. However
this has side effect for dual pipe cases where overfetch is required for
smooth scaling effect in the middle of image. Add a flag to catch these
cases and enable overfetching in the middle.

Change-Id: I2545dbdab2c0643986fefa85990e9e820e4c3611
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>

Conflicts:

	drivers/video/msm/mdss/mdss_mdp_pipe.c

Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
mdss: fb: Unblock blit ioctl calls when commit is occuring

Since BLIT calls have no effect on the frame being commited it
does not need to block in pan_idle.

Change-Id: Ic0cfa7c0c275ddc051b60ff8823fcd7299cb8b57
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Revert "msm: mdss:set brightness to min_bl if brightness is less than min_bl."

Backlight should not be limited to be above a minimum level in the
backlight scale function. Nor should it be limited for all backlight
drivers (should be implemented in the culprit panel's set_backlight func).

This reverts commit 2e5776fdb8acd50ad84752df0c6e0debf42cdf5d

Change-Id: Idcbf26eb3babb2a29964b9c7fb8e95aa31a8c5b8
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: fb: Copy & send unsigned value for notify update

Copy unsigned long from userspace and modify the data fields
before copying back unsigned long data to userspace. This
keeps the datatypes of all operands homogeneous without
data leaks from kernel to user space.

CRs-Fixed: 526286
Change-Id: Ie4673563170c3459019dd6a5f1f55376f6e560c7
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: mdss: fb: null check mfd data

Add appropriate null check for mfd data structure
before accessing it's members. This prevents null
pointer accesses in the driver.

Change-Id: Id301d4a90c9a52049944c7e3b31aa1a34ad292d7
CRs-Fixed: 526286
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: mdss: Add error handling in mdss_fb_no_update_notify_timer_cb

Return in case mfd is NULL to avoid NULL pointer dereference.

CRs-Fixed: 563125
Change-Id: I82415ed5f1f7b3d27796e9e3a0c96178aa54bdc5
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdp: Add retire fence

Generate the retire fence with a +1 offset from the current
release timeline. This would mean that the retire fence of the
last frame is signaled when the current frame has transferred.

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

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c
	include/linux/msm_mdp.h

Change-Id: I545d5d9defe300a90c7bf7b87d9e38f3ae680aba
mdss: Fix writeback

Fix retire fence threshold for writeback.
Notify when writeback buf is not available.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
mdss: Validate sync timeline object before inc

An earlier commit - 4b7db574f061e13857e3780ceddd24ab0681628b
removed this by mistake. Restore this check.

Bug: 10953656
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: create new vsync timeline for retire fences

Retire fence timeline should follow the actual panel vsync more closely.
In case of command mode the panel vsync can be different from buffer
release timeline. To handle the panel vsyncs better, create a new
timeline for the retire fence signaling.

Change-Id: If8a1eb717d733ca215275a8be4f0054091dbc147
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp.h
	drivers/video/msm/mdss/mdss_mdp_overlay.c
Revert "msm: mdss: create new vsync timeline for retire fences"

This reverts commit 190ceddf42436a04dd89fa936e3f43c9caa6bd7c.
Revert "mdss: Validate sync timeline object before inc"

This reverts commit 7f847702069df53b1edda85b64c230698ebdf9ce.
Revert "mdss: Fix writeback"

This reverts commit 31ef947ae5942add08e0fdef188390a97d74b698.
Revert "msm: mdp: Add retire fence"

This reverts commit dc5dd915f88934e7c0cf64e37a36398425003295.
msm: mdss: Remove additional clk refcnts in dual-dsi

When dual-dsi panel is attached to a device, both DSI controllers
are registered to mdss. But only one registration done notification
needs to be sent. Currently two notifications are sent and it leads
to an additional refcnt on mdp clocks which in turn prevents proper
suspend. Fix this by sending notification only once.

Change-Id: I29e3c92e9ab0cccd9314cc5428b4accc31b0d0d9
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Block postprocessing updates during DTM

When calibration tool requests the fb driver to enter in
Display Tuning Mode (DTM), PostProcessing blocks should
not update the HSIC, Memory color, Six Zone colors, etc.
Updating them during DTM conflicts the update from
calibration tool.

Change-Id: I11fcac57a651581d85e771911f83b2fdd9c3c681
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
msm: mdss: Returning NOTIFY_SUSPEND while polling NOTIFY_UPDATE

mdss_fb_update_notify does not return Suspend in NOTIFY_UPDATE
case. Daemon polls on NOTIFY_UPDATE but does not get Suspend
notification. Hence Daemon would not stop polling.

Suspend Case is added in UPDATE case.

Change-Id: Iaeaf819a6849acda2eb7eb78f0fc3306866d1b64
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: remove interruptible timeout waits

Currently display driver contexts are not utilizing interruptible
wake-ups while using wait_for_completion_interruptible_timeout. This
can lead to incorrect context wake-up and un-predictable outcome. Since
there is already a timeout attached to these kind of context sleeps, it
is safe to replace them with wait_for_completion_timeout.

Change-Id: Ia528debf34aef0acdda2bea1219a128c200c3651
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
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: call suspend and resume panel events during runtime triggers

Send a panel suspend/resume event to all the MDSS devices to ensure
proper handling of regulators and clocks during the suspend/resume
sequence.

Change-Id: I820f5e4113f599ba53d4fa4726e406f74872f95f
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>