ASoC: msm: qdsp6v2: Add a new waitqueue state for mem map/unmap

All of the commands being sent to the DSP are using cmd_state flag
which can be overwritten when several commands are sent at the same
time. This results in Memory map command timing out. The change will
separate the memory flag from flags for other commands so that they
do not overwrite each other.

CRs-fixed: 673781
Change-Id: I61e059f402feb2c4e1e3dbed1825990456e78471
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
ASoC: msm: qdsp6: Add support to configure ISO and ARIB coefficients

Add support for configuring ISO or ARIB stereo mixing
coefficients. This change introduces a function with which,
AAC multi-channel driver can configure ISO or ARIB coefficients
according to configuration done by the client.

CRs-Fixed: 623127
Change-Id: I00845bdef075631f93a0c65a335b7edb5d10497b
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>
ASoC: msm: qdsp6v2: Do not free memory that has not been unmapped from DSP

The memory that is not unmapped from DSP should not be used until
DSP clears it. Do not free iom memory if the DSP unmap has
failed.

CRs-fixed: 599780
Change-Id: I4ceae34e0f8d6381efc34ce642babbc30ca5e57e
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
ASoC: msm: add support for 256KHz ibit clock

The Low Power Audio Sub-System supports internal bit clock of
256KHz. Add definition for the same for use in audio use-cases.

Change-Id: Idc92595bab37548aa2b2936b57dd6605fae9a1ea
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
ASoC: msm: set IIR1 gain after IIR clock is enable

Sidetone gain is not getting applied when provide gain
value from mixers_path.xml(IIR1 INP1 Volume). The problem
is the volume control is applied before IIR clock/power is
enabled reason is controls to enable the clock are
registered with soc-dapm framework and volume control is
registered with soc-core framework and gets applied before.
Fix is to register a post power up handler with IIR1 clock
power/control widget. This handler reads  register value of
volume gain and re-apply it.

CRs-Fixed: 675099

Change-Id: I32c6de0f20e5e98cab6cddeefac53b8d86d5b71a
Signed-off-by: Ramjee Singh <ramjee@codeaurora.org>
ASoC: msm8226: New soundcard for smartboost

New soundcard implementation for smartboost with TFA9890. It will
be configured on device-tree with following way.

   &soc > sound-9302 > qcom,tapan-codec-9302-tfa9890

For getting "qcom,tapan-codec-9302-tfa9890", we have to place
new soundcard before the original one of "qcom,tapan-codec-9302"
becaused of "msm8226.dsti" aleady has "qcom,tapan-codec-9302"
without the value. The probe function will register the last
soundcard to ALSA core driver. So, smartboost configuration on
device-tree can makes the different soundcard loading

Change-Id: I2da44df411515afa872f836939994330dcee4eba
Signed-off-by: Michael Hong <vktx63@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/566312
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Sriram Divakar <sriramhd@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Jason Hrycay <jason.hrycay@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>

Conflicts:
	sound/soc/msm/msm8226.c
ASoC: msm8226: clean up mbhc_start

Falcon/Peregrine use tpa6165ac for headset detection and doesn't use QC mbhc.
we shouldn't start mbhc as we will fall into uninitilized area,
and we also need to return gracefully to call adsp_state_notifier.

Change-Id: I6e8d60452da4e9f451748b4cd483c64dd9b865b1
Signed-off-by: SeungYoon Lee <w22905@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/618978
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Jason Hrycay <jason.hrycay@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.co
ASoC: msm8226: update the blk rate and the codec name

Changes are
1. Not use the master bit clock
2. Update the new codec name in platform driver

Change-Id: I1d1fd51fa0474532df07148f6aee0a1d3a2ddc0c
Signed-off-by: Zhou Dong <a22255@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/580422
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Jason Hrycay <jason.hrycay@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
ASoC: msm8226: add ext stereo speaker support

Titan has two single-ended external speakers. Control
of external speakers is achieved through the two
gpio's. Logic is added to handle this independently
from the existing single-gpio control of differential ext
speaker used in other products.

Titan also uses top speaker as earpiece. This mode requires
enabling of gpio-52. Add support to switch top speaker
between loudspeaker and earpiece modes.

Change-Id: I31ce7d373c04400462ffbdf982799bad47355a8b
Signed-off-by: Rajasekhar Goparaju <chb764@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/611177
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Vladimir Karpovich <vkarpovich@motorola.com>
Reviewed-by: Jonathan Eklund <jeklund@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
ASoC: compr: timestamp fix for non-gapless mode

Cache last known playback timestamp before resetting the
in use session in preparation for possible re-use of the
same session.

Change-Id: Id422f5654960818c159f9f07d5af3c497192bae2
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
ASoC: msm: Configure correct gain on set Volume command

Output channel gain is product of per channel gain and master gain.
Hence if only per channel gain is set and master gain is set to 0
then no audio is heard at the output.
Ensure that if we change per channel gain then we set master gain
to unity and vice versa. This enables only one gain to be effective.

Change-Id: I4cc2990efbb3e86edcc3d4328761cb64ed8fa775
Signed-off-by: Ashish Jain <ashishj@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
ASoC: msm: set the master gain to 0 on DSP while configuring

- Mute media volume and play any music clip then reboot
  the phone. Play music again noise comes. This noise
  is introduced in DSP/LPASS.

- DSP suggestion is to mute master volume gain while
  configuring ASM session to avoid such noise at
  begining of asm playback.

Change-Id: I2aa2846d6e3e9a85c459534e9108e6fe7aebb962
Signed-off-by: Ramjee Singh <ramjee@codeaurora.org>
CRs-Fixed: 643053
ASoC: msm: qdsp6v2: adding volume per dev-id

Add volume mixer control per device id for pcm use case.

Change-Id: Ieab721541a5cdf494b7fad78abc06d4f667b4baf
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
ASOC: msm: Enable volume mixer for hfp

Enable volume mixer for HFP in afe loopback

CRs-Fixed: 596437
Change-Id: I6ba180b4c700f24e610fbac4abcbbb0d1d57ccda
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>
ASoC: msm: qdsp6v2: add support for dynamic TTY mode change

DSP supports enabling/disabling and changing between TTY modes
while a call is already ongoing. Add support in voice drivers
to enable and switch between different TTY modes.

Change-Id: Idf3372fc3d0205f706584e8b3652dc5e39b4ceef
CRs-fixed: 608183
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
ASoC: msm: Add switch for primary mi2s hostless playback

Add switch widget to route hostless playback to primary mi2s
backend to support voip loopback test or FM.

Change-Id: I8829742674783e9465bdd97d5f94bbae826e0038
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
QDSP: fix merge error in msm-pcm-routing.c
ASoC: msm: qdsp6v2: add support for device mute

Add support for muting the RX and TX devices without affecting
the voice stream. This feature is added to aid in voice call
quality testing.

CRs-Fixed: 634690
Change-Id: I6e4eeda853bb5aa31166d1b66f486142397a6b43
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
ASoC: msm: Add G711 media type support for Voip call

G711 is currently not supported in the Voip driver.
Add G711 media type to existing Voip driver.

Change-Id: If464afa68400ddc63a0b2700d8357511d4435787
Signed-off-by: Prashanth Reddy <pgreddy@codeaurora.org>
ASoC: msm: qdsp6v2: Remove cmd_state from ASM header function

Cmd_state indicates whether the callback has been received
and whether the function should exit wait.
Remove setting of this variable in ASM header because
some functions such as get_session_time need ASM header
but do not need to modify this flag.

CRs-fixed: 613817
Change-Id: I6751cd89b3199c7350aaf1ebb70d7062ac65554f
Signed-off-by: Damir Didjusto <damird@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/q6asm.c