From patchwork Wed Sep 17 08:41:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 37509 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCD432054D for ; Wed, 17 Sep 2014 08:41:34 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id x12sf596486wgg.2 for ; Wed, 17 Sep 2014 01:41:34 -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=jvWHxnmkROZuEVlhbUg0dKgVVUSkzOiJ0L7qkVLhhaU=; b=D9G4leRWXotZ9Kyp+PAassPUvJ95DFyK3r2J6KZGaaq3g5P49suBR4OKOyI8TrlUgV K/uqedpr0Fh9pXEnORsWcKTukm5yVjgz+rHkJ2ZFfmEm4FVP5xhcxIdWGldsDzWChSn5 Mm+aDj24CU3utX+yvouVMNotdneMtjjbcmTvH6C4cAwcaBClLW60qmIdLqE6CUJOAsF+ dt12dNBtaTOYLo9bFBNk/KkoKyipw2bNIRskycQloNvjuZxHak90SsZqmIzsEQozczzh Ycd9MhUAU9gcEnILsGZkCR2wi95QCsxkUML9E8b8CF5EziDoNTBNG5x5zeLDeLPfIiu9 AXVg== X-Gm-Message-State: ALoCoQnu91S2nIaMtdPJE0IO3fT+RsfmVgBd9Yb4WLMd2PBpFkT/fGB71K1X97OolhhTiiOgzapb X-Received: by 10.194.100.3 with SMTP id eu3mr305wjb.6.1410943294056; Wed, 17 Sep 2014 01:41:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.6 with SMTP id 6ls79356lay.26.gmail; Wed, 17 Sep 2014 01:41:33 -0700 (PDT) X-Received: by 10.112.53.230 with SMTP id e6mr1487765lbp.100.1410943293715; Wed, 17 Sep 2014 01:41:33 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id y10si27624947laj.52.2014.09.17.01.41.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 01:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id el20so1360669lab.5 for ; Wed, 17 Sep 2014 01:41:33 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr42148139laa.27.1410943293576; Wed, 17 Sep 2014 01:41:33 -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 of9csp537469lbb; Wed, 17 Sep 2014 01:41:32 -0700 (PDT) X-Received: by 10.68.243.70 with SMTP id ww6mr57862711pbc.3.1410943289987; Wed, 17 Sep 2014 01:41:29 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id v3si33667138pds.170.2014.09.17.01.41.28 for ; Wed, 17 Sep 2014 01:41:29 -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 EB6A06A27AC; Wed, 17 Sep 2014 16:41:22 +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 5/9] Improve wm8971_set_dai_fmt Date: Wed, 17 Sep 2014 16:41:11 +0800 Message-Id: <1410943275-4160-5-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.46 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 modify the function of wm8971_set_dai_fmt(). Signed-off-by: Xavier Hsu Signed-off-by: Andy Green --- Any comments about improving the patch are welcome. Thanks. 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 c2ebc77..7021f77 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; }