From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 03/15] ALSA: hda - Always resume the codec immediately
Date: Mon, 14 May 2012 17:31:54 +0200 [thread overview]
Message-ID: <1337009526-26256-4-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1337009526-26256-1-git-send-email-tiwai@suse.de>
This is a fix for the problem in commit 785f857d1c, the pop noise
issue on some machines with ALC269. The problem was the uninitialized
state after the resume due to the delayed resume of the codec chips.
In that commit, we tried to fix by forcibly putting the codec to D3 at
suspend. But, this still also leaves the uninitialized state after
resume, and it _might_ be still problematic with some BIOS. Since the
commit turned out to regress another issues, we reverted it in the
end.
Now, in this fix, try to fix by turning on the codec immediately at
the resume path. We need to take care of the power-saving in this
case. When the device is woken up at the power-saved state, it should
go power-saving again after the resume.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/hda_codec.c | 9 +++++++--
sound/pci/hda/hda_codec.h | 2 --
sound/pci/hda/hda_intel.c | 14 +-------------
3 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 98976c8..e134e72 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3500,6 +3500,10 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
*/
static void hda_call_codec_resume(struct hda_codec *codec)
{
+ /* set as if powered on for avoiding re-entering the resume
+ * in the resume / power-save sequence
+ */
+ hda_keep_power_on(codec);
hda_set_power_state(codec,
codec->afg ? codec->afg : codec->mfg,
AC_PWRST_D0);
@@ -3515,6 +3519,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
snd_hda_codec_resume_amp(codec);
snd_hda_codec_resume_cache(codec);
}
+ snd_hda_power_down(codec); /* flag down before returning */
}
#endif /* CONFIG_PM */
@@ -4332,6 +4337,7 @@ void snd_hda_power_up(struct hda_codec *codec)
snd_hda_update_power_acct(codec);
codec->power_on = 1;
codec->power_jiffies = jiffies;
+ codec->power_transition = 1; /* avoid reentrance */
if (bus->ops.pm_notify)
bus->ops.pm_notify(bus);
hda_call_codec_resume(codec);
@@ -5521,8 +5527,7 @@ int snd_hda_resume(struct hda_bus *bus)
list_for_each_entry(codec, &bus->codec_list, list) {
if (codec->patch_ops.pre_resume)
codec->patch_ops.pre_resume(codec);
- if (snd_hda_codec_needs_resume(codec))
- hda_call_codec_resume(codec);
+ hda_call_codec_resume(codec);
}
return 0;
}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 56b4f74..0fe6491 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -1051,12 +1051,10 @@ const char *snd_hda_get_jack_location(u32 cfg);
#ifdef CONFIG_SND_HDA_POWER_SAVE
void snd_hda_power_up(struct hda_codec *codec);
void snd_hda_power_down(struct hda_codec *codec);
-#define snd_hda_codec_needs_resume(codec) codec->power_count
void snd_hda_update_power_acct(struct hda_codec *codec);
#else
static inline void snd_hda_power_up(struct hda_codec *codec) {}
static inline void snd_hda_power_down(struct hda_codec *codec) {}
-#define snd_hda_codec_needs_resume(codec) 1
#endif
#ifdef CONFIG_SND_HDA_PATCH_LOADER
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6e958bf..c19e71a 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2351,17 +2351,6 @@ static void azx_power_notify(struct hda_bus *bus)
* power management
*/
-static int snd_hda_codecs_inuse(struct hda_bus *bus)
-{
- struct hda_codec *codec;
-
- list_for_each_entry(codec, &bus->codec_list, list) {
- if (snd_hda_codec_needs_resume(codec))
- return 1;
- }
- return 0;
-}
-
static int azx_suspend(struct pci_dev *pci, pm_message_t state)
{
struct snd_card *card = pci_get_drvdata(pci);
@@ -2408,8 +2397,7 @@ static int azx_resume(struct pci_dev *pci)
return -EIO;
azx_init_pci(chip);
- if (snd_hda_codecs_inuse(chip->bus))
- azx_init_chip(chip, 1);
+ azx_init_chip(chip, 1);
snd_hda_resume(chip->bus);
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
--
1.7.9.2
next prev parent reply other threads:[~2012-05-14 15:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 15:31 [PATCH 00/15] HD-audio updates for 3.5 Takashi Iwai
2012-05-14 15:31 ` [PATCH 01/15] ALSA: hda/realtek - Call a common helper for alc_spec initialization Takashi Iwai
2012-05-14 15:31 ` [PATCH 02/15] ALSA: hda - Fix possible access to uninitialized work struct Takashi Iwai
2012-05-14 15:31 ` Takashi Iwai [this message]
2012-05-14 15:31 ` [PATCH 04/15] ALSA: hda - Clear the power-saving states properly at reset Takashi Iwai
2012-05-14 15:31 ` [PATCH 05/15] ALSA: hda - Protect the power-saving count with spinlock Takashi Iwai
2012-05-14 15:31 ` [PATCH 06/15] ALSA: hda - Move up the fixup helper functions to the library module Takashi Iwai
2012-05-14 15:31 ` [PATCH 07/15] ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.c Takashi Iwai
2012-05-14 15:31 ` [PATCH 08/15] ALSA: hda - Remove pre_resume and post_suspend ops Takashi Iwai
2012-05-14 15:32 ` [PATCH 09/15] ALSA: hda - More robustify the power-up/down sequence Takashi Iwai
2012-05-14 15:32 ` [PATCH 10/15] ALSA: hda - Add the support for Creative SoundCore3D Takashi Iwai
2012-05-14 15:32 ` [PATCH 11/15] ALSA: hda - Add Conexant CX20751/2/3/4 codec support Takashi Iwai
2012-05-14 15:32 ` [PATCH 12/15] ALSA: hda - Protect SPDIF-related stuff via spdif_mutex Takashi Iwai
2012-05-14 15:32 ` [PATCH 13/15] ALSA: hda - Fix concurrent hash accesses Takashi Iwai
2012-05-14 15:32 ` [PATCH 14/15] ALSA: hda/conexant - Correct vendor IDs for new codecs Takashi Iwai
2012-05-14 15:32 ` [PATCH 15/15] ALSA: hda - Disable FLOAT format support Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337009526-26256-4-git-send-email-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).