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.

Change-Id: I0ccbe674defbdad638ce5d4378e18d0428003bb0
CRs-Fixed: 356297
CRs-Fixed: 359764
Signed-off-by: Tejas Shikhare <tshikhar@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.

Change-Id: I3b03f56cf988c9471c7988665bcec3c467e60bfc
Signed-off-by: Amal Paul <amal@codeaurora.org>
ASoC: msm: Fixes for underrun issue in LPA Playback

Update LPA platform driver to register restart callback.
The implementation of the callback is to issue a pending buffer
written by the application to restart the session when the dequeue
process is stopped due to underrun issue.
The callback is triggered from ALSA core when the framework
detects that the renderer stopped pulling data but the application
is still writing data. It runs in atomic context.

Fixes:
-A disturbance was heard when switching from one song
to the other, or when the song is paused for greater
than 3 seconds and then resumed
-This was due to the previous value of the track
volume being used in the lpa driver
-This was fixed by setting 0 as the initial volume

Change-Id: I035760937d032038fb3f3383dc87ecbdc5f4700d
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
ASoC: msm: Resume writes only for start command

For compressed and LPA drivers, set pending_buffers flag to 1 only if the client
issues a trigger_start command, not a pause_release command. This flag
is used to initiate writes to the dsp.

Change-Id: I503156863646210b460613a0b9a26a6bfb8854ed
CRs-Fixed: 442269, 449126
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-compr-q6.c
ASoC: msm: Reduce the minimum period size for compress audio

-Reduce the minimum period size for compress audio.
-This allows smooth audio video playback.

Change-Id: I2ba56021fb3f0df5fb3e53cf91baf4b1a5c5690a
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: msm: Add AAC support for compressed audio

Add support for playback of aac clips through
compressed audio driver.

Change-Id: I234a94d291de200eefafea383be5d845c0eaa4b7
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: msm: Add volume support for compressed and pcm driver

Add support for controlling pcm and compressed audio
volume from DSP. Add TLV mixer control to set the pcm
and compressed audio stream volume. Enable soft volume
and soft pause features in pcm and compressed driver.

Change-Id: Ifea8faca39a92127fa91e880b904c0e60c92f9d0
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-pcm-routing.c
ASoC: msm: Add support for AC3 pass through playback

Add support for AC3 tunnel mode playback where dsp acting
As pass through.

Change-Id: Ibc6536a439f7cae8cbbadcaddd4ad27e4ee84543
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>

Conflicts:

	include/sound/snd_compress_params.h

Conflicts:

	sound/soc/msm/msm-compr-q6.c
ASoC: msm: Send a write done for the last buffer

The write done event corresponding to the last compressed buffer
is not notified to the userspace. This event is required to handle
EOS for compressed audio playback. Send a write done for the last
buffer.

Change-Id: I337024cf97537fff5997f89e222a6d19a1e58e55
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: msm: Support WMA playback

Add support for WMA codec in tunnel mode playback.

Change-Id: I1084418a1ccbe63ada78a34b6f8cf532904b919c
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
ASoC: msm: Support WMA Pro playback

Add support for WMA Pro codec in tunnel mode playback.

Change-Id: Iad8d67c77fcd8b6af7db9102f2faf4dde7423f24
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>

Conflicts:

	include/sound/snd_compress_params.h
ASoC: msm: qdsp6: Add APIs for compressed audio playback/capture

Add APIs for compressed audio playback/capture in pass through mode

Change-Id: Ic9b4c71b518e653dae4726112edb75025ccc2bc2
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>

Conflicts:

	include/sound/snd_compress_params.h
	sound/soc/msm/qdsp6/q6asm.c
ASoC: core: Update ALSA core  to issue restart in underrun.

When compressed and pcm session is started the buffer pull will
Be from the DSP, in mmap mode for the scenario Hardware pointer
Is same as application pointer implies application has not filled the
Buffer to be send to DSP, and platform driver has to break and restart
The de queue process when the application has sufficient buffers.

When hardware pointer is same as application pointer it is an under run
Scenario where the ALSA framework has to trigger the under run and in HAL
The session has to re-prepare and re-triggered. based on the stop
Threshold, but in our system the stop threshold is INT_MAX which
Indicates that under run is not triggered in practical cases.

We have a brodcast usecase in which the mentioned under run case
Is hit mulitple times, and every time re-prepare and re-trigger will be
Expensive

Update the ASoC core framework to restart de queue process stopped
By platform Driver when the under run is hit, based on the available
Buffer and render flag, so the System will recover from the hang state.

To restart de queue process the ASoC core will be calling the restart
Callback registered by platform driver and this callback will be running in
Atomic context.

Change-Id: Ic9ea05a0dc6246346e9913493232882e2f5447d1
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
ASoC: msm: Add support for afe disconnect command

For compressed playback to bypass ADM, AFE connect command
Is used when the session is closed AFE disconnect command
Should be issued.

Add the support for AFE disconnect command.

Change-Id: I4cc4e867c1be36fbc2659520fd14a356c8405f7b
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-pcm-routing.c
ASoC: msm: Add metadata mode changes to LPA driver

Playback hangs for three seconds on seeking to EOS. This is
because the lpa driver works on period size. Partial buffers
are not handled. Add metadata mode changes to LPA Driver to
support partial frames.

CRs-Fixed: 458904
Change-Id: Ieb89b59dbca4b40ec0915a286d53c4617c23c471
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-pcm-lpa.c
	sound/soc/msm/msm-pcm-q6.h
ASoC: msm: Update the encode option and sample rate.

Populate the sample rate, encode option in wma config params.

CRs-Fixed: 367243, 367242
Change-Id: Ieeb9d302454d3935faa51cac77021e7c1d77012c
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>

Conflicts:

	include/sound/compress_params.h
ASoC: msm: Add support timestamp update VCAP playback usecase.

Compressed data in HDMI IN or VCAP usecase is propagated with
timestamp from DSP with each buffer. For playback, the same or
interpolated timestamp is updated with the corresponding buffer.
DSP will render the buffer a) without any delay if timestamp mode is
synchronous to absolute timestamp b) with a delay if timestamp is more
than the absolute timestamp c) drop the buffer if the timestamp is
less than the absolute timestamp. Add support for the same.

Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
(cherry picked from commit aa1f5e51dbc251dc758a1f762802d87d4f2128b7)
(cherry picked from commit cb209b8f0bddcedaf26a181f20de696e4ad729bc)

Change-Id: I5b7b2cb405f72ea9afa4751c6a92cde09f40d69c
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-compr-q6.c
ASOC: msm: msm-compr-q6: Use compress_params.h
ASoC: msm: Support independent left-right channel volume control

The current volume sent to DSP is averaged between left and
right channels. As a result with volume level as zero on one
channel and non zero on the other channel results to playback on
both channels. Add support to send left and right volumes to DSP

Change-Id: Icc5f182d138c841607ea356ec37a7f78b4ba770d
CRs-Fixed: 449284
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
Signed-off-by: Jay Wang <jaywang@codeaurora.org>

Conflicts:

	sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c
	sound/soc/msm/qdsp6v2/msm-pcm-lpa-v2.c
	sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
ASoC: compr: change sequence of softvol

As the ASM session is opened in hw_param the soft volume does
not take effect. Hence move it to hw_param so its applied after
asm open.

CRs-Fixed: 434323
Change-Id: I1ce24d74382bd2c1926df2d63ff2eb40b0652f95
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>

Conflicts:

	sound/soc/msm/msm-compr-q6.c