Merge "audio-kernel: wcd: Disable 1M Pull-up resistor"
Этот коммит содержится в:
коммит произвёл
Gerrit - the friendly Code Review server
Коммит
e8568049e3
@@ -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 */
|
||||
|
||||
@@ -1344,6 +1344,17 @@ static void wcd939x_surge_reset_routine(struct wcd_mbhc *mbhc)
|
||||
regcache_sync(wcd939x->regmap);
|
||||
}
|
||||
|
||||
static void wcd939x_mbhc_zdet_leakage_resistance(struct wcd_mbhc *mbhc,
|
||||
bool enable)
|
||||
{
|
||||
if (enable)
|
||||
snd_soc_component_update_bits(mbhc->component, WCD939X_ZDET_BIAS_CTL,
|
||||
0x80, 0x80); /* disable 1M pull-up */
|
||||
else
|
||||
snd_soc_component_update_bits(mbhc->component, WCD939X_ZDET_BIAS_CTL,
|
||||
0x80, 0x00); /* enable 1M pull-up */
|
||||
}
|
||||
|
||||
static const struct wcd_mbhc_cb mbhc_cb = {
|
||||
.request_irq = wcd939x_mbhc_request_irq,
|
||||
.irq_control = wcd939x_mbhc_irq_control,
|
||||
@@ -1370,6 +1381,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
|
||||
.mbhc_moisture_detect_en = wcd939x_mbhc_moisture_detect_en,
|
||||
.bcs_enable = wcd939x_mbhc_bcs_enable,
|
||||
.surge_reset_routine = wcd939x_surge_reset_routine,
|
||||
.zdet_leakage_resistance = wcd939x_mbhc_zdet_leakage_resistance,
|
||||
};
|
||||
|
||||
static int wcd939x_get_hph_type(struct snd_kcontrol *kcontrol,
|
||||
|
||||
@@ -443,6 +443,11 @@ static int wcd939x_init_reg(struct snd_soc_component *component)
|
||||
if (wcd939x->version != WCD939X_VERSION_2_0)
|
||||
snd_soc_component_write(component, WCD939X_CFG0, 0x05);
|
||||
|
||||
/*
|
||||
* Disable 1M pull-up by default during boot by writing 0b1 to bit[7].
|
||||
* This gets re-enabled when headset is inserted.
|
||||
*/
|
||||
snd_soc_component_update_bits(component, WCD939X_ZDET_BIAS_CTL, 0x80, 0x80);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -531,6 +531,7 @@ struct wcd_mbhc_cb {
|
||||
void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *mbhc, bool enable);
|
||||
void (*mbhc_moisture_detect_en)(struct wcd_mbhc *mbhc, bool enable);
|
||||
void (*surge_reset_routine)(struct wcd_mbhc *mbhc);
|
||||
void (*zdet_leakage_resistance)(struct wcd_mbhc *mbhc, bool enable);
|
||||
};
|
||||
|
||||
struct wcd_mbhc_fn {
|
||||
|
||||
Ссылка в новой задаче
Block a user