ASoC: msm: Move ASM custom topology data out of Debugfs define

Move variables used for ASM custom topology out of
the debugfs define. ASM custom topology should be
enabled even when debugfs is not.

Change-Id: Ie16191c04d80981e48e11ddda71ccbe1ccbc18ca
CRs-fixed: 551711
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Route low latency frontend to in-call music backend

Add routing controls to support routing of low latency stream
to in-call music delivery backend.

Change-Id: I5934f32fb4cbfb7f12a09e9bad76f370c3fd7fb7
CRs-fixed: 550396
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Add missing backends for Multimedia4

Some backends for the front-end Multimedia4 is missing in the
routing driver. This results tunnel recording failure for
USB headset/BT SCO usecases.

Change-Id: I7998309df4e7da9545bdc75e9b67873cc0417870
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Propagate device HW delay to AFE

HW delay for each supported device is maintained in ACDB. This needs
to be propagated to AFE for timestamp calculation in voice path.
AFE provides device HW and SW delays to CVD; based on which timestamps
are calculated for voice packets.

Change-Id: I959676c1ee4e0568e661e7666a61c98152344047
Signed-off-by: Pradnya Chaphekar <pradnyac@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Avoid double free of hw_delay structure

acdb_release function can be called from multiple threads resulting
in double free of hw_delay structure. Avoid this by freeing it only
when usage count is 1.

Change-Id: Id10d095b03dc8ec9554b2a91f2e387838c585a0b
CRs-fixed: 555760
Signed-off-by: Pradnya Chaphekar <pradnyac@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Change acdb_mmap size variable to unsigned

The acdb_mmap fuction does a size calculation but
stores the result in an int which makes negitive
numbers possible. Changing the variable to unsigned
ensures that the size used is never out of bounds.

Change-Id: Ie3cf4c0a1037e7f5fef29b8301becc6c19200ed6
CRs-fixed: 548145
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@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: flar2 <asegaert@gmail.com>
ASoC: msm: Change ACDB driver to use mutex

Remove all atomic variables and provide greater
safety with mutex. Lock mutex for every access
from userspace to ensure that multiple threads
do not concurrently alter data in shared memory
which is used for Audio & Voice calibration. Also
use mutex to protect from concurrent read and write
for calibration that does not used shared memory.

Change-Id: Ib3f2e46805a83ed7e81d0abae1dde32d610b2ba9
CRs-Fixed: 555762
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Safe error recovery for column data and hw delay

Add saftey checks to make sure col data was allocated
before dereferance and that col data input was not NULL.
Add safe error recovery in case of column data or hw delay
kmalloc failure.

Change-Id: I3be233db1cf086de7b9e750d610d41161888ecc5
CRs-Fixed: 572581
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Fix HW Delay print

HW delay print allows a possible NULL pointer dereference.
Move print to location that does not allow NULL dereference.

Change-Id: If99531d4b59d1ff78be43ad85e7b5e870798a0ed
CRs-Fixed: 582529
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Update log message priority to debug

Update log message priority to debug to avoid excessive logging
when hardware delay entries are not found in acdb.

Change-Id: I88210d5f228b6221a11a591e3b4200e95146f972
Signed-off-by: Pradnya Chaphekar <pradnyac@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Add support for EVRCNW format

Add changes to support VoIP call with EVRCNW audio format.

Change-Id: Iaaedbc6434cee4a59bf22c265bfe463df55a19fd
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Add support to configure min and max rates

Add support to configure min and max frame rates for EVRC/EVRCB/
EVRCWB/EVRCNW codecs. This change is needed to support variable
length frames for VoIP calls.

Change-Id: Id17dd645b17b1b8c1dc21afcf20dbc7e2c9c0d30
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: qdsp6v2: Add support for non-pcm VoIP formats

This change is needed to support non-pcm vocoder formats
for VoIP call.

Change-Id: If69d52450816a0f438de1fa17d6382b1e0fb9247
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Add playback support for AC3/EC3 in compress driver

- Dolby DS1 supports both AC3 and EC3 playback in compress
  path. Add code in offload compress driver to support
  playback of AC3/EC3 formats.

Change-Id: I4fb5ee01c47dd7ac083c6180693b87e9fbb4fa0a
Signed-off-by: Mingming Yin <mingming@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Add few more Dolby endpoint dependent paramters

While turning Dolby effecrs on and off from its UI app, volume of
levels vary and difference is observed. Dolby requires few more
paramters to be sent based on endpoints for proper tuning.

CRs-Fixed: 503579
Change-Id: Ibae16d417d4df53eb2bf27475ed24fa409af3861
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: update endpoint based DAP table for REMOTE_SUBMIX

Update endpoint parameters table for REMOTE_SUBMIX and FM
endpoints used for Miracast devices in DAP driver.

Change-Id: I9bda1d884f93c131149b3cae0f22a0113020d6e7
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Handle data loss at device switch for FM

- When device switch happens there are underflow errors
in LPASS. And there is some break in audio observed for
around 2 sec.
- To handle this, ASM run command needs to be sent again
to DSP at device switch.

Change-Id: Ie75dbb1fede4fc88cf827795a176891501202abe
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: msm: Correct the EC reference RX port id for 0x1001

The EC reference RX port id that is being used for
PRIMARY_MI2S_TX is not correct and is set to 0 currently.
Set this to proper RX port id of 0x1000.

Change-Id: Id7a88076f06816adcb50e9cee0b83da10393883f
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm:qdsp6v2: Check null pointer on userspace data argument in kernel

The null pointer check is required to ensure that userspace data
in kernalspace is not null.

Change-Id: I9e522c393ae643626a4bae03731a73f5d6db6458
CRs-Fixed: 563752
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>