audio: invoke CSD client APIs only for Fusion3 platform

- CSD client APIs are only used for Fusion3 platform.
  Always check platform_is_Fusion3() before invoking CSD APIs
- Miscellaneous fix for QCOM FM and ANC flags
  in AudioPolicyManagerALSA

Change-Id: I549b602cd782b737bf75a69e5cabd776547aa0ca
alsa-sound: fix typo

Change-Id: Idce1c52077b14a491cfa5156db16898d35094b79
alsa_sound: Initialize the mPfdProxy in constructor

The uninitialised variable of the proxy parameter PfdProxy in the
ALSADevice constructor is initialized to avoid unnecessary call to

(cherry picked from commit 6d812e2cba18aba1c40159b5e5194d225534235a)

sys_close::lib_close without the proxy session enabled.
CRs-Fixed: 428656

Change-Id: I6ab4f02af3aa67efdf90e61a04c7824df143c35e
msm7630 : Send proper channleMask for getInputProfile()

-Unable to perform Voice call recording.
-Unable to find profile for the device.
-Update proper channelMask for getInputProfile().

Change-Id: Ic67a1d59c4ea54ecccab2958e3c94672282f710f
alsa_sound: Fix for no audio when switching between BT headsets

- mExtOutStream is not initialized in openExtOutput() but set to
  NULL in closeExtOutput() while disconnecting BT device.
- Initialize mExtOutStream in openExtOutput()

Change-Id: I3ae5f20f0cce0b8a10878a574561ac32aa3e898b
CRs-Fixed: 446922
 Fix for MT call ringtone on USB headset

- Issue:when usb headset connected MT call ringtone heard
  only on speaker and expected behaviour is ringtone should
  be heard on both speaker and usb headset.
- Fixed by defining combo device usb proxy rx speaker

Change-Id: I511b3c209f89506d6b3b3fa25067069e2107e12d
CRs-Fixed: 443227
audio: fix to play Skype calltone on earpiece instead of speaker

- Google's default AudioPolicyManager uses earpiece for Skype
  call tones, remove the code to select speaker in phone
  strategy if not in call.

CRs-Fixed: 421065

Change-Id: I4c2421e081d3ab6f7a496bacff91732dfb3cbe9c
alsa_sound: Set tunnel/lpa bit for playback over usb headset

-The tunnel/lpa bit was not being set in all scenarios when
 playback happens over usb headset.
-This resulte in no audio when trying to play the next tunnel
 mode clip.
-Fix by setting the lpa/tunnel bit if the device is usb and
 playback session is tunnel or lpa.

Change-Id: I6721a508e034c836a4aae5cc98cebb6236ee14d0
CRs-Fixed: 447677
alsa_sound: Fix for Audio routing to HDMI when BT connected

Currently when BT is connected Audio routes to HDMI when
HDMI is plugged in and expected behaviour is audio should
route to BT only as BT has higher priority than HDMI.This is
because route function is being called with HDMI device in
openOutputStream. Removing the route call will fix the issue.

Change-Id: I76933b7f19498023ad2739e6b0305d36a2c77bb6
CRs-Fixed: 451268
alsa-sound: AudioSessionOut optimization

- Skip memset(0) for tunnel mode playback in write()
- For LPA playback, call memset(0) only for partial buffers

Change-Id: Ia3cec99afa3bd9750298ebbe7aa6c5fc2ebed927
CRs-Fixed: 444041
alsa_sound: Fix usb headset record noise

-Issue: recording with USB headset has noise
-Fix: Increase the period size to 2048 so that
 number of times that the poll event executed is
 reduced which inturn matches proxy writes to DSP
 in real time

Change-Id: I5a566ce413f0c5c10cf30817b7b4095a2f45c6fa
CRs-Fixed: 426421
alsa-sound: Avoid use of extra bytes to signal seek processed

- A few bytes were reserved in the buffer written by the AudioSessionOut
  client to indicate a seek has been processed and there
  is no need to skip it.
- We won't need this method anymore and its expected the client
  take care of this.

Change-Id: Idfdeb3d41320e3e332424c13638c66ed200c0fee
alsa-sound: Use errno to check for error code of ioctl()

- ioctl() calls by definition must return -1 on failure with
  the error type set in errno.
- Therefore, the return value must not be used
  to check the error type for a failed drain ioctl().
- Use errno instead.

Change-Id: I4d6814bd0da678feaeef17bae83008d4c7376233
hardware/qcom/audio: fix memory leak in alsa_ucm.c file

 - Free the current device if no valid device is found in
   set_controls_of_usecase_for_all_devices function.

(cherry picked from commit c03520e5e6c9fe7ec35ddcb510a8ab53ebb023b5)

CRs-fixed: 421414
Change-Id: I759baaa8b3257950aa712fc2aaa28aa38a064a21
alsa_sound: Fix to prevent additioal doRouting call

- During an MO VoLTE call if BT is connected then
  no sound was heard on either side.
- When the Call state was updated for VoLTE,
  doRouting was called, which tried to set BT with
  A2DP profile as the device if BT was connected.
- Added a check to call doRouting only when an
  ACTIVE or HELD call's state is being changed.

Change-Id: I8422c024e52abd99836cadd15a2d5df9d36f2eea
CRs-fixed: 446294
audio/msm7630: Add usb audio hal profile.

remove USB ACCESSORY support from STRATEGY_PHONE to force speaker

Change-Id: I080d1e547310d48b43bdf9bae8ee789887766b3c
audio/msm7630: Fix the issue of voice call when HDMI connected

- Voice call is not working when HDMI cable is connected.
- When HDMI is connected getDeviceForStrategy is picking
  up HDMI rx as active device, because of this voice call
  is not working.
- Avoid updating the HDMI as active output device, when
  strategy is STRATGY_PHONE.

(cherry picked from commit 93bc81a7cd494373c19e5611fed060732a14b31b)

Change-Id: I74be601f771883d9dfecc751994a4068acaf2d03
7x30 : Port heap mask change to ion

-mp3 clips fails to play intermittently.
-ION fails to register with the driver.
-Heap mask field passes as argument at allocation
time to specify ion heap.

CRs-Fixed: 444197

Change-Id: I35b7f162c906b856b7b4f5ee2270cd10256144bf
Merge remote-tracking branch 'cm/cm-10.1' into jb-4.2