From patchwork Thu Nov 2 11:06:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 117771 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1915508edm; Thu, 2 Nov 2017 04:06:19 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QL3H+6djEfuEbMMcgm3o+bsLBfn3XZ+7j5SKPaut+cqbnHAonaJCOVYzLeFZvU/ciHMf2p X-Received: by 10.223.160.132 with SMTP id m4mr2457192wrm.45.1509620779593; Thu, 02 Nov 2017 04:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509620779; cv=none; d=google.com; s=arc-20160816; b=UJhVnwb88K/olLA53avs1tGazzrTR3DizTGgTKZtdCiyrz/pQWsYRZuoD7oqdU3ZIC iFHWQAPjkIw8XvuPV34hFVx3mYrLB2uG279gw6KB8l2o/kfLX5wDhqKb3BxzKt41F3Xa EPbJW+qdIXkKTj1gDZyax7myqGln9i+C6/KMAPm/9PTQihdmXfN7w2wEsdhBnsh9+l3D CYPfAIxx0tZ0VkXALmd/c8MIT0qkAaLLsBVSmZSf+XBI4yVL6LuheAITA8IxRbRmlmu1 ILg0mUW6d4E39ACSMliIjayukhkuFRfvObgODsEB0urp6RyOC7hz6i4OtsExp+Tp0ot/ o0PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=Ac8NbxwcZT9Uj4A9zTHum+hRK8zteovBQ+EAU/8bRng=; b=FMBWzfNpFQqpkNomGErQDD1ebMjQGIQjjTuAbg++gItcaRUIXVjcOmNO4RPF/CnIA8 4X54EeCTvRCyCypNozkMnUjamDl7w9tc3P+JijD1A7SSDPwr4oFV/YoGLV8c7z7CN1z2 L2jO80uyLOKrskA6gbzzSEt1EA4hKQkeYCRE7NUnsEn2UcGbJryQ/CGPTKeGbya9Bky2 q6+VXdxtyvy+/5j0+Bn7Fopnsw3rqUBGJ5eV2shQ5BQaeRJOzTXCadXo8mrkgMWB7wwD HGiBcE/+N9W16eazwXr4wsvztwkaHZC1wVlwUMs7AQ8/ulqIRr2QafquDio5ZI/7t7yt 3APw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=atnqPoJg; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id v191si2612711wmf.87.2017.11.02.04.06.19; Thu, 02 Nov 2017 04:06:19 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=atnqPoJg; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4347F2673E8; Thu, 2 Nov 2017 12:06:17 +0100 (CET) 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 ABA2A267412; Thu, 2 Nov 2017 12:06:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id E7DB02673E8 for ; Thu, 2 Nov 2017 12:06:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=LMigv60ytIsOXGq7oAXJ75dXWaUjtCw2aOFzYm3hZJc=; b=atnqPoJg/fzU x17hHN4C8j9f+6AwzAa8Cg1DSDzVPXR8k6lRZP4ZxWzwbxzgnYt7LYSTiiEcN3bsLcizjFVqtb/Pl 5vD3rKkf0U00ooWUE7WeBRkm/CDcBe8BCvn/oZriXrDBhW9q35dmrWyRJO8YyD62ASRRjG3E4+ADc lxwOc=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eADK1-0006UP-KU; Thu, 02 Nov 2017 11:06:05 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1eADK1-0002EA-7P; Thu, 02 Nov 2017 11:06:05 +0000 From: Mark Brown To: Charles Keepax In-Reply-To: <20171101110325.2433-1-ckeepax@opensource.cirrus.com> Message-Id: Date: Thu, 02 Nov 2017 11:06:05 +0000 Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, lgirdwood@gmail.com, broonie@kernel.org, ce3a@gmx.de, sergej@taudac.com Subject: [alsa-devel] Applied "ASoC: wm8741: Use snd_soc_update_bits rather than hard coding" to the asoc tree 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 The patch ASoC: wm8741: Use snd_soc_update_bits rather than hard coding has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From eaf8abcfb21ecb5f6460d0505b03da4c3b7eee98 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Wed, 1 Nov 2017 11:03:25 +0000 Subject: [PATCH] ASoC: wm8741: Use snd_soc_update_bits rather than hard coding Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm8741.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) -- 2.15.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index b8c1940f2243..3c96af057a3e 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -196,7 +196,7 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_codec *codec = dai->codec; struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); - u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1FC; + unsigned int iface; int i; /* The set of sample rates that can be supported depends on the @@ -223,15 +223,16 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, /* bit size */ switch (params_width(params)) { case 16: + iface = 0x0; break; case 20: - iface |= 0x0001; + iface = 0x1; break; case 24: - iface |= 0x0002; + iface = 0x2; break; case 32: - iface |= 0x0003; + iface = 0x3; break; default: dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", @@ -242,7 +243,9 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d, rate param = %d", params_width(params), params_rate(params)); - snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); + snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, WM8741_IWL_MASK, + iface); + return 0; } @@ -295,7 +298,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; - u16 iface = snd_soc_read(codec, WM8741_FORMAT_CONTROL) & 0x1C3; + unsigned int iface; /* check master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -308,18 +311,19 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - iface |= 0x0008; + iface = 0x08; break; case SND_SOC_DAIFMT_RIGHT_J: + iface = 0x00; break; case SND_SOC_DAIFMT_LEFT_J: - iface |= 0x0004; + iface = 0x04; break; case SND_SOC_DAIFMT_DSP_A: - iface |= 0x000C; + iface = 0x0C; break; case SND_SOC_DAIFMT_DSP_B: - iface |= 0x001C; + iface = 0x1C; break; default: return -EINVAL; @@ -330,13 +334,13 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, case SND_SOC_DAIFMT_NB_NF: break; case SND_SOC_DAIFMT_IB_IF: - iface |= 0x0010; + iface |= 0x10; break; case SND_SOC_DAIFMT_IB_NF: - iface |= 0x0020; + iface |= 0x20; break; case SND_SOC_DAIFMT_NB_IF: - iface |= 0x0030; + iface |= 0x30; break; default: return -EINVAL; @@ -347,7 +351,10 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, fmt & SND_SOC_DAIFMT_FORMAT_MASK, ((fmt & SND_SOC_DAIFMT_INV_MASK))); - snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); + snd_soc_update_bits(codec, WM8741_FORMAT_CONTROL, + WM8741_BCP_MASK | WM8741_LRP_MASK | WM8741_FMT_MASK, + iface); + return 0; }