From patchwork Mon Dec 1 06:51:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 41746 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7AF6A20672 for ; Mon, 1 Dec 2014 06:52:44 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf6066691lbv.5 for ; Sun, 30 Nov 2014 22:52:43 -0800 (PST) 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=QdZ/7BzW/8O2iHMVP+PIDr+OtkvyMOYvPyXrujgBWOs=; b=Mu58I1ywNZBSsRN/kbHmBhWE3ToJw8gTt5WWOg00mwUlJEZ5aEIWmNtLEic92klroK 9bOzFRb0kIqvM1C3+HlrzIvbG9fzMV/jhFjFmYMwsmgoyrNAIfcYlUzRbIFE/p9NUWCo dI8Co4C6UConnWZ469Q18isCIdiBtBlOalwi57uROefpiDtYkUc83CGTV/FprmMOirNy Q4rwQW8sw1oSnGNNla3PO8dZorhahYpItutHXBHiOu6lKrC0GSnjrqWhMS43LWf56+t7 /v9npgn4nhelw20WL5JPTFdbLF2jujUOVAq6F/JKKjINWD+hobpEPIlsifnzz+mau9vv IfNw== X-Gm-Message-State: ALoCoQkbSG2JPJoitVy8c4QtNeVBV+/VMovaAKNmDjF7GOXxSD8P+60iljjlPH6U6pYVTjovbuL8 X-Received: by 10.112.151.38 with SMTP id un6mr15406359lbb.0.1417416763428; Sun, 30 Nov 2014 22:52:43 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.98 with SMTP id lf2ls413355lac.16.gmail; Sun, 30 Nov 2014 22:52:43 -0800 (PST) X-Received: by 10.112.138.137 with SMTP id qq9mr54933937lbb.80.1417416763292; Sun, 30 Nov 2014 22:52:43 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id k12si4209712laa.24.2014.11.30.22.52.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 22:52:43 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id hs14so3540954lab.11 for ; Sun, 30 Nov 2014 22:52:43 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr54441307lbc.23.1417416763209; Sun, 30 Nov 2014 22:52:43 -0800 (PST) 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.184.201 with SMTP id ew9csp236474lbc; Sun, 30 Nov 2014 22:52:42 -0800 (PST) X-Received: by 10.66.243.38 with SMTP id wv6mr99022752pac.103.1417416758421; Sun, 30 Nov 2014 22:52:38 -0800 (PST) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id tl7si7749560pbc.203.2014.11.30.22.52.36 for ; Sun, 30 Nov 2014 22:52:38 -0800 (PST) Received-SPF: temperror (google.com: error in processing during lookup of xavier@kraken: DNS timeout) client-ip=124.219.7.128; Received: by Kraken (Postfix, from userid 1011) id 8B6E26A2A4E; Mon, 1 Dec 2014 14:52:15 +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: [PATCHv6 5/9] ASOC: wm8971: improve the function of wm8971_set_dai_fmt() Date: Mon, 1 Dec 2014 14:51:57 +0800 Message-Id: <1417416721-17271-5-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417416721-17271-1-git-send-email-xavier.hsu@linaro.org> References: <1417416721-17271-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.52 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: , We use snd_soc_update_bits() to replace snd_soc_write(). "As suggested by Mark Brown" Signed-off-by: Xavier Hsu Signed-off-by: Andy Green --- sound/soc/codecs/wm8971.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index b06bd83..5f711bd 100755 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -552,12 +552,11 @@ static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = 0; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: - iface = 0x0040; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0040, 0x0040); break; case SND_SOC_DAIFMT_CBS_CFS: break; @@ -568,18 +567,18 @@ static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai, /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - iface |= 0x0002; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0002, 0x0002); break; case SND_SOC_DAIFMT_RIGHT_J: break; case SND_SOC_DAIFMT_LEFT_J: - iface |= 0x0001; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0001, 0x0001); break; case SND_SOC_DAIFMT_DSP_A: - iface |= 0x0003; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0003, 0x0003); break; case SND_SOC_DAIFMT_DSP_B: - iface |= 0x0013; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0013, 0x0013); break; default: return -EINVAL; @@ -590,19 +589,18 @@ static int wm8971_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_NB_NF: break; case SND_SOC_DAIFMT_IB_IF: - iface |= 0x0090; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0090, 0x0090); break; case SND_SOC_DAIFMT_IB_NF: - iface |= 0x0080; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0080, 0x0080); break; case SND_SOC_DAIFMT_NB_IF: - iface |= 0x0010; + snd_soc_update_bits(codec, WM8971_IFACE, 0x0010, 0x0010); break; default: return -EINVAL; } - snd_soc_write(codec, WM8971_IFACE, iface); return 0; }