msm: mdss: Call blank and panel OFF events only once

For command mode dual DSI panels, currently the interface blank
and panel OFF events are called twice, once for each interface
control off function. The panel and both the DSI controllers get
turned off during the first interface BLANK and PANEL_OFF events
itself since each interface handler internally gets called for
both the DSI controllers. Hence, call the interface events only
once for the left mixer controller off function.

Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "cpufreq: interactive: Simplify frequency calculations"

This reverts commit dab8fc00db2dbef858e1f441444b8ddff32ea2fe.
cpufreq: interactive: Allow go_hispeed to be disabled

Specify 0 for go_hispeed_load to disable it.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Add target_loads_down freq selection

Using a single set of target loads causes an excessive number
of frequency changes.  Reduce by having a mode that allows
for separate load factos for "up" frequency selection and
"down" frequency selection.

If user-space specifies target_loads_down then the new
duel mode frequency selection will be used and frequencies
will be scaled up to meet the load requirements but they
will only be scaled down if the can be scaled down without
violating the down target loads.

If user-space does not store a value in target_loads_down
then this change makes no functional difference in the
governor.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: add proper pipe unmap calls for pipe references

For every pipe get/map call there needs to be a related unmap call.
These are missing in some cases.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: add support for rotator in mdss_mdp_mixer_get

Currently ctl->mfd is not populated for rotator sessions. If
mdss_mdp_mixer_get is called by rotator session then it will always
fail the NULL check for ctl->mfd. This will flood the logs for every
rotator commit and can lead to un-predictable outcome. Fix this by
properly handling rotator case in mdss_mdp_mixer_get.

Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: fix sync fence deadlock when rotator is used

In the current implementation, whenever rotator play is called, it
forces DMA pipes to be released by calling commit on video mode ctl
paths if they are using DMA pipes. Here assumption was that DMA pipes
will either be used in block mode or line mode, all or none. But this
assumption is not valid any more where we can have a use-case where
DMA0 is used for rotator and DMA1 for video mode ctl path. In this
use-case, current implementation can lead to sync fence deadlock. Fix
this by removing obsolete assumption.

Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: refactor pipe list management

A pipe can only belong to either used list or cleanup list, to ensure
this refactor the list management by having only a single list head in
pipe structure. Also add a better name for the lock that should be used
for ensuring atomic access to these lists to prevent incorrect use of
these locks.

This also ensures that a pipe can only be freed on the fb device it was
allocated and prevents unexpected behavior when this is not the case.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Allow DMA pipe sharing only on WB mixer

DMA pipe can only be shared on the writeback mixer for
concurrent line and block mode operations. Only allow
sharing if the mixer attached to the pipe is already a
writeback mixer.

Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Fix rgb_565 format for 90 degree rotation

Make rotator output format for rgb_565 and bgr_565
as rgb_888 for 90 degree rotation as expected by
MDSS.

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

msm: mdss: Swap RGBA format to BGRA with bwc rotation

When BWC is enabled, rotator format needs to be swapped from
RGBA to BGRA to avoid color mismatch on the ouput image.
This is specially needed with a GPU composed FB.

Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>

msm: mdss: synchronize formats across rotator output and pipe setup

The rules applied to switch formats must be the same across
rotator output and the following pipe setup. Also, yuv rotator
output format should always be set to pseudo planar for MDP
hardware optimality.

Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mdss: msm_fb: Allocate fb memory during mmap

Current design of display driver (overlay) is no more
using the physically contiguous memory for normal display
functionality.

However, we still need to be backward compatible for any client
using the legacy implementation (eg. pan display) functionality.
As soon as there is a mmap call, the allocation happens from
system heap and gets removed once the references to frame buffer
driver becomes NULL.

With this change one can remove the physically contiguous memory
which gets allocated at the boot time and the usage of physically
contiguous memory is optimized.

mdss: fb: Add backward compatibility to fb memory

In the current implementation, contiguous memory allocation
during bootup is removed and related changes were made in
frame buffer driver which is not backward compatible. With this
change, add backward compatibility to map to physically contiguous
memory when available which is allocated at bootup.

Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>