From 46451883c7b134c6c8b0c6089b479280562cd56f Mon Sep 17 00:00:00 2001 From: Phani Kumar Uppalapati Date: Thu, 29 Sep 2016 17:27:34 -0700 Subject: ASoC: wcd934x: Add pre/post HPHL/R PA off notifications Send headphone left/right PA off notifications in pre/post events for client drivers like MBHC, to update their status correctly. Change-Id: I2a27e9f59bd5d1ce99245df51cde9e6eb4133387 Signed-off-by: Phani Kumar Uppalapati --- sound/soc/codecs/wcd934x/wcd934x.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wcd934x/wcd934x.c b/sound/soc/codecs/wcd934x/wcd934x.c index 28914ed3f937..68fef3f036e3 100644 --- a/sound/soc/codecs/wcd934x/wcd934x.c +++ b/sound/soc/codecs/wcd934x/wcd934x.c @@ -1807,6 +1807,9 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, tavil_codec_override(codec, tavil->hph_mode, event); break; case SND_SOC_DAPM_PRE_PMD: + blocking_notifier_call_chain(&tavil->mbhc->notifier, + WCD_EVENT_PRE_HPHR_PA_OFF, + &tavil->mbhc->wcd_mbhc); /* Enable DSD Mute before PA disable */ if (dsd_conf && (snd_soc_read(codec, WCD934X_CDC_DSD1_PATH_CTL) & 0x01)) @@ -1814,11 +1817,14 @@ static int tavil_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, 0x04, 0x04); break; case SND_SOC_DAPM_POST_PMD: + /* 5ms sleep is required after PA disable */ + usleep_range(5000, 5100); tavil_codec_override(codec, tavil->hph_mode, event); + blocking_notifier_call_chain(&tavil->mbhc->notifier, + WCD_EVENT_POST_HPHR_PA_OFF, + &tavil->mbhc->wcd_mbhc); snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL, 0x06, 0x0); - /* 5ms sleep is required after PA disable */ - usleep_range(5000, 5100); break; }; @@ -1876,6 +1882,9 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, tavil_codec_override(codec, tavil->hph_mode, event); break; case SND_SOC_DAPM_PRE_PMD: + blocking_notifier_call_chain(&tavil->mbhc->notifier, + WCD_EVENT_PRE_HPHL_PA_OFF, + &tavil->mbhc->wcd_mbhc); /* Enable DSD Mute before PA disable */ if (dsd_conf && (snd_soc_read(codec, WCD934X_CDC_DSD0_PATH_CTL) & 0x01)) @@ -1883,11 +1892,14 @@ static int tavil_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, 0x04, 0x04); break; case SND_SOC_DAPM_POST_PMD: + /* 5ms sleep is required after PA disable */ + usleep_range(5000, 5100); tavil_codec_override(codec, tavil->hph_mode, event); + blocking_notifier_call_chain(&tavil->mbhc->notifier, + WCD_EVENT_POST_HPHL_PA_OFF, + &tavil->mbhc->wcd_mbhc); snd_soc_update_bits(codec, WCD934X_HPH_REFBUFF_LP_CTL, 0x06, 0x0); - /* 5ms sleep is required after PA disable */ - usleep_range(5000, 5100); break; }; -- cgit v1.2.3