ARM: dts: msm: Add new property to specify OCMEM size

OCMEM is required by video hardware to deliver optimal
performance mostly at higher resolutions/fps. For targets
which have low specifications, OCMEM is not needed or not
needed as much as for higher targets. This change adds the
property to dtsi file to specify the size of OCMEM.

Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>

msm: vidc: Add OCMEM check during power collapse

Targets which does not have ocmem will fail while
performing any ocmem related operations like alloc, free
ocmem. Such failure can abort power collapse.
Add checks to avoid such operation for targets
which do not have ocmem.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>

msm: vidc: keep ocmem availability check while allocation

Keep the ocmem availability check before ocmem_alloc
declares it as failure.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Suppress false error messages

When parsing the device tree the driver emits false error messages when
optional properties are not found.  This commit gracefully handles the
absence of optional properties.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: vidc: Set QDSS memory based on debug flag

Allocate and map QDSS memory to video hardware based on
debug flag "msm_fw_debug_mode". There is no need to
allocate QDSS memory if QDSS debug mode is not enabled.

To enable QUEUE debug mode -
adb shell "echo 0x1 > /d/msm_vidc/fw_debug_mode"
To enable QDSS debug mode -
adb shell "echo 0x2 > /d/msm_vidc/fw_debug_mode"
To enable both debug modes -
adb shell "echo 0x3 > /d/msm_vidc/fw_debug_mode"

By default QUEUE debug mode is enabled.

Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: abstract the dsi command utility API

The dsi command parsing and construction functionalities
are hardware independent.  This is to abstract these
utility API, so that it can be shared with different versions
of  dsi host controllers.

Change-Id: I8481d9fd21e5eacc4542c72c064fa37d7fd3a11b
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Prevent excessive logging during rotation set failure

Changing the error log to debug log in case SMP reserve fails
for rotation. The use case falls back to GPU. Same is being
done in  case of mdp interface set path.

Change-Id: I00a9e05b3a04a87e354fd0e60ad900f4f71cdfc1
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: expose mdss tearing check parameters

Tearing may happen for command mode panels when data transfer from mdp
to panel is not synced with panel's own update. These panel dependent
mdp parameters are used by mdp h/w logic to avoid tearing, so they can
be tuned through device tree settings for different panels.

CRs-fixed: 514910
Change-Id: Ibe9e27233692f8e50f36ce3b8be521a4d0097146
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: wb: Ensure iommu reference is available in wb terminate

In static screen case on command mode, when wifi display is
disconnected, buffers don't get free as there is a probability
that iommu is not attached. Ensure that iommu is attached when
wifi display terminate is called.

Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Add error handling support for DCS command APIs

Currently there is no error handling done for DSI DCS command
APIs like mdss_dsi_cmdlist_put. So for ESD thread use cases,
the caller functions of these DCS command APIs do not have error
propagated if the panel read/write commands fail. Hence add support
for error handling for these functions.

Change-Id: I0e558fd32fbfd8ae247b60c92fa2756159c3d3c6
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: distinguish between mdp and dsi bus votes

For DSI read or write commands, they will also go through
axi bus.  Earlier, we were only voting for the mdp bus bandwidth.
In the case where the mdp bus bandwidth vote is 0 and there is
a DSI transaction, it will result in DSI hang.

Change-Id: Iafd9e06ae2050665392c6c74fece8f20cb6d44b1
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Debug log for assertive display inputs

Log updates to ambient and strength inputs on assertive display.

Change-Id: Ie96baf2cb6f4af4c74e154322b870f4eb58cbfb2
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Update BL on first AD update

First AD update is not updating with current backlight value. Initialize
last_bl variable so that first request updates backlight along with user
specified input.

Change-Id: I453e5448229dbddb6204c0a654c267e1540c59a3
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>