From patchwork Tue Sep 2 03:27:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Hsu X-Patchwork-Id: 36430 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C82492032B for ; Tue, 2 Sep 2014 03:28:00 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id eb12sf36061945oac.1 for ; Mon, 01 Sep 2014 20:28:00 -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=NsQhD24V2qJqEGN90Q4Or9qQ4wnFLuj/Y6s7O9tkb6VtqGeOPPJ32ZvxMLtFIUOsbe qU147glnkvbti+JxictvZbuGyAA85necDqP9knFsjmOCwbI/pgICrU9BNYRrjolchIh5 5jBh+913o9M+pBrBzFJfZaaPgxlUZG33IdNXs9Odl3oxUVXxkM1bGF18YZ7aPkiXSCpk OjIq8xjtDaDhTxtfaNgcJWQebEtwP+jwxIBeAuwiRnm4WC/4uxvV1h+yPFpCwxDbcfD2 Z4E2+UPSX60guUlXyPZcOZbat1oR4/DSKEm8T2tBAiTvy3Goqtarqd4iB7RYBVG7gDyz eLSQ== X-Gm-Message-State: ALoCoQlHU+IfCX8dsjA3zSaHPKVcA5a3ZOTr+kR46BXVElRnDCZfn82thTXkTbvcs1u+BwI/IGIK X-Received: by 10.50.80.111 with SMTP id q15mr12949454igx.0.1409628480206; Mon, 01 Sep 2014 20:28:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls2115127qgt.60.gmail; Mon, 01 Sep 2014 20:28:00 -0700 (PDT) X-Received: by 10.52.27.16 with SMTP id p16mr23963546vdg.14.1409628480111; Mon, 01 Sep 2014 20:28:00 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id ew3si1765358vdb.11.2014.09.01.20.28.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 20:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hq11so6368096vcb.36 for ; Mon, 01 Sep 2014 20:28:00 -0700 (PDT) X-Received: by 10.220.81.132 with SMTP id x4mr28167186vck.0.1409628480026; Mon, 01 Sep 2014 20:28:00 -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 uj3csp465114vcb; Mon, 1 Sep 2014 20:27:59 -0700 (PDT) X-Received: by 10.68.134.201 with SMTP id pm9mr9008298pbb.143.1409628478252; Mon, 01 Sep 2014 20:27:58 -0700 (PDT) Received: from Kraken ([124.219.7.128]) by mx.google.com with ESMTP id fb7si3897903pab.30.2014.09.01.20.27.56 for ; Mon, 01 Sep 2014 20:27:58 -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 476306A27A4; Tue, 2 Sep 2014 11:27:55 +0800 (CST) From: Xavier Hsu To: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, patches@linaro.org Cc: Xavier Hsu , Andy Green Subject: [PATCHv3 4/9] Improve wm8971_set_dai_fmt Date: Tue, 2 Sep 2014 11:27:45 +0800 Message-Id: <1409628470-13059-4-git-send-email-xavier.hsu@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1409628470-13059-1-git-send-email-xavier.hsu@linaro.org> References: <1409628470-13059-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.177 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 Acked-by: Charles Keepax --- 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; }