msm: mdss: Prevent HDMI panels from doing AD checks

Assertive display is meant only for primary display, however the AD
checks are being done on the HDMI frame buffer and its mixers. Adding
a check for HDMI panel type will prevent edge case errors when doing
AD checks.

Change-Id: Iffdec9fcf479f24e9407d6508517fb4103b1e977
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm:mdss: Fix the issue with AD resume

AD is not configured correctly on dual DSI devices during
suspend/resume. The AD configuration data from user space are
only copied to the master AD configuration structure, and the AD
configuration structure attached to the right mixer (slave AD structure)
is never filled. So in the resume function, we cannot use the AD
configuration data from the slave AD configuration. Use the one
from the master structure instead.

Change-Id: I04cf3c467c2614420e01f9177f564eec7ce7bb23
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
(cherry picked from commit cc2176c176f99836d8040d268954f7575267f406)
msm: mdss: Prevent AD configuration on HDMI path

Currently there is no use case for enabling AD on HDMI path. This check
is already present in mdss_ad_init_checks(), but that does not prevent
mdss_mdp_ad_setup() from being called. So invoke mdss_mdp_ad_setup() only
if display panel is not of HDMI type.

CRs-fixed: 624298
Change-Id: I175fcdbb0cc4ccda31d3fc8074b1e0213e0af10a
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Prevent AD on WFD configuration

Assertive display is not allowed on HDMI and WFD configurations.
However, since WFD uses the writeback path, and AD uses the
writeback path for earlier hardware, then we must check which
hardware configuration is being used when checking writeback
panel configuration to prevent or allow AD.

CRs-fixed: 624298
Change-Id: I85f7380d0345cad7785ed41e22df559bc5c1618e
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Baldev Kumar Sahu <bsahu@codeaurora.org>
msm: mdss: Fix single pipe AD tile control

The tile control parameter is used by the Assertive Display
block to control merged mode or independent mode AD for
dual-pipe AD. However, in single pipe AD, the tile control
should always be set to zero.

Change-Id: I0dd3c3b716fd5156d9a0f9206911159d186fd9c7
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Initialize ad_info completion during dt probe only

Previously, the ad_info completion structure was initialized every
time ad_input was called, which reset the completion wait_queue. A
completion structure should only be initialized once, in order to
prevent any corruptions of the wait_queue. Instead, we initialize
the completion during dt probe so that the wait_queue is only
initialized once, and during ad_input, we use a safer INIT_COMPLETION
for resetting complete count.

Change-Id: If1fb7c9a9dec2ad1ec1f07b022bdeabe1af41b22
Signed-off-by: Benet Clark <benetc@codeaurora.org>
msm: mdss: Fix the AD backlight attenuation implementation

Fix the AD backlight attenuation implementation by sending the
attenuation backlight to both panel and AD HW block, to achieve power
saving.

Change-Id: I64c79d7aa439a8d9e722b4b098c0b163fd115699
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Add AD BL ATT debug log and checks

Enable more checks and add more debug logs for AD BL attenuation
functionality tests.

Change-Id: I088657bdbed553970c3550aab5bdc399970d9b23
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Disable the PP features if partial update feature is enabled

Check the whether partial update feature is enabled or not before enabling
any post processing features.

Change-Id: Ibf2111d5ca8714279903980d14e63bab556bb41f
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Update condition check for AD BL attenuation calculation

Enable the AD backlight attenuation calculation every time the
mdss_fb_set_backlight function is called, so that the backlight
sent to panel can be properly attenuated if AD is enabled.

Change-Id: If751b69fe5f927c15580332645e7e26fe6cb778c
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Add update notify for backlight change in static screen

Previously, the change of backlight sysfs node value will not trigger
notify updates if display is in static screen case. This will cause
delay or wrong configuration for assertive display. This patch fixes
the above issue by adding an update notify if backlight changes when
there are no display updates.

Change-Id: I1475896214a50dc1fa71739aa751b2e626d27adb
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Add backlight notification support for PP features

Notify post-processing features whenever there is a backlight change, so
that PP feature can update accordingly.

Change-Id: I2317088752444478bcfd9cf4f6acfa8553e85d30
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
msm: mdss: Change DSI backlight pwm_config to use nanoseconds

The DSI panel backlight is now configured using nanosecond duty cycle
and period for pwm. A nanosecond duty cycle is needed in order to satisfy
the granularity needed for 255 backlight levels and the DSI period. If the
pwm_period is very large, then a microsecond configuration is used.

Change-Id: I9551f52360f9d5da47ab7e2da6e039ad6f2695fb
Signed-off-by: Benet Clark <benetc@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
ASoC: msm: Add bounds checking to ADM get params.

Add additional bounds checking to ADM get params.
Validate that all buffer sizes are valid before
dereferencing.

Change-Id: If7c7a5ae6a56812e9c4a11a38c9bdc78f42d09f3
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Abhinav Gurram <c_abhina@codeaurora.org>
Merge "ASoC: msm: Add bounds checking to ADM get params."
msm: mdss: Wait for vsync before iommu attach during cont splash

During first borderfill commit in splash cleanup, wait for vsync
before iommu attach to prevent IOMMU page faults during bootup.

Change-Id: I68b7162d090513b082cbd4c0013731cedc0ebdbe
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
Merge "msm: mdss: Prevent HDMI panels from doing AD checks"
Merge "msm:mdss: Fix the issue with AD resume"
Merge "msm: mdss: Prevent AD configuration on HDMI path"
Merge "msm: mdss: Prevent AD on WFD configuration"