ASoC: msm: Add few more Dolby endpoint dependent paramters

While turning Dolby effecrs on and off from its UI app, volume of
levels vary and difference is observed. Dolby requires few more
paramters to be sent based on endpoints for proper tuning.

CRs-Fixed: 503579
Change-Id: Ibae16d417d4df53eb2bf27475ed24fa409af3861
Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
ASoC: wcd9xxx: Do not disable MBHC clock enable signal

MBHC needs clocks enabled which are controlled through
analog enable signal. Do not disable this signal when
adc block is disabled.

CRs-fixed: 540125
Change-Id: Iba1713769fb37b49b7f71596ec0a35b87b0e498c
Signed-off-by: Simmi Pateriya <simmip@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.

CRs-fixed: 522829
Change-Id: I0689982edab9204aa4f833e59f979f38d6d34418
Signed-off-by: Bhalchandra Gajare <gajare@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.

CRs-fixed: 535909
Change-Id: I91995655b8ad8f36fccd34223d1d8a6e9a413fd7
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.

CRs-fixed: 539445
Change-Id: I9438812f0a924c22932dacc56181cf997625e056
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8x10: Parse the micbias internal property

Micbias can be either internal to the codec or external onboard pull up
resistor. Parse the property from device tree to setup the micbias
appropriately.

CRs-fixed: 539445
Change-Id: I2281b9b98a00d3d4cbfb98f912eaa41274a6c8ee
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.

CRs-fixed: 539445
Change-Id: Ie55784ea990df5eba6ca35a97b431bbf93f0c945
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8x10-wcd: Fix the micbias external capacitor setting

The register setting for external bypass capacitor was not updated as
per the platform data provided. Due to this the appropriate register
setting for external cap mode was not set correctly. Fix the codec
register setting for external bypass capacitor mode.

CRs-fixed: 539445
Change-Id: I9f9bc106faa6908acf48c6ce73342f46ab678df5
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8x10-wcd: Pull TX2 to micbias whenever micbias is enabled

It is noticed that the headset mic has a buzz whenever micbias is
enabled. To reduce this buzz, always pull up the TX2 (headset)
microphone front end to micbias.

CRs-fixed: 526901
Change-Id: Id007a4c34c68aea0d0e01743d3e7aa8ca09fd5f7
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm: Correct the EC reference RX port id for 0x1001

The EC reference RX port id that is being used for
PRIMARY_MI2S_TX is not correct and is set to 0 currently.
Set this to proper RX port id of 0x1000.

Change-Id: Id7a88076f06816adcb50e9cee0b83da10393883f
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: q6: check upper bounds when copy ac3 params

Although AC3 maximum param size is fixed, better check upper bounds
when copy user data. It might cause overflow, possibly cause memory
corruption.

Change-Id: I2f7cec8edd9e013de1433ea06480b963ec307196
Signed-off-by: Fred Oh <fred@codeaurora.org>
ASoC: wcd9xxx: Fix detection issue for headsets with threshold on MIC

Add additional check to see whether micbias is enabled
during DCE measurements and if it is enabled update the
condition so that plug type cannot be wrongly classified
as invalid plug type.

Change-Id: Id758e1bc553e1e6dbc81721f00f9c147b11cf390
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: Parse headset jack type

Headset jack type can be either normally open
or normally closed. Read the on-board headset
jack type from device tree.

CRs-fixed: 543701
Change-Id: I5860a67fae5c9853be251ccad10c221021982976
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: Fix disable of clock block

When the external clock to the codec is disabled, the clock gating
internal to the codec also needs to be disabled to avoid any
stability issues. Fix the disable of clock block for the codec to
gate the clock internally to codec whenever external clock is disabled

CRs-fixed: 551937
Change-Id: Iad6962bbed6ca62a6d7f2748676306084ef5c08d
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8x10: Configure the codec external clock drive strength

Whenever the codec external clock is enabled, configure the drive
strength on this clock before clock enable. This is to avoid possible
interference this clock can cause with other signals based on board
layout.

CRs-fixed: 551937
Change-Id: Ie45627424ce4f06dff96051ad18c55f4fb3279bc
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: wcd9xxx: Add support to enable or disable impedance detection

Add support to enable or disable impedance detection
using kernel module parameter. This gives flexibility
for the user to enable or disable this feature.

Change-Id: Ide1d223db256516400e138bf3d7e509a0a2242b9
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: Fix crash when enable mbhc driver logs

Fix crash by avoiding NULL pointer access when mbhc driver
logs are enabled.

Change-Id: I6575a215b035bafb3fe85d5fc3ff72f985fe7a25
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: Route low latency frontend to in-call music backend

Add routing controls to support routing of low latency stream
to in-call music delivery backend.

Change-Id: I5934f32fb4cbfb7f12a09e9bad76f370c3fd7fb7
CRs-fixed: 550396
Signed-off-by: Narsinga Rao Chella <nrchella@codeaurora.org>
ASoC: msm: qdsp6v2: Set ADM channel to max supported for ULL

ULL copp can only operate currently for 2 Channels.
ADM open for ULL fails for channel greater than 2 channels
Set the channel to max supported
when adm is opened for a ULL device session.

Change-Id: Ib47af5bca7461b935fae0f695b04767929bea925
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
ASoC: msm: Add missing backends for Multimedia4

Some backends for the front-end Multimedia4 is missing in the
routing driver. This results tunnel recording failure for
USB headset/BT SCO usecases.

Change-Id: I7998309df4e7da9545bdc75e9b67873cc0417870
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>