ASoC: msm: Prepare for complete backport

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Clear ION handle after freeing

Once ion memory is freed ion handle should be set to
NULL to avoid double free or any unintended access.
This change clears the ION handle after freeing up
the memory.

Change-Id: I37d76fe2641c111fa4376eff8f7e45f6795414ca
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC :msm: Increase Proxy buffering

-Proxy buffering can overflow if BT playback setup takes a lot of time
-Fix this by increasing the proxy buffer size so that we will end
 up buffering the additional data that can come in during this time

Change-Id: I3b9acc848e0922bb26c87845fc6164f4266fbfa9
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>

ASoC: msm: Increase Proxy buffering

-Proxy buffering can overflow if BT playback setup takes
longer than usual.
-Fix this by increasing the proxy buffer size so that
we will end up buffering the additional data that can come
in during this time.

Change-Id: I5d091ff12036a80dbf50fd14556b13852dd0cc24
CRs-Fixed: 547254
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>

Revert "ASoC: msm: Increase Proxy buffering"

This reverts commit c1a463e27329c0a0016ccfc38c513bb760f82337

Change-Id: I88ffb9822184d8f227799a97a7cbceaf2f80f769
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoc: msm: qdsp6: Add ultra low latency playback support

Using ULL further reduces continuous latency when
compared to the current low latency path.
This is achieved by having no post-processing in
the DSP along with smaller buffer sizes

Change-Id: I81cb10db575b0fd3405fe6d051ccce4f8496bb32
Signed-off-by: Aleksander Holynski <aholynsk@codeaurora.org>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Fix playback failure on device switch during ULL playback

When a device switch happens for ultra low latency playback, we are
opening a regular playback COPP. ULL stream is routed to a non ULL
COPP. ULL stream can be only routed to a ULL COPP. This results in
playback failures. The fix is to use the perf mode flag as a
part of front end instead of back end dai.

Change-Id: I07f3f02b1414d2826a2f2d3f79b1bc0337cd3c32
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Update the topology if there is no ACDB

The topology for ASM and ADM is passed down from ACDB to adsp.
If there is no ACDB, then the topology ID is zero. In the current
implementation, whenever the topolpgy ID is zero, then the default
topology is used for asm and adm. The problem arises for msm8x10
because it support only null/none topolgy. It causes audio playback
failure in factory test mode when ACDB loader is disabled by factory
test application. Update the topology to null/none from default to
cover all the platforms.

CRs-fixed: 538213

Change-Id: I8cc694d731284294fb2f8341b370e0dfeb2a7d9b
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Set ADM sample rate to 48Khz for ULL

ULL copp can only operate at sample rate of 48Khz. BT SCO back end
sets sample rate is 8Khz. ADM open for  ULL fails when backend is
BT SCO. Set the sample rate to 48Khz when adm is opened for a ULL
device session.

Change-Id: I18f18466324eebf2a2c8884b6e531155707996f4
CRs-Fixed: 545401 545397
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Don't update state variables for no-wait commands

Some of the afe commands that are sent to dsp are asynchronous
and the thread will not go into sleep. Do not modify any state
variable that are used for the synchronous commands to avoid
possible race conditions.

CRs-fixed: 538366
Change-Id: I10cf75ceb6749ffbdb05461ac0b3bdf944d59299
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Set ADM channel to max supported for ULL

ULL copp can only operate currently for 2 Channels.
ADM open for ULL fails for channel greater than 2 channels
Set the channel to max supported
when adm is opened for a ULL device session.

Change-Id: Ib47af5bca7461b935fae0f695b04767929bea925
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "ASoC: msm: Add support to enable audio post processing in DSP"

This reverts commit f6c88c6e114ccb7ccdce9e27af61e0d52349d73a.
ASoC: msm: qdsp6v2: Copy frame data based on frame length

Copying data based on count will result in copying
uninitialized data to userspace which can potentially
disclose sensitive data. Fix by copying data based on
frame instead.

Change-Id: I39e264b1ffc7a6b79b01c14cd0b5bb00c67307c6
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Fix playback failure with tinyalsa test app

PCM playback through tinyplay test app fails as it tries
to write data in chunks of ring buffer size instead of
period size. msm_pcm_playback_copy function checks the
available bytes in the shared buffer and rejects if the
bytes received are more.
Instead of rejecting the buffer, copy bytes equal to available
size i.e. period size. The ALSA framework will take care of
updating the offsets and looping through the remaining data.

Change-Id: Ie5136f7188091e3e978d4b3c3251c0b066c5ac6c
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: qdsp6v2: Buffer address for Record and playback is 32-byte aligned.

Use 32-byte aligned buffer address to ADSP for playback
and record usecases. ADSP expects 32-byte aligned buffers,
and if they are not received, ADSP will return them.
This causes failure in record and playback.

Change-Id: I62ee59ae761b89545cdb61e5834b7389bc151e32
CRs-Fixed: 549103
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: qdsp6: Add support for gapless audio playback

Update ASM driver to support for gapless audio playback in
tunnel mode.

Change-Id: Id1f25afef25b3636fb50dc08b5feb803150d1b59
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Add support for gapless audio playback

Update compress driver to enable gapless mode in DSP to
achieve gapless audio playback in compress offload mode.

Change-Id: I212178025996f28ff5a3ddc361ceb7bd70b5d192
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Handle SSR for audio playback over BT usecase

Proxy afe and pcm afe instances are not reset to 0 when
adsp ssr happens during audio playback over BT. Reset these
instances to 0 to avoid playback failures after subsystem restart.

Change-Id: I7afd9f1c3a953ed67248a96d0d8a4804e8a77061
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: qdsp6: Add support for custom topology

Update ASM driver to send commands to DSP to enable
custom topology for enabling audio post processing
effects in POPP.

Change-Id: Ic222b5045820ebabb79148c8e51f5fd90fcd1410
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: qdsp6: Add support for audio post processing effects

Add interface to support configuring equlaizer, bass boost,
virtualizer and reverb effects in DSP for tunnel mode of
playback.

Change-Id: Ie1512e340315302691327b6379a0935170dc57a7
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Add support to enable audio post processing in DSP

Add interface to support configuring equlaizer, bass boost,
virtualizer and reverb effects in DSP for tunnel mode of
playback.

Change-Id: I5ed578df1e1cb860734d2205c0895e82cfbdfbfc
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Update device tree node for msm-pcm-dsp

Update the name and properties for msm-pcm-dsp. Use qti instead
of qcom for device node and its properties.

Change-Id: I97d8f336be5e3b6792d99eece27c7d7773e33aa1
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>