ARM: dts: msm: Update the vifeed back routing

Codec clock should be enabled when vifeedback path for speaker
protection is enabled.
Change adds the routing entries to enable the codec clock for
speaker protection vi capture feedback path for 8974.

Change-Id: I6230f5a40a20a3d5e81d194a622083ece8873b79
CRs-fixed: 591723
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
sched: fix race between try_to_wake_up() and move_task()

Until a task's state has been seen as interruptible/uninterruptible
and it is no longer on_cpu, it is possible that the task may move
to another CPU (load balancing may cause this). Here is an example
where the race condition results in incorrect operation:

- cpu 0 calls put_prev_task on task A, task A's state is TASK_RUNNING
- cpu 0 runs task B, which attempts to wake up A
- cpu 0 begins try_to_wake_up(), recording src_cpu for task A as cpu 0
- cpu 1 then pulls task A (perhaps due to idle balance)
- cpu 1 runs task A, which then sleeps, becoming INTERRUPTIBLE
- cpu 0 continues in try_to_wake_up(), thinking task A's previous
  cpu is 0, where it is actually 1
- if select_task_rq returns cpu 0, task A will be woken up on cpu 0
  without properly updating its cpu to 0 in set_task_cpu()

CRs-Fixed: 665958
Change-Id: Icee004cb320bd8edfc772d9f74e670a9d4978a99
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
misc: Kill logspam

Change-Id: Ida0b1eaeda4c678f0103675b44a8cc845f3dacbf
ASoC: msm: Rampup volume on each start

Rampup volume on each trigger start call to compress driver.
This helps in reducing pops heard by the listener after a seek/pause+resume

Change-Id: I0d82c5a9a8ed2b64683e8c0855da2208c90d8199
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
CRs-Fixed: 692337
mfd: wcd9xxx: Add support for REPEAT_CHANGE_VALUE

Slimbus supports ability to write upto 16 bytes to the same register as
one transaction on the bus through REPEAT_CHANGE_VALUE slimbus message.
Add support to write codec register with multiple values using
REPEAT_CHANGE_VALUE. Not all sizes from 1 to 16 are supported by such a
message, add support in driver to be able to write all sizes from 1 to
16 by splitting the register writes of unsupported sizes into multiple
writes of supported sizes.

Change-Id: I33fdd983068bc10f65523b2a95f1d7741fa6c486
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: Don't enable micbias if headset is removed

If special headset is removed, the callback to
disable micbias will be called, as micbias is
always on with special headset. Mbhc driver
checks a flag, used to disable/enable micbias
for special headset, to make sure micbias is
not disabled by recording. If this flag is not
updated properly before the callback is called
while the headset is removed, it can cause that
micbias is left enabled.

CRs-Fixed: 687630
Change-Id: Id49a2a0ba43821deef8fc5b6fb904239b2273f69
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
ASoC: wcd9320: Update condition to disable HPH PA after impedance detection

For headsets with threshold on mic, the flag hph_pa_dac_state gets
cleared once they are re-inserted into headphone jack with hph pas
are still ON. This causes impedance detection to disable the PA after
impedance computations. This will result into audio mute. Avoid the audio
mute by updating the condition to disable PAs.

Change-Id: If27c020be94f756aa14899fc6f8e2e591c635df2
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9320: Check denominator for zero before division

Check denominator for zero before performing division
operation to avoid division by zero error.

Change-Id: Ib281bdb53e91f026a8da7330d71327e03574b8b0
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx-mbhc: Disable micbias for impedance detection

If micbias is enabled during impedance detection, it can result into pop
noise on headphone left and right channels. Since micbias is not really
used for impedance detection measurements, it is safe to disable the
micbias during impedance measurements.

CRs-fixed: 675563
Change-Id: Ibd8cf271cf56cffa405ca1fc3f42d7f0d3da4cb1
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: Enable current source support for 2nd mic detection

Use current source to detect presence of second mic if MICBIAS
for primary and secondary mic is not shared. If MICBIAS is shared,
do not use detection with current source.

Change-Id: I25009bd15cf5a593761d8b182ed4bcb6c2c210a2
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
ASoC: wcd9xxx-mbhc: Avoid flipping current source setting

In some cases, the current source switch on codec is disabled and
enabled again where it could have been left in enabled state. This
flipping of current source setting is causing a pop on the headphones.
Add fix to avoid this unnecessary flipping of current source switch.

CRs-fixed: 675563
Change-Id: I891d7a8da6957a10c8c38f39ff024a90c17bde7b
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9320: Add ANC loopback path and cache HPF bypass control

Add route to connect ANC FB tune signal back to decimator
DEC7 to DEC10. These paths are used to evalute the device acoustics
and provide a way to tune ANC algorithm. In addition, a logic is
implemented to cache the TX HPF bypass control to allow user
bypass the TX HPF during ANC tuning.

Change-Id: Id6b8a046480fcfb5a4d0fb1876f7c364796d4378
Signed-off-by: Jay Wang <jaywang@codeaurora.org>
ASoC: wcd9xxx: Correct wrong check conditions

1) For targets where micbias is shared, we do not
use vddio to identify special headset. We want
micbias to be enabled always with any headset
inserted for such targets. Currently, if headset is
inserted during recording, we check for this vddio
flag as well. Since, it is null for the above mentioned
targets, we never touch the code to enable micbias
always for any type of headset.

2) Again for the above mentioned targets, if micbias
is enabled by voice call, and we insert the headset.
Now if headset is removed, we try force diable of
micbias. This results in Tx mute. The count to disable
micbias needs to be corrected.

Change-Id: I022a54578c47485ebf7eef27c405e31ea6395ecf
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
msm8974: Clean up Oppo audio configurations

 * Remove deprecated options from DT

Change-Id: Ibb08426b01fecf3b335aecaaeb53e613339f5155
asoc: msm: Untangle the external micbias control for wcd9320

 * Use standard on-demand supply for external micbias and
   clean up the code a bit.

Change-Id: Iffeb246e482481dfb682e88a18ae8f42bed6650c
asoc: msm: Adjust MBHC thresholds

 * Revert Oppo damage- these are wrong after revert to QC version
 * Reduce delta to 10mV for correct detection when headphone is active

Change-Id: I6611ebeb09f60fb4cda48ba042bc1623544d688f
ASoC: wcd9xxx: switch to VDDIO while recording is on TX1

On Tapan, ADC2/3 are same and there is coupling between ADC1
and ADC2 due to this there is polling noise in the recorded
audio when IN1/IN3 path is used for the recording with
headset inserted.Switch to VDDIO to avoid polling noise
to be captured in the recorded audio

CRs-Fixed: 696178
Change-Id: I34e96f31ce9460b77eae7a82803015995cce3641
Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
ASoC: msm8974: Add VoWLAN dia link

Add VoWLAN dai link to the machine driver
to enable Voice over WLAN.

CRs-fixed: 662362
Change-Id: I3ada1f10436e5724670052901b648f46885d3bf6
Signed-off-by: Vicky Sehrawat <vickys@codeaurora.org>
asoc: wcd9320: Use class AB headphone path for high-res formats

 * The class AB path is less efficient, but has a lower noise floor.
 * Enable this path for 24-bit or high (>96KHz) sample rate, as this
   tradeoff is worth it with lossless, high resolution music.

Change-Id: I0bf4e6f366e987f17d86b4e967e3bc8b40d86ed3