msm: mdss: support DSI command mode interface

MDP3 supports both DSI video interface and DSI command interface.
This is to support DSI command mode interface.

Change-Id: If9cc403051f9b12769078db2f7a002192808f197
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: detach the SMMU when display goes off

Detach SMMU when display goes off, and attach it when display
goes on.  This prevents clocks left on while display goes off.

Change-Id: I50d96424bb030af55fa502241009ffc2dc1b1575
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: support FB memory reservation removal on 8x10

User space is allocating its own ION memory for composition
buffer, which makes the FB memory allocation in the driver
redundant.

Change-Id: I79d655bf0dac02fd2c6b9a40dfcc3cc5c6a4343a
Signed-off-by: Radhika Ranjan Soni <rrsoni@codeaurora.org>
msm: mdss: add histogram and lut support for 8x10

Histogram control and collection, and look up table
is used by content adaptive backlight algorithm (CABL).
Display driver provides control API for CABL to
start/stop histogram collection.  It also provides
the data API for CABL to collect histogram to analyze
the display content.   After analyzing the histogram,
CABL updates the look up table.

Change-Id: If4777e80d2b58ec0e3c55ee1ec748e281472f503
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
msm: mdss: disable irq when display is off on 8x10

Enable the irq when the display is on, and disable it
when the display is off.

Change-Id: Ib164537dd5175cdf5a1779a62c4861bda2647e35
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: fix the mdp dsi clock dependency issue on 8x10

MDP DSI clock is coming from the DSI PLL.  During the shut
down process, the DSI PLL was powered off first before turning
off the MDP DSI clock.   This results in the mdp_dsi_clk stuck
on message.   The shutdown sequence is changed to: turn off
the panel, turn off the MDP clocks, turn off the DMA engine,
and turn off the dsi controller, including the DSI clocks.

Change-Id: Ib9b47c693188784e7f59d209d868b665ff0beef8
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: Add support to get/set secure flag via an ioctl

Add support to get/set secure flag for WB session through an ioctl.
This is required for WB clients such as AD/WFD, enabling them to modify
or query the secure flag depending on requirements e.g. secure video
playback when using AD.

Change-Id: I852b6f79b31b5ba027d9a5c11561c562023cb99f
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
msm: mdss: access copy of userspace buf only

Copy buffer data from userspace and access only the
pointer to buffer in kernel memory. Copy back this data
back to user space memory once the operation is completed.
This prevents accessing user space virtual address from
driver.

Change-Id: I319bf08055cdf914803c4a35c5a607f92017d9a0
CRs-Fixed: 520129
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: rotator: implement display thread to handle commits

The rotator bits were missing from the original merge, put them
in

Change-Id: I0e47c8c8d386afae04fbfcfd293cea194200414e
msm: mdss: cleanup MDP3 driver compilation

Enable MDP3 driver compilation only on chip-sets where MDP3 core is
present. This helps reduce the size of kernel binary where MDP3 is
not present.

Change-Id: I357ff73f91e7ee1654a8666a78efebf68a2a8290
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Fix race condition for vsync irq enable/disable

Disable and enable of vsync happens in separate thread, which
may lead to a race condition where enable/disable may
happen at the same time and resulting irq in disable state.
Add lock to properly synchronize the enabling/disabling
of vsync interrupts to fix race condition.

Change-Id: Ib52bea5ca7a3612c866a4a962f09725a77e40563
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
mdss: dsi: Add support to partial update

Add support to send DCS commands to set the partial update region
of interest(ROI) size. These commands will set the column/row start and end
coordinates based on the ROI size.

Change-Id: I1b5944ca057bb082caa70b8c2ad39e11fe418756
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
mdss: mdp: Add support for partial panel updates

This change programs MDP only for the output resolution (ROI)
set by the client. All staged pipes are cropped to fetch data
only for the resolution programmed.

Change-Id: If06fb36c6ebe167ba369b11a622ab5feaf52172a
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
msm: mdss: remove extra lock for ctl calls

Some ctl functions need only protection for mixer programming changes,
since all of these calls are made within ov_lock there is no need for
additional protection. Specially since ctl->lock is still held when
mixer configuration is safe to be changed.

Change-Id: I4f39e28f40ef18789a653d02346358b7ca7590c6
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
mdss: Remove lock from vsync control

The lock protecting the vsync control ioctl is not needed since
the vsync control should take effect immediately and be
asynchronous to the display updates.

Change-Id: I5068246488b7fefec9e11e8422bacbe7489c827f
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: update pipe params on first update after suspend

Whenever panel is turned off, need to ensure that pipe is reprogrammed
fully when turned back on in case the pipes are not properly unset.

Change-Id: I6242b8f90695dd713c87924eb15306767b62803e
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Reserve framebuffer memory for the splash screen

Reserve memory for the framebuffer in the HLOS partition that
would be used to display splash screen in the bootloader as
well as the initial stages of the kernel bootup. This avoids
copying splash screen memory to a local buffer in the kernel.
The reserved memory would be freed when the first real update
comes in from the userspace.

Change-Id: I7dc256f8ffd69c24e56ac10ed57e37d96c8c9a2f
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Implement overlay handoff for continuous splash screen

In order to support a smooth and seemless transition from the splash
screen to the boot animation, MDP needs to handoff all the
hardware ctl, mixers and pipes that were staged by the bootloader.
Implement this functionality by populating the MDP software structure
to reflect the state of the hardware at probe time. This removes the
the need to turn off the MDP timing generator when transitioning to
the boot animation and reduces this delay to just one frame.

Change-Id: I607e7b8af3e477ad960497548e8617ceb9cfbdfd
CRs-Fixed: 546447
Signed-off-by: Aravind Venkateswaran <aravindh@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>
msm: mdss: optimize MDP pipes cleanup

There are cases where pipe cleanup can happen without display commit.
This means that the pipe was never programmed to hardware, in these
cases the pipe can be cleaned up without the need of display commit
cycle to happen. Also there is no need to access hardware to release
resources such as SMPs since they have not been programmed yet.

Change-Id: I57a46471dc1fba4e45e55c3543940ba4fba0540a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>