alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Harsha Priya <harshapriya.n@intel.com>
To: alsa-devel@alsa-project.org, tiwai@suse.de
Cc: Harsha Priya <harshapriya.n@intel.com>,
	Emmanuel Jillela <emmanuel.jillela@intel.com>
Subject: [PATCH v2] ALSA: HDA: Early Forbid of runtime PM
Date: Thu, 27 Aug 2020 16:05:36 -0700	[thread overview]
Message-ID: <1598569536-9450-1-git-send-email-harshapriya.n@intel.com> (raw)

For certain codecs (like Realtek), pm_runtime_forbid() is invoked 
in the probe function after build_controls(). In a stress test, 
its observed occasionally that runtime PM calls are invoked 
before controls are built. This causes the codec to be
runtime suspended before probe completes. Because of this, not all
controls are enumerated correctly, and audio does not work until
system is rebooted.

This issue being common across all codecs, pm_runtime_forbid() is 
called when the codec object is created to fix this issue. 
A codec enables or disables runtime pm in its own probe function.

Multiple stress tests of 2000+ cycles has been done to test the fix.

Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Emmanuel Jillela <emmanuel.jillela@intel.com>
Reviewed-by: Kailang Yang <kailang@realtek.com>
---
 sound/pci/hda/hda_codec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e96a87f1b611..a356c21edb90 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1000,6 +1000,9 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
 	if (err < 0)
 		goto error;
 
+	/* PM runtime needs to be enabled later after binding codec */
+	pm_runtime_forbid(&codec->core.dev);
+
 	return 0;
 
  error:
-- 
2.17.1


             reply	other threads:[~2020-08-27 23:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 23:05 Harsha Priya [this message]
2020-08-28  7:33 ` [PATCH v2] ALSA: HDA: Early Forbid of runtime PM Takashi Iwai
2020-08-28 15:03   ` Kai Vehmanen
     [not found]     ` <BN6PR1101MB2275262388388F71D62390299C520@BN6PR1101MB2275.namprd11.prod.outlook.com>
2020-08-31  9:40       ` Takashi Iwai
2020-09-18 14:56     ` Kai Vehmanen

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=1598569536-9450-1-git-send-email-harshapriya.n@intel.com \
    --to=harshapriya.n@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=emmanuel.jillela@intel.com \
    --cc=tiwai@suse.de \
    /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).