|
@@ -35,6 +35,9 @@ static const unsigned int mbhc_ext_dev_supported_table[] = {
|
|
|
EXTCON_NONE,
|
|
|
};
|
|
|
|
|
|
+struct mutex hphl_pa_lock;
|
|
|
+struct mutex hphr_pa_lock;
|
|
|
+
|
|
|
void wcd_mbhc_jack_report(struct wcd_mbhc *mbhc,
|
|
|
struct snd_soc_jack *jack, int status, int mask)
|
|
|
{
|
|
@@ -320,9 +323,9 @@ out_micb_en:
|
|
|
mbhc->mbhc_cb->set_cap_mode(component, micbias1, false);
|
|
|
break;
|
|
|
case WCD_EVENT_PRE_HPHL_PA_OFF:
|
|
|
- mutex_lock(&mbhc->hphl_pa_lock);
|
|
|
break;
|
|
|
case WCD_EVENT_POST_HPHL_PA_OFF:
|
|
|
+ mutex_lock(&hphl_pa_lock);
|
|
|
clear_bit(WCD_MBHC_HPHL_PA_OFF_ACK, &mbhc->hph_pa_dac_state);
|
|
|
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
|
|
|
if (mbhc->hph_status & SND_JACK_OC_HPHL)
|
|
@@ -336,13 +339,13 @@ out_micb_en:
|
|
|
else
|
|
|
/* Disable micbias, pullup & enable cs */
|
|
|
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_CS);
|
|
|
- mutex_unlock(&mbhc->hphl_pa_lock);
|
|
|
+ mutex_unlock(&hphl_pa_lock);
|
|
|
clear_bit(WCD_MBHC_ANC0_OFF_ACK, &mbhc->hph_anc_state);
|
|
|
break;
|
|
|
case WCD_EVENT_PRE_HPHR_PA_OFF:
|
|
|
- mutex_lock(&mbhc->hphr_pa_lock);
|
|
|
break;
|
|
|
case WCD_EVENT_POST_HPHR_PA_OFF:
|
|
|
+ mutex_lock(&hphr_pa_lock);
|
|
|
clear_bit(WCD_MBHC_HPHR_PA_OFF_ACK, &mbhc->hph_pa_dac_state);
|
|
|
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
|
|
|
if (mbhc->hph_status & SND_JACK_OC_HPHR)
|
|
@@ -356,7 +359,7 @@ out_micb_en:
|
|
|
else
|
|
|
/* Disable micbias, pullup & enable cs */
|
|
|
wcd_enable_curr_micbias(mbhc, WCD_MBHC_EN_CS);
|
|
|
- mutex_unlock(&mbhc->hphr_pa_lock);
|
|
|
+ mutex_unlock(&hphr_pa_lock);
|
|
|
clear_bit(WCD_MBHC_ANC1_OFF_ACK, &mbhc->hph_anc_state);
|
|
|
break;
|
|
|
case WCD_EVENT_PRE_HPHL_PA_ON:
|
|
@@ -427,22 +430,22 @@ static void wcd_mbhc_clr_and_turnon_hph_padac(struct wcd_mbhc *mbhc)
|
|
|
WCD_MBHC_REG_READ(WCD_MBHC_HPH_CNP_WG_TIME, wg_time);
|
|
|
wg_time += 1;
|
|
|
|
|
|
- mutex_lock(&mbhc->hphr_pa_lock);
|
|
|
+ mutex_lock(&hphr_pa_lock);
|
|
|
if (test_and_clear_bit(WCD_MBHC_HPHR_PA_OFF_ACK,
|
|
|
&mbhc->hph_pa_dac_state)) {
|
|
|
pr_debug("%s: HPHR clear flag and enable PA\n", __func__);
|
|
|
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HPHR_PA_EN, 1);
|
|
|
pa_turned_on = true;
|
|
|
}
|
|
|
- mutex_unlock(&mbhc->hphr_pa_lock);
|
|
|
- mutex_lock(&mbhc->hphl_pa_lock);
|
|
|
+ mutex_unlock(&hphr_pa_lock);
|
|
|
+ mutex_lock(&hphl_pa_lock);
|
|
|
if (test_and_clear_bit(WCD_MBHC_HPHL_PA_OFF_ACK,
|
|
|
&mbhc->hph_pa_dac_state)) {
|
|
|
pr_debug("%s: HPHL clear flag and enable PA\n", __func__);
|
|
|
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_HPHL_PA_EN, 1);
|
|
|
pa_turned_on = true;
|
|
|
}
|
|
|
- mutex_unlock(&mbhc->hphl_pa_lock);
|
|
|
+ mutex_unlock(&hphl_pa_lock);
|
|
|
|
|
|
if (pa_turned_on) {
|
|
|
pr_debug("%s: PA was turned on by MBHC and not by DAPM\n",
|
|
@@ -1934,8 +1937,6 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_component *component,
|
|
|
wcd_mbhc_fw_read);
|
|
|
INIT_DELAYED_WORK(&mbhc->mbhc_btn_dwork, wcd_btn_lpress_fn);
|
|
|
}
|
|
|
- mutex_init(&mbhc->hphl_pa_lock);
|
|
|
- mutex_init(&mbhc->hphr_pa_lock);
|
|
|
init_completion(&mbhc->btn_press_compl);
|
|
|
|
|
|
/* Register event notifier */
|
|
@@ -2121,18 +2122,20 @@ void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
|
|
|
WCD_MBHC_RSC_UNLOCK(mbhc);
|
|
|
}
|
|
|
mutex_destroy(&mbhc->codec_resource_lock);
|
|
|
- mutex_destroy(&mbhc->hphl_pa_lock);
|
|
|
- mutex_destroy(&mbhc->hphr_pa_lock);
|
|
|
}
|
|
|
EXPORT_SYMBOL(wcd_mbhc_deinit);
|
|
|
|
|
|
static int __init mbhc_init(void)
|
|
|
{
|
|
|
+ mutex_init(&hphl_pa_lock);
|
|
|
+ mutex_init(&hphr_pa_lock);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static void __exit mbhc_exit(void)
|
|
|
{
|
|
|
+ mutex_destroy(&hphl_pa_lock);
|
|
|
+ mutex_destroy(&hphr_pa_lock);
|
|
|
}
|
|
|
|
|
|
module_init(mbhc_init);
|