ASoc: msm: Fix Null dereferencing and variable initialization

Dereferencing of elements stored in array 'buf' without checking if
buf is NULL will cause a crash.

Variable 'ret' should be intialized before use.

Change-Id: Ic927233009d12314251f2966ab5516ce4b2652d8
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
(cherry picked from commit 0f6c1dba6226742b7685bcdf08be72d07fcbbfab)
ASoc: msm: Fix array index out of bound issue

session_id is used as an array index in send_rtac_asm_apr() is not
checked for upper bound. Check for upper bound in order to avoid
array index out of bound issue.

Change-Id: I5016e03f86d2db4c0ebc097ae12b421266f8fce7
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
(cherry picked from commit a84982a54ca8deafcd3afc584c4a1a59c2c5f10d)
ASoC: msm: avoid routing setup on established path

During voice call, it was found that ADM COPP is left opened.
Since there is no music playback nor recording, ADM COPP should
not be opened. The problem is due to user-space application issue
mixer command again to join front-end and back-end when front-end
and back-end are already joined and active. PCM routing driver
just blindly create ADM COPP again as the condition of active
front-end and back-end is met. Update logic to avoid routing
setup twice.

CRs-fixed: 339027
Signed-off-by: Patrick Lai <plai@codeaurora.org>
(cherry picked from commit 6231458cedbfae1bb96f04046cf470b8ece42c6a)

Change-Id: I91a5e5bd2f60b245c837cb185f88c4fc75e456a9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
ASoC: msm: Fix a bug in the audio FE check

It is found that recording from MI2S audio HW path
is broken. The reason is that the check to validate
the front-end ID is compared to wrong ID.

Update the comparson so that the correct front-end
ID is used.

CRs-Fixed: 339027
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
(cherry picked from commit 1bd26c67fb7b7579d02ae248b169be0218f08778)

Change-Id: Id6ff22184edd80807e193969df404826b5633460
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
ASoC: msm: Provide linear DSP volume

To give the higher resolution, provide the linear DSP volume gain
instead of percentage through ALSA mixer control

Change-Id: I08e3e8194fab00e36398fc1fd8c2d2e7e0693975
CRs-Fixed: 351468
Signed-off-by: Jay Wang <jaywang@codeaurora.org>
ASoc: msm: Improve error checking in code

Improve code by adding more error checking,
fixing case statments and removing unnecessary
logic.

Change-Id: Ic4d07f5dd9a7079248d8320fab95ee6f4d150b88
CRs-fixed: 344634
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoc: msm: Fix error checking

Fix error checks to look at returned value
instead of passed variable. Updates copyrights
for files altered by previous patch.

Change-Id: Ice69e58bf33a1c451c1324ff0286f743d436d32f
CRs-fixed: 344634
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Asoc: msm: Remove the condition check before sending FENS command

If FENS is disabled before starting voice call, FENS disable
command is not sent to CVD.
Remove the condition check, fens disable and enable command will
send to CVD when starting voice call.

Change-Id: I0cfa21db428cd9cc635442c34321f5482d3b3018
CRs-fixed: 349234
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>

Conflicts:

	sound/soc/msm/qdsp6/q6voice.c
ASoC: msm8960: Decrease period and buffer size for LPA driver

Deacreasing the buffer size for LPA buffer helps to improve the
overall audio quality and latency related issues

(cherry picked from commit b08560da3b365be1990b3c6a11db50e521c06bc4)

Change-Id: I7b92302c7bca8bc385a931b8602c9221b8beb5b3
CRs-Fixed: 344793
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
ASoc: msm: Fix the kernel panic issue in dapm

- Widget list in dapm is getting corrupted during concurrent
use cases where dapm_power_widget is accessed from core,
machine driver, codec driver and soc-dsp. This corruption
is resulting in kernel crash in dapm.
- Fix the issue by adding protection in dapm_power_widgets
API.

CRs-fixed: 351250
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
(cherry picked from commit 247d36e2d8df019f77007c8eed30190b8dfaae6a)

Change-Id: Id486d1cea7f5f6edc94f71711035c0dba17512c2
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
ASoc: msm: Avoid memory allocation failure in proxy driver.

- Allocating memory using dma_alloc_coherent is resulting
failures due to fragmentation
- Fix the issue by replacing the API with
allocate_contiguous_ebi_nomap.

CRs-fixed: 358301
Change-Id: I726623d23c0080b7207911181590fa417c3e9886
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
(cherry picked from commit de48faf59a41bd47a360983407a27fd0fd3dbcc1)
ASoC: msm: Fix mute issue in LPA

In event of an under-run, driver is not able to start again.
Memset the buffer to play silence while userspace recieves the
next set of data and copies it into the mmap buffer.

CRs-Fixed: 356297
CRs-Fixed: 359764
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
(cherry picked from commit 0c2a7704c764371e63e27d1cbbcfe4646d7ea84f)

Change-Id: I3b01599753f3cbe5fa3f0711f08b90de63e00166
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
ASoC: qdsp6: Fix device crash issue in LPA seek

Accessing buffer pointer before initialization results in device crash.
To memset the buffer using physical address also results in a device crash.
Fixed this by initializing the buffer pointer before it is accessed and
memset the buffer using the virtual address.

CRs-fixed: 359764
Signed-off-by: Amal Paul <amal@codeaurora.org>
(cherry picked from commit 3e0c932acabfeafcef6d06abc801ba8507ccaa46)

Change-Id: I47296fc224d260fa7549afe4d2531af6123b07e6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>