Commit 4bb09523 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] soc - Use global workqueue

Use global workqueue for simplicity instead of own workqueue
in SoC core and wm8750 codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 4014c38b
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#define warn(format, arg...) \ #define warn(format, arg...) \
printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg) printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg)
static struct workqueue_struct *wm8750_workq = NULL;
static struct work_struct wm8750_dapm_work; static struct work_struct wm8750_dapm_work;
/* /*
...@@ -1039,7 +1038,7 @@ static int wm8750_resume(struct platform_device *pdev) ...@@ -1039,7 +1038,7 @@ static int wm8750_resume(struct platform_device *pdev)
if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) { if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) {
wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
codec->dapm_state = SNDRV_CTL_POWER_D0; codec->dapm_state = SNDRV_CTL_POWER_D0;
queue_delayed_work(wm8750_workq, &wm8750_dapm_work, schedule_delayed_work(&wm8750_dapm_work,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
} }
...@@ -1084,8 +1083,7 @@ static int wm8750_init(struct snd_soc_device *socdev) ...@@ -1084,8 +1083,7 @@ static int wm8750_init(struct snd_soc_device *socdev)
/* charge output caps */ /* charge output caps */
wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2);
codec->dapm_state = SNDRV_CTL_POWER_D3hot; codec->dapm_state = SNDRV_CTL_POWER_D3hot;
queue_delayed_work(wm8750_workq, &wm8750_dapm_work, schedule_delayed_work(&wm8750_dapm_work, msecs_to_jiffies(1000));
msecs_to_jiffies(1000));
/* set the update bits */ /* set the update bits */
reg = wm8750_read_reg_cache(codec, WM8750_LDAC); reg = wm8750_read_reg_cache(codec, WM8750_LDAC);
...@@ -1228,11 +1226,6 @@ static int wm8750_probe(struct platform_device *pdev) ...@@ -1228,11 +1226,6 @@ static int wm8750_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&codec->dapm_paths); INIT_LIST_HEAD(&codec->dapm_paths);
wm8750_socdev = socdev; wm8750_socdev = socdev;
INIT_WORK(&wm8750_dapm_work, wm8750_work, codec); INIT_WORK(&wm8750_dapm_work, wm8750_work, codec);
wm8750_workq = create_workqueue("wm8750");
if (wm8750_workq == NULL) {
kfree(codec);
return -ENOMEM;
}
#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) #if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE)
if (setup->i2c_address) { if (setup->i2c_address) {
normal_i2c[0] = setup->i2c_address; normal_i2c[0] = setup->i2c_address;
...@@ -1256,8 +1249,7 @@ static int wm8750_remove(struct platform_device *pdev) ...@@ -1256,8 +1249,7 @@ static int wm8750_remove(struct platform_device *pdev)
if (codec->control_data) if (codec->control_data)
wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold); wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
if (wm8750_workq) flush_scheduled_work();
destroy_workqueue(wm8750_workq);
snd_soc_free_pcms(socdev); snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev); snd_soc_dapm_free(socdev);
#if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE) #if defined (CONFIG_I2C) || defined (CONFIG_I2C_MODULE)
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
static DEFINE_MUTEX(pcm_mutex); static DEFINE_MUTEX(pcm_mutex);
static DEFINE_MUTEX(io_mutex); static DEFINE_MUTEX(io_mutex);
static struct workqueue_struct *soc_workq;
static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq); static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq);
/* supported sample rates */ /* supported sample rates */
...@@ -810,7 +809,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream) ...@@ -810,7 +809,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* start delayed pop wq here for playback streams */ /* start delayed pop wq here for playback streams */
rtd->codec_dai->pop_wait = 1; rtd->codec_dai->pop_wait = 1;
queue_delayed_work(soc_workq, &socdev->delayed_work, schedule_delayed_work(&socdev->delayed_work,
msecs_to_jiffies(pmdown_time)); msecs_to_jiffies(pmdown_time));
} else { } else {
/* capture streams can be powered down now */ /* capture streams can be powered down now */
...@@ -1102,7 +1101,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -1102,7 +1101,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
} }
/* close any waiting streams and save state */ /* close any waiting streams and save state */
flush_workqueue(soc_workq); flush_scheduled_work();
codec->suspend_dapm_state = codec->dapm_state; codec->suspend_dapm_state = codec->dapm_state;
for(i = 0; i < codec->num_dai; i++) { for(i = 0; i < codec->num_dai; i++) {
...@@ -1227,16 +1226,9 @@ static int soc_probe(struct platform_device *pdev) ...@@ -1227,16 +1226,9 @@ static int soc_probe(struct platform_device *pdev)
} }
/* DAPM stream work */ /* DAPM stream work */
soc_workq = create_workqueue("kdapm");
if (soc_workq == NULL)
goto work_err;
INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work); INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work);
return 0; return 0;
work_err:
if (platform->remove)
platform->remove(pdev);
platform_err: platform_err:
if (codec_dev->remove) if (codec_dev->remove)
codec_dev->remove(pdev); codec_dev->remove(pdev);
...@@ -1263,9 +1255,6 @@ static int soc_remove(struct platform_device *pdev) ...@@ -1263,9 +1255,6 @@ static int soc_remove(struct platform_device *pdev)
struct snd_soc_platform *platform = socdev->platform; struct snd_soc_platform *platform = socdev->platform;
struct snd_soc_codec_device *codec_dev = socdev->codec_dev; struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
if (soc_workq)
destroy_workqueue(soc_workq);
if (platform->remove) if (platform->remove)
platform->remove(pdev); platform->remove(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment