From patchwork Tue Sep 2 03:30:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 36441 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D46F220C87 for ; Tue, 2 Sep 2014 03:30:57 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id id10sf19218904vcb.1 for ; Mon, 01 Sep 2014 20:30:57 -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=aok6s+3xxAdEXjAJJndzu1XkRCLI/i2QnK6MCNO4UV8=; b=ORV2dzsHVzgvu7cpYTo/78wdF48tJ5KL0zGHVACfRVnYLlHfYERgyqmjyd5jgUXJ8W wPOwhC/m0O7yW22LV46D6SLJsB+LHsvTC1rckgrzm0JGEgZ6Evzkq8QbYaBNGhJzdzXV T+cJXatxzQYZXhlfmVTFQ7vx8ks190MvvJ01F9nW4raxsuVNZP7kAzv7OnwCQW97c7bn vC9yWxUTrB4HUUVnjw8wBoHbfRYe5lVs3kOVuGIM/jop9pBrp0jVM9/JQ+Hb49T9RltE LK/0EG9ROFZRX+Q7MG8NW6mYzLcnNv1v1kGS9+8zeQRlVL1XG7TOu92Wp8z4Ugf4kVBo 1Lgw== X-Gm-Message-State: ALoCoQlZBl7aJVf+ykP5DDerWEAdlv7uBkOgDm1z5/oEWQcQf1K674X6/Y54A9C2bkDMI7/P+/kG X-Received: by 10.52.36.197 with SMTP id s5mr1446346vdj.5.1409628657669; Mon, 01 Sep 2014 20:30:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.228 with SMTP id d91ls2245903qge.41.gmail; Mon, 01 Sep 2014 20:30:57 -0700 (PDT) X-Received: by 10.220.105.142 with SMTP id t14mr28390863vco.14.1409628657611; Mon, 01 Sep 2014 20:30:57 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id ts3si1745590vcb.70.2014.09.01.20.30.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 20:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id im17so6505638vcb.27 for ; Mon, 01 Sep 2014 20:30:57 -0700 (PDT) X-Received: by 10.220.184.70 with SMTP id cj6mr27920277vcb.5.1409628657544; Mon, 01 Sep 2014 20:30:57 -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.221.45.67 with SMTP id uj3csp465341vcb; Mon, 1 Sep 2014 20:30:57 -0700 (PDT) X-Received: by 10.70.118.166 with SMTP id kn6mr44495071pdb.65.1409628656160; Mon, 01 Sep 2014 20:30:56 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id jy10si3649031pbc.150.2014.09.01.20.30.54 for ; Mon, 01 Sep 2014 20:30:56 -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 90E696A27A6; Tue, 2 Sep 2014 11:30:53 +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: [PATCHv3 6/9] WM8971 uses msleep to replace work queue Date: Tue, 2 Sep 2014 11:30:45 +0800 Message-Id: <1409628648-13732-6-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1409628648-13732-1-git-send-email-xavier.hsu@linaro.org> References: <1409628648-13732-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.220.182 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" Any comments about improving the patch are welcome. Thanks. Signed-off-by: Xavier Hsu Signed-off-by: Andy Green --- sound/soc/codecs/wm8971.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 20cfdd3..68b4f52 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 { unsigned int sysclk; @@ -774,16 +772,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); @@ -801,8 +789,7 @@ 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)); + msleep(100); } return 0; @@ -813,19 +800,13 @@ 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)); + msleep(100); /* set the update bits */ snd_soc_update_bits(codec, WM8971_LDAC, 0x0100, 0x0100); @@ -846,8 +827,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; }