[alsa-devel] [PATCH 1/2] ALSA: hda/realtek - Remove depop delay for suspend and resume if applicable
From: Kailang Yang kailang@realtek.com
This patch defines a flag "no_depop_delay" in alc_spec. If this flag is set, delay in alc_eapd_shutup and alc_resume will be skipped.
Machine-specific fixup can set this flag to reduce suspend/resume time, if the codec and hardware analog design can avoid pop noise without this delay.
Signed-off-by: Kailang Yang kailang@realtek.com Signed-off-by: Mengdong Lin mengdong.lin@intel.com
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6366a66..503cf78 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -118,7 +118,8 @@ struct alc_spec {
int init_amp; int codec_variant; /* flag for other variants */ - bool has_alc5505_dsp; + unsigned int has_alc5505_dsp:1; + unsigned int no_depop_delay:1;
/* for PLL fix */ hda_nid_t pll_nid; @@ -280,8 +281,11 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) */ static void alc_eapd_shutup(struct hda_codec *codec) { + struct alc_spec *spec = codec->spec; + alc_auto_setup_eapd(codec, false); - msleep(200); + if (!spec->no_depop_delay) + msleep(200); snd_hda_shutup_pins(codec); }
@@ -863,7 +867,10 @@ static int alc_suspend(struct hda_codec *codec) #ifdef CONFIG_PM static int alc_resume(struct hda_codec *codec) { - msleep(150); /* to avoid pop noise */ + struct alc_spec *spec = codec->spec; + + if (!spec->no_depop_delay) + msleep(150); /* to avoid pop noise */ codec->patch_ops.init(codec); snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec); @@ -4448,7 +4455,7 @@ static int patch_alc269(struct hda_codec *codec) }
if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { - spec->has_alc5505_dsp = true; + spec->has_alc5505_dsp = 1; spec->init_hook = alc5505_dsp_init; }
From: Mengdong Lin mengdong.lin@intel.com
This patch defines a fixup 'alc_fixup_no_depop_delay', which sets alc_spec flag 'no_depop_delay' to indicate skipping delay in Realtek codec suspend/resume.
And Intel Baytrail BayleyBay board applies this fixup to reduce driver suspend/resume time.
Signed-off-by: Mengdong Lin mengdong.lin@intel.com
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 503cf78..46822e0 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -369,6 +369,15 @@ static void alc_fixup_sku_ignore(struct hda_codec *codec, } }
+static void alc_fixup_no_depop_delay(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + struct alc_spec *spec = codec->spec; + + if (action == HDA_FIXUP_ACT_PROBE) + spec->no_depop_delay = 1; +} + static int alc_auto_parse_customize_define(struct hda_codec *codec) { unsigned int ass, tmp, i; @@ -2298,6 +2307,7 @@ enum { ALC262_FIXUP_BENQ, ALC262_FIXUP_BENQ_T31, ALC262_FIXUP_INV_DMIC, + ALC262_FIXUP_INTEL_BAYLEYBAY, };
static const struct hda_fixup alc262_fixups[] = { @@ -2362,6 +2372,10 @@ static const struct hda_fixup alc262_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_inv_dmic_0x12, }, + [ALC262_FIXUP_INTEL_BAYLEYBAY] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_no_depop_delay, + }, };
static const struct snd_pci_quirk alc262_fixup_tbl[] = { @@ -2373,6 +2387,7 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), + SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY), {} };
At Fri, 29 Nov 2013 00:35:26 -0500, mengdong.lin@intel.com wrote:
From: Kailang Yang kailang@realtek.com
This patch defines a flag "no_depop_delay" in alc_spec. If this flag is set, delay in alc_eapd_shutup and alc_resume will be skipped.
Machine-specific fixup can set this flag to reduce suspend/resume time, if the codec and hardware analog design can avoid pop noise without this delay.
Signed-off-by: Kailang Yang kailang@realtek.com Signed-off-by: Mengdong Lin mengdong.lin@intel.com
Thanks, applied both patches now.
Takashi
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6366a66..503cf78 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -118,7 +118,8 @@ struct alc_spec {
int init_amp; int codec_variant; /* flag for other variants */
- bool has_alc5505_dsp;
unsigned int has_alc5505_dsp:1;
unsigned int no_depop_delay:1;
/* for PLL fix */ hda_nid_t pll_nid;
@@ -280,8 +281,11 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) */ static void alc_eapd_shutup(struct hda_codec *codec) {
- struct alc_spec *spec = codec->spec;
- alc_auto_setup_eapd(codec, false);
- msleep(200);
- if (!spec->no_depop_delay)
snd_hda_shutup_pins(codec);msleep(200);
}
@@ -863,7 +867,10 @@ static int alc_suspend(struct hda_codec *codec) #ifdef CONFIG_PM static int alc_resume(struct hda_codec *codec) {
- msleep(150); /* to avoid pop noise */
- struct alc_spec *spec = codec->spec;
- if (!spec->no_depop_delay)
codec->patch_ops.init(codec); snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec);msleep(150); /* to avoid pop noise */
@@ -4448,7 +4455,7 @@ static int patch_alc269(struct hda_codec *codec) }
if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
spec->has_alc5505_dsp = true;
spec->init_hook = alc5505_dsp_init; }spec->has_alc5505_dsp = 1;
-- 1.8.1.2
participants (2)
-
mengdong.lin@intel.com
-
Takashi Iwai