ASoC: rt5682s: Fix HP noise caused by SAR mode switch when the system resumes
When the system resumes from S3, if the system plays a beep, there is continuous "Zizi.." noise from HP that could be heard. It is caused by the SAR mode switch during the combo jack re-detection which be executed parallelly in a workqueue after the system resumes. This patch changes the behavior of SAR mode switch to avoid this issue. Signed-off-by: Derek Fang <derek.fang@realtek.com> Link: https://lore.kernel.org/r/20211001074113.2223-2-derek.fang@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
04a8374c32
commit
0b26ca1725
|
@ -779,7 +779,8 @@ static int rt5682s_headset_detect(struct snd_soc_component *component, int jack_
|
|||
RT5682S_FAST_OFF_MASK, RT5682S_FAST_OFF_EN);
|
||||
snd_soc_component_update_bits(component, RT5682S_SAR_IL_CMD_1,
|
||||
RT5682S_SAR_SEL_MB1_2_MASK, val << RT5682S_SAR_SEL_MB1_2_SFT);
|
||||
rt5682s_sar_power_mode(component, SAR_PWR_SAVING, 1);
|
||||
if (!snd_soc_dapm_get_pin_status(&component->dapm, "SAR"))
|
||||
rt5682s_sar_power_mode(component, SAR_PWR_SAVING, 1);
|
||||
rt5682s_enable_push_button_irq(component);
|
||||
break;
|
||||
default:
|
||||
|
@ -1313,18 +1314,6 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
|
|||
}
|
||||
}
|
||||
|
||||
static int is_headset_type(struct snd_soc_dapm_widget *w,
|
||||
struct snd_soc_dapm_widget *sink)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if ((rt5682s->jack_type & SND_JACK_HEADSET) == SND_JACK_HEADSET)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rt5682s_hp_amp_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
|
@ -1372,6 +1361,10 @@ static int sar_power_event(struct snd_soc_dapm_widget *w,
|
|||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if ((rt5682s->jack_type & SND_JACK_HEADSET) != SND_JACK_HEADSET)
|
||||
return 0;
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
|
@ -1784,7 +1777,7 @@ static const struct snd_soc_dapm_route rt5682s_dapm_routes[] = {
|
|||
{"CLKDET SYS", NULL, "MCLK0 DET PWR"},
|
||||
|
||||
{"BST1 CBJ", NULL, "IN1P"},
|
||||
{"BST1 CBJ", NULL, "SAR", is_headset_type},
|
||||
{"BST1 CBJ", NULL, "SAR"},
|
||||
|
||||
{"RECMIX1L", "CBJ Switch", "BST1 CBJ"},
|
||||
{"RECMIX1L", NULL, "RECMIX1L Power"},
|
||||
|
@ -1890,7 +1883,7 @@ static const struct snd_soc_dapm_route rt5682s_dapm_routes[] = {
|
|||
{"HP Amp", NULL, "DAC L1"},
|
||||
{"HP Amp", NULL, "DAC R1"},
|
||||
{"HP Amp", NULL, "CLKDET SYS"},
|
||||
{"HP Amp", NULL, "SAR", is_headset_type},
|
||||
{"HP Amp", NULL, "SAR"},
|
||||
|
||||
{"HPOL", NULL, "HP Amp"},
|
||||
{"HPOR", NULL, "HP Amp"},
|
||||
|
@ -2823,8 +2816,9 @@ static int rt5682s_resume(struct snd_soc_component *component)
|
|||
|
||||
if (rt5682s->hs_jack) {
|
||||
rt5682s->jack_type = 0;
|
||||
rt5682s_sar_power_mode(component, SAR_PWR_NORMAL, 0);
|
||||
mod_delayed_work(system_power_efficient_wq,
|
||||
&rt5682s->jack_detect_work, msecs_to_jiffies(250));
|
||||
&rt5682s->jack_detect_work, msecs_to_jiffies(0));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue