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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Fix dither matrix configuration

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ARM: Don't dump vmalloc addresses with show_data()

Memory-mapped IO address spaces cannot be safely dumped at will.
Some addresses may not be available (clocked, powered) at all times,
and may result in hangs or bus decode errors if accessed. Other
registers that are accessible may have read side-effects, and dumping
them may have adverse affects on stability or the functionality of
the affected peripheral.

Be safe, and skip dumping such addresses altogether.

CRs-Fixed: 625442
Change-Id: I4cfa75f027ededf841a0240715af0db385857cbe
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 23bbd49b56e4854067337c16ad2c2c95abbf7100)
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ARM: Improve vmalloc address checking in show_data()

There is an unhandled corner case with the current check
which has recently been hit. The nbytes argument may be
large enough for the range being dumped to cross a
boundary between page-table mappings, and dump addresses
which are vmalloc'd in the neighboring mapping.

Check every address being dumped to see if its vmalloc'd,
not just the address passed to show_data().

CRs-Fixed: 625442
Change-Id: I255b093808177321f5202dcacea337ee333bfc63
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit 2811c0946b2164cc3ede5350ce04dae32ce863e2)
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Prevent AD on out of range displays

Prevent array out of bounds error when displays fall out of range for AD
support.

Change-Id: Iffebee5ed78bf256c8dd7c6f62587ac27cb2241e
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Correction in cyclical reading of histogram bins

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
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>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Fix error cases in AD config

The BL linearity LUT was not being copied correctly. This change allows
AD config to exit with errors correctly if the BL linearity LUT is not
passed correctly.

Change-Id: I491a7cc4b168b7691c65cbc2d2963f8a7a3f804d
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: Add backlight attenuation mechanism in AD auto strength mode

AD backlight attenuation provides the ability to modulate backlight based
on calibration before feeding it to AD core for strength computation.

Change-Id: Iea011807b25882463b1142e17324fa0509007aa4
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
msm: mdss: fix merge derp.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>