s2w/s2s/dt2w: Cleanup and re-implementation

* Thanks to Flar.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Print task name when fb_open fails

Certain process is trying to open the frame buffer node
when target shutdown is in progress. This process keeps
calling fb_open if request fails. Printing name of the process
helps to pinpoint it when user space log is not provided.

Change-Id: I83601d478113a7b8ee78c1ee0e79d91c11e59826
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: fix potential deadlock with ulps work thread

Do not check if the clocks are on when sending the ULPS event from
the worker thread. This check is not needed since the work is only
scheduled after the clocks are turned off and would be cancelled
anyway when the clocks are turned on if it is pending. Removing this
unnecessary check avoids acquiring a shared lock which can potentially
lead to a deadlock.

Change-Id: Ib9760221f044dded50a38a32b59d0158c2f6b50e
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit a31ee86c77b510893b321847ae4f8c81601a4390)
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Move splash thread functionality

framebuffer and overlay drivers are tightly coupled with
splash thread functionality. This adds lots of code
related to continuous splash screen handling in
both drivers. Moving them to separate file cleans up
both drivers and allows to handle continuous splash screen
cases efficiently.

CRs-fixed: 605934
Change-Id: Id89bb281dbbf22e726cf5fd97e93f891e5c73f60
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Fixup __ioctl_wait_idle() if ULPS is not enabled

This is how it ought to be and it's also easily readable this way.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Add missing BL lock around BL-related info

The bl_updated variable requires the BL lock. Otherwise, it can be
corrupted and cause backlight issues.

Change-Id: I55eb4b8d525765ede4f27a404f5c3f1f0b446719
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: control backlight level during blank and unblank events

Add code to set the backlight level to zero for blank event
and restore the backlight level to its previous value during
unblank event. This will fix any unexpected panel flicker
that might show up on the screen during panel ON sequence.

CRs-Fixed: 608091
Change-Id: I871a067b0cc40d893b8b7e5a25103ebb914f9b7a
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mdss: Dynamic timeout calculation for cmd stop

Time out condition was hard coded to 60 fps. If dynamic fps
feature was used, an invalid timeout might occur.

Change-Id: I0abe52416c10ef4ae0af6f541d22c66f6c8a6b5e
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: make the mdss debugfs implementation generic

Remove the core specific details in the debugfs implementation via
a defined debug interface.

Change-Id: I2bf9ac47e0121f1f269d8d82274143d760305526
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: disable MDP hw underflow recovery

When MDP underflows, hardware will automatically try to issue a reset to
recover from it. Potential issue has been identified when reset happens
on two video interfaces at the same time which may lead to a hw lockup.
To avoid such situations disable the hardware underflow recovery, MDP
will still automatically recover at the beginning of next frame.

Change-Id: I3473486e229e67f6213db83a0ecb34333a977d4f
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: allow assertive display on write back framebuffer

Reserve a mixer that supports AD to be used for write back and expose a
sysfs node for frame buffer devices which are able to support AD.

Change-Id: I0598a686d251444fc40bb8073ac50750036be7fe
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Fix debugfs string overwrite

If more than one display paths are active, like split display or external
mirroring, and stat debugfs node is read then debug data for only one
display is shown. Fix this by using correct offsets.

Change-Id: Ia8b36eb3105f6df8f096ff544b82cc49c9b31a48
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Initialize right mixer ROI for split control

This change initializes ROI of the right mixer on dual DSI panels
to its complete resolution. This will ensure that the right mixer
composes to its full resolution when partial update feature is not
enabled / applicable.

CRs-Fixed: 556185
Change-Id: I3c2f2b9a220dc223ef66475d6f6cbfc18c4a67db
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: enable fb_split feature for dual-dsi panels

Currently fb_split feature is limited to dual-pipe but single
interface, i.e eDP 2560x1600, panels. Extend use of this feature
to dual-dsi panels as well and by default enable equal split to
support dual-dsi portrait panels, i.e 1600x2560. Default settings
will be over-ridden by split settings from device tree if available.

Change-Id: I38279e1af7dcd1278fa203f51b8b33f82d0848af
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: check for fb node refcount before calling null commit

Add a frame buffer reference count check before calling
null commit to release the free list pipes. This avoids
unnecessary flickering on screen if a process tries to open
and close the fb node without performing any operation.

Change-Id: I96b824edccf27f0ddb796c420ef1feb49f65ddea
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: display: only release kickoff when no cleanup pipe

If there is some pipe to clean up, need wait for it be done to
make sure the pipe can be used for the second cycle and recover
mode can be executed.

Change-Id: Ifb3fdb152bc4bbf367b3d272aa0c88b1a0650c19
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Neti Ravi Kumar <ravineti@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>