From patchwork Wed Sep 17 08:41:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 37511 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5340E20CB7 for ; Wed, 17 Sep 2014 08:41:37 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id s18sf598206lam.1 for ; Wed, 17 Sep 2014 01:41:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=8H72RkrbRDXJo9om6e+5MtM+Wo9muE8Mke95EEKMKPQ=; b=Ec8ohWJhFlGcAmWZrxe9gySnpBmPH7hvyk8bST+D3JXUWqZBBQucehTVbt/ngDzRtX MJJwzTgnOrvUsOTUSlgzb/U0l0joidSaZrhtKKcVXV52/eCYBq4zk2Qj0njWvPwpCiPM Tf5qT/6tPEIcZuk5XMoKVKQmewAhVfdmh3fnQE24izor3Lic2QbPMhC5fN3T8QI2NT0T LS7nFaEDC0WlwWRujRFBf6RPgYSYEAx1Yr/fHOWTr7puQso/pV5p1af9BlcXS1lnw8FN Sjb6rAPrwANYYJVtt/r+zC/QASDIb1i9PuSnPNox/bnuTXQ1QHyEP6JcpwuLh5XcOp6v mqCg== X-Gm-Message-State: ALoCoQmREe48POEWpndR6EtEQbS8/QOUoIep+X65cg3JM6H89BI1gZP0wNadGjfdNG/6dt8jUpxv X-Received: by 10.180.221.169 with SMTP id qf9mr639617wic.5.1410943296185; Wed, 17 Sep 2014 01:41:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.100 with SMTP id lb4ls91042lab.82.gmail; Wed, 17 Sep 2014 01:41:35 -0700 (PDT) X-Received: by 10.112.180.137 with SMTP id do9mr22855702lbc.63.1410943295897; Wed, 17 Sep 2014 01:41:35 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id 7si18482434lai.94.2014.09.17.01.41.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 01:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id ty20so1372265lab.37 for ; Wed, 17 Sep 2014 01:41:35 -0700 (PDT) X-Received: by 10.152.179.226 with SMTP id dj2mr42990464lac.40.1410943295730; Wed, 17 Sep 2014 01:41:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.130.169 with SMTP id of9csp537474lbb; Wed, 17 Sep 2014 01:41:35 -0700 (PDT) X-Received: by 10.68.204.137 with SMTP id ky9mr2521912pbc.167.1410943291932; Wed, 17 Sep 2014 01:41:31 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id v9si33716229pdp.136.2014.09.17.01.41.30 for ; Wed, 17 Sep 2014 01:41:31 -0700 (PDT) Received-SPF: none (google.com: xavier@kraken does not designate permitted sender hosts) client-ip=124.219.7.128; Received: by Kraken (Postfix, from userid 1011) id 9EB756A27AE; Wed, 17 Sep 2014 16:41:24 +0800 (CST) From: Xavier Hsu To: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, patches@linaro.org Cc: lars@metafoo.de, ckeepax@opensource.wolfsonmicro.com, Xavier Hsu , Andy Green Subject: [PATCHv4 7/9] WM8971 uses msleep to replace work queue Date: Wed, 17 Sep 2014 16:41:13 +0800 Message-Id: <1410943275-4160-7-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1410943275-4160-1-git-send-email-xavier.hsu@linaro.org> References: <1410943275-4160-1-git-send-email-xavier.hsu@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: xavier.hsu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch improves WM8971. We use msleep to replace work queue. "As suggested by Mark Brown" Signed-off-by: Xavier Hsu Signed-off-by: Andy Green --- Any comments about improving the patch are welcome. Thanks. sound/soc/codecs/wm8971.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 5b38c7a..d081cae 100755 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -36,8 +36,6 @@ #define WM8971_REG_COUNT 43 -static struct workqueue_struct *wm8971_workq; - /* codec private data */ struct wm8971_priv { /* MCLK */ @@ -779,16 +777,6 @@ static struct snd_soc_dai_driver wm8971_dai = { .ops = &wm8971_dai_ops, }; -static void wm8971_work(struct work_struct *work) -{ - struct snd_soc_dapm_context *dapm = - container_of(work, struct snd_soc_dapm_context, - delayed_work.work); - struct snd_soc_codec *codec = dapm->codec; - - wm8971_set_bias_level(codec, codec->dapm.bias_level); -} - static int wm8971_suspend(struct snd_soc_codec *codec) { wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); @@ -806,8 +794,8 @@ static int wm8971_resume(struct snd_soc_codec *codec) reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); codec->dapm.bias_level = SND_SOC_BIAS_ON; - queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work, - msecs_to_jiffies(1000)); + wm8971_set_bias_level(codec, codec->dapm.bias_level); + msleep(1000); } return 0; @@ -818,19 +806,14 @@ static int wm8971_probe(struct snd_soc_codec *codec) int ret = 0; u16 reg; - INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work); - wm8971_workq = create_workqueue("wm8971"); - if (wm8971_workq == NULL) - return -ENOMEM; - wm8971_reset(codec); /* charge output caps - set vmid to 5k for quick power up */ reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e; snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0); codec->dapm.bias_level = SND_SOC_BIAS_STANDBY; - queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work, - msecs_to_jiffies(1000)); + wm8971_set_bias_level(codec, codec->dapm.bias_level); + msleep(1000); /* set the update bits */ snd_soc_update_bits(codec, WM8971_LDAC, 0x0100, 0x0100); @@ -850,8 +833,6 @@ static int wm8971_remove(struct snd_soc_codec *codec) { wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); - if (wm8971_workq) - destroy_workqueue(wm8971_workq); return 0; }