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: 4923211 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB8FB9F2EC for ; Wed, 17 Sep 2014 08:40:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55B5920127 for ; Wed, 17 Sep 2014 08:41:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8D2A420121 for ; Wed, 17 Sep 2014 08:41:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 14C9E265309; Wed, 17 Sep 2014 10:41:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D2FA826532C; Wed, 17 Sep 2014 10:41:38 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 69AF5265334; Wed, 17 Sep 2014 10:41:38 +0200 (CEST) Received: from Kraken (unknown [124.219.7.128]) by alsa0.perex.cz (Postfix) with ESMTP id E77C92652DB for ; Wed, 17 Sep 2014 10:41:29 +0200 (CEST) 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 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> Cc: Xavier Hsu , ckeepax@opensource.wolfsonmicro.com, lars@metafoo.de, Andy Green Subject: [alsa-devel] [PATCHv4 5/9] Improve wm8971_set_dai_fmt X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }