alsa_sound: A2DP playback changes on jellybean

-Re-design for A2DP playback for changes. Data is read from
 proxy port and written to A2DP HAL. A2DP output is opened
 and configured from 8960 AHAL.

Change-Id: Icb373f882a99ff2a091e32a902811226ada77140
(cherry picked from commit 7c733664750e8c0ba45e8282f5195d536db00520)

alsa_sound: Fix for no audio on A2DP after pause and resume

- No audio is heard on A2DP headset after resuming audio playback
  after pause for more than 5sec.
- On long pause, the output stream is set to standby and the A2DP
  playback thread is suspended. But while resuming the playback,
  A2DP thread is not restarted which results no audio on A2DP.
- Fixed the issue by starting A2DP playback on first write to
  audio HAL on resume.

(cherry picked from commit d3ae028c373135615cfeeef0d670fe27693f9d99)

Change-Id: I2c1ddf751630b459d59d9e2e7d3bcca94c7d4330

alsa_sound: Fix for audio not routed through WiFi display

- DEVICE_OUT_PROXY is overwritten by A2DP device
- Switch to A2DP device only when DEVICE_OUT_PROXY is not set

(cherry picked from commit 2361761fb4ee2417cf84e73125f875936d6a285f)

Change-Id: Iea5e9934a4939bd71575faca4fd9c3627b48f7fc

alsa_sound: Fix for audio loss during BT power ON/OFF

 -Currently when BT headset is powered off audio HAL does not
  stop A2DP playback thread as we are calling suspendA2DPplayback
  in standby function which is causing audio loss when BT is
  conencted back. This is because dorouting is not called when
  BT is reconnected and is not teared down path previously
 -Fixed by calling stopA2DPplaybcak in standby function which
  will stop A2DP playback and called dorouting again when BT is
  connected again.

CRs-fixed: 391103
(cherry picked from commit 015e6f3bafafb516c4b1c8684d194d279cc47ab9)
(cherry picked from commit f5ca1b342591e21ff8a879ce14d593d6f250b14d)

Change-Id: I8493229e79ea0633ec11599bcd78792015e599ab

audio/alsa_sound: Fix for audio routing to speaker after BT voice call drop

Steps to reproduce :
1. Connect and pair BT.
2. Make a MO Voice call.
3. Play Music. (Both voice call and music is routed to BT SCO)
4. Disconnect the Voice call.
5. Music resumes in speaker

Root cause of the problem :
When phoneState get changed, A2DP suspend flag should be updated first. Speaker was selected

How to fix the CR :
check for device and output changes with proper order

Change-Id: I5043b6807fa48145ded7a268223074a8cf693f69
CRs-Fixed: 392743
(cherry picked from commit 45c2afae5e720fa6c676812db1a7c26cb6899b35)

alsa_sound:Fix for LPA clips audio loss during BT power ON/OFF

-mRouteAudioToA2dp should not set to true in standby function
 which will close all A2DP streams.
-This is taken care  in stopA2dpplayback function so removed in standby.

Change-Id: I61f1b901261cab7ebad9d17491fb8158835aeba1
CRs-Fixed: 391103
(cherry picked from commit 709dd53cae31c31c501accb47026ed9fd00d5c68)

alsa_sound:Fix for voice+Music playback over BT

- Issue: Start Music playback,initiate MO/MT call,disconnect call
  and music should resume but Music plaback resumes and stops after
  1 or 2 secs.
- Rootcause is because of standby function called after 3 secs of voice call
  end which in turn calls stopA2dpPlayback function
- Fix: Deal with lowlatency use cases over BT seperately.

Change-Id: I79d65f72dffbdb32c1859fba6b3607c8afe5eb52
CRs-Fixed: 398060
(cherry picked from commit 76841ce85e73f3e333adf321d615cf4eec383e7f)
(cherry picked from commit fc8e6b8efddd690656fcb3c15c43196c7176067a)

alsa_sound: Fix for no audio in BT after standby is called.

When BT is connected, and there is no audio for three seconds,
standby is called. But pcm device close was bypassed in the case,
when BT device was connected. Due to this mRouteAudioToA2dp was not
getting set to true in subsequent playback and hence a2DpPlayback
was never getting started.

Make a fix to close pcm device even when BT device is connected

Change-Id: Ice455455063179c82640b9fef9fdab7c002b615c
CRs-Fixed: 409889
(cherry picked from commit 41d8544b953cc5f0f3d8ac0316df60ff631811fc)

alsa_sound: Fix for no audio in music+ringtone concurrency on A2DP

- While playing audio on A2DP, if we go to settings and select a
  ringtone, the audio is lost. Expected behavior is that the ringtone
  should be heard on both A2DP and Speaker and music playback muted.
- While A2DP playback thread is reading data from proxy, if the
  device switch is done from A2DP to A2DP+Speaker, the proxy device
  is disabled and re-enabled which results bad state the A2DP playback
  thread.
- Fixed by stopping A2dp playback and resuming after the routing is
  complete.

Change-Id: I413540404d173a6c0d15c7704ee6e2efeab0887e
CRs-Fixed: 392353

alsa_sound: Shush the logging

Change-Id: Ib6bdafc600b66489868b0b18846446bb08cc8426
audio/msm8660: Fix for Mute not working in VoIP call

- In VoIp call mute option is not working
- Due to wrong device selection, PCM recording path is selected, instead
  of MVS Tx path, for VoIP tx.
- Enable MVS Tx path for VoIP uplink.

CRs-Fixed: 406977
(cherry picked from commit 9941ecfadc64514f4de8f4962b238d623aac52ce)

Change-Id: I5e2525938107a0c6a7115038d85419c4b886d5fe
(cherry picked from commit b4f3bad309e6fd0a9b39c10a64ef3bcb1141b373)
Merge "audio/msm8660: Fix for Mute not working in VoIP call" into jellybean
Merge remote-tracking branch 'cyan/jellybean' into jellybean