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
msm8974: Set micbias flags for common device

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