msm: mdss: fix the non-continuous splash screen use case

In the non-continuous splash screen use case, we need to
stop the display.  The display clocks are on before we
stop the display.

Change-Id: If8f76d4776fb64f4deb89e5b78c52ab54a56f02a
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
mdp3: Wait for proper vsync when updating display frame

This fixes an issue where we would report that dma is displaying
new frame, but in fact were really still displaying the old
frame.

Change-Id: I99dc89b2341481ea42f9cce451b9b2833dd1f700
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdp3: implement asynchronous frame events

Asynchronous frame events from MDP allows commit thread to be unblocked
once the frame contents have been flushed to MDP HW and new frame can be
programmed while waiting for DMA transfer to complete.

Change-Id: If2ecc3cedfd92e20b2e98b0ac4f6f3608ce78579
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: allow histogram stop operation while display is off

After the display is off, the user space can still call histogram
stop operation.

Change-Id: I5c28b3e7e0529319de9d22ca49bdd606994cf7fd
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
mdp3: Enable sw vsync when dma is not active

Recently in an attempt to enhance sync event reporting we
prevented sw vsync when dma is turned of from toggleing display
off and on.

Change-Id: I71c9be55d36dc92e513d9f5ead4d1e42157285c6
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
msm: mdss: fix overlay set issue on 8x10

The driver was assuming the color format and resolution
of the overlay to be the same as frame buffer.  This
causes page fault and corruption if the client is using
a different color format or resolution.   The change is
to re-configure the dma pipe if the overlay configuration
is different from the default.

Change-Id: Ic7558811a3015a416b2428fb0d626bf13663e528
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: support frame buffer allocation on 8x10

The pan display api is using the frame buffer allocated
from the display driver.  This change is to use the
splash screen memory as frame buffer.

Change-Id: I2560aa644c92145658ac4e873ba6d2e58c5f502a
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: set the mdp core clock rate on 8x10

During the kernel initialization, we need to set
rate on the mdp core clock rate.  Otherwise, the
core clock rate is at its minimum, causing display
under-run on large panels.

Change-Id: Idcd69a758cbf3022f8ad6590b021f21dad5972b1
Signed-off-by: Xiaoming Zhou <zhoux@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>
msm: mdss: fix display corruption on 720p panel

The MDP dma source size should match with the panel
resolution, instead of using the overlay size which
can be different from the panel size.

Change-Id: I4c9f8ea4e0d12e739646fe3d67dad299d3b3245b
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: fix the panel color distortion issue for RGB565 format

For the color format RGB565, the pack pattern was set to BGR instead
of RGB, causing the red and blue color swapping on the panel.

Change-Id: Ib9233a93676e7d5d40f134f9a1657781c631ebdd
Signed-off-by: Xiaoming Zhou <zhoux@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: 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>
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>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
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>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
ARM: dts: msm: change mdp bandwidth default fudge factors

Tune default bandwidth fudge factors to smaller values because mdp
driver implements bandwidth calculation equations.

Change-Id: Iba078ab55748c430238a2da58b88b93387f8b62d
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
ARM: dts: msm: remove mdss-high-ib-factor

This factor was used to increase mdp bandwidth request and now it is
not needed any more after mdp driver implemented bandwidth calculation
equations.

Change-Id: I94c4f2499eb09a2db268a3db55bf7172a96315b5
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
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>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: calculate mdp clk requirement of each pipe with the fudge factor

Currently the mdp clk margin is added for the final calculated max of
all individual pipe clk requirements to avoid underruns. When this
final rate is greater than the max rate that h/w can support, pipe
decimation mode may not be enabled to avoid underruns. So, move this
margin calculation into each pipe clk so that when any individual pipe
has higher clk rate than the max, pipe decimation can be enabled.

CRs-fixed: 538803
Change-Id: Ia4dc500cfc27e7e4d08f03066b511ed3e4ae4664
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: refactor performance calculations

Current logic could potentially lead to drop in performance (and
underflow) when multiple panels are there and both are updating mixer
configuration independently, as we may end up raising bus bandwidth for
another panel which may not be ready just yet. This is addressed by
updating performance configuration values until it's ready to switch
rather than updating values and performing these later (other panel
update could come in between).

Change-Id: I247ef0cd3e0616de3e5ddd9599233af570e422a5
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>

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