Revert "Revert "ASoC: wcd9xxx: introduce headphone impedance detection support""

This reverts commit d66ea111275be49d9f8d2990e135a2aabf7257d6.
Revert "Revert "ASoC: wcd9xxx: Enhance class H controller to support dynamic CP voltage""

This reverts commit 0e20d572ea6ccf0bd3443303e5106c5eb0cc12f1.
Revert "Revert "ASoC: wcd9xxx: Apply class H parameters based on impedance""

This reverts commit 60d05666497c8e7858c67627c856b5cef15a813b.
Revert "Revert "ASoC: wcd9320: Update buck control and mode registers""

This reverts commit f3287dc86d6d52670198e2bcfb10b98a8b5640fd.
Revert "Revert "ASoC: wcd9xxx: fix class H controller driver to handle concurrency""

This reverts commit bbced114a02a62b33d89b851853c1471289182f5.
ASoC: wcd9xxx: Enable headset in high performance

Invoke class AB sequence for headset path dynamically based on
module parameter. Change enables headset path in high performance
mode when module parameter is set to one.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9xxx: Enable headset in high performance

Invoke class AB mode for headset path when sample rate
is set to 192KHz and bit width is set to 24. Change enables
headset path in Ultra High Quality Audio(UHQA)mode.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	sound/soc/codecs/wcd9xxx-common.h
ASoC: msm: Do not set volume to zero during session open

Setting stream volume to 0 will cause problem when user
starts playback from aplay. The previous volume which is
set gets overwritten with 0 when the playback starts. To
avoid this user space can control the volume setting at
the start of the playback.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Add check for NULL pointer and buffer overflow

Changes to add check for NULL pointer before they
get dereferenced and check for buffer overflows
to ensure out of bound indexes of arrays are not
accessed.

Signed-off-by: Aravind Kumar <akumark@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
ASoC: wcd9xxx: [HACK] Prevent headphone&speaker from clipping

* Buck mode is set to 2V when HPH+Spk combo device has been selected.

Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	sound/soc/codecs/wcd9xxx-common.c
ASoC: wcd9320: Fix for VI feedback underflow errors

VIfeedback capture widget was added in the speaker RX path.When speaker
is enabled, the VI feedback capture widget would be turned on.
During the shutdown of speaker RX path VI feedback codec path is
shutdown first and then the AFE port is closed. This will cause the
underflow errors during the shutdown seqeunce.
Change removes the vifeedback capture widget from playback path and
creates a new capture path.Userspace module will enable/disbale the VI
feedback path via mixer control.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Conflicts:
	sound/soc/codecs/wcd9320.c
ASoC: wcd9320: Add HD2 tuning coefficients for HPH path

Add 2nd Harmonic Distortion (HD2) tuning coefficients
for HPH path. HD2 coefficients get turned ON during HPH
enable and turned OFF during path tear down. Enabling HD2
coefficients would increase the Headphone PA efficiency during
audio playback.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Change compander parameter for 192Khz playback

Update the meter rate parameter for compander in order to achieve
better performance with Compander support for headphone, lineout
and speaker paths for 192 KHz sampling rate. Update the static gain
offset accordingly depending on the buck voltage requested.

Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd93xx: Remove deadlock for ANC use-cases

When calling snd_soc_dapm_sync(), it eventually tries to
lock the same mutex already locked for ANC widgets and a
deadlock occurs. By moving the mutex unlock to just before
snd_soc_dapm_sync(), this deadlock is prevented.
This problem was introduced in Linux 3.5.

Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Change compander parameter for 192Khz playback

Update the meter rate parameter for compander in order to achieve
better performance with Compander support for headphone, lineout
and speaker paths for 192 KHz sampling rate. Update the static gain
offset accordingly depending on the buck voltage requested.

Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: release codec mutex before calling dapm function

DAPM calls will internally acquire soc_card class locks for its
operations. Therefore, release codec->mutex before calling into
snd_soc_dapm_mux_update_power and snd_soc_dapm_mixer_update_power.
This will help avoid deadlock inside those functions.

Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: wcd9320: Fix for audio recording

If multiple mixer widgtes share the same kcontrol,ASoC framework
will create common controls. For audio capture usecase we need
each AIF cap mixer widget to have its own control.
Change creates control for each of the AIF capture mixer widgets.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
snd: wcd9320: Enable class AB mode always

* Enabling/Disabling UHQA runtime causes unbalanced charge pump.
* Keep UHQA / class AB / high_perf_mode always enabled.
* Needs to be tested for power draw.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>