During SSR, when usbc analog device is disconnected, the
respective disconnect interrupt is not handled and hence userspace
is not notified. When ADSP recovers, fsa driver sends a disconnect
notification. So handle device disconnect and notify jack/userspace
through this notification.
Change-Id: Ic695c2267c9289f9528d50202938ec09f634de8a
Signed-off-by: Vignesh Kulothungan <vigneshk@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>
ANC headphones are no longer supported, removed dead code related to the feature.
Change-Id: I3dd51b5b1d9f77fd870947608f8a14fc3f7aeed0
Signed-off-by: Akhil Karuturi <akarutur@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>
Moisture detection is not disabled properly if threshold
remains set as 24k even if duty cycle is disabled.
This is leading into headset not getting detected
sometimes. Disable threshold as well if duty cycle disabled.
Change-Id: Ic90c65d8bbaa965cf147f95edf5add8980889e1f
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Micbias2 internal pull-up remains enabled even after headphone is detected.
This results in power issues. Disable pull up after insertion detection.
Change-Id: I335dbb498192738fc282421d92510400a661cf0c
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
In the existing code, Over Current Protection interrupt is enabled
as part of MBHC insertion event handling.
This is causing audio mute on Stereo Headset randomly.
This OCP through MBHC is no more required as the
Over Current/surge is handled in HW.
Removing the OCP enabling code to fix the issue.
CRs-Fixed: 2622368
Change-Id: Iae8994aa365eb294793190f665407af111b23c82
Signed-off-by: Ramlal Karra <rkarra@codeaurora.org>
POWER_SUPPLY_TYPEC_SINK_AUDIO_ADAPTER is not supported on new
kernel-5.4. Update mode to TYPEC_ACCESSORY_AUDIO for analog
type-c headset.
Change-Id: Id46ea2eebea8257a48134431f07a81b6ed7e6c7d
Signed-off-by: Meng Wang <mengw@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>
Use "wcd_mbhc_usbc_ana_event_handler" function only when
CONFIG_QCOM_FSA4480_I2C is enabled.
Change-Id: I5211a8ce09fb06021310e528b5815fdbcd3f2dab
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
Headset insertion is not detected after moisture is configured and then
removed. This is because during moisture_detect GND_DET_EN is configured
irrespective of whether it is enabled or not. Add a check before enabling
gnd_det_en. Also as moisture_en is disabled and duty cycle is enabled
change check during removal to disable threshold and polling.
Change-Id: Iee9d79b38b228e78d1509d59e92d37f1328f079e
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
IRQ data pointer is corrupted due to slimbus NGD errors.
This may happen as IRQ will be received from slimbus.
Check for mbhc null pointer before dereferencing to avoid crash.
Change-Id: I142ee535c6d643b53063b57c0f45414aff8b6304
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Max limit of 60k ohms was set for cable to be detected as lineout
to fix headset detected as lineout issue on legacy targets.
This was because of large impedance detected for headset.
This is not applicable for adc based targets as headset is
detected based on mic adc voltage. Remove max impedance limit for
lineout detection.
Change-Id: If73bbe2cd78d04d1fcb359a3e5ed5cd69f3ab9f0
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
During playback if lineout is inserted it is detected
as lineout then changed to headphone. This is because
we do not compute impedance again as pa is on. Force
jack to be detected as lineout based on initial detection
to resolve the issue.
Change-Id: I243c324dcd251596db97aeef07b8535986550650
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Read hphl_swh and gnd_swh from dtsi instead of hardcoding to NC
for every USBC target. Some platforms use NO switch.
Change-Id: I3dca6c7450579e8feb5d80c1340495958683a026
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Moisture Detection should be disabled at init if duty cycle is enabled.
Change-Id: If398928a680174d981b9baefe02d9efd4e21766e
Signed-off-by: Vatsal Bucha <vbucha@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>
Zdet current source is enabled for 4 pole aux cable and kept
even after plug removal. This increases voltage for both hph left and
right which causes error in cross-connection detection for subsequent plug
detections. Remove current source enablement from unrequired places.
CRs-Fixed: 2234559
Change-Id: Icffbca88f7a6873c509c91e31b494dd6d5d21cb9
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
Detect moisture in the headset jack and avoid headset jack
corrosion due to presence of moisture over prolonged duration.
Change-Id: I0227e516feb58c96ddf6a8fbc32423bfe7733ca6
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
When ssr is in progress, during some race conditions
mbhc events are getting reported when codec is still
coming up. Ignore such events without reporting.
Change-Id: I3d3f78f97c2b855fc36a480f38c166bda2d979f0
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
Enable or disable mbhc clk in sync with L_DET
so that L_DET interrupt is not raised for
false positives for usbc analog.
Change-Id: I69792e8dc82cdc80751f2c1c705f603074cb9a2f
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
Add support for usbc analog audio for msmnile platform
by adding fsa driver calls in mbhc driver to make
any switching orientation changes of gnd/mic.
Change-Id: Iab7511907325a24345734402c10a4cf5f8ebfa23
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
AQT1000 supports different headset detect pull up current source
values in MBHC. Add a callback function to handle new current
source values in MBHC driver.
Change-Id: I060af1aff3fe7c4dfd4aa4c480542efa54c2777c
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
High impedance aux cable when inserted causes jack to change to
lineout. This causes removal event to be called which results
in pause during music playback because jack value is not updated.
Do not change current plug while plug is marked as lineout.
CRs-Fixed: 2151012
Change-Id: I99797b58c48be00185a352094e32e8623faee491
Signed-off-by: Vatsal Bucha <vbucha@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>
Switch to DLKM for all audio kernel modules.
Change-Id: I6a96023a21f655f873531af9ace81f2b01eb0f58
Signed-off-by: Laxminath Kasam <lkasam@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>