msm: mdss: Notify userspace of idle screen case

Expose two new sysfs nodes - idle_time and idle_notify - that
are used to notify userspace whenever the display is idle with
no screen updates. The idle_time node needs to be configured
with the duration in milliseconds to detect no screen updates.
The userspace app can poll on the idle_notify node to get
notifications of the idle state.

Change-Id: I7435a084ad2c928d952c5d106ff9ef92aaa385b9
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
Signed-off-by: Neti Ravi Kumar <ravineti@codeaurora.org>
CRs-Fixed: 637403
mdss: display: use local_clock() instead of ktime for xlog

For better analysis, time stamp of xlog should synchronize with
the time stamp of printk. Use local_clock() to log time stamp.

CRs-Fixed: 673350
Change-Id: I00e456fdc35f5a85d8029d12f4507990444e2821
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: mdss: Reserve single SMP block for writeback mixer pipes

Writeback does not have stringent requirement for latency
buffers. So, SMP blocks reservation for the pipes attached
to writeback block can be restricted to single SMP block for
each plane. This makes more SMP block available for other
clients.

Change-Id: I3d788bcf7fcbc5667b4a3a0c52256f55cc0aa1e7
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Fix BWC width alignment

BWC src width is segmented into 16 aligned RAUs. The segmentation
into 16 RAUs needs to be rounded up for corner cases.

Change-Id: Idbf675d7adfb45cb28e6c456dd4fd7c7f41ea280
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: perform proper clock handoff during cont. splash screen

During continuous splash screen need to ensure clocks are properly ref
counted once and released once handoff has happened. Doing it in
different places can lead to improper order and cause clocks to be
disabled. Fix this by centralizing this into footswitch ctrl which is
called when continous splash screen is enabled.

Change-Id: I17f3d5517d9a0583221fdb5c354bf1992ddeddbd
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: Enable EOT packets for DSI

Expose properties to enable ignoring and appending of
EOT packets for DSI panels.

CRs-Fixed: 575875
Change-Id: Ib1ad4fedf7bea7f47b5468621793c6845c4d1180
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
ARM: dts: mdss: Add boolean property for LUT readability

LUT read is not supported by hardware in the case of msm8226.
Adding property to dtsi file to denote the absense of support
for read in hardware.

Change-Id: I29cf869af4135e1199bc0feb4369700b994520ec
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: Correct ARGC read write for all DSPP

Currently ARGC read write is done for DSPP0 irrespective of
dspp_num, as the dspp_num corresponding to the block provided
is not calculated.

Added the calculation of the dspp_num to get correct address
of ARGC registers.

Change-Id: Id787e76debb26d23d75d3cdb859a697b6f0016f5
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: Copy IGC LUT data correctly to userspace

During IGC read operation, IGC LUT's data was copied to
userspace incorrectly because of swapping color components.

Fix component data swapping during IGC LUT data copy to
user space to provide the correct IGC LUT data to user space.

Change-Id: I301a3500f0e0c4bbf9f52affa66373585c72d987
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: Reading IGC and PGC LUT from cached values

Certain targets like msm8226 do not have capability of reading
IGC and PGC LUT from hardware registers.
Adding functions to read the LUT values from software cache.

Change-Id: Ifd0f5f131b7ff1fd7d1fb122425241a0e0cec328
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
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>
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>
msm: mdss: Move histogram completion initialization to pp_init

The histogram completion structure only needs to be initialized fully
once, and this can be done when the pp resource structure is created.
Otherwise, when enabling the histograms, it is sufficient to use the
reusable INIT_COMPLETION, in order to avoid any wait_queue errors.

Change-Id: Id4bfb19c91bd5ab07c01a5eb347ba50621fe8a97
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
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>
msm: mdss: Increase commit count for first kickoff

During panel unblank a kickoff is done to turn on the panel so that the
first update is not delayed. It is also used to give buffer to command
mode panel prior to enabling backlight prevent junk data from appearing.
In order to prevent release fence timeline from being signaled too
early we will increase the commit count. This allow next sync point
to be added to the appropriate point on timeline, instead of relying
on frame done being called before sync/commit calls.

Change-Id: I566f90b3013b59dedbe42bbb9fdf6fa37d65e779
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: Decimation and BWC cannot be enabled together

Hardware cannot support decimation and bwc together.
The use case should be failed.

Change-Id: Ic7547340eb08d542a296aa9cfdd150e7eb0bea4b
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@quicinc.com>
msm: mdss: Support scalar programming for all usecases

Program scalar registers for both RGB and VIG pipes
when requested by the user. The scalar factors are
also computed by the user.

Change-Id: I6854a9ff3acdef07bb6a964f2f3686612230eff3
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>
mdss: mdp: fix incorrect programming of scalar enable

In use-cases where scaling is required in one direction
and not on other, scalar extension parameter will be set
to update the scale register. Add proper check to this enable
scale bit only in the required direction.

Change-Id: I5527f22c83fe456d0124af12516c5bdb240e80a9
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm: mdss: Dynamically enabling ESD

Allow the check_status interval time to be
configurable via /sys interface.
Allow the dsi_check_status function to be
enabled or disabled via /sys interface
Combine MDP3 & MDP5 code and separate
the platform specific code.

Change-Id: I0a6be25b6974ff8dafa472febbdbde517d35cbbc
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
msm: mdss: Cancel ESD workqueue whenever display off happens

Display can be turned off by using different ioctls. Make sure that
in all the cases ESD workqueue is cancelled.

CRs-Fixed: 626835
Change-Id: Id14992665e4a86941386a8269600d322c3500a70
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>