From: Liam Girdwood <lg@opensource.wolfsonmicro.com>
To: alsa-devel@lists.sourceforge.net
Subject: [PATCH] ASoC force running of delayed PM work at suspend() and remove()
Date: Wed, 31 Jan 2007 12:26:25 +0000 [thread overview]
Message-ID: <1170246385.16760.51.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 771 bytes --]
This patch fixes a bug whereby the power management delayed work would
never be run at driver suspend() or module remove(). Delayed work would
be created (after audio had finished) with a long delay (~5 secs) and
was sometimes never queued before flush_scheduled_work() was being
called at suspend or module remove. This caused the delayed work to
queued after the module had been removed or after resume.
This patch forces any delayed work to complete by cancelling it (timer
cannot fire and add it to queue later), scheduling it for now and
waiting on it's completion.
This is something I probably would like to add to workqueue.c in the
next merge window, however it's here atm because it can oops.
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
[-- Attachment #2: asoc-delayed-work.patch --]
[-- Type: text/x-patch, Size: 1421 bytes --]
diff -r b4265ee02e26 soc/soc-core.c
--- a/soc/soc-core.c Wed Jan 31 10:35:19 2007 +0100
+++ b/soc/soc-core.c Wed Jan 31 12:06:05 2007 +0000
@@ -76,6 +76,25 @@ static int pmdown_time = 5000;
static int pmdown_time = 5000;
module_param(pmdown_time, int, 0);
MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)");
+
+/*
+ * This function forces any delayed work to be queued and run.
+ */
+static int run_delayed_work(struct delayed_work *dwork)
+{
+ int ret;
+
+ /* cancel any work waiting to be queued. */
+ ret = cancel_delayed_work(dwork);
+
+ /* if there was any work waiting then we run it now and
+ * wait for it's completion */
+ if (ret) {
+ schedule_delayed_work(dwork, 0);
+ flush_scheduled_work();
+ }
+ return ret;
+}
#ifdef CONFIG_SND_SOC_AC97_BUS
/* unregister ac97 codec */
@@ -1101,7 +1120,7 @@ static int soc_suspend(struct platform_d
}
/* close any waiting streams and save state */
- flush_scheduled_work();
+ run_delayed_work(&socdev->delayed_work);
codec->suspend_dapm_state = codec->dapm_state;
for(i = 0; i < codec->num_dai; i++) {
@@ -1254,6 +1273,8 @@ static int soc_remove(struct platform_de
struct snd_soc_machine *machine = socdev->machine;
struct snd_soc_platform *platform = socdev->platform;
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
+
+ run_delayed_work(&socdev->delayed_work);
if (platform->remove)
platform->remove(pdev);
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
next reply other threads:[~2007-01-31 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-31 12:26 Liam Girdwood [this message]
2007-01-31 13:23 ` [PATCH] ASoC force running of delayed PM work at suspend() and remove() Takashi Iwai
2007-01-31 17:22 ` Liam Girdwood
2007-01-31 17:39 ` Liam Girdwood
2007-02-01 11:13 ` 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=1170246385.16760.51.camel@localhost.localdomain \
--to=lg@opensource.wolfsonmicro.com \
--cc=alsa-devel@lists.sourceforge.net \
/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).