msm: mdss: Parse max bandwidth property from device tree

Maximum bandwidth on the AXI bus supported by MDSS is a hardware
capability that needs to be exposed to userspace process via
sysfs node for MDP composition decisions.

Change-Id: I60e74e96666ca97f21a9880f49a95c3264d01870
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
ARM: dts: msm: define max supported memory bandwidth for display

As display resolutions increase, the memory bandwidth requirement
increases as the number of layers supported increase. With these high
memory requirements it's not possible to sustain high memory bandwidth
requirement past a certain threshold without potentially underflowing.
These bandwidth thresholds are different across targets, define these
according to system level profiling results.

Change-Id: I360e59243ce483e77abf0ea9cd4944fd07d0f3dd
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Make sure MDP clocks are voted for while AD is stabilizing

MDP clocks were not voted for while AD stabilization was in progress,
which could result in unclocked register access in certain use cases.

Make sure MDP clocks are voted for as long as AD is stabilizing.

Change-Id: I5598beee152585a9a9bf9aefd1121f3561dbc0b8
Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: fix sw calculation of interlace x offset

Interlacing is handled in software by changing the original height to
half which would become the width after rotation. In cases of 90 degree
rotation the height becomes the displayed width so in that case the
source x offset needs to be updated to half of intended similar to
source width.

CRs-Fixed: 545926
Change-Id: I0de9adb243d6162f5387b1ebc2821141eea4b111
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: Fix under run on interlace clip play in landscape

Rotator src rect y co-ordinate is getting odd after de-interlace
calculation but mdss expects even.

Change-Id: I124d059c89c51126208ad1de02a9d34d87b0f553
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
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: Add an extra write of zero to clear dsi-ack-err bit

In addition to writing 1 to clear dsi-ack-err bit, an extra write
of 0 is also needed to clear error bit completely.

CRs-fixed: 574066
Change-Id: Ib9df9fe5f993605372ced8766874fa00538f505a
Signed-off-by: Shivaraj Shetty <shivaraj@codeaurora.org>
mdss: Fix null point dereference in mdss_mdp_pp_init

Fixed null point dereference in case of memory allocation
failure in mdss_mdp_pp_init.

Change-Id: I3593a583da355915b731ac30b1f38aaa010eba85
Signed-off-by: Krishna Chaitanya Parimi<cparimi@codeaurora.org>
msm: mdss: Fix error in BL linearity inverse LUT check

Associate the maximum index for the BL linearity inverse LUT with the
table size and not the maximum backlight value. The maximum backlight
value can cause an out of bounds index for the BL linearity inverse LUT.

Change-Id: I35fb276f8f1cc6be3be158fa25e6442be438cbf0
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Sanitize read of panel properties

Check panel property's values properly before operating on
them.

CRs-Fixed: 562887
Change-Id: I26ce51e8b3a8e9328e7b6370b9c56d67fcdd1901
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: enable vsync event during continuous splash

Currently when continuous splash screen is enabled the vsync
event reports are delayed until first frame update. This blocks
boot animation. To fix this issue, after user space enables
vsync through vsync_ctrl, mdp driver will start sending vsync
events.

CRs-fixed: 567649
Change-Id: Ifb35e3479805e595d950ab7c38c26de201aa2d16
Signed-off-by: Ray Zhang <rayzhang@codeaurora.org>
Revert "msm: mdss: Turn off backlight while power off"

This reverts commit 6b9bcc740ad0355f74683d2ec2f5f0a7dba3b9c7
This patch will lead to backlight shutdown in recovery mode

Change-Id: I229aca313f74b10e2a38fffdc991ac6ae243e410
Signed-off-by: Shuo Yan <shuoy@codeaurora.org>
msm: mdss: Remove additional clk refcnts in dual-dsi

When dual-dsi panel is attached to a device, both DSI controllers
are registered to mdss. But only one registration done notification
needs to be sent. Currently two notifications are sent and it leads
to an additional refcnt on mdp clocks which in turn prevents proper
suspend. Fix this by sending notification only once.

Change-Id: I29e3c92e9ab0cccd9314cc5428b4accc31b0d0d9
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Read the max brightness level from device tree

Parse the maximum brightness level supported by different targets from
device tree instead of defining a macro for all targets.

Change-Id: If997f87c75d763395844cc11dbb8b8c0c24f4212
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Block postprocessing updates during DTM

When calibration tool requests the fb driver to enter in
Display Tuning Mode (DTM), PostProcessing blocks should
not update the HSIC, Memory color, Six Zone colors, etc.
Updating them during DTM conflicts the update from
calibration tool.

Change-Id: I11fcac57a651581d85e771911f83b2fdd9c3c681
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
msm: mdss: Handle solid fill call with width one correctly

If userspace calls solid fill with width one, even alignment in
driver will make it zero and this will result in page fault.
Handle this case in driver by making this width two rather than
zero if it is not crossing the buffer boundary.

Change-Id: I84c9ed7e029cb98f4fb7c5d92e09fd2a54d74662
Signed-off-by: Shivaraj Shetty <shivaraj@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>
mdp3: Prevent deref of invalid pointer that contains err code

It is possible that mdp3_iommu_meta_put with a non null iommu_meta
that contains PTR_ERR value.

Change-Id: I440c78e324f558fec22d2db373dfd2c0e4d5fbb7
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
pwm: qpnp: modify to use pwm_config_us() for some qcom drivers

Kernel 3.10 defines pwm_config() to use nanosecond parameters, but
now some qcom drivers still use pwm_config() to pass microsecond
parameters. pwm-qpnp driver has already provided a new API called
pwm_config_us() to support microsecond parameters, so we should
modify to use pwm_config_us() instead of pwm_config() for these
drivers.

CRs-Fixed: 545809
Change-Id: I222440bb7636972b9ae35eba175ddffc58095ce8
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
msm: mdss: Fix writeback timeout on WFD

Configure MDSS_MDP_REG_SCALE_INIT_PHASE_X and
MDSS_MDP_REG_SCALE_INIT_PHASE_Y only for VG
pipe.

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