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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@gmail.com>
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: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Fix for power collapse hostless usecase

For hostless pcm usecases apps processor is not needed
for data path. Once data path is established hostless
driver will remove the pm_qos_request to allow the host
CPU to power collapse. Change adds the support to remove
the pm_qos_request once data path is setup.

Change-Id: Ic6ac8d99628c770061ec785f8549c164f6a9bbd8
CRs-fixed: 561202
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@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: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Enable initial/trailing silence removal

For gapless audio playback, the DSP HW decoder needs to
remove the initial and trailing samples from the decoder
output according to meta data present in the stream. This
change is to enable the silence removal by sending the
meta data down to DSP.

Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Handle RESET_EVENTS in compress driver

Listen for RESET_EVENTS message in the q6asm callback and move
compress driver to an error state. All ops except free() are rejected
in this state.

Change-Id: Id12dba9e3a40b01f02e516857cb32af8f9e4cb60
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: qdsp6v2: Fix APR de-register issues during session close

APR de-register should get called for all open streams. The
change handles a case where de-register is not called.

CRs-fixed: 584533
Change-Id: Ied50b68cdf675583e1451954f7ddf40e9c4f53df
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Add support for RTAC version 1.1

Add support for RTAC v1.1 which includes POPP topology.
To support backwards compatibility an ADM RTAC v1.0
structure is created as well as a 1.1.

Change-Id: Ia87109263f4176534043d6eaceddd24f9f83cfec
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>