From patchwork Tue Sep 2 03:30:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 36440 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 20D512032B for ; Tue, 2 Sep 2014 03:30:57 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf67250759pac.3 for ; Mon, 01 Sep 2014 20:30:56 -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=k4p4/9W1LC7b1dFpWLyy01WQ2EcI1iU1MqzVRz9YvtU=; b=gW49XawHfYk/rYepkrhZqbyCDBEz4Kmjb+GrDj68fTlzs0Im4qRaSp8kpsuEKii6Np zTqFMKqY9kw/uWgtYpOdEzpcQ6M8xuXrcglkYe6t7HyJ3BnaG3jWeVXi2v23xE5TDBIK NYZ4tLhAanY337WKBnqhkZbco6tIYj7696jlStSs3kLLGWFUV7Rm0rWkukfq8EnwClKY nuugSnbXZkSCeZEJjBjA/0ObVCogyQSTnkNgfqMIeIHKY9PMuZ/DSIBiMFdmDiukU+ed Jg1CKDtB6pw8ZXvE3g0m7ZQ6b+EunQ4Ez/fFh4kGN1wwrUXQlpMPDjPSG3nxjy0n28kP BwZQ== X-Gm-Message-State: ALoCoQmWyOJswnE1UAvgoEjC0KzIMtIBdoAgTvoBqrMzzVhqE58F+eFzgeYExFugsTqLUPIGTDl1 X-Received: by 10.66.248.232 with SMTP id yp8mr17454215pac.22.1409628656385; Mon, 01 Sep 2014 20:30:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.112 with SMTP id 103ls2168640qga.9.gmail; Mon, 01 Sep 2014 20:30:56 -0700 (PDT) X-Received: by 10.52.245.101 with SMTP id xn5mr22570741vdc.32.1409628656303; Mon, 01 Sep 2014 20:30:56 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id e14si1751178vcv.56.2014.09.01.20.30.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 20:30:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so6357737vcb.37 for ; Mon, 01 Sep 2014 20:30:56 -0700 (PDT) X-Received: by 10.220.122.194 with SMTP id m2mr26691647vcr.17.1409628656249; Mon, 01 Sep 2014 20:30:56 -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 uj3csp465338vcb; Mon, 1 Sep 2014 20:30:55 -0700 (PDT) X-Received: by 10.66.192.195 with SMTP id hi3mr16513497pac.117.1409628655494; Mon, 01 Sep 2014 20:30:55 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id ak10si3610944pbd.169.2014.09.01.20.30.53 for ; Mon, 01 Sep 2014 20:30:55 -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 34E116A27A4; Tue, 2 Sep 2014 11:30:52 +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 4/9] Improve wm8971_set_dai_fmt Date: Tue, 2 Sep 2014 11:30:43 +0800 Message-Id: <1409628648-13732-4-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.178 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(). Any comments about improving the patch are welcome. Thanks. 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 7c2b175..64ed226 100755 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -550,12 +550,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; @@ -566,18 +565,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; @@ -588,19 +587,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; }