asoc: wcd939x: avoid static sbu1/2 connections to gnd/mic

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>
This commit is contained in:
Phani Kumar Uppalapati
2023-05-15 13:57:32 -07:00
parent 6acdb1bc38
commit e6eac8ce72
2 changed files with 18 additions and 6 deletions

View File

@@ -963,6 +963,21 @@ 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)
{
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
if (connect) {
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);
} else {
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);
}
#endif
}
static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
{
bool detection_type = 0;
@@ -1004,6 +1019,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);
/* If moisture is present, then enable polling, disable
* moisture detection and wait for interrupt
*/
@@ -1119,6 +1135,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);
} else if (!detection_type) {
/* Disable external voltage source to micbias if present */