msm: qdsp: fix aac encoder configuration validation

Unsupported encoder configuration was getting forwarded to
DSP causing encode failure at latter stage.
Corrected encoder validation logic which would throw
error for unsupported configuration values and would use
default conf in such cases, preventing failure at latter
stage where error from dsp cannot be handled gracefully.
Also updated userspace to driver format mapping.

CRs-Fixed: 621150
Change-Id: Id049425ac12fa076ad2891f563da67a103630383
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
msm: Fix for audio loss during WLAN & LTE call handover

Current APR implementation doesn't support session based
multiple service registrations. The apr_deregister()
function sets the destination and client IDs to zero, if
deregister is called for a single service instance.
Fix this by registering for dummy services in voice SVC
driver.

CRs-fixed: 690921
Change-Id: I36ffee5102df25b3309032b64db7cd4c3dc0be1e
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
ASoC: update drivers to handle errors correctly

Avoid logical conflicts seen while error handling.

Change-Id: I4c6b58bfcbd87f4d764fc6b923bf718e5f642ae5
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
ASoC: qcom: qdsp6v2: fix crash due to asynchronous read/write

Whenever an async read command is issued to dsp when
the driver is not enabled, there is a crash in userspace.
The read command is disallowed in the driver and an error
is propagated to userspace which results in the crash.
The driver is re-enabled in a subsequent asynchronous write
command anyway, so the async read command can be allowed.
Ensure that read is allowed by removing a superfluous check.

CRs-Fixed: 675131
Signed-off-by: Satya Krishna Pindiproli <satyak@codeaurora.org>
Change-Id: I5d0598e37d08ac1090f98c24be49fd99c132e22f
msm: qdsp6v2: Allow 320K AAC encoding

 * DSP supports this swimmingly.

Change-Id: I11696dd49253c5a310b32c0bfe1a878009597b24
ASoC: msm: audio-effects: improve logging

Make logs more meaningful by logging values where ever
applicable.

Change-Id: I0fd0e62e543480762096d64c7ee7c92eb1204126
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
ASoC: msm: EOS timeout now based on audio data

The timeout value, in relation to waiting for the
EOS command completion message from ADSP, is now
based on the time it will take the ADSP to stream
the remaining audio buffers.

Change-Id: I76fa7d97b91052afd8884aab40bc5df040951be5
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
ASoC: msm: qdsp6v2: fix rtac command failure

In rtac driver, while sending PP_Params for ADM copp
to DSP, token needs to be port_id whereas coppid is used.
Replace it with port_id to avoid failure in command
and timeout issue.

Change-Id: I77ab13ea14e8d6c25514bdeed24db37ef8113a75
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
ASoC: msm: Fix ADM GET PARAM callback

Add size check on inband get param call and do
not process inband if RTAC is active.

Change-Id: I2c099f5ea254a214f224dda556773a7fe6754fe5
CRs-fixed: 548397
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoC: msm: Add bounds checking to ADM get params

Add additional bounds checking to ADM get params.
Validate that all buffer sizes are valid before
dereferencing.

Change-Id: If7c7a5ae6a56812e9c4a11a38c9bdc78f42d09f3
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
msm: usbaudio: remove usbaudiosdev switch

- Remove usbaudiosdev switch to avoid reporting
  analog dock headset for USB headset

Change-Id: Ib5f505385742b708a98f13ab6fd98808b6d1803e
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
ALSA: Avoid endless sleep after disconnect

    When disconnect callback is called, each component should wake up
    sleepers and check card->shutdown flag for avoiding the endless sleep
    blocking the proper resource release.

    Selectively taken from 0914f7961babbf28aaa2f19b453951fb4841c03f
    from kernel/msm-3.10

Change-Id: Id5f19eef3b3db030854b7d40a188d5b23ed8da45
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
ASoC: msm: update min buffer count and size

Update minimum buffer size and count to provide more
options to the client.

Change-Id: Ia303978f4e4b230e021a2ae35146328b1c594460
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
ASoC: pcm: update the start-up sequence for playback

Codec should be started before the adsp to ensure that there is no data
loss during playback.Current sequence enables the adsp first followed by
codec.This change updates the sequence prevent any playback data loss.

Change-Id: Iaf01d153f41a2f94d302ae7f4c1c98b1361dd24f
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
ASoC: msm: qdsp6v2: Add a new waitqueue state for mem map/unmap

All of the commands being sent to the DSP are using cmd_state flag
which can be overwritten when several commands are sent at the same
time. This results in Memory map command timing out. The change will
separate the memory flag from flags for other commands so that they
do not overwrite each other.

CRs-fixed: 673781
Change-Id: I61e059f402feb2c4e1e3dbed1825990456e78471
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
ASoC: msm: qdsp6v2: Fix memory corruption in ASM driver

During VoIP call if SSR happens there is no audio from the
next call onwards. Incorrect typecasting of void pointer
causing memory corruption in ASM driver resulting in this issue

CRs-Fixed: 687854
Change-Id: Ib04b40b978c82e00fe78cc7b12122f2052fb14c1
Signed-off-by: Venkata Narendra Kumar Gutta <vgutta@codeaurora.org>
ASoC: q6asm: Fix the memory leak during the SSR

If a session is released during the SSR, then the memory unmap
command to DSP fails. This results in not releasing up the memory
block shared among apps and the DSP.
Fix by checking if the session has been invalidated during the SSR
and free up the memory during the close command.

Change-Id: I66251e624e5cc1abd816c2e4647997482b96c771
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
ASoC: update codec driver to handle new SSR design.

Update codec driver to reduce the time for wait to check Q6 core
is ready.

LNX.LA.3.7 Change-Id: I06f7124dda56bf867df32c3a03a63e1ee0e2bd94

Change-Id: I2067772e2cb66a1b7a59a84ccf072927580a38ee
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
ASoC: msm: qdsp6v2: handle VoIP call recovery during SSR

Add support for VoIP call auto recovery during Sub System Restart(SSR)

Change-Id: Ie8dce8f575ba3af5560c523a00e8520aef1c68c3
Signed-off-by: Venkata Narendra Kumar Gutta <vgutta@codeaurora.org>
ASoC: wcd9320: fix the no audio issue on triggering SSR

After the SSR is triggered there is possibility of the  mismatch
among  the cache register values and the actual hardware registers
values. Due to this some of the registers doesn't gets updated when
the enable sequence is triggered. This results incomplete path
getting enabled resulting in no audio.
Fix by updating the registers to the reset state and updating the
cache also. Also restart the mbhc for the proper headset detection

LNX.LA.3.7 Change-Id: I851c303928dad1a0f36951ad40ac0b6a912e1757

Change-Id: I00b6bc97ca8ab26bd2d4d25b5e0d967595075f65
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>