msm: mdss: enable fb_split feature for dual-dsi panels

Currently fb_split feature is limited to dual-pipe but single
interface, i.e eDP 2560x1600, panels. Extend use of this feature
to dual-dsi panels as well and by default enable equal split to
support dual-dsi portrait panels, i.e 1600x2560. Default settings
will be over-ridden by split settings from device tree if available.

Change-Id: I38279e1af7dcd1278fa203f51b8b33f82d0848af
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
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>
Revert "msm: wfd: Restart hrtimer after forwarding it"

This reverts commit Ia8e82a6ad327acddc135835268a755e3646d2ee8.
Calling hrtimer_forward_now() outside of the hrtimer callback context
and not restarting it seems to be a misuse of the hrt APIs.

Change-Id: Idd3f967d8037435ec43bbd843ce122d989aa838a
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
ASoC: wcd9320: Wait for enough time for Line PAs to get settled

During fast switching of audio playback, we need to wait
for 5ms for the LINE PAs to get settled down before enabling
them again for playback. Same delay is also required after PA
is enabled. Add the required delays after LINE PAs are enabled
or disabled.

CRs-Fixed: 668339
Change-Id: Ie51a88c7a3359660aa416bb23131ca4ac0c49b7a
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
msm: mdss: add tracing events in mdss driver

Add tracing points in key points in driver.

Change-Id: Ie31e27be4890e2e7cd573c00dbf3f66fa9c62060
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: Cleanup handling of dual dsi broadcast mode

When broadcast mode is enabled for dual dsi panels, the two dsi
controllers act in a master-slave configuration. A lot of configuration
in the driver requires special handling in such scenarios. Current
implementation has a lot of redundant code to check for broadcast mode
configurations. Rework the code to remove these and add a unified set of
APIs to query broadcast mode configurations.

Change-Id: I634f94266e8dce28bcaa897ef39e7c3ca9b558e5
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: cleanup dsi clock handling

Currently the DSI driver uses a two level reference counting for
the clocks used by the driver so as to ensure that the clocks are
correctly configured for dual-dsi use cases. However, this is not
necessary as the same can be achieved by using a single reference
count. Clean up the code to remove the sub-level ref counts and
add necessary error handling.

Change-Id: I6f1c1bfe83322dc0e1da3d757b6ca88cd629663e
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Add support to selectively control bus and link clocks

DSI driver needs two different types of clocks for normal
operation - bus clocks and link clocks. The clock control function
enables/disables both these set of clocks together. However,
under certain circumstances, it is required to control just the
link clocks or the bus clocks. To support this, add separate
ref counts for link and bus clocks and modify the clock control
function to selectively control these clocks.

Change-Id: I25312131fc737b56dc15f4edf5e55a5824dad855
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Turn on DSI link clocks after exiting ULPS

DSI branch clocks should only be enabled after removing the DSI clamps
when exiting the Ultra Low Power State (ULPS). If this is not enforced,
then the RCG for these clocks may not get turned on correctly which
may eventually lead to some display corruption. Fix this by
appropriately modifying ULPS exit sequence.

Change-Id: I5109dd140f8921256f95eb479dd33a73615d489f
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: dsi: check ULPS state only for active lanes

It is possible that for certain panels, not all four data lanes are
active. After configuring the lanes to Ultra Low Power State (ULPS),
only check the status of the active lanes since the lanes that are not
used will never enter ULPS.

Change-Id: I0da358f2bd24d4472cfccb6cca9ca8b26ffa8226
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss add bw related events for command mode panels

Add events to observe when bandwidth is requested,
when bandwidth is needed and when bandwidth is released
for command mode panels.

Change-Id: I56b8ce28683696bee50e9cd10351076c49e4a84c
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: add systrace begin/end trace events

Adding trace points for systrace at various points in
the driver.

Change-Id: I4783fd2982bddb7f111de9e064bcaff153eb1ce1
Signed-off-by: Vineet Bajaj <vbajaj@codeaurora.org>
msm: mdss: Dynamic FPS using VFP

Using Fixed fps and v_total for BW calculations, it
results in underrun if dynamic fps and v_total is used.
Dynamic FPS change should be Mutex protected for
synchronization between read/write so that multiple
processes don't change fps at the same time. Line
count should be checked to make sure we have sufficient
lines before we start programming FPS. Do not configure
new fps when vsync timeout happens. Add support for
FIFO empty recovery.

CRs-Fixed: 651333

Change-Id: Icff48a7f85755484a321f0de26d4816f895c367e
Signed-off-by: Justin Philip <jphili@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
msm: vidc: Fix various decoder downscalar issues

Queue output buffers without extradata to Venus.
Venus is returning UPSCALE_NOT_SUPPORTED error when
output2 size is bigger than output size. This change
suppresses this error as it is not fatal.

Change-Id: I8a3f708092b131400b88828f6c1a684f08b3f18a
Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
usb: gadget: Fix synchronization issue between f_audio_source

Race is happening when both audio_pcm_close() and audio_send()
executes in parallel.
When the PCM session is closed, the substream attribute of the
audio_dev structure is set to NULL in audio_pcm_close().
As there is no synchronization protection for the audio_dev subtream
attributes in audio_send(), it is causing NULL pointer dereference.
Hence fixing the issue by adding proper synchronization protection
for the audio_dev subtream attributes in audio_send().

CRs-Fixed: 613498
Change-Id: Id9ab0d4e347b8bb2f551f9033829e541bdcaf0e8
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
msm: mdss: enable MRPS command for short read commands

Currently, we specify the size of payload that the panel needs
to send back via the MRPS command only for DCS/Generic long
read commands. Enable the MRPS command to be sent for short
commands also based on the return length of the payload expected.

Change-Id: I634a8e5d12a8ea8d0a8118f360aef27610b21c9c
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm: Increase start voice command timeout

Start voice command timeout is exceeding 300ms
on ADSP.BF.2.2. Increase it to 500ms to avoid
timeout errors.

CRs-fixed: 681025

Change-Id: I940a55a6cd8444ea3ff6fdba0576d7a1f7e8d98c
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
i2c_qup: Fix for unhandled IRQ

I2C qup driver handle scenario where runtime
PM is not enabled and enables clocks explicitly.
But it checks runtime PM suspended state in ISR
routine before processing further which can lead to issue
of unhandled valid IRQ sometimes because I2C client
can initiate transaction very early after system
resume and runtime PM is not enabled.

Add atomic flag to synchronize between active transaction
request when clocks are enabled and ISR.

CRs-Fixed: 670480
Change-Id: I175bc29a7b5b6e713ab6ec28deb34b2b0d23fa8a
Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Merge "i2c_qup: Fix for unhandled IRQ"
Merge "msm: vidc: Fix various decoder downscalar issues"