arm/dts: hammerhead: Add JDI 1080p command mode panel config

Use a seperate config file. Move some stuff around an apply
a cleanup.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: primary panel config from boot param

Add ability to read kernel's boot parameters to
check for primary panel interface and panel
configuration. The parameter passes three
fields of information which are parsed by the MDP
driver as a part of the device probe.

Format for cmdline param expected is:
"mdss_mdp.panel=<lk_cfg>:<pan_intf>:<dt_node_name_panel>"
where <lk_cfg> is "1" - lk/gcdb config or "0" non-lk/non-gcdb
config;
<pan_intf> is one of "dsi:<ctrl_id>", "hdmi", "edp";
and <dt_node_name_panel> is the string identical to panel's
device node name from the DT.

Change-Id: Ib9e7e4b69c62537f551aaf9ccaf0dd69eddd6889
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: remove dsi panel device probe

Remove dsi panel's device probe since the
dsi controller initializes the panel through
the phandle from device tree. dsi panels are
moved under mdss mdp device and are no longer
treated as devices themselves. This enables the
implementation of dsi panel detection.

Change-Id: I3a9966027042fe4f05ba26115079d89ec5a765eb
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Sanitize post processing inputs

Sanitize the inputs to histogram, assertive display, and calibration buffer
so that invalid values cannot be used as feature configuration.

CRs-Fixed: 516710
Change-Id: Ifb585174b1baadbac628f53fe67f3c3b3ae61a54
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@gmail.com>
msm: mdss: Correction in cyclical reading of histogram bins

The iteration condition in loop for reading histogram bin has an
error. We are essentially missing out on the value of one bin.

Change-Id: I713ad6c580374173b38cd1a1f4f8120f55cf1452
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Verify histogram size before sending to user

Add check to DSPP histograms to verify that the number of pixels collected
is the same as the resolution of the region being processed.

Change-Id: I21acd1b4a25d06391c853e7495ca3fb3bb0ffef4
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@gmail.com>
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>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Support post processing blocks address access

Support MDP address read/write for post processing blocks
like PA, ARGC, PCC, IGC, dither, etc on all dspps,
layer mixers and source pipes for display calibration tool.
It checks the post processing blocks address ranges against
the base address provided in mdss dtsi.

Change-Id: Ief0ae097c542e4372d5690b5b8ca94530da54cba
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Update op mode register access for calibration

Update OP_MODE register access on all source pipes for
calibration service to enable/disable PA, IGC, six
zone, etc post processing blocks.

Change-Id: Id52d7af71e0c0ad758c3ca939c8e1991c1dcf6ff
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Prevent multiple completions for each read request

Each read request should only capture one histogram done. completion to
prevent future histograms from trying to read unavailable data. Makes sure
that the read request is set for both pipes before waiting for a new
histogram. Likewise, make sure the read request is unset for both pipes
after waiting. To prevent accumulation of histogram bins, only kick off
histograms when histogram state is IDLE (i.e. read or reset(recently
 zeroed) bins).

Change-Id: Idc1ebb14dce500a6e5dfc0261ecec992e727a380
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Remove redundant data from histogram info

Remove the 'is_kick_ready' variable from the histogram info since it is
duplicating col_en.

Change-Id: Ie2b3d5fae83d3030e79b323260223458eed174b0
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Fix ARGC error when writing LUT to registers

When updating the ARGC LUT registers, the data is incorrectly written
such that the arrays are off by one index. This patch fixes that error
by starting from the correct index.

Also, when the READ flag is enabled for ARGC, the dirty flag is no longer
set.

[myfluxi: This fixes lcd kcal lut access as well]

Change-Id: I7e8e19c51d5891cd11344a425f1a8ac47d57368c
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: fix IGC access for calibration service

Fix IGC address range access on DSPP and SSPP pipes
for calibration service.

Change-Id: I5601f0da1088ea9c31d98e13d0cc5f9c7e33ce3b
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@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: Dan Trifan <jimsth@gmail.com>
msm: mdss: Move histogram completion initialization to pp_init

The histogram completion structure only needs to be initialized fully
once, and this can be done when the pp resource structure is created.
Otherwise, when enabling the histograms, it is sufficient to use the
reusable INIT_COMPLETION, in order to avoid any wait_queue errors.

Change-Id: Id4bfb19c91bd5ab07c01a5eb347ba50621fe8a97
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>