From patchwork Mon Jun 17 13:49:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Trevor Gamblin X-Patchwork-Id: 13700880 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 703AFC2BC81 for ; Mon, 17 Jun 2024 15:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RFjXujGbmKSF4mSftDNwpGnvEQOGQ9JNxbBABDjRITw=; b=F9Ot5B1q+Igkuf 2lKR2Lb1LOpbsFFSAAQGCQdcEvZ+ma/BsVTcpDedWeA1Lj6y6RC7C83Y1udSdUvyF1a97vePMAjdY NO8/mFhND6HC+NbQVAoESV+4olL/kjVPhhxuNM+1Oh1JL4PgyuX3EnGSSrztVvxuzkeY9W7Yj8qKA XfpI3N8gcvUFlJ+ZmvBubhc/6onpYXrT5cpgHukLvg61Z9wIE51wzL27DKBww8D7ZCLxFKGAglZg4 Ppy/EjNnhtIoj9FFjqIx+pkpBfZaCfauObgjS1A4zkIOcLebQ4GlK+9OqKjqPRmGK6XbDiXdFrJlR NbM+ddmbnMt1Lpe22kQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJDrA-0000000BKM4-40TV; Mon, 17 Jun 2024 15:01:17 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJCkj-0000000AxJX-29uw for linux-amlogic@bombadil.infradead.org; Mon, 17 Jun 2024 13:50:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=l19FGmHt7cx9Y1e6lJcD6lg62Kq+f+HHsekNkW7FIwQ=; b=fFGjk4RRmLuODoItzc1qpf/a4R EYCj2tEdlw2HLdzTI0au7Jw1aIHgknpmGqijiqHpS4qPm8ckf0tQOF/vQWWaTR1uvFH5oe/t+r1t6 /cPA035DzrnoAfLEcbPpUM3Bqd5HGefm/0Pw1ZwV/e6eaGQaCqCa0/OPIWC40rdbB3+GgkHXyhlGY nJtPuQiMxEhTRqmRBtv1dIyOp3pqD3XHr+4KnmnpIAGRR0C9+fpqe9b0ckClHLHVrIcw8ejN4KlIl vRaHI+JQ2ooMWXOtv7vwAEwTa6OaZZnhcUeAjFgkW8t7zCvGEuZIeqC/FEPUhlHxpPBrMiOg+Wrwu 4NncfZWQ==; Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJCke-00000006R9n-2poF for linux-amlogic@lists.infradead.org; Mon, 17 Jun 2024 13:50:32 +0000 Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-797f222c9f9so258868385a.3 for ; Mon, 17 Jun 2024 06:50:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1718632223; x=1719237023; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=l19FGmHt7cx9Y1e6lJcD6lg62Kq+f+HHsekNkW7FIwQ=; b=GKl7d3zi7qtXnC+IIcuKX13J16jbw++94w33mMj4w1/LJlQFqne0/FXvVUnMHs1zXi U6emrRJ6P/t3y/8rTtH/NOfCYkrc9oPM4+dSQX6igMsgSGQ6MAZJacxEfRbiKs7aXsui /1+K00sgVOH6pR+JgpQW/GknZa9QoPwAjlw1OsVOpBpIxP37EOr1RTsEI11nJv9PP11n 6FgG42A+EmM41j1fBQTnqu59/VcrOAWk2LnaNViOHU3ZsTz2ePiT5S9iRzKviBMmEfAM 8hdGY6UoW/GfP9zqbXeb8JCNYt0CRU7j+fmRKB5MCba8YcU3rA/K4CbQd08Hl/Rbs3MH n2ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718632223; x=1719237023; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l19FGmHt7cx9Y1e6lJcD6lg62Kq+f+HHsekNkW7FIwQ=; b=imssEAFT6d9v52jPqDofI0pTPzbWhHDZCMHZuSFe3NSpUS5eQlPA3PAfzJbA+UuObk +kBYqPVBl4yzqLjJrE2oDXje7gWunOBg5iUVkka9pjff10C5UFt/AOgH6qiAwMGGq+NK wwXppLRch0/AJ//5lMijyyVJBLrAM1qAYsTYIlt0aD5HlZpqwa5jhWDBiJQqYcobKnn3 LfYOtd6Owsr+z7/iHX7FrK3ByzF1biGRnOwFCAPGa83qK2jsuS5KsUx9fBwSR0kd0McB WBTHf0JP03lFnzpdL91v1nOIM+II1AB+2uKVXNoYTBV5+wO4Cn01BCrJq/CSDXy2uBY9 v/1g== X-Forwarded-Encrypted: i=1; AJvYcCWeQp9rOgHfGiJ7mAkff0NXV8hRn+wxUodCpiEJLYy4G+qJqwb5M99D3WldOJTaW62ZIrbRaAyuuWkumUdThfayg6uoZSenY8etvYQ4sjKr/b4= X-Gm-Message-State: AOJu0Yx0RnFK/CVl8CcAMnmbRCvvGOzJDUh+Zi4AdKAWokI8vKTSCgUW Q9SzI0gmzCxlhWiDBhxtj+E+XzynkGnI54SwbR9Tfkr2+d4YQ8rO6u4LcqRwKUU= X-Google-Smtp-Source: AGHT+IEh7KDprGK33BeeaVNTDiPQqvpWOrx7hEFjzf44w52REiEzqTJNM1IGPx8qlAanIRK9VBBUsQ== X-Received: by 2002:a05:620a:4101:b0:795:dca5:e9b7 with SMTP id af79cd13be357-798d26b4948mr1182835585a.69.1718632223483; Mon, 17 Jun 2024 06:50:23 -0700 (PDT) Received: from megalith.oryx-coho.ts.net (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798aaecc004sm432892285a.31.2024.06.17.06.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 06:50:23 -0700 (PDT) From: Trevor Gamblin Date: Mon, 17 Jun 2024 09:49:58 -0400 Subject: [PATCH v3 18/41] iio: adc: stm32-dfsdm-adc: make use of regmap_clear_bits(), regmap_set_bits() MIME-Version: 1.0 Message-Id: <20240617-review-v3-18-88d1338c4cca@baylibre.com> References: <20240617-review-v3-0-88d1338c4cca@baylibre.com> In-Reply-To: <20240617-review-v3-0-88d1338c4cca@baylibre.com> To: Jonathan Cameron , Lars-Peter Clausen , Dmitry Rokosov , Michael Hennerich , Cosmin Tanislav , Chen-Yu Tsai , Hans de Goede , Ray Jui , Scott Branden , Broadcom internal kernel review list , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Saravanan Sekar , Orson Zhai , Baolin Wang , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , =?utf-8?q?Nuno_S=C3=A1?= , Linus Walleij , Jean-Baptiste Maneyrol , Crt Mori Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Trevor Gamblin X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_145028_907782_26E13488 X-CRM114-Status: GOOD ( 11.17 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits(). Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits(). Suggested-by: Uwe Kleine-König Signed-off-by: Trevor Gamblin --- drivers/iio/adc/stm32-dfsdm-adc.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index 9a47d2c87f05..fabd654245f5 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -759,8 +759,7 @@ static int stm32_dfsdm_start_conv(struct iio_dev *indio_dev, return 0; filter_unconfigure: - regmap_update_bits(regmap, DFSDM_CR1(adc->fl_id), - DFSDM_CR1_CFG_MASK, 0); + regmap_clear_bits(regmap, DFSDM_CR1(adc->fl_id), DFSDM_CR1_CFG_MASK); stop_channels: stm32_dfsdm_stop_channel(indio_dev); @@ -774,8 +773,7 @@ static void stm32_dfsdm_stop_conv(struct iio_dev *indio_dev) stm32_dfsdm_stop_filter(adc->dfsdm, adc->fl_id); - regmap_update_bits(regmap, DFSDM_CR1(adc->fl_id), - DFSDM_CR1_CFG_MASK, 0); + regmap_clear_bits(regmap, DFSDM_CR1(adc->fl_id), DFSDM_CR1_CFG_MASK); stm32_dfsdm_stop_channel(indio_dev); } @@ -951,16 +949,14 @@ static int stm32_dfsdm_adc_dma_start(struct iio_dev *indio_dev) if (adc->nconv == 1 && !indio_dev->trig) { /* Enable regular DMA transfer*/ - ret = regmap_update_bits(adc->dfsdm->regmap, - DFSDM_CR1(adc->fl_id), - DFSDM_CR1_RDMAEN_MASK, - DFSDM_CR1_RDMAEN_MASK); + ret = regmap_set_bits(adc->dfsdm->regmap, + DFSDM_CR1(adc->fl_id), + DFSDM_CR1_RDMAEN_MASK); } else { /* Enable injected DMA transfer*/ - ret = regmap_update_bits(adc->dfsdm->regmap, - DFSDM_CR1(adc->fl_id), - DFSDM_CR1_JDMAEN_MASK, - DFSDM_CR1_JDMAEN_MASK); + ret = regmap_set_bits(adc->dfsdm->regmap, + DFSDM_CR1(adc->fl_id), + DFSDM_CR1_JDMAEN_MASK); } if (ret < 0) @@ -981,8 +977,8 @@ static void stm32_dfsdm_adc_dma_stop(struct iio_dev *indio_dev) if (!adc->dma_chan) return; - regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR1(adc->fl_id), - DFSDM_CR1_RDMAEN_MASK | DFSDM_CR1_JDMAEN_MASK, 0); + regmap_clear_bits(adc->dfsdm->regmap, DFSDM_CR1(adc->fl_id), + DFSDM_CR1_RDMAEN_MASK | DFSDM_CR1_JDMAEN_MASK); dmaengine_terminate_all(adc->dma_chan); } @@ -1305,9 +1301,8 @@ static irqreturn_t stm32_dfsdm_irq(int irq, void *arg) if (status & DFSDM_ISR_ROVRF_MASK) { if (int_en & DFSDM_CR2_ROVRIE_MASK) dev_warn(&indio_dev->dev, "Overrun detected\n"); - regmap_update_bits(regmap, DFSDM_ICR(adc->fl_id), - DFSDM_ICR_CLRROVRF_MASK, - DFSDM_ICR_CLRROVRF_MASK); + regmap_set_bits(regmap, DFSDM_ICR(adc->fl_id), + DFSDM_ICR_CLRROVRF_MASK); } return IRQ_HANDLED;