Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3496496imw; Thu, 7 Jul 2022 02:48:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uA6Yrf0K7VYFrEbIUwqe9TmTXCD1tmFmISN17cmCzK4HvtvkGzki6PAT2Qj61PMQbvU9B8 X-Received: by 2002:a17:907:7da7:b0:728:1c89:129e with SMTP id oz39-20020a1709077da700b007281c89129emr44974239ejc.637.1657187311760; Thu, 07 Jul 2022 02:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657187311; cv=none; d=google.com; s=arc-20160816; b=cVcysiyGjxpiYRZF8xZ2XyjxjgZ8wVso+uIJplVZlhKkQz5y+MKRhLwdo31FrnUxOe FyzCrAtCM2iD7t6RZrwySz7jbwCdjV038jxwf6bh29Jz3gtUYSs3hWKlWst+ARr0qaC8 v6AblQD3kjT+nFGKca+rXIQDa+cYDteZTPpe3BXSH38AIgprcDJuNJTkTQrAHC1OZdZQ Kfmge9NBpkGDComV1WxAbH2+V7VZbF0mi6K3NuNAyM2IabcCLghDZqz+HXnf8DEC36xe sozzC5RAmUQ4py62dOp4xb+zMvbDGTZlkugDfOOhReAPA/twzn7eYj75VezNIqjY8OXc gKlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=Tyen7txTUb5pq9zQQGZmuWYUpttgvf+WfkbcsWB8ZG4=; b=tZCoeGGZ3DkbZ8LJGQt+yGxHNcFFIrp0iKphhtSgL/h6683x0Nr/ErlVTxDT64sjGk rw/RvBRSMNHfgmrUyykuBE4SLOzFZnfyHI8QyrBKGw983JpE2pqGuv6x6Ge6+OY5NnKf bU49lFYY7v/VzL+bOeWBSXceMtsLMQSmhSLRyBZty6bApEP1nAr+sdvHiBOaxHPA5/2n URoiAaIzoZ8m2qJPsNMDKXGkDXS8eDmrpOwFnV0G+7bHAZslEb4W0YGfEWQ19EB87jmK e6LVcji+Ha7qpOTDP8Vt/TxgJMI0Z0SWadqPZrSlg3acnfMWVAhvk+XVKZFnRWcI2q1x g+nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MaSHGdQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd19-20020a1709076e1300b007070522a0fdsi30087658ejc.835.2022.07.07.02.48.06; Thu, 07 Jul 2022 02:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MaSHGdQB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234502AbiGGJkn (ORCPT + 99 others); Thu, 7 Jul 2022 05:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235257AbiGGJkl (ORCPT ); Thu, 7 Jul 2022 05:40:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FFC313D30; Thu, 7 Jul 2022 02:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657186839; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tyen7txTUb5pq9zQQGZmuWYUpttgvf+WfkbcsWB8ZG4=; b=MaSHGdQBI+VAXUZX/C8tnXzbfL4brntQ/nxoaJhWbkMP80u3mi4YyKlBfABfFtTD1DgVaq RRtbfxPfeOdL3JfrQM+gxQ2nJORDBvRcPovkKaZH5TDuUsRzxDGKwbfsFSXkurOOk4Z/m7 6PWG8VIiSZuXOYD/L4CSukqEkAo+8BA= Date: Thu, 07 Jul 2022 10:40:29 +0100 From: Paul Cercueil Subject: Re: [PATCH 06/11] ASoC: jz4740-i2s: Use FIELD_PREP() macros in hw_params callback To: Aidan MacDonald Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, linux-mips@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: <20220706211330.120198-7-aidanmacdonald.0x0@gmail.com> References: <20220706211330.120198-1-aidanmacdonald.0x0@gmail.com> <20220706211330.120198-7-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mer., juil. 6 2022 at 22:13:25 +0100, Aidan MacDonald=20 a =E9crit : > Get rid of a couple of macros and improve readability by using > FIELD_PREP() and GENMASK() for the sample size setting. >=20 > Signed-off-by: Aidan MacDonald Acked-by: Paul Cercueil Cheers, -Paul > --- > sound/soc/jz4740/jz4740-i2s.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) >=20 > diff --git a/sound/soc/jz4740/jz4740-i2s.c=20 > b/sound/soc/jz4740/jz4740-i2s.c > index 8bb9449d13d3..3c3cf78bf848 100644 > --- a/sound/soc/jz4740/jz4740-i2s.c > +++ b/sound/soc/jz4740/jz4740-i2s.c > @@ -3,6 +3,7 @@ > * Copyright (C) 2010, Lars-Peter Clausen > */ >=20 > +#include > #include > #include > #include > @@ -49,8 +50,8 @@ > #define JZ4760_AIC_CONF_FIFO_RX_THRESHOLD_OFFSET 24 > #define JZ4760_AIC_CONF_FIFO_TX_THRESHOLD_OFFSET 16 >=20 > -#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK (0x7 << 19) > -#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK (0x7 << 16) > +#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE GENMASK(21, 19) > +#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE GENMASK(18, 16) > #define JZ_AIC_CTRL_ENABLE_RX_DMA BIT(15) > #define JZ_AIC_CTRL_ENABLE_TX_DMA BIT(14) > #define JZ_AIC_CTRL_MONO_TO_STEREO BIT(11) > @@ -65,9 +66,6 @@ > #define JZ_AIC_CTRL_ENABLE_PLAYBACK BIT(1) > #define JZ_AIC_CTRL_ENABLE_CAPTURE BIT(0) >=20 > -#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET 19 > -#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET 16 > - > #define JZ_AIC_I2S_FMT_DISABLE_BIT_CLK BIT(12) > #define JZ_AIC_I2S_FMT_DISABLE_BIT_ICLK BIT(13) > #define JZ_AIC_I2S_FMT_ENABLE_SYS_CLK BIT(4) > @@ -245,8 +243,9 @@ static int jz4740_i2s_hw_params(struct=20 > snd_pcm_substream *substream, > } >=20 > if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { > - ctrl &=3D ~JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK; > - ctrl |=3D sample_size << JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET; > + ctrl &=3D ~JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE; > + ctrl |=3D FIELD_PREP(JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE, sample_size); > + > if (params_channels(params) =3D=3D 1) > ctrl |=3D JZ_AIC_CTRL_MONO_TO_STEREO; > else > @@ -254,8 +253,8 @@ static int jz4740_i2s_hw_params(struct=20 > snd_pcm_substream *substream, >=20 > div_field =3D i2s->field_i2sdiv_playback; > } else { > - ctrl &=3D ~JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK; > - ctrl |=3D sample_size << JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET; > + ctrl &=3D ~JZ_AIC_CTRL_INPUT_SAMPLE_SIZE; > + ctrl |=3D FIELD_PREP(JZ_AIC_CTRL_INPUT_SAMPLE_SIZE, sample_size); >=20 > div_field =3D i2s->field_i2sdiv_capture; > } > -- > 2.35.1 >=20