ARM: dts: msm: use a corner regulator for wcnss VDD_CX on all boards

Update wcnss nodes to use voltage corner regulators for VDD_CX on MSM8226,
MSM8610, MSM8974, and MSM8974Pro.

Also update the wcnss platform driver to use voltage corner values for the
VDD_CX regulator supply.

Change-Id: I3f42104c2609a8cd237a34c66ff76be4426e9de8
Signed-off-by: Yue Ma <yuem@codeaurora.org>
msm: mdss: double check mdp ping pong done state

There are cases where the irq trigger may get delayed for more than
expected, in such cases the ping pong done status may have been updated
by MDP hw. Add additional check to see if this has been triggered even
though interrupt wasn't scheduled for pingpong done.

Change-Id: I4730d166d95f238f4525eab2b5c99be40b30699b
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: always set mdp_busy when partial update is disabled

mdp_busy flag is used to serialze kickoff operations by ensuring
that any pending kickoffs are first completed before issuing any
new kickoffs. This avoids any potential mpd_busy_wait timeouts.
Therefore, for normal operations (partial update disabled), mdp_busy
flag should always be set. However, when partial update is enabled,
width and height of panel's ROI need to be checked before setting
mdp_busy flag. Otherwise mdp_busy_wait will timeout since no update
will be sent to the panel. In addition, perform roi merge from both
panels if roi-merge is enabled to decide whether column and page address
has changed. If it was changed, then new column and page address need
to be sent to the panel.

CRs-Fixed: 692382
Change-Id: Ib0070b84a626afffd4c51a65f59bc97aae1d8994
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
video: mdss: Color enhancement feature

 * Add support for color enhancement feature of JDI panel

Change-Id: I6bacd36a329a0c648a5541efdb87b1142aefbfdf
qcom: rpm-smd: Mask the interrupt before sending the sleep set.

Sending a sleep set would cause an SMD interrupt to fire. If the
interrupt was previously affine to a different CPU, it could cause a
premature wakeup of that CPU. Prevent this by masking the interrupt
before sending the sleep set.

Change-Id: I45734c6fa52b7f69c0d68c5b3cd221185a516248
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
msm: mdss: refactor MDSS idle power collapse logic

MDSS GDSC can be turned off, or power-collased for command mode panels
in static screen use-cases. In the current implementation, the power
collapse is triggered by a worker thread in the interface driver
whenever once it enters the idle state. However, MDP driver already
registers pm_runtime callbacks for idle and suspend notifications and
also maintains a count of active overlay sessions. It is much simpler
and cleaner to trigger idle-power collapse based on that. This also
avoids unnecessary synchronization issues pertaining to the power
collapse worker thread.

Change-Id: I96ee339b96ad794b2d87d19d1c14768fca3fa192
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
video: mdss: Fixup power collapse

Change-Id: Iaf58e785e86c994b25001e6589162ba5c3043abc
msm: mdss: reset runtime status upon device resume

MDSS is power-collapsed in idle screen cases using the pm runtime
framework. However, it is possible that the runtime PM status may
not match with the post-system sleep status when the device is
resumed. This sometimes leads to the inconsistencies in MDSS
idle-power collapse upon system resume. To address this issue,
reset the runtime PM status in the pm resume handler.

Change-Id: I74b082d2ff80c3719996a482510ba24e1f5f8170
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: release pipes associated with respective process

It is possible that fb_open and fb_release APIs are called
from different processes for same file node. fb_release
finds correct process through file descriptor node in
such scenario and releases respective ref count. However,
overlay_release API tries to release the pipes associated
with current process id. This check fails to find correct
resources and does not release any pipe. This change calls
overlay release API with respective process id to release
all pipes associated with it.

Change-Id: Icc176032401483e05f347d3c08a4b344f61686f2
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
mdss: mdp: start vreg release index from PANEL_PM

Start vreg release index from PANEL_PM to avoid
release call with DSI_MAX_PM in error case. This
avoids crash in dsi_probe if panel node parsing fails.

Change-Id: I236f40851d41831fe37eea77aa83e2f4ce031a3b
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
video: mdss: Fix control of batfet regulator

Change-Id: I4b88a83e3c7caf1c1f5c57005731a05d05c774c8
msm: mdss: fix handling of runtime pm ref counts for fb device

In the current implementation, pm runtime status for the framebuffer
device changes to active when the overlay session is started. With idle
power collapse feature enabled, it is possible that the MDSS core could
be turned off prior to starting the overlay session depending on the
duration of the idle timeout. This may result in an invalid hardware
configuration leading to various target instabilities. Fix this by
holding a reference to the pm runtime when mdp overlay is turned on.
Similarly, when the userspace process is killed, wake up MDSS from idle
power collapse before shutting down the fb device.

Change-Id: Ie7748732fe76f9b2766da32b972e1e9fe7ff8751
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Configure TE GPIO using gpiomux framework

The TE GPIO needed on command mode panels has a gpio_func
value of 1. Acquiring resources of this gpio using gpio_request
API might configure this to a common gpio which has
gpio_func value equal to 0. Hence control this gpio using
the gpiomux framework.

Change-Id: I2e14ada484a6d20774030393ae6549f05ac1e8db
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm8974: Add TE gpio to gpiomux framework for Oppo boards

Change-Id: I12a91634a2aaf77c2b9cd0220c54e153280af15e
msm: mdss: fix screen shifting in some scenarios when split display enabled

Split display configuration requires that lower and upper pipe
control registers get programmed accordingly. This change fixes
a missing configuration bit in one of the control registers.

Change-Id: I17c71c004dbf6807483f132cb22271230b27960c
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
video: mdss: Fix another unbalanced clock ctrl

Change-Id: Ia993ab7532197f94e400f34df989d7d576a11552
msm: vidc: Disable clock gating feature

Clock gating between inter frames when video hardware
is in IDLE state is not giving any power savings and
at the same time this feature is resulting in few
stability issues. So disabling clock gating feature.

Change-Id: I3d1d4521ec3ee2fbd25d80b33bd5c531a25d9034
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
msm: mdss: when fb splash logo enabled do not attach iommu

If fb splash logo is enabled pan display gets called with
continuous splash enabled. IOMMU attach should not be called
in such a case as this will lead to IOMMU page faults.

Change-Id: I59ac704c6fd77a7e731db0b544338cac3b8e8fe6
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: Fix memory leaks in overlay kickoff

Add missing changes from the commit
398653b3734cd85ee1edd43acf0a11fc03014eb9. That commit is
not propagated properly to LNX.LA.3.6 branch and the
missing changes cause memory leaks during overlay kickoff
in scenarios where it is called without any data input
(i.e. during suspend/resume).

Change-Id: Ieed5bb614f0bd7d96c53fd7d24d4fddeaf2a03c4
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Revert "msm: mdss: handle get buffer failure gracefully"

 * It's possible in the split rotator case for the rotator to
   get queued with has_buf = 0, which results in solidfill being
   enabled on the pipe. This is leads to IOMMU page faults and
   writeback timeouts.
 * Fixes green screen when rotating video on dual-DSI, and 4K
   video rotation on single-DSI (split rotator).

This reverts commit e092ab6793d4c718a37da38f79bb9d79c92c22c8.

Change-Id: I6cd57bba4be77242c2e314a5c0452eae1f10b104