add check to return from the hs_rem_irq( ) if the headset
removal is already reported.
Change-Id: If9ffc1a471b80f8c9d01875b531748327032926a
Signed-off-by: Ganapathiraju Sarath Varma <quic_ganavarm@quicinc.com>
usbc USCI event gets called and removal is reported, where bit
0 of mbhc->intr_status i.e. (WCD_MBHC_ELEC_HS_INS) will be set to 0.
So in adc_hs_ins_irq() we can check if the WCD_MBHC_ELEC_HS_INS bit
is 0 or not, if 0 we just ignore the and return.
Change-Id: I5a7753a077f53c5cd26c8ad199899ff9c81ef7b8
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
While measuring the adc, if PA is on we will get incorrect values of
adc due to which the detection type is missmatched. So disable the PA
While measuring the adc values and restore back PA once measuring adc
done.
Change-Id: I5833452e23a71637353449bb48b937ee44be24ae
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
With moisture_en flag being set as true for legacy moisture detection,
need to check if duty cycle is also enabled so as to report headset
insertion/removal properly when moisture detection enabled.
Change-Id: I6014e2e047d7c33b16bf9229ee1901fd8d042b47
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
BCS is not enabled sometimes after inserting headset if
plug is already reported and we dont report it again.
Enable BCS if plug type already reported.
Change-Id: I8c9f15ced66a21bda169d3479da96168ebec26a7
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
When SVA is enabled and headset is inserted and playback is started
on headset, sometimes electrical irq is triggered resulting in
headset removal being reported. This happens because of high mic
voltage being reported. Enable micbias before checking for adc
voltage to resolve issue.
Change-Id: If7445c906b2e62f12b48548a2d435db01f184587
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
BCS is not enabled for us headset as after 3sec loop
we directly switch to report headset and bcs is still disabled.
Enable bcs only after reporting valid plug to resolve issue.
Change-Id: I69bb71d20583fd2e2be921e9b657d9c44c047708
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
When EU headset is inserted into US headset jack and corrected as
right jack type, BCS will not be enabled. Remove the headset
type check to disable/enable BCS for all headset types.
Change-Id: I9898581727b74795cb357a19a2489761aa294f3b
Signed-off-by: Meng Wang <mengw@codeaurora.org>
During bootup and headset inserted, headset may first
detect as GND_MIC swap type and not report. During three
seconds polling, it's corrected as headset or headphone.
When wrk_complete is false, it will not report to userspace.
When current_plug is MBHC_PLUG_TYPE_NONE, report headset or
headphone to userspace.
Change-Id: I63394f1704c34cf355f0f4b0c33959332a69a639
Signed-off-by: Meng Wang <mengw@codeaurora.org>
When current source mode is enabled, comparator auto
zeroing should be turned ON by HW. As rouleur codec HW
doesn't do this automatically, add this support
in SW to set the auto zero enable before FSM enable
and reset to auto once FSM is enabled.
Disable surge protection before ADC measurements
and change HPHL and HPHR thresholds while
identifying cross connection for proper
accessory identification.
Change-Id: Ib775de0f0bdb6c655a3c0eb4775276acfbca1e84
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
Current source mode in rouleur does not work
properly leading to issues in button interrupts
and fake electrical removal interrupts.
Enable pull up mode instead of current source
mode to fix these issues. Modify the headset
max vref voltage to 1.7 volts and micbias
calculation logic.
Change-Id: If3e4a2fdcf080b07fe3c363b6eb6115f101b91f4
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
Playback pauses during aux cable insertion as removal of
cable is reported followed by insertion. Report removal
of current cable only when headset connected to other end
of extension cable and not lineout.
Change-Id: I08933f4a88493136a518ee72646aa10b1f06eb70
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Add CONFIG_AUDIO_QGKI check for variables and functions
in audio drivers, so they are used only during a QGKI build.
Change-Id: Ia04232566367f196f298a49cf3962bb7927bec6a
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
Audio is distorted during first 3 secs on headset record
while doing device switch from dmic to headset mic.
Disable BCS before slow insertion detection and enable it
afterwards to resolve the issue.
Change-Id: Ie5bc4b5292e5f69066760cab44d78989a74f13f4
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
In wcd_mbhc_adc_hs_rem_irq when hph_on bit is set
both left and right channel should get enabled. But we
enable left channel first, disable left ch and enable right channel.
Fix this to enable both left and right channel.
Change-Id: Ia50c55a0ed68e01359ef0a9c76eba6901a04e17c
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
When detecting special headset, vref for special headset is
set based on headset threshold reference 1800mv or based on
regular micbias settings from device tree. Scale threshold
reference as per the special headset micbias voltage.
Change-Id: Ic4cc24e18efeb420b53a2154707c9399eb886181
Signed-off-by: Meng Wang <mwang@codeaurora.org>
Mono headsets have only one channel connected. Hence make cross
connection decision based on the voltage result of alteast one
channel showing cross connection.
Change-Id: I22a4ea7e25d09e785e7141f4a74c2830fdff555e
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
Some alsa API are removed in kernel-4.19 which would cause
codec driver compile failure. Update codec driver to fix it.
Change-Id: Ie358ec1863082166958059c179300b453d2a03ad
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Switch audio drivers to SPDX identifier on msm-4.19.
Change-Id: Ic3f0230a516db251b8d81e8a7e73dbc04d66fe1b
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Check for in2p clamp state in insertion irq
and ignore the interrupt if the clamp is already
set, which means the mechanical removal is about
to happen next.
Change-Id: I55691d427cf07d5b61862b6dbd39f3ec34d873e5
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
Comparison of headset threshold during special headset detection is
not proper. This results in to improper detection of special headset
and recording usecase failure on special headset. Fix the special
headset detection issue by adding proper check condition while selection
of headset threshold from device tree.
Change-Id: I4c338ded1bcb9fa643e1584eb23c6260fe52acee
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
After headset removal disable button current source
to not have any voltages output in micbias after
headset removal from extension cable.
Change-Id: I2a751c16c704176381bb26f375aebf351686e911
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
To reduce time of usb-c analog headset detection, reduce
gnd mic swap threshold if usb-c is enabled. Use
existing threshold value otherwise.
CRs-Fixed: 2137077
Change-Id: Ic1d1f3a00c9034caaac45f2c80f018546a69ce59
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
when moisture is in jack, removing of the plug result in
electrical removal interrupt. So, update electrical interrupt
handler to handle mechanical removal based on moisture status.
CRs-Fixed: 2058106
Change-Id: I9cfbfbaf04783f0edcadb14d7828759020745289
Signed-off-by: Meng Wang <mwang@codeaurora.org>
To config different headset detection parameters for different hardware, add
two new headset detection parameters in device tree and read it in mbhc driver.
Change-Id: I10457b7d5eae54eba8a4cd273885a63ebad3ccb3
Signed-off-by: Meng Wang <mwang@codeaurora.org>