ASoC: wcd9xxx: Report lineout immediately

If extension cable is inserted into the jack, it
is taking 5 sec to report the insertion. Reduce
this delay by reporting high headphone immediately.

Change-Id: I904f232ede585c39c6b600692ddb8750b848ebcd
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Notify mbhc when TX1/IN1 path is enabled

Notification is sent to mbhc whenever TX1/IN1 path is used
for audio capture. MBHC then will switch to VDDIO if headset
is inserted. This is to avoid polling noise that gets captured
in the recorded audio due to noise coupling in hardware b/w
TX2 and TX1 paths.

Change-Id: Iac40f41572d1417d2afdc55438d86c047710824f
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Fix RX Ear register gain values

Rx Ear Gain register on WCD9306 supports different gain
values from 6DB to -12DB. It was wrongly configured with
2DB. This change fixes the issue and adds support for
correct gain values for Ear PA Gain.

CRs-Fixed: 520688
Change-Id: I6493cf63a1d36d9c9c0a3086b645b92f8c3de588
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: dapm: Convert pin switches to use snd_soc_card

Since the addition of the non-CODEC control adds card controls like the
DAPM pin switch have been broken as they are expecting the private data
for the control to be the CODEC but it's now the card. Fix that for the
pin switches, an audit of other drivers is required.

CRs-Fixed: 567030
Change-Id: I7333c14d944a5fb6c18d59888438911bca556791
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: dapm: Use DAPM mutex for DAPM ops instead of codec mutex

It has now become necessary to use a DAPM mutex instead of the codec
mutex to lock the DAPM operations. This is due to the recent multi
component support and forth coming Dynamic PCM updates.

Currently we lock DAPM operations with the codec mutex of the calling
RTD context. However, DAPM operations can span the whole card context
and all components.

This patch updates the DAPM operations that use the codec mutex to
now use the DAPM mutex PCM subclass for all DAPM ops.

We also add a mutex subclass for DAPM init and PCM operations.

CRs-Fixed: 567030
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Change-Id: Ica9e4654558fd181e1d85e70576fa262f76b4a78
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: dapm: lock mixer & mux update power with DAPM mutex

Both snd_soc_dapm_mux_update_power() and snd_soc_dapm_mixer_update_power() can
be called internally within DAPM core (with DAPM mutex held) and externally.

Provide some wrappers so that external users of both functions do not have to
remember to hold the DAPM mutex.

CRs-Fixed: 567030
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Change-Id: I54172ba20edb352c813a28676059df2ec7aaaa18
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: dapm: Change mutex lock subclass in dapm

Address the compilation issue by changing the subclass
enum in mixer/mux power update dapm functions

Change-Id: I3946cf2a5c6a0b469378d5c0583fd9c8567d4b70
CRs-Fixed: 567030
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: dapm: Fix race condition in dapm

Dirty widget list can be accessed by multiple
paths in dapm framework. Dirty list is protected by
dapm mutex. Since stream_event function accesses the dirty list,
it should acquire dapm mutex instead of codec mutex.

CRs-fixed: 593141, 596103
Change-Id: I9f41bf436b41ba9b4fa3bb447035fd1fe262e76b
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoc: msm : update speaker gain control.

Configuring speaker max gain as 8 in the SPKR_DRV_GAIN register.
Other wise the gain setting when the invert flag is set will differ.

Change-Id: I18ae30c4035088fd439ae00bba2a34aa4e9385a9
CRs-Fixed: 593181
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Add support to change bit rate during VoIP call

Add support to change the bit rate for AMR NB and AMR WB
vocoders while in VoIP call. This change is needed as part of
supporting VoWLAN feature.

Change-Id: Ic486dd7f48aca2c640b2364d00712741b50df4c8
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	sound/soc/msm/qdsp6v2/q6voice.h

Signed-off-by: Dan Trifan <jimsth@gmail.com>
ALSA: jack: Add support to report second microphone

ALSA jack framework currently supports reporting only
one microphone. Add support to report presence of
second microphone to the userspace.

Change-Id: Id0df7aa222e547da3771f5d61092a959394c10dc
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Add support for MBHC 5-pole plug detection

Add support to determine the presence of second microphone
on a 5-pole plug used for active noise cancellation.

Change-Id: I85227a00c47fed1d0e4453b77902c1b473097a5b
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Add support for 96KHz/192KHz sample rate playback over HDMI

Add support for 96KHz and 192KHz sample rate audio playback over
HDMI. A mixer control has been added to select 96 or 192 KHz sample
rate on HDMI backend.

Change-Id: Ic2b46e282236d5b27c30d85b58f65d1625383a21
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	sound/soc/msm/msm8974.c

Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Fixup number of channels for FM transmitter

Backend during FM transmission supports only stereo
channels. Fix up the number of channels to 2 for FM
transmitter.

CRs-fixed: 556019
Change-Id: I453a13ea0a8f27228670e72b41bc10a8560e7d31
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Parse the jack type property

Parse the property from device tree to check
the jack type.

Change-Id: I9d91745ae1faa07501a49e31773e21a11bfe9bd4
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Handle anc headphone detection with slow insertion

When 4 pole/5 pole/6 pole headsets are inserted into jack with
anc support, we need to handle cases of slow insertions as it
might lead to incorrect detection. Reconfirm the plug type in this
case if anything other than headset is found.

Change-Id: I1342425904197240aa39fce59fee497605b56d41
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Use button polling with anc headphone

Anc headphone can be considered as a headset without microphone.
Button polling can be used to catch removal for such headsets.

Change-Id: I786794885e53db74f26a77144683caa3e7d8c52a
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: Add 16 bit PCM as default format for  backend

Add 16 bit PCM as default format for backend. This sets
backend tx format to be 16 bit pcm in case of tunnel mode playback

CRs-Fixed: 593469
Change-Id: Ie686a8e7d2c496f67bbf2a29ba2640037f95e08f
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: qdsp6v2: Change incall recording to be session based

In current design, recording will be enabled for all the sessions.
When multi sims are supported, recording will be started only on
active session.
Refactor incall recording function to start and stop recording on
a specific session.
Add mixer control to set session vsid.

Change-Id: I38bb0d80f812755d2eadb132e7aced3599d2a142
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: qdsp6v2: Add DTX support

Add support to set DTX mode ON/OFF for EVRCB, EVRCWB and
EVRCNW vocoder formats.

Change-Id: I1fcfdb39e22edd4063080be5a0451cb81dcdbdd5
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>