add support for both fsa and wcd usb AATC.
Change-Id: I0253faad734a433f5da93c34adfc4f9c2e37fa14
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
update the usbss switches only once the HS removal is completed.
Change-Id: I050b30c2c407f189cefed56ec137848efb45e5b4
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
moved compponent inside the #define of WCD_USBSS, to avoid
compilation issue for unsed of WCD_USBSS_I2C in some targets.
Change-Id: Ia2f64182aa8330db10122e70f12066ffebe9d16b
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Enable wcd939x surge reset routine. Add callback for
the event within mbhc and enable it for wcd939x.
Change-Id: Iabc8c3367ae2eca5982db4526c6860e5eba63b76
Signed-off-by: Eric Rosas <quic_erosas@quicinc.com>
Currently on pineapple CDP platform, sbu1/2 switches are always
pre-connected to gnd/mic of the jack. Avoid this static connection
and connect/disconnect only when headset insertion/removal is detected.
Change-Id: If3bef6834caeb539492304d8b16808cd09c5afab
Signed-off-by: Phani Kumar Uppalapati <quic_phaniu@quicinc.com>
In SSR/PDR usb switch settings won't be reset in wcd939x-i2c
driver. So no need to do switch settings for AATC when recovering
from SSR/PDR. Depends on the status to avoid AATC switch settings
again after SSR/PDR.
Change-Id: If7fc2a84356a406e9cf7e6cc557e19584fda3969
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
enable l_det_en bit while detecting the HS.
Issue: While removing HS some additional electrical interrupts
are triggered and reporting different events to userspace, which is
cause issues. To avoid this electrical interrupt flow, there is
a check in adc_hs_rem_irq for wcd_swch_level_remove() to check
for l_det_en bit status. Depends on this it will return from the
adc_hs_rem_irq() without going further.
Solution: Enabling the l_det_en bit will helps to avoid serving
electrical interrupt flow to further in adc_hs_rem_irq().So this
will helps to stop reporting different/unwanted events to user space.
Change-Id: I29d72b65ebb59969b69f3f8c7f4c7eb2debb0f1c
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
WCD USB AATC does not require mech plug irq, UCSI
layer will help to get the events to process insert/remove
of AATC HS.
Change-Id: Ie1b14703605be294471303b6454f94b55e9f932d
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
enable impedance and calculations according to wcd939x.
Change-Id: Id0c2c7ebea6941dadbe501d388bdedc265e93db6
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Resolve warning log when hph pa mutex lock is destroyed before
unlock. Initialize hph pa locks as global lock and do not destroy
during SSR to resolve issue.
Change-Id: Idc5af793294f7fdc8dbcc17770f68fe2c46ab337
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
MBHC extcon device is unregistered when adsp ssr happens and causes
kernel panic. Avoid unregistering MBHC extcon device in mbhc_deinit.
Change-Id: I69fa057a480ebadaf324ca1f61bf399c176e3b2d
Signed-off-by: Meng Wang <mengw@codeaurora.org>
Call impedance detection routine as part of callback to get impedance
before printing value of impedance.
Change-Id: I8b7174e4f7fd9c7715a2c12a0628c8f7849a93e6
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
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>