msm: mdss: Use primary display backlight in WB AD case

When AD is configured to run on the writeback display, it needs to use the
primary display's backlight configuration for getting, setting, and being
alerted to backlight changes since the writeback display does not have a
backlight to itself.

Change-Id: I615ce878a948798c1ce0c49c427e361c73798335
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Allow CMD panels for Assertive Display

Remove the check that prevented command mode panels from enabling assertive
display functionality.

Change-Id: Iecf0f518a45da556d1d9d0558a7d2dc572cc82da
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Don't calculate AD with zero backlight

Don't calculate AD strength when backlight is zero to prevent updates that
would not be visible from impacting screen when first backlight request
arrives.

Change-Id: Iabf10317ef40ae7bd940d94297a62975947c5ee4
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Store AD backlight notification function

Store Assertive Display backlight notification function while locked to
prevent race condition where AD is disabled while lock is released,
setting function pointer to NULL.

Change-Id: I7996a29595854ed8e50d0fff663a779c3ccd388f
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Update screen resolution for Assertive Display

Apply the latest screen resolution to AD hardware so that banding
artifacts are not generated.

Change-Id: I5df8a3de4551c5e45e0e8ff2b21b60549b479788
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Validate input argument

MDP kernel function allocates memory using one of the input
parameters. Add sanity check for this input parameter to
ensure proper memory allocation.

Change-Id: Ib7ff3b02e818c0d2a623fb3428fb93cc5bd8e41e
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
msm: mdss: Prevent ALS data configuration when AD is disabled

If assertive display is disabled, backlight data structure is reset
to NULL, which in some conditons gets dereferenced or casuses
crash.

Change-Id: I535eac6d2f0aef222fc2846f80d72db1f3e3480d
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Use DT offsets for post-processing

Change post-processing code to use device tree offsets when reading from
and writing to post-processing registers. The device tree defines the bases
of hardware blocks, and previously these bases were hardcoded. Now they are
parsed dynamically from the DT so that the post-processing code is scalable
for different targets

Change-Id: Ic503889459f7793ea68af4128d2d0955e6f6bef2
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Make DSPP PP setup more modular

The previous DSPP PP setup function included config functions for each
of the different PP blocks except for dither. Now there is a dither setup
function, as well as an opmode setup function in order to clean up what is
done inside DSPP PP setup.

Change-Id: Ia347c35bb675e20531272566647a364f6e68468c
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Unlock correct mutex in AD setup

The incorrect mutex for the BL file descriptor was being unlocked
in AD setup. Removed the incorrect unlock and replaced it with an
unlock on the correct mutex.

Change-Id: I276823c34d1183b69d7af06bae8b02cb7e1b56b1
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Balance clock requests in histogram enable

Balance the clock requests in histogram enable to prevent clocks from being
left on.

Change-Id: I45fc029049b68cceb56d0dc40f7819aca0625a58
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Fix dither matrix configuration

Configure entry 0 to entry 15 in dither matrix.

Change-Id: I1259c121e84078325e54d952cbd2671031df2978
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: mdss: Separate AD info from AD hardware base address

Splitting the AD info struct, which is used primarily to store state, from
the hardware blocks. Functionality is preserved by passing the structures
containing hardware information to the functions that execute the register
writes. This change is necessary for dual pipe operation where one AD state
machine controls more than one AD hardware block.

Change-Id: Ia0d8be6b70d121095df2bbaa102b7dedd26f2302
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
ARM: dts: msm: Add a boolean property for WFD writeback block for
msm8974

Dedicated writeback block for WFD needs separate handling
as opposed to regular line mode writeback blocks.

Change-Id: I71aba9bc4de5ca6c91295a4a6fc16cf3768787ee
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: update kernel to support autogenerated dtsi files

Changes are to support autogenerated panel/mdss dtsi files
and their corresponding format

Signed-off-by: Arpita Banerjee <cabane@codeaurora.org>
Change-Id: Id7d33190f117f29ff5aca0021517020620a7afea
ARM: dts: msm: fix several mdss device tree gpio properties

The third tuple of reset and enable named gpio represents a flag which
is not accessed on mdss driver side, so specify them to be zero to
avoid the assumption that it means something. These properties for
msm8974 and msm8226 got changed due to GCDB update and they are
changed back to the original values.

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

Change-Id: Id4556a4db39e344669431e6a410c784d38afe090
msm: mdss: add te gpio for command mode panel

Enable te gpio only for command mode panel and for other panel types
don't enable it to avoid excess current draw.

Change-Id: I7bbdd5984c719fbed8b24494666543a66de5a4d4
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
mdss: display: remove the pwm gpio request from edp backlight

There is no use of the pwm gpio inside the driver so cleaning up the code
and removing it from devicetree.

Change-Id: I72c038f3082aa6ed18ea9142de75faecc1e1e0fd
Signed-off-by: Asaf Penso <apenso@codeaurora.org>
mdss:display: add regulator control to dsi-1

Regulators are shared by both dsi controller. For both
dual and split display application regulator should be
controlled individually to avoid reualtors are turned off
while dsi-1 still running which cause DLB0_ERR_CONTENTION_LP1
error.

CRs-fixed: 579900
Change-Id: Ia29bd3e49a405ccb1ad55f08f3897cee2ff6f4c6
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
arm/dts: hammerhead: Update panel config

Change-Id: I9a7717d003a998580ac16bc7c097dd39e81e4347