qdsp5: audio: Add support for adsp dump mechanism

Whenever timeout happens at apps while waiting for response
from ADSP services, dsp or audmgr apps initiates command to
collect cache coherent dumps to modem ADSP services to collect
dump. This will help in debugging the timeout issue.

Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>
(cherry picked from commit b5c4e9843eeb08bf4f234877778863dca05ca887)

Change-Id: Iabb4a5117bc5f9ec6e5bf689dd4732168dcfcc14
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: audio: qdsp5: Add support for MIDI method

Currenly CAD driver only supports VOICE method when setting volume.
For applying dynamic PMIC gain MIDI method is used. Changes are made
to support MIDI method also.

Change-Id: I6fc66f5683e81266f234b3bfb49b5d3d8167acaa
Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>
qdsp5: mvs: Allow only single instance of mvs session

During MVS open, mvs driver calls msm_rpc_connect to establish
rpc connection with modem mvs server without checking for
current state of mvs driver. This causes modem oncrpc memory
pool to exhaust if back to back open is called without closing
the mvs driver.

Added check to call rpc connect only if mvs driver is in
closed state.

(cherry picked from commit 32c4287136ff1dedd396586fd3adb3ce7959fc2c)

Change-Id: I8abbe1fcc9d4d099938bbf7556e32161aaad75a8
CRs-Fixed: 433208
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
msm: audio: qdsp5: Fix for wrong device values sent to acdb

Wrong device values are being sent acdb driver callback function.
This is because for a new audio manager session which gets registered,
device info is sent only when there is change in device configuration
or sample rate configuration. Due to this, not all sessions are updated
with the current device info and wrong values are sent to acdb.
Avoid this by maintaining a common device info across all sessions
to send correct device values.

(cherry picked from commit 5c715a3a9549b2098c0c7816f7f75713466a5900)

Change-Id: I6839b4b3f5c5b2afcd9a60d996646e7e65ebf06d
CRs-Fixed: 420467
Signed-off-by: Chaithanya Krishna Bacharaju <chaithan@codeaurora.org>
qdsp5: audio: Avoid race condition by using mutex lock

There is chance of race condtion if audpp(audio postprocessing)
callback registration function is called concurrently
by more than one clients.

Avoid this by serializing audpp callback function using
mutex lock.

CRs-Fixed: 441525
Change-Id: Ic7524d83b32d54b09ba77648a266585957f49648
Signed-off-by: Manish Dewangan <manish@codeaurora.org>
qdsp5: mvs: Fix kernel panic due to early closure of endpont

MVS driver closes the RPC endpoint while it sends reply to the
RPC read sometimes. The RPC write for this reply results in
crash as endpoint is already closed.
Wait for RPC read and reply to complete before closing the
endpoint.

CRs-Fixed: 443706
Change-Id: Ia1918082118f23ab9aefec1c3a04908d8d8c1199
Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>
msm: audio: qdsp5: Add support of dynamic re-enable of post proc

DSP can disable the post processing features due to unavailability
of MIPS during video playback. As a result difference in audio
quality is observed after video playback. Add support to re-enable
the post processing features once video playback ends and MIPS are
available.
DSP sends a message whenever post processing features are disabled
due to unavailability of MIPS and sends another message once the
MIPS are available. AUDPP driver broadcasts these messages to all
the relavant clients which keeps track of disabled features and
re-enables them when re-enable message is received from DSP.

Change-Id: Ic4cad4e7b0afe4377006055417ba193b01cce930
Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>
msm: adsp: Avoid preemption during driver registration

Prevent the scenario where platform_driver_register(adsp)
is called first but kworker from RPC router preempts it
before it finishes driver register.

CRs-Fixed: 448408
Change-Id: I2022200413fb77a073e10bd19b8fff82a3e3d46e
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
qdsp5: audio: Fix crash in audpp driver due to invalid state

AUDPP driver state is not reset if disable fails and this
results in crash as next AUDPP enable assumes that it is
already in enabled state and tries to access some invalid
data

CRs-fixed: 471094
Change-Id: Ibcb5c83e110d2e09f5d3d15c62e12fbbbc040bb4
Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>