From patchwork Fri Oct 24 06:00:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 39406 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1F2A520341 for ; Fri, 24 Oct 2014 06:01:12 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf218356wid.0 for ; Thu, 23 Oct 2014 23:01:11 -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=GMKPegglS9MqxgDZC/OmHACjGaQo7FCzWAAZPY9ZhHk=; b=fxOHYx8pkzstOKNFE7e5/bpb93E53o1TpRNRFIgAxRJilemv4DzjKbx+Oza70gT8zU lXWuKk9L56ZVpYK03jImBtfn0MChJAsxD2ta8DQ29QoamVfHy5LY6hjIZh+hFKNKc3Ae JcyREK4DRGo+JW36VUwEUeL9JOe9C3u5fr1j/5PhtM3dZqQ3gxzUlvdKmQ63Zy+FW5Eu xS2QcaMSb3YUHPZNEsUPpaGJcPAniHkwxSFvc8T5W8KFQ8B37jmU6aI4AqETRtf57+pe t1Jj87eJcmrg/PpJ4ztxrB9qYur62EBReJm41lHNirOmQVHv3KmAbxOXj2vonS0G7YKF CPyQ== X-Gm-Message-State: ALoCoQkNdCitS478uqla3MjCXJeIjOKDpcmP5wviKwqD6ISWEuoXquZB7hiYoB9uXs9BKpicCoZN X-Received: by 10.112.154.194 with SMTP id vq2mr193094lbb.10.1414130470677; Thu, 23 Oct 2014 23:01:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.135 with SMTP id v7ls412005lae.40.gmail; Thu, 23 Oct 2014 23:01:10 -0700 (PDT) X-Received: by 10.112.146.37 with SMTP id sz5mr2041641lbb.27.1414130470476; Thu, 23 Oct 2014 23:01:10 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id j9si5499266lab.13.2014.10.23.23.01.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 23:01:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so1994201lbv.19 for ; Thu, 23 Oct 2014 23:01:10 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr2041688lbc.23.1414130469686; Thu, 23 Oct 2014 23:01:09 -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.84.229 with SMTP id c5csp374987lbz; Thu, 23 Oct 2014 23:01:08 -0700 (PDT) X-Received: by 10.68.225.99 with SMTP id rj3mr2336272pbc.97.1414130468119; Thu, 23 Oct 2014 23:01:08 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id j1si1025397pdf.165.2014.10.23.23.01.06 for ; Thu, 23 Oct 2014 23:01:08 -0700 (PDT) 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 B9B1E6A27A8; Fri, 24 Oct 2014 14:00:57 +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: [PATCHv5 5/9] ASOC: wm8971: improve the function of wm8971_set_dai_fmt() Date: Fri, 24 Oct 2014 14:00:31 +0800 Message-Id: <1414130435-14183-5-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414130435-14183-1-git-send-email-xavier.hsu@linaro.org> References: <1414130435-14183-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.217.174 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 4572446..1c871de 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; }