audio-kernel: wcd: Disable 1M Pull-up resistor

1M Pull-up resistor within WCD causes LPD (Liquid Presence
Detection) failures. So add support for disabling 1Mohm
Pull-up resistor. Re-enable it whenever wcd enters into
audio mode.

Change-Id: Ib3115315bc61d4e6126ddf688653182417d5d54d
Signed-off-by: Phani Kumar Uppalapati <quic_phaniu@quicinc.com>
This commit is contained in:
Phani Kumar Uppalapati
2023-07-09 22:54:02 -07:00
parent a6734b9ac0
commit 3fca2376eb
4 changed files with 29 additions and 3 deletions

View File

@@ -963,10 +963,15 @@ static bool wcd_mbhc_moisture_detect(struct wcd_mbhc *mbhc, bool detection_type)
return ret;
}
static void wcd_mbhc_set_hsj_connect(struct snd_soc_component *component, bool connect)
static void wcd_mbhc_set_hsj_connect(struct wcd_mbhc *mbhc, bool connect)
{
struct snd_soc_component *component = mbhc->component;
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
if (connect) {
if (mbhc->mbhc_cb && mbhc->mbhc_cb->zdet_leakage_resistance)
mbhc->mbhc_cb->zdet_leakage_resistance(mbhc, false); /* enable 1M pull-up */
if (of_find_property(component->card->dev->of_node,
"qcom,usbss-hsj-connect-enabled", NULL))
wcd_usbss_switch_update(WCD_USBSS_HSJ_CONNECT, WCD_USBSS_CABLE_CONNECT);
@@ -974,6 +979,9 @@ static void wcd_mbhc_set_hsj_connect(struct snd_soc_component *component, bool c
if (of_find_property(component->card->dev->of_node,
"qcom,usbss-hsj-connect-enabled", NULL))
wcd_usbss_switch_update(WCD_USBSS_HSJ_CONNECT, WCD_USBSS_CABLE_DISCONNECT);
if (mbhc->mbhc_cb && mbhc->mbhc_cb->zdet_leakage_resistance)
mbhc->mbhc_cb->zdet_leakage_resistance(mbhc, true); /* disable 1M pull-up */
}
#endif
}
@@ -1019,7 +1027,7 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
if ((mbhc->current_plug == MBHC_PLUG_TYPE_NONE) &&
detection_type) {
wcd_mbhc_set_hsj_connect(component, 1);
wcd_mbhc_set_hsj_connect(mbhc, 1);
/* If moisture is present, then enable polling, disable
* moisture detection and wait for interrupt
*/
@@ -1135,7 +1143,7 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
mbhc->mbhc_cb->mbhc_moisture_detect_en(mbhc,
false);
}
wcd_mbhc_set_hsj_connect(component, 0);
wcd_mbhc_set_hsj_connect(mbhc, 0);
} else if (!detection_type) {
/* Disable external voltage source to micbias if present */