fmradio: enable STE radio

Change-Id: Ieb666f1f0cdd267f35157d9663491ccc55ba2be5
AudioSessionOut: Fix to handle a single write() with an empty buffer

- This fix is a workaround to exit cleanly in the case where the AudioSink
  write might give just a single zero length buffer to the driver.

Change-Id: I68d023e6f0bd5b5e4f593a42b26c685e3405288b
CRs-Fixed: 445182
Merge "AudioSessionOut: Fix to handle a single write() with an empty buffer" into cm-10.1
alsa-sound: Adjustment for tunnel mode buffer size

- Make necessary adjustments to align the buffer size
  for tunnel mode playback to satisfy the following condition
- Buffer size is a multiple of LCM(1,2,4,6,8)
- Buffer size is aligned to 4k.
CRs-Fixed: 447274, 442365

Change-Id: Ieb188cba6945b96e99bad4ceba4b53112383fd57
alsa_sound: use "Voice Speaker" instead of "Speaker" when in calls

This change enables the use of "Voice Speaker" usecase when in-call,
instead of "Speaker". This permit us to control then volume of
speakerphone, without change normal speaker volume.

Change-Id: Ied491fc972124a31d53c25743728a407906e8920
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