msm: mdss: Support scalar programming for all usecases

Program scalar registers for both RGB and VIG pipes
when requested by the user. The scalar factors are
also computed by the user.

Change-Id: I6854a9ff3acdef07bb6a964f2f3686612230eff3
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: mdss: ensure retire fences are signaled during panel off

When turning off command mode panel, if retire fences are still active
and suspend sequence goes through some fences may remain active.
If fences remain active command panel off sequence would stop signaling
vsyncs and would throw off the timeline. To fix this clear the retire
timeline when turning panel off.

Change-Id: I32a5fe0f81b16fa2ef959c7f05e484fb9f9f8598
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
ASoC: wcd9320: Fix DAPM timeout when accesing MAD calibration

request_firmware called by MAD configuration requires
user space daemon to locate MAD codec calibration data.
When system is in suspend state either due to sleep or
user space daemon not ready or filesystem is down then
it needs be up briefly before accesing the codec
calibration data. This change fixes the accesing the
codec calibration data by codec when in suspend state.

Crs-Fixed: 609223
Change-Id: Id2d87363276619c9bd841ee335dc92c58bcc27c0
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
msm: camera_v2: limit the max stream_cnt to 0x0000FFFF

In userspace, the stream id will be rounded by 0x0000FFFF when
packed into identity, which will cause stream id mis-match problem
if we keep increasing stream_cnt beyond 0x0000FFFF. So we also need
limit the max stream_cnt correspodint to userspace.

Change-Id: I65b064762be9fc8389f1fcde3c6602e2f2f68410
Signed-off-by: Fei Zhang <feizhang@codeaurora.org>
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>
mdss: mdp: fix incorrect programming of scalar enable

In use-cases where scaling is required in one direction
and not on other, scalar extension parameter will be set
to update the scale register. Add proper check to this enable
scale bit only in the required direction.

Change-Id: I5527f22c83fe456d0124af12516c5bdb240e80a9
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
mdss: mdp: reset init phase and phase step to default

reset the init phase and phase step registers to default
when the pixel extension are not calculated in userspace.

Change-Id: I876f1628fb46901a07deb1b97a4ab55f924612b0
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: display: reduce display commit prepare waiting time

Unblock overlay_set, prepare and buffer sync ioctls when
commit thread finishes hardware programming.
Use wait_for_kickoff nstead of pan_idle for these ioctls.

Change-Id: Iefb6cbc390d2130926fdcb93688b4d92bfb26937
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Neti Ravi Kumar <ravineti@codeaurora.org>
msm: display: only release kickoff when no cleanup pipe

If there is some pipe to clean up, need wait for it be done to
make sure the pipe can be used for the second cycle and recover
mode can be executed.

Change-Id: Ifb3fdb152bc4bbf367b3d272aa0c88b1a0650c19
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Neti Ravi Kumar <ravineti@codeaurora.org>
Merge "ASoC: wcd9320: Fix DAPM timeout when accesing MAD calibration"