ASoC: wcd9xxx: Correct RCO enable and disable sequence

Correct RCO enable and disable sequence. Add bandgap
enable before setting RCO and disable bandgap after RCO
is turned off. Also, CLK_MCLK_EN_CTL can not be disabled
once it is set to 1 otherwise the digital state machine
on the codec will go in bad state and thus audio can be
muted.

Change-Id: I42b0da47cd68d9a257d69be244cc4e3d05cd4ea1
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: don't release mbhc firmware while it's still in use

When mbhc is de-initialized, driver shouldn't presume it's end of its
life as software reset might be happening so mbhc firmware should be
retained.  Move mbhc firmware release to mbhc exit function in order to
prevent improper firmware release.

CRs-fixed: 532512
Change-Id: I09b800a76d0502efae153cba9f2b0cc8365f8dce
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9xxx: Add support to compute hph L & R impedance

Add support to compute impedance of the headphone left
and right on Tapan codec. This can be used to adjust gain
according to the value of impedance so that user can have
consistent  volume level with different headphones.

Change-Id: I16c8ee18aefa1e8e666a352719c6dff72c9435f0
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9320: Update buck control and mode registers

Leave BUCK control registers as default and set to lower BUCK ref voltage
for  avoid pop noise during playback initiation.

Change-Id: Ieea450af3906540432185d3df2308b7d96d5f33b
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9xxx: fix class H controller driver to handle concurrency

Fix class H controller driver's finite state machine to handle concurrent
playback.  This makes audio playback quality to be better with less power
consumption.

Change-Id: If1648ed35e74a51fc571c3cb298cbe8a3a4394a9
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9320: Configure codec hardware in optimal mode

Update class H controller registers to configure codec in optimal mode.

Change-Id: I9a044ac7a2ded187eee3fe37f3d3488004cc7958
CRs-fixed: 506099
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9xxx: Enable MBHC TxFE when micbias is enabled

When micbias is turned ON for audio recording with headset
plugged in, there can be possible noise on the recorded
data due to micbias polling for button detection. To
avoid the noise on audio recording, it is required to
enable the MBHC TxFE (Front-End). Add support to enable
MBHC TxFE when micbias is being enabled for audio recording.

Change-Id: Ic9dee6dd139848dd658d5c382a9ef25b4d801305
CRs-fixed: 522829
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: check NULL for mbhc->resmgr->reg_addr

Check the mbhc->resmgr->reg_addr before getting the
mbhc->resmgr->reg_addr->micb_4_mbhc to avoid
 the null pointer crash

Change-Id: Id8c0414c1dd00085906179b5ba3c9eb1c198dc71
Signed-off-by: Meng Wang <mwang@codeaurora.org>
ASoC: wcd9xxx: recalibrate DCE reference voltages

Recalibrate DCE reference voltages before starting MBHC insertion detection
to revise possible initial calibration error.

Change-Id: I50af2fca523babb6005e7ed4c2ac4ea9e177eb89
CRs-fixed: 537456
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9xxx: Enable voltage source for micbias for headset detection

Micbias on some codecs can be sourced from external voltage source.
In order to enable micbias for MBHC calibration, headset type detection,
etc, it is required to enable external voltage source for such codecs to
avoid incorrect headset type detection. Add callback per codec to enable
external voltage source if such a source is present for the codec power
rail.

Change-Id: I58fedd6a049285c4afa72f26cfe849a23782fa8b
CRs-fixed: 535909
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: WCD9XXX: Add configurable micbias option for headset detection

Micbias is required to perform plug type detection on 3.5mm headset
jack. Some platforms can have the microphone pulled up to micbias using
external on-board pull up resistor or using the pull up resistor
internal to the codec. Add support for headset detection logic to
support configurable option for internal or external micbias.

Change-Id: I7917dcf2140b8169a799ae35676efe1b5ff46f60
CRs-fixed: 539445
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: Add codec specific settings to switch micbias to vddio

Micbias to the codec is sourced from LDO (either internal or external to
the codec). Micbias can also be enabled by switching the micbias to
vddio rail in the codec. The register settings changes between codecs.
Add capability to perform this setting specific to codec.

Change-Id: Icdc0a3af3d741bad1cc3877941f3e96b72394e79
CRs-fixed: 539445
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: improve mbhc button detection performance

Update mbhc ground voltage calibration selectively to be able to
accomplish accurate voltage measurement without compromising of measurement
latency.
Revise false button detection logic for different codecs to perform
false button checking for same amount of time.

Change-Id: I0bd7aeb5e41d69ead76ec5aeaa9ebd08a03e5a5d
CRs-fixed: 532971
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
ASoC: wcd9306: Fixup the DAPM routing as per codec capabilities

Add mixer controls to enable sharing the same RX path between headphones
and lineout.

Change-Id: I620b72e1523bff3cb72a1b97f5c5d191fe1a0f91
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: Correct OCP IRQ mapping for Tapan

OCP interrupt mapping bit number is changed in Tapan codec,
so correct the interrupt mapping accordingly.

Change-Id: Icdab7561cff7b41e13650835747c1a1f5bf259c0
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
ASoC: wcd9xxx: Refactor interrupt mapping per codec

Different codecs can have different interrupt mappings. In order for the
common drivers to be able to request/free the codec interrupts, refactor
out the codec interrupt mapping from the common drivers to individual
codec drivers.

Change-Id: I75bb729df8ec94f2738d2b96c9e429abb6e71705
CRs-fixed: 552734
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ARM: dts: msm: Modify VFE master port for msm8226

The master port value for VFE is incorrectly listed as 16 which could
result in an illegal memory access. Modify this to be 7.

CRs-Fixed: 565266
Change-Id: Ieaa33b2acc1c297ae4f37de7994582b24d391edd
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
Merge "ARM: dts: msm: Modify VFE master port for msm8226"
Merge "ASoC: wcd9xxx: Correct RCO enable and disable sequence"
Merge "ASoC: wcd9xxx: don't release mbhc firmware while it's still in use"