defconfig: added test tag to kernel
msm: audio: qdsp6v2: Fix the issue of memory unmap

- Target freeze observed during monkey run.
- Memory unmap getting called from interrupt context,
  which is causing scheduling during atomic operation.
- Avoid calling memory unmap from interrupt context.

(cherry picked from commit a64fae9ba272ba2f689f30bc7b33c8a1fe4445e5)
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>

Change-Id: Iab9372ba1b2d560c7e161f39483478f0342ac30a
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
msm: audio: qdsp6v2: Add size safety check to ACDB driver

Check that the size sent by userspace is not larger
then the internal amount allowed. This protects
against overflowing the stack due to an invalid size.

Change-Id: I8230fdb00a7b57d398929e8ab0eb6587476f3db1
CRs-fixed: 470222
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
msm: audio: qdsp6v2: Fix seek issue in tunnel player

- Seeking to 0 position during tunnel playback, music stream
  jumps to incorrect postion.
- Initial buffer after seek to new position is corrupted as
  flush ioctl is not synchronous. Ioctl FLUSH is posting
  CMD_FLUSH to DSP, but WRITE_DONE to user space are posted
  even before it receives FLUSH ack from DSP.
- Fix is to wait for FLUSH ack from DSP, then post the
  WRITE_DONE events to user space, which will ensure FLUSH
  is completely handled.

CRs-Fixed: 425420,458910
Change-Id: Ieca3353dba3a67af39a2967659034f073acf5277
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/qdsp6v2/audio_utils_aio.h
	arch/arm/mach-msm/qdsp6v2/q6audio_v1_aio.c
msm: audio: qdsp6v2: Fix command sequence issue in Non-tunnel player

The CMD_CLOSE and CMD_UNMAP needs to be sequentially sent to dsp.
Avoid sending CMD_UNMAP if CMD_CLOSE is not sent.

CRs-Fixed: 485051
Change-Id: Ic6dd9775b0aea218874161b8a44dc0286608616c
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
arm: msm: qdsp6v2: update to finite loop

The reason why the original code requires infinite loop
cannot be accounted for. However, it seems reasonable to
wait for 10 minutes.

Change-Id: I057f7ac8a83585abbc4ccd63a721df82f71ea045
Signed-off-by: Patrick Lai <plai@codeaurora.org>
msm: audio: qdsp6v2: Fix voice RTAC.

There was data type mismatch which caused the corruption during
memory copy. It leads to the voice RTAC failure.

CRs-Fixed: 391392
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
(cherry picked from commit 823fd65d9eef2f728b343fe0e891122f226b887e)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
(cherry picked from commit 0ce787caa67c0c215edde3be28b578c183a6f337)

Change-Id: I19c000d2c5bc3e08a57be6e4e4036b37140badbf
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: audio: qdsp6v2: Fix WMV stream resume issue

- Suspend phone while WMV clip playback is going on.
Resume it, clip fails to play.
- At resume of WMV clip, Pause is issued initially
to driver. But there is a bug in pause API which is
not returning appropriate result. OMX component when
starts playback, it now issues resume to driver and
driver is setting DSP to run state even before ENC_DEC
params are set.
- Fix pause code to return error value if driver is not
enabled. This will avoid driver in sending CMD_RUN
before ENC_DEC command.

CRs-Fixed: 394756
Change-Id: Ic5f0b4fc92b2892885fe2ff2c86593bd269041ea
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
(cherry picked from commit 92ad28cd56803b451ae4bde72bfd20021c769649)
msm: audio: qdsp6v2:  Check return code from audio_aio_open()

When audio_aio_open() is triggered in blocking fashion, it  frees audio
resouces and returns error code. In the current implementation,  callers
did not check the error code which can lead to dereference to freed
resources and cause system crash.  Update the callers to check return
code and then return error back to application to avoid the issue. In
the meanwhile, update the audio_aio_open not to free memory for caller
and leave the caller to free the memory in error condition.

CRs-fixed: 436653
Change-Id: If4dda158cb988c5837517817b1afa0572c30696e
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/qdsp6v2/audio_amrnb.c
	arch/arm/mach-msm/qdsp6v2/audio_amrwb.c
	arch/arm/mach-msm/qdsp6v2/audio_evrc.c
	arch/arm/mach-msm/qdsp6v2/audio_mp3.c
	arch/arm/mach-msm/qdsp6v2/audio_qcelp.c
	arch/arm/mach-msm/qdsp6v2/audio_utils_aio.c
	arch/arm/mach-msm/qdsp6v2/audio_wma.c
	arch/arm/mach-msm/qdsp6v2/audio_wmapro.c

Conflicts:
	arch/arm/mach-msm/qdsp6v2/audio_amrwbplus.c
msm: audio: qdsp6v2: Fix for kernel crash during stability

- Userspace calling AYSN_READ during flush, READ_DONE ack for
  this is coming after FLUSH_DONE which is hitting BUG_ON as
  buffers are removed from in_queue/out_queue during flush.
- Fix is to avoid sending READ requests to DSP until flush
  is complete.

CRs-Fixed: 485288
Change-Id: Ia2a64471a3507b3f5565b695c40cc6dd9081930d
Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
msm: audio: qdsp6v2: Set end of frame flag to avoid aac multiseek issue

- During aac playback, multiple seek lead to target freeze.
- DSP starts decoding when internal buffer size maximum is
  reached, hence, if there are corrupted frames in that buffer,
  the entire set will not be decoded. This results in target freeze.
- Fix is to set the end of frame flag in the buffers that
  are sent to DSP for decoding.

(cherry picked from commit 08508ac42fed7b1e3a7a9b7e098dfb4ceff8b836)

Signed-off-by: Swaminathan Sathappan <Swami@codeaurora.org>

Change-Id: Ic34272222dcb1df42d7e2fe5d028d513b8cf452f
Signed-off-by: Neha Pandey <nehap@codeaurora.org>