ASoC: wcd9xxx: Fix codec type detection failure error handling

Changes fixes the error handling exit point when the codec
type is not found.

Change-Id: I2923dc16880fe312741188b360620ea924fe4ca3
CRs-fixed: 517978
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
mfd: wcd9xxx: Add support to parse new set of regulators

Chargepump supply to the codec can be supplied from multiple
regulators. Add support to maintain list of regulators for
chargepump that can be used by individual codec drivers to
dynamically enable/disable the regulators.

Change-Id: I22e2abac349f099ed60a786e50bc15cffd0a3aa2
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Correct the ondemand property for regulators

The chargepump regulators were incorrectly marked as static
regulators, causing the regulators to be enabled at boot time.
Correct the regulators, mark the chargepump regulators as
on-demand so they will be enabled only when needed.

Change-Id: I0ba9723e1fa2eaba4b69fc58b7c415bff6fe6ef5
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Change implementation to use callbacks

To use common mbhc code across multiple codecs, use
callback functions instead of mbhc version for each
codec. This will make the codec driver to handle the
codec dependent changes.

Change-Id: I83e1bab17a64add05baa83b6956e05fa5920be8a
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Enhance class H controller to support dynamic CP voltage

Codecs can operate at a lower voltage for vdd_buck, whereas
this voltage source being shared, it is not guaranteed that the
codec will always receive exactly the requested voltage. Add support
to class H controller to handle dynamic switching of the chargepump
voltage.

Change-Id: I68f93e0b070ec51db9b958f56c797edb5cbe0c85
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: fix HPHL DAC path enable sequence

The dac_ref_en bit should not be turned ON by codec
driver when headset is inserted. Setting the
dac_ref_en bit, and not resetting it when headset is
removed, will cause the DAPM framework to keep HPHL
DAC path connected.
This change returns the ownership of setting the
dac_ref_en bit to DAPM framework and fixes the HPHL DAC
path enablement issue when headset is inserted.

CRs-fixed: 483600
Change-Id: Iabfe09a82507579a443b87458dc8dba0d2cd5ce5
Signed-off-by: Banajit Goswami <bgoswa@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: don't assume PA is off during insertion detection

The mbhc find plug type can possibly run with audio playback on headphone.
This means micbias source can be from vddio as well as hphl status isn't
reliable.
Change micbias source to cfilt and don't refer hphl status when playback
is running with headphone during plug type detection.

Change-Id: Ie902b64927964c787dd91982d9236015ef302891
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Avoid mic schmitt trigger while finding plug type

Do not enable mic schmitt trigger when the plug type
determination work is interrupted by another mechanical
or electrical mbhc interrupt. Otherwise, enabling mic
schmitt trigger will cause spurious unwanted electrical
interrupts to be generated while plug type is getting
determined.

Change-Id: I3dce10b874c903ec517a6683cbcbc8d2a3d82c92
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: introduce headphone impedance detection support

Different headphones have different impedance that results in volume level
difference on ears as lower impedance headphone will have higher
volume with the same gain on PAs.
Provide impedance of headphones to be able to adjust gain according to
impedance so user can have consistent volume level with different
headphones.

Change-Id: I707f34344cd0068507bdd8a0192eb7afea1147f2
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9xxx: Add config variable to enable/disable impedance detection

Some of the codecs still do not support impedance detection feature.
Currently it is only enabled for wcd9320. So, add a config variable
to mbhc configuration to enable or disable impedance detection
calculation.

Change-Id: I2d32d4f3bbdcd6211accf1278dd5ab44d6520b6e
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm: Enable current source for plug type detection

Enable current source for detecting plug type on tapan.
Update cs_enable_flags accordingly to use current source
during insertion, polling and removal of the plug.

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