Squashed merge of CM-10.2:

Summary:
alsa_sound: Maintain separate mute states for each call type.

   Mute is not proapagated to CS call session during
   SRVCC handover.

   This is due to mute state is not updated to CS call
   session when SRVCC handover happens.

   Fix is to maintain different mute states to different
   call types, so that mute state will be updated on
   each call type independently.

   CRs-Fixed: 516986

Change-Id: I88a589ce74bba3e4018e0455f0008b5f1cb002e8

alsa_sound : send voc-cal data for play voip use case

- Volume not being changed when playing voicemail
  during MODE_IN_CALL
- The calibration data was not being sent to the DSP
  for the play voip use case
- Setting the current modifier properly
  Permitting sending of calibration data despite
  no change in rx and tx devices

Change-Id: Ice9599941d3d6c115daa63c44bf4a1daa8f50ba3
CRs-Fixed: 508126

Merge "   alsa_sound: Maintain separate mute states for each call type."

Merge "alsa_sound : send voc-cal data for play voip use case"

alsa_sound: primary desc check for sonification

- Audio glitches on alarm expiry if alarm starts
  on screen lock/standby mode

- On alarm expiry alarm tone will start play on combo device
  &screen unlock tone try to play on headset which results
  multiple device switch, as a result audio glitches are audible

- If sonfication strategy is used by primary desc , we will
  treat all non music streams with sonfication stragey which
  will avoid device switch

CRs-Fixed: 514467

Change-Id: I922210ff5d8538dc752a2c3a20676efb05809c83

audio: fix for volume burst during FM device switch

- Issue: Volume burst is heard during device switch
  (headphone and speaker) for FM playback
- Root cause: delayMs passed to CheckAndSetVolume is
  not applied for FM playback
- Fix: Double delayMs and apply FM volume with this delay

CRs-Fixed: 526553

Revert "Revert "alsa_sound: Calculate proxy port latency""

This reverts commit b7d4839fff30b743458a6e62e94b9413dbbd4da8.

Remove High water mark check in ALSA Device

- High water mark framecount check while reading from proxy
  device is causing issues during A2DP Music Playback
- Remove this check to avoid freeze during A2DP Playback

Change-Id: If066438c9f1886aa29ad57ccba154e0ca970a5f3

alsa_sound: Add boundary check for alsa appl and hw ptr

for continuous playback the hw_ptr and appl_ptr may go beyond boundary.
The overflow check is required to ensure boundary check.

CRs-Fixed: 483203
Change-Id: I8c56a97ad1cc2a895f904bb9c03f23714ea61035

alsa_sound:Removed AWB from tunneled-input-formats

-AMRWB recording is failing because tunnelled mode is
 getting enabled in Sound Recorder use case
-Fix is to remove AWB parameter from tunneled-input-
 formats as it is not supported on A Family devices

Change-Id: I0cfc9b62639dfd179bc13af0988776a6c89999da
CRs-fixed: 521809

libalsa-int: Check for valid mixer control

 When the mixer value is NULL , the mixer_close function
 crashes.
 Added a check to make sure that only a valid mixer function
 is handled

 CRs-Fixed: 516186
Change-Id: I61a45e4fbc68fbd82fdcb8f372e5b66a36487f2f

alsa_sound: Fix to Support in-call uplink recording

Uplink recording during voice call fails as the case was not
 getting handled while opening the input stream.
 -Added support for Incall Uplink recording in openInputStream.

GTalk call doesn't work if call is started during an existing
 recording session. All subsequent calls are failing after this
 scenario
 - Move the pcm device node open to read() call instead which will
   avoid opening the pcm device node of normal recording session
   and doesn't go into the error state. This will allow GTalk call
   to work and also all the subsequent calls to work

CRs-Fixed: 517810
Change-Id: I440ac4090b9f3e3a70b8acb4a818cfbf97e8c868

alsa_sound :Starting "UsbRecordingThread" if not started

- Recorder stop() was getting called in hangout app before the
  call got connected, this will stop UsbRecordingThread.
  Recorder set() is called with a sample rate of 48k due to which
  the USB recording thread doesnt get re-started because for VOIP
  the sample rate expected is 8/16k.

- UsbRecordingThread has to get started when the call
  gets connected.

Change-Id: I12c4d1f473224de7df2041f22fdc45cf77ac4acb
CRs-Fixed: 516270

alsa_sound : send voc-cal data for play voip use case

- Volume not being changed when playing voicemail
  during MODE_IN_CALL
- The calibration data was not being sent to the DSP
  for the play voip use case
- Setting the current modifier properly
  Permitting sending of calibration data despite
  no change in rx and tx devices

Change-Id: Ice9599941d3d6c115daa63c44bf4a1daa8f50ba3
CRs-Fixed: 508126

Merge "audio: fix for volume burst during FM device switch"

msm7x30: fix -Wreorder warnings

Signed-off-by: Michael Bestas <mikeioannina@gmail.com>

Change-Id: I0a9a8989dd153e99a474da4a2f6c37dc068227fd

alsa_sound: Fix CAMCORDER_TX use case

* Enable use case by setting BOARD_USES_SEPERATED_CAMCORDER

Change-Id: Icabb0073f85e65455d5bbeae9b9b6956a8a78b90

alsa_sound: Add support for custom LPA buffer size

 * On msm8930, during playback over A2DP with DSP Manager effects enabled,
   there's a lot of stuttering with the default buffer size. Stock kernel
   used a buffer size of 32, but that caused no audio at all in CM because
   of mismatch in buffer size between kernel and user space. So up until
   now I've been using a buffer size of 256 to get audio working at all,
   but unfortunately it causes stuttering as mentioned. Hence add support
   for a custom buffer size so we can revert to stock value used in kernel,
   and enjoy no stuttering.

Change-Id: I29113cee46d0adcc72a8c9c830e4c15d9fdd43dc

Merge "alsa_sound: primary desc check for sonification"

audio: libaudioamp: add hooks to open/close for amplifier init

Change-Id: I64e8cafad3e5eb872f2924eabde9b5dbfc947710

alsa_sound:  Fix to avoid crash while erasing item from mDeviceList

-In AudioHardwareALSA's destructor,while erasing item from mDeviceList
is leading to crash in current implementation, if List containing
more than one item.
-This is happening because of Invalid iterator value after deleting
current item from List, then using same iterator for next operation.
-It can avoid returning an Iterator item form List's erase function
and then use it for next operation.

Change-Id: I30ba5b5a9904c1d3cad1f470f9fae84d23a90aa5
CRs-Fixed: 517101
(cherry picked from commit 41d7bad968b94bc8ac1d6ea92849b2792604963e)

Merge "alsa_sound:  Fix to avoid crash while erasing item from mDeviceList"

alsa_sound: Fix Echo reference logic

-During Skype call , there is Echo hearing at far end device.
-This is happening because Echo reference is setting after enabling
 the devices, so a wrong EC reference id is sending to DSP.
-Echo reference should be set even before enabling the devices.

Change-Id: Ibd23dd9be11c7b1ae882a633be3d55779bc72c7c
CRs-Fixed: 536541
(cherry picked from commit d0dd74fbaff448194f49057fe3e16c16debc8f02)

Revert "audio: libaudioamp: add hooks to open/close for amplifier init"

This reverts commit 5507a6b2fd06e0313df55f8c1bd46296e977f628.

Depends on an incomplete change device-side.

Change-Id: I6ac49669a8e81dacc44804e7dae11c0a8e3ee65d

Revert "Revert "audio: libaudioamp: add hooks to open/close for amplifier init""

This reverts commit d29144f22c0269ae223db8fb3545962526e0a0c9.

Change-Id: Ia1434020a8719002a6a0096a0661b628ed400ca3

Merge "alsa_sound: Fix CAMCORDER_TX use case" into cm-10.2

Merge "alsa_sound: Add support for custom LPA buffer size" into cm-10.2

Merge "msm7x30: fix -Wreorder warnings" into cm-10.2

Merge "alsa_sound: Fix Echo reference logic"

alsa_sound: Fix audio over Miracast

 * We're not using QC's proprietary WFD solution, so pick the remote
   submix instead of the proxy.

Change-Id: Ie32a4591a27f17e2a1d0b87b5f5a7b8b320ff169

Merge branch 'jb_2.5' of git://codeaurora.org/platform/hardware/qcom/audio into cm-10.2

Change-Id: If58c40a26d116bbc9379237499682dcb4f700197

alsa_source: Undo the proxy/latency changes

 * This change causes problems on 4.3, revert it all.

Change-Id: I1d703e379fa9949fb4d8d51c59515acf68a97793

Merge remote-tracking branch 'cm/cm-10.2' into merge_cm

Test Plan: UNTESTED! interested parties test and merge

Reviewers: synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D520