msm: mdss: Set correct flush bit for writeback mixer.

Wrong flush bit is being set for writeback mixer which can cause
MDP hang/unexpected behaviour when the mixer is used in line mode.
This patch addresses the issue by setting the correct flush bit.

Change-Id: Ie0c2ee27b1f466164a8fb84f7daae9309b74d1d8
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
mdss: Avoid panel ON commands during boot up for command mode

In command mode, when continuous splash is enabled, we do not
send the panel OFF commands through the SPLASH_BEGIN callback.
Avoid the SPLASH_FINISH callback also for command mode since
panel ON commands are not required to be sent. This avoids
unnecessary warnings during boot up.

Change-Id: Ifc249f259655045ecd799b57e1efb964238c504a
Signed-off-by: Padmanabhan Komanduru <pkomandu@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: Finetune ab votes for PPP

Current ab calculation pushed the power numbers very high.
Finentune the calculation and keep ib undisturbed.

Change-Id: Iddfa39a735201a52daae7278f4006fa6f929b19c
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
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>
msm: mdss: clean up overlay resources properly when display is off

When display is turned off, the clocks are already turned off and
unprepared.  Earlier, when unsetting the overlay resource, we were
trying to re-enable the unprepared clocks.

Change-Id: I36e79e4a0bdbbe35f4474527a09a4da59cbec96c
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
mdp3: ppp: simplify ppp completion logic

This fixes issue where ppp would no longer process requests
claiming that ppp core is hung, when in fact ppp core was
not active at all.

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

Conflicts:
	drivers/video/msm/mdss/mdp3_ppp.c
msm: mdss: allow re-queue of writeback buffers

When a buffer has been properly processed, client may choose to use sync
fence to acknowledge when buffer is complete. In such cases dequeue is
not necessary, allow this use case by allowing client to re-queue
writeback buffers as long as the buffer has been properly processed
already.

Change-Id: Ibac1eb9710477734e1ee2daf8136085d4439b0d4
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: initialize write back arguments in kickoff

The kickoff code relies on the fact that write back arguments are zero
initialized to check for available buffer. If it's not zero initialized
it may pick dirty buffer address from stack.

Change-Id: I7309f8fe508640833a182a8ecdb2d3be1797fab7
Signed-off-by: Adrian Salido-Moreno <adrianm@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>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.h
msm: mdss: unmap user writeback buffers after session is terminated

Currently if buffers are provided to writeback driver through user space
ioctl, these are never unmapped and may cause leaks in memory. Also, we
can reuse the nodes which are already mapped until session is
terminated.

Change-Id: Ic786dfa735af529998bfc9467ac872b2badc0e31
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: add iommu attach in bus bandwidth control request

Add mdss_iommu_attach in mdss_bus_bandwidth_ctrl to
attach iommu on bus bandwidth enable request.
mdss_iommu_attach/mdss_iommu_dettach can happen in
separate thread, which may lead to a race condition
where attach/detach may happen at same time. Add lock
to properly synchronize the iommu attach/detach to
fix race condition.

Change-Id: I45c8ef1fa1fa1c2da9c6c3702bd007856e469b9d
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp.c
msm: mdss: Modify SMP requirement for BWC decompression

BWC SMP buffer allocations are different from BWC fetch strides.
The Detile write of BWC is segmented into 16 algined segments for
every line buffer. This has to be taken into account and based on the
format the buffers need to be channeled.

Change-Id: I168014709bd81bfb189ce8cb3d1224f911838ba7
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Add support to halt pipe fetches

Add a utility to halt any pipe fetches and wait on it until all fetches
are completely halted. Use this utility during staging and un-staging
of the pipe.

Change-Id: Id865970063dffc2870be5fd2cf51b9711134dc89
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Use MDP_SOLID_FILL to enable color on pipe

To enable constant color on a pipe, set MDP_SOLID_FILL in pipe
flag. This will do a solid fill on the pipe with the color
specified in bg_color.

CRs-Fixed:592032
Change-Id: I3201e2fa657a6fc6d0e7f51f8585366afc3d29a3
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Reset pipe's mfd parameter during pipe free

There is a corner case with dma pipe. If its set call
fails as line mode (for mdp) and is configured
subsequently as block mode (for rotation), mfd parameter
of the dma pipe structure does not get reset during set
failure cleanup. This causes unnecessary force dma
cleanup call in rotatorp lay which gets hang and
results in rotator fence timeout.

Change-Id: Ia090e9eebf43ab6e28a2746f8fe57e2c3da34e59
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pipe.c
msm: mdss: remove panel type check for split display case.

Split display flag is derived from dsi controller configuration
specified at dtsi. Therefore no need to add checking panel
type at FB registration.

Change-Id: I5b60656c1f5724bdc358d743b8d7600d5beba0b3
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: mdss: Move bus scale table implementation to device-tree

Bus scale table is chip-set dependent where number of paths per
bandwidth use-case can differ chip-set to chip-set. Current
implementation has a static table where it supports only one path per
use-case. Expand MDSS bus scaling implementation to accommodate
chip-sets where more than one path per use-case, i.e. apq8084, is
possible and move table initialization to device-tree so that every
chip-set configures its own table.

Conflicts:

	Documentation/devicetree/bindings/fb/mdss-mdp.txt
	arch/arm/boot/dts/apq8084-mdss.dtsi
	arch/arm/boot/dts/msm8226-mdss.dtsi
	arch/arm/boot/dts/msm8974-mdss.dtsi
	drivers/video/msm/mdss/mdss.h
	drivers/video/msm/mdss/mdss_mdp.c

Change-Id: Ia6f76654d129fe0ec1a7124aa87b16f96167fe84
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp.c
msm: mdss: move mdss fudge factors to device-tree

MDSS has a common driver for multiple chip-sets. Each of these chip-sets
can have their own fudge factors for calculations of resource demand.
Move these pre-defined fudge factors to device-tree since they are
platform dependent.

Conflicts:

	Documentation/devicetree/bindings/fb/mdss-mdp.txt
	arch/arm/boot/dts/msmsamarium-mdss.dtsi
	drivers/video/msm/mdss/mdss.h

Change-Id: Ia558a2ad0a096b49cdabf41dd25cf30c843149c4
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>

Conflicts:
	Documentation/devicetree/bindings/fb/mdss-mdp.txt
	drivers/video/msm/mdss/mdss.h
	drivers/video/msm/mdss/mdss_mdp_ctl.c
mdp: mdss: Tune bandwidth and clock based on ROI

Calculate bandwidth and MDP clock requirement considering
the ROI submitted for a frame. When doing partial frame update
for smart panels, the data actually fetched for a pipe is not
always the full resolution of the buffer programmed. Use the
ROI passed to find out the region of fetching and calculate the
bandwidth and clock values accordingly.

Change-Id: I01f24f8fd9a42a2c4d705b8eb0a7658e79884175
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_ctl.c