aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-12-19 11:16:14 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:02:42 -0500
commit4bb09523de50dcf1afc5d3099b9da0381f01b04c (patch)
tree55ccea8c60314591c829b7af7483c58fd6d67d53 /sound/soc
parent4014c38bd94156c10986a11d890bdae99437dc9a (diff)
[ALSA] soc - Use global workqueue
Use global workqueue for simplicity instead of own workqueue in SoC core and wm8750 codes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8750.c14
-rw-r--r--sound/soc/soc-core.c15
2 files changed, 5 insertions, 24 deletions
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 4cc85128dc59..069b66cb18e0 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -51,7 +51,6 @@
51#define warn(format, arg...) \ 51#define warn(format, arg...) \
52 printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg) 52 printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg)
53 53
54static struct workqueue_struct *wm8750_workq = NULL;
55static struct work_struct wm8750_dapm_work; 54static struct work_struct wm8750_dapm_work;
56 55
57/* 56/*
@@ -1039,7 +1038,7 @@ static int wm8750_resume(struct platform_device *pdev)
1039 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) { 1038 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) {
1040 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); 1039 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
1041 codec->dapm_state = SNDRV_CTL_POWER_D0; 1040 codec->dapm_state = SNDRV_CTL_POWER_D0;
1042 queue_delayed_work(wm8750_workq, &wm8750_dapm_work, 1041 schedule_delayed_work(&wm8750_dapm_work,
1043 msecs_to_jiffies(1000)); 1042 msecs_to_jiffies(1000));
1044 } 1043 }
1045 1044
@@ -1084,8 +1083,7 @@ static int wm8750_init(struct snd_soc_device *socdev)
1084 /* charge output caps */ 1083 /* charge output caps */
1085 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); 1084 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
1086 codec->dapm_state = SNDRV_CTL_POWER_D3hot; 1085 codec->dapm_state = SNDRV_CTL_POWER_D3hot;
1087 queue_delayed_work(wm8750_workq, &wm8750_dapm_work, 1086 schedule_delayed_work(&wm8750_dapm_work, msecs_to_jiffies(1000));
1088 msecs_to_jiffies(1000));
1089 1087
1090 /* set the update bits */ 1088 /* set the update bits */
1091 reg = wm8750_read_reg_cache(codec, WM8750_LDAC); 1089 reg = wm8750_read_reg_cache(codec, WM8750_LDAC);
@@ -1228,11 +1226,6 @@ static int wm8750_probe(struct platform_device *pdev)
1228 INIT_LIST_HEAD(&codec->dapm_paths); 1226 INIT_LIST_HEAD(&codec->dapm_paths);
1229 wm8750_socdev = socdev; 1227 wm8750_socdev = socdev;
1230 INIT_WORK(&wm8750_dapm_work, wm8750_work, codec); 1228 INIT_WORK(&wm8750_dapm_work, wm8750_work, codec);
1231 wm8750_workq = create_workqueue("wm8750");
1232 if (wm8750_workq == NULL) {
1233 kfree(codec);
1234 return -ENOMEM;
1235 }
1236#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) 1229#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE)
1237 if (setup->i2c_address) { 1230 if (setup->i2c_address) {
1238 normal_i2c[0] = setup->i2c_address; 1231 normal_i2c[0] = setup->i2c_address;
@@ -1256,8 +1249,7 @@ static int wm8750_remove(struct platform_device *pdev)
1256 1249
1257 if (codec->control_data) 1250 if (codec->control_data)
1258 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold); 1251 wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
1259 if (wm8750_workq) 1252 flush_scheduled_work();
1260 destroy_workqueue(wm8750_workq);
1261 snd_soc_free_pcms(socdev); 1253 snd_soc_free_pcms(socdev);
1262 snd_soc_dapm_free(socdev); 1254 snd_soc_dapm_free(socdev);
1263#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) 1255#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9f23901fc85c..cf84d8251715 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -59,7 +59,6 @@
59 59
60static DEFINE_MUTEX(pcm_mutex); 60static DEFINE_MUTEX(pcm_mutex);
61static DEFINE_MUTEX(io_mutex); 61static DEFINE_MUTEX(io_mutex);
62static struct workqueue_struct *soc_workq;
63static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq); 62static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq);
64 63
65/* supported sample rates */ 64/* supported sample rates */
@@ -810,7 +809,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
810 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 809 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
811 /* start delayed pop wq here for playback streams */ 810 /* start delayed pop wq here for playback streams */
812 rtd->codec_dai->pop_wait = 1; 811 rtd->codec_dai->pop_wait = 1;
813 queue_delayed_work(soc_workq, &socdev->delayed_work, 812 schedule_delayed_work(&socdev->delayed_work,
814 msecs_to_jiffies(pmdown_time)); 813 msecs_to_jiffies(pmdown_time));
815 } else { 814 } else {
816 /* capture streams can be powered down now */ 815 /* capture streams can be powered down now */
@@ -1102,7 +1101,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
1102 } 1101 }
1103 1102
1104 /* close any waiting streams and save state */ 1103 /* close any waiting streams and save state */
1105 flush_workqueue(soc_workq); 1104 flush_scheduled_work();
1106 codec->suspend_dapm_state = codec->dapm_state; 1105 codec->suspend_dapm_state = codec->dapm_state;
1107 1106
1108 for(i = 0; i < codec->num_dai; i++) { 1107 for(i = 0; i < codec->num_dai; i++) {
@@ -1227,16 +1226,9 @@ static int soc_probe(struct platform_device *pdev)
1227 } 1226 }
1228 1227
1229 /* DAPM stream work */ 1228 /* DAPM stream work */
1230 soc_workq = create_workqueue("kdapm");
1231 if (soc_workq == NULL)
1232 goto work_err;
1233 INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work); 1229 INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work);
1234 return 0; 1230 return 0;
1235 1231
1236work_err:
1237 if (platform->remove)
1238 platform->remove(pdev);
1239
1240platform_err: 1232platform_err:
1241 if (codec_dev->remove) 1233 if (codec_dev->remove)
1242 codec_dev->remove(pdev); 1234 codec_dev->remove(pdev);
@@ -1263,9 +1255,6 @@ static int soc_remove(struct platform_device *pdev)
1263 struct snd_soc_platform *platform = socdev->platform; 1255 struct snd_soc_platform *platform = socdev->platform;
1264 struct snd_soc_codec_device *codec_dev = socdev->codec_dev; 1256 struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
1265 1257
1266 if (soc_workq)
1267 destroy_workqueue(soc_workq);
1268
1269 if (platform->remove) 1258 if (platform->remove)
1270 platform->remove(pdev); 1259 platform->remove(pdev);
1271 1260