alsa_sound: Patch to fix device switch in skype

-During a skype VOIP call, device switch to speaker is not working
-When a device switch is attempted in skype during VOIP call, skype closes
 the existing record/VOIP tx session, re-opens it and sets the tx device
 which is BUILT_IN_MIC, due to the limiation in HAL, for a BUILT_IN_MIC
 device handset_rx is picked up instead of speaker_rx, also the
 SetForce() value is not considered due to this.
-Fix is to check the current rx device in audio HAL and picking up
 speaker_rx instead of handset_rx

CRs-Fixed: 453817

Change-Id: I8a5ab4fd7b5ec75958d5db0441285e319688185f
alsa_sound: Use current device to parse edid and configure HDMI device

The device stored in the handle is used to get EDID and configure
HDMI device accordingly. Use the current active device appropriately
to validate and configure if HDMI is the current active device

Change-Id: Ie10bff3fc63b77bb6d056826c14d381295487f3f
CRs-Fixed: 457096
alsa_sound: Fix for audio loss on switching from BT to AOA

-When AOA is connected to device while playback is on BT, usb stream is
 created. The external out stream gets updated with usb stream even
 when a2dp stream is active.
-Update external out stream with a2dp or usb stream in openExtOut only
 if it does not refer to any other stream.

Change-Id: I625ee20ac91ef1be4b21e91fd5e9fffc54a08033
CRs-Fixed: 464457
alsa_sound: Patch to remove delay in second MT call during hold

-When voice call is on hold, when another MT call comes, the ringtone
 is delayed by 6sec.
-This is a special case for fusion, when the voice call is on hold and
 there is another incoming MT call, telephony will set MODE_IN_RINGTONE
 During this there is a change in device from Handset to Speaker,
 this is not propagated to MDM.
-Fix is to propagate device change to MDM during MODE_IN_RINGTONE
 if there is a call on hold already.

CRs-Fixed: 447560

Change-Id: Ia29729bc97a585bd45657e558d04374104e1ce9c
Change to handle A2dp suspend setparameter, which will suspend the thread

When A2dp suspend setparameter is called we were not suspending the thread.
We were suspending it only during stop. This will make sure we suspend the
thread even during the suspend setparameter call

CRs-Fixed: 415399
Change-Id: I49ae25fc028e9d4927fd3d3131c8f97f3e873fc1
alsa_sound: Fix for FM volume issue on USB headset

-Adding FM as a device caused several issues
  such as volume change for USB and other
  devices had no effect. LPA clips were not
  able to play when FM was enabled.
-FM was included as a device along with the
  other actual device that was connected.
  Thus the final device was not the correct
  one.
-Fixed by not adding the FM device in
  the global device variable, instead use
  a local device variable to handle FM. Also
  added setFmVolume changes which earlier relied
  on the device variable to contain FM.

Change-Id: Idfb31a1cc6b8978974650683f4689e8c1efd1a29
CRs-fixed: 418806

Conflicts:

	alsa_sound/ALSADevice.cpp
Merge "alsa_sound: Use current device to parse edid and configure HDMI device"
Merge "alsa_sound: Fix for FM volume issue on USB headset"
Merge "Change to handle A2dp suspend setparameter, which will suspend the thread"
alsa_sound: Fix corruption in recording over usb.

-Sometimes the hardware pointer for proxy driver is not updated for
 successive callbacks. This is because in the recording case proxy
 driver and usb driver runs at real time. This does not mandate
 that the data is read by proxy driver as soon as data is written
 from userspace. Any delay in getting dat from usb also can cause
 the issue.
-Fix is to increase the start threshold of proxy side for recording
 so that playback is not started without sufficient data.

Change-Id: I86384bfc96b8262309a1402ca9fe5744af3b436d
CRs-Fixed: 465317
Merge "alsa_sound: Patch to fix device switch in skype"
alsa_sound: Fix for Tunnelplayer IOCTL drain block

-IOCTL drain was getting stuck when standby was
called after seeking to EOS
-This happens when seek was done to the
end of the stream which would lead to only
a zero length buffer being sent.
In this case, IOCTL drain will block forever
-To solve this, IOCTL drain was interrupted
by calling flush from the context of standby

CRs-Fixed: 467166

Change-Id: I0d119c362670fd4f99b023dd4a1fdebde7832c02
alsa_sound: Configure period count for pcm recording

-While pcm recording is going on, if buffers are not requested from
 dsp at real time then dsp drops the buffers and sends partial
 buffers. This was causing record failures. Pcm recording platform
 driver has 2 periods.
-If system is loaded read request will not be at real time. Add
 flexible period count to pcm record platform driver so client can
 configure the period count.

Change-Id: Ib142411f526f0cde53d5936b0291d84fdee76651
CRs-Fixed: 467746
hardware/qcom/audio: Fix for Crash during Gtalk startup

 -Crash is observed when Hangouts and Gtalk start running
  simultaneously
 -Dirver does not support multiple instances of voip call.
 -Avoid creating multiple voip session if mVoipStreamCount
  is already 2
CRs-Fixed: 440160
(cherry picked from commit b9f1299e4ca8b96907f97914a0cf65fd5a3d3174)

Change-Id: I7ef3cf76394e1469db9d21a1484aacf1251c4f25
Merge "hardware/qcom/audio: Fix for Crash during Gtalk startup"
Merge "alsa_sound: Fix for Tunnelplayer IOCTL drain block"
Merge "alsa_sound: Fix for audio loss on switching from BT to AOA"
alsa_sound: set ALSADevice::mInChannels to 0 after voice call finishes

When a voice call is established, through  enableVoiceCall()
mInChannels is set to non-zero value, so during disableVoiceCall()
it should be reset to zero.

Change-Id: Ic3f39990c7e1820e5c61e063b8c84e160cdd20bb
CRs-Fixed: 467775
Merge "alsa_sound: set ALSADevice::mInChannels to 0 after voice call finishes"
Merge "alsa_sound: Patch to remove delay in second MT call during hold"