Merge "asoc: codecs: wcd934x: Add NULL checks for mbhc"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
474e2a0b08
@@ -2377,6 +2377,7 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
tavil_ocp_control(component, false);
|
||||
if (tavil->mbhc)
|
||||
blocking_notifier_call_chain(&tavil->mbhc->notifier,
|
||||
WCD_EVENT_PRE_HPHR_PA_OFF,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
@@ -2409,6 +2410,7 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
|
||||
else
|
||||
usleep_range(5000, 5100);
|
||||
tavil_codec_override(component, tavil->hph_mode, event);
|
||||
if (tavil->mbhc)
|
||||
blocking_notifier_call_chain(&tavil->mbhc->notifier,
|
||||
WCD_EVENT_POST_HPHR_PA_OFF,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
@@ -2554,6 +2556,7 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
tavil_ocp_control(component, false);
|
||||
if (tavil->mbhc)
|
||||
blocking_notifier_call_chain(&tavil->mbhc->notifier,
|
||||
WCD_EVENT_PRE_HPHL_PA_OFF,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
@@ -2588,6 +2591,7 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
|
||||
else
|
||||
usleep_range(5000, 5100);
|
||||
tavil_codec_override(component, tavil->hph_mode, event);
|
||||
if (tavil->mbhc)
|
||||
blocking_notifier_call_chain(&tavil->mbhc->notifier,
|
||||
WCD_EVENT_POST_HPHL_PA_OFF,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
@@ -5436,6 +5440,7 @@ static void tavil_codec_hph_reg_recover(struct tavil_priv *tavil,
|
||||
int i;
|
||||
unsigned int reg;
|
||||
|
||||
if (tavil->mbhc)
|
||||
blocking_notifier_call_chain(&tavil->mbhc->notifier,
|
||||
WCD_EVENT_OCP_OFF,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
@@ -5548,12 +5553,14 @@ pa_en_restore:
|
||||
}
|
||||
|
||||
end:
|
||||
if (tavil->mbhc) {
|
||||
tavil->mbhc->is_hph_recover = true;
|
||||
blocking_notifier_call_chain(
|
||||
&tavil->mbhc->notifier,
|
||||
WCD_EVENT_OCP_ON,
|
||||
&tavil->mbhc->wcd_mbhc);
|
||||
}
|
||||
}
|
||||
|
||||
static int tavil_codec_reset_hph_registers(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol,
|
||||
@@ -5596,6 +5603,7 @@ static int tavil_codec_reset_hph_registers(struct snd_soc_dapm_widget *w,
|
||||
} else {
|
||||
dev_dbg(component->dev, "%s: cache and hw reg are same\n",
|
||||
__func__);
|
||||
if (tavil->mbhc)
|
||||
tavil->mbhc->is_hph_recover = false;
|
||||
}
|
||||
break;
|
||||
@@ -10292,6 +10300,7 @@ static int tavil_device_down(struct wcd9xxx *wcd9xxx)
|
||||
priv->dai[count].bus_down_in_recovery = true;
|
||||
snd_event_notify(priv->dev->parent, SND_EVENT_DOWN);
|
||||
|
||||
if (priv->mbhc)
|
||||
priv->mbhc->wcd_mbhc.deinit_in_progress = true;
|
||||
if (delayed_work_pending(&priv->spk_anc_dwork.dwork))
|
||||
cancel_delayed_work(&priv->spk_anc_dwork.dwork);
|
||||
@@ -10307,12 +10316,15 @@ static int tavil_device_down(struct wcd9xxx *wcd9xxx)
|
||||
}
|
||||
if (delayed_work_pending(&priv->power_gate_work))
|
||||
cancel_delayed_work_sync(&priv->power_gate_work);
|
||||
if (priv->mbhc) {
|
||||
if (delayed_work_pending(&priv->mbhc->wcd_mbhc.mbhc_btn_dwork)) {
|
||||
ret = cancel_delayed_work(&priv->mbhc->wcd_mbhc.mbhc_btn_dwork);
|
||||
ret = cancel_delayed_work(
|
||||
&priv->mbhc->wcd_mbhc.mbhc_btn_dwork);
|
||||
if (ret)
|
||||
priv->mbhc->wcd_mbhc.mbhc_cb->lock_sleep
|
||||
(&priv->mbhc->wcd_mbhc, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->swr.ctrl_data) {
|
||||
if (is_snd_event_fwk_enabled())
|
||||
@@ -10397,6 +10409,7 @@ static int tavil_post_reset_cb(struct wcd9xxx *wcd9xxx)
|
||||
dev_err(component->dev, "%s: invalid pdata\n", __func__);
|
||||
|
||||
/* Initialize MBHC module */
|
||||
if (tavil->mbhc) {
|
||||
mbhc = &tavil->mbhc->wcd_mbhc;
|
||||
ret = tavil_mbhc_post_ssr_init(tavil->mbhc, component);
|
||||
if (ret) {
|
||||
@@ -10406,7 +10419,7 @@ static int tavil_post_reset_cb(struct wcd9xxx *wcd9xxx)
|
||||
} else {
|
||||
tavil_mbhc_hs_detect(component, mbhc->mbhc_cfg);
|
||||
}
|
||||
|
||||
}
|
||||
/* DSD initialization */
|
||||
ret = tavil_dsd_post_ssr_init(tavil->dsd_config);
|
||||
if (ret)
|
||||
|
Reference in New Issue
Block a user