From: Trevor Gamblin <tgamblin@baylibre.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Dmitry Rokosov" <ddrokosov@sberdevices.ru>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Saravanan Sekar" <sravanhome@gmail.com>,
"Orson Zhai" <orsonzhai@gmail.com>,
"Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Chunyan Zhang" <zhang.lyra@gmail.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Jean-Baptiste Maneyrol" <jmaneyrol@invensense.com>,
"Crt Mori" <cmo@melexis.com>
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,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Trevor Gamblin" <tgamblin@baylibre.com>
Subject: [PATCH v3 13/41] iio: adc: meson_saradc: make use of regmap_clear_bits(), regmap_set_bits()
Date: Mon, 17 Jun 2024 09:49:53 -0400 [thread overview]
Message-ID: <20240617-review-v3-13-88d1338c4cca@baylibre.com> (raw)
In-Reply-To: <20240617-review-v3-0-88d1338c4cca@baylibre.com>
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 <u.kleine-koenig@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
drivers/iio/adc/meson_saradc.c | 101 ++++++++++++++++++-----------------------
1 file changed, 44 insertions(+), 57 deletions(-)
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 13b473d8c6c7..e16b0e28974e 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -546,35 +546,31 @@ static void meson_sar_adc_start_sample_engine(struct iio_dev *indio_dev)
reinit_completion(&priv->done);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_FIFO_IRQ_EN,
- MESON_SAR_ADC_REG0_FIFO_IRQ_EN);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_FIFO_IRQ_EN);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_SAMPLE_ENGINE_ENABLE,
- MESON_SAR_ADC_REG0_SAMPLE_ENGINE_ENABLE);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_SAMPLE_ENGINE_ENABLE);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_SAMPLING_START,
- MESON_SAR_ADC_REG0_SAMPLING_START);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_SAMPLING_START);
}
static void meson_sar_adc_stop_sample_engine(struct iio_dev *indio_dev)
{
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_FIFO_IRQ_EN, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_FIFO_IRQ_EN);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_SAMPLING_STOP,
- MESON_SAR_ADC_REG0_SAMPLING_STOP);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_SAMPLING_STOP);
/* wait until all modules are stopped */
meson_sar_adc_wait_busy_clear(indio_dev);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_SAMPLE_ENGINE_ENABLE, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_SAMPLE_ENGINE_ENABLE);
}
static int meson_sar_adc_lock(struct iio_dev *indio_dev)
@@ -586,9 +582,8 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
if (priv->param->has_bl30_integration) {
/* prevent BL30 from using the SAR ADC while we are using it */
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_DELAY,
+ MESON_SAR_ADC_DELAY_KERNEL_BUSY);
udelay(1);
@@ -614,8 +609,8 @@ static void meson_sar_adc_unlock(struct iio_dev *indio_dev)
if (priv->param->has_bl30_integration)
/* allow BL30 to use the SAR ADC again */
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
- MESON_SAR_ADC_DELAY_KERNEL_BUSY, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_DELAY,
+ MESON_SAR_ADC_DELAY_KERNEL_BUSY);
mutex_unlock(&priv->lock);
}
@@ -869,17 +864,16 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
* disable this bit as seems to be only relevant for Meson6 (based
* on the vendor driver), which we don't support at the moment.
*/
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
- MESON_SAR_ADC_REG0_ADC_TEMP_SEN_SEL, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG0,
+ MESON_SAR_ADC_REG0_ADC_TEMP_SEN_SEL);
/* disable all channels by default */
regmap_write(priv->regmap, MESON_SAR_ADC_CHAN_LIST, 0x0);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
- MESON_SAR_ADC_REG3_CTRL_SAMPLING_CLOCK_PHASE, 0);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
- MESON_SAR_ADC_REG3_CNTL_USE_SC_DLY,
- MESON_SAR_ADC_REG3_CNTL_USE_SC_DLY);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG3,
+ MESON_SAR_ADC_REG3_CTRL_SAMPLING_CLOCK_PHASE);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG3,
+ MESON_SAR_ADC_REG3_CNTL_USE_SC_DLY);
/* delay between two samples = (10+1) * 1uS */
regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELAY,
@@ -914,21 +908,17 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
MESON_SAR_ADC_CHAN_10_SW_CHAN1_MUX_SEL_MASK,
regval);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN0_XP_DRIVE_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN0_XP_DRIVE_SW);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
+ MESON_SAR_ADC_CHAN_10_SW_CHAN0_XP_DRIVE_SW);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN0_YP_DRIVE_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN0_YP_DRIVE_SW);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
+ MESON_SAR_ADC_CHAN_10_SW_CHAN0_YP_DRIVE_SW);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN1_XP_DRIVE_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN1_XP_DRIVE_SW);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
+ MESON_SAR_ADC_CHAN_10_SW_CHAN1_XP_DRIVE_SW);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN1_YP_DRIVE_SW,
- MESON_SAR_ADC_CHAN_10_SW_CHAN1_YP_DRIVE_SW);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_CHAN_10_SW,
+ MESON_SAR_ADC_CHAN_10_SW_CHAN1_YP_DRIVE_SW);
/*
* set up the input channel muxes in MESON_SAR_ADC_AUX_SW
@@ -944,12 +934,10 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
regmap_write(priv->regmap, MESON_SAR_ADC_AUX_SW, regval);
if (priv->temperature_sensor_calibrated) {
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
- MESON_SAR_ADC_DELTA_10_TS_REVE1,
- MESON_SAR_ADC_DELTA_10_TS_REVE1);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
- MESON_SAR_ADC_DELTA_10_TS_REVE0,
- MESON_SAR_ADC_DELTA_10_TS_REVE0);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
+ MESON_SAR_ADC_DELTA_10_TS_REVE1);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
+ MESON_SAR_ADC_DELTA_10_TS_REVE0);
/*
* set bits [3:0] of the TSC (temperature sensor coefficient)
@@ -976,10 +964,10 @@ static int meson_sar_adc_init(struct iio_dev *indio_dev)
regval);
}
} else {
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
- MESON_SAR_ADC_DELTA_10_TS_REVE1, 0);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
- MESON_SAR_ADC_DELTA_10_TS_REVE0, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
+ MESON_SAR_ADC_DELTA_10_TS_REVE1);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_DELTA_10,
+ MESON_SAR_ADC_DELTA_10_TS_REVE0);
}
regval = FIELD_PREP(MESON_SAR_ADC_REG3_CTRL_CONT_RING_COUNTER_EN,
@@ -1062,9 +1050,8 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
meson_sar_adc_set_bandgap(indio_dev, true);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
- MESON_SAR_ADC_REG3_ADC_EN,
- MESON_SAR_ADC_REG3_ADC_EN);
+ regmap_set_bits(priv->regmap, MESON_SAR_ADC_REG3,
+ MESON_SAR_ADC_REG3_ADC_EN);
udelay(5);
@@ -1079,8 +1066,8 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
return 0;
err_adc_clk:
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
- MESON_SAR_ADC_REG3_ADC_EN, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG3,
+ MESON_SAR_ADC_REG3_ADC_EN);
meson_sar_adc_set_bandgap(indio_dev, false);
regulator_disable(priv->vref);
err_vref:
@@ -1104,8 +1091,8 @@ static void meson_sar_adc_hw_disable(struct iio_dev *indio_dev)
clk_disable_unprepare(priv->adc_clk);
- regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
- MESON_SAR_ADC_REG3_ADC_EN, 0);
+ regmap_clear_bits(priv->regmap, MESON_SAR_ADC_REG3,
+ MESON_SAR_ADC_REG3_ADC_EN);
meson_sar_adc_set_bandgap(indio_dev, false);
--
2.45.2
next prev parent reply other threads:[~2024-06-17 13:50 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 13:49 [PATCH v3 00/41] iio: simplify with regmap_set_bits(), regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 01/41] iio: accel: fxls8962af-core: Make use of " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 02/41] iio: accel: kxsd9: Make use of regmap_clear_bits() Trevor Gamblin
2024-06-18 11:09 ` Linus Walleij
2024-06-22 9:43 ` Jonathan Cameron
2024-06-17 13:49 ` [PATCH v3 03/41] iio: accel: msa311: make " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 04/41] iio: adc: ad4130: " Trevor Gamblin
2024-06-17 14:42 ` Nuno Sá
2024-06-17 13:49 ` [PATCH v3 05/41] iio: adc: axp20x_adc: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 06/41] iio: adc: axp288_adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 07/41] iio: adc: bcm_iproc_adc: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 08/41] iio: adc: berlin2-adc: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 09/41] iio: adc: cpcap-adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 10/41] iio: adc: fsl-imx25-gcq: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 11/41] iio: adc: ina2xx-adc: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 12/41] iio: adc: intel_mrfld_adc: " Trevor Gamblin
2024-06-17 13:49 ` Trevor Gamblin [this message]
2024-06-20 9:41 ` [PATCH v3 13/41] iio: adc: meson_saradc: make use of regmap_clear_bits(), regmap_set_bits() George Stark
2024-06-17 13:49 ` [PATCH v3 14/41] iio: adc: mp2629_adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 15/41] iio: adc: qcom-spmi-rradc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 16/41] iio: adc: rn5t618-adc: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 17/41] iio: adc: sc27xx_adc: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 18/41] iio: adc: stm32-dfsdm-adc: " Trevor Gamblin
2024-06-17 13:49 ` [PATCH v3 19/41] iio: dac: ltc2688: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 14:43 ` Nuno Sá
2024-06-17 13:50 ` [PATCH v3 20/41] iio: dac: stm32-dac-core: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 21/41] iio: gyro: bmg160_core: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 22/41] iio: gyro: mpu3050-core: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 16:13 ` Jonathan Cameron
2024-06-17 13:50 ` [PATCH v3 23/41] iio: health: afe4403: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 24/41] iio: health: afe4404: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 25/41] iio: health: max30100: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 26/41] iio: health: max30102: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 27/41] iio: imu: inv_icm42600: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-20 20:13 ` Jean-Baptiste Maneyrol
2024-06-17 13:50 ` [PATCH v3 28/41] iio: light: adux1020: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 29/41] iio: light: iqs621-als: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 30/41] iio: light: isl29018: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 31/41] iio: light: st_uvis25_core: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 32/41] iio: light: veml6030: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 33/41] iio: magnetometer: ak8974: make use of regmap_set_bits() Trevor Gamblin
2024-06-18 11:11 ` Linus Walleij
2024-06-17 13:50 ` [PATCH v3 34/41] iio: magnetometer: mmc35240: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 23:22 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of Vasileios Amoiridis
2024-06-18 11:12 ` [PATCH v3 35/41] iio: pressure: bmp280-core: make use of regmap_clear_bits() Linus Walleij
2024-06-17 13:50 ` [PATCH v3 36/41] iio: proximity: sx9324: make use of regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 37/41] iio: proximity: sx9360: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 38/41] iio: proximity: sx9500: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 39/41] iio: proximity: sx_common: " Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 40/41] iio: temperature: mlx90632: make use of regmap_clear_bits() Trevor Gamblin
2024-06-17 13:50 ` [PATCH v3 41/41] iio: trigger: stm32-timer-trigger: make use of regmap_clear_bits(), regmap_set_bits() Trevor Gamblin
2024-06-17 15:17 ` [PATCH v3 00/41] iio: simplify with regmap_set_bits(), regmap_clear_bits() Uwe Kleine-König
2024-06-22 18:07 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240617-review-v3-13-88d1338c4cca@baylibre.com \
--to=tgamblin@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandre.torgue@foss.st.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cmo@melexis.com \
--cc=cosmin.tanislav@analog.com \
--cc=ddrokosov@sberdevices.ru \
--cc=festevam@gmail.com \
--cc=hdegoede@redhat.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet@baylibre.com \
--cc=jic23@kernel.org \
--cc=jmaneyrol@invensense.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=orsonzhai@gmail.com \
--cc=rjui@broadcom.com \
--cc=s.hauer@pengutronix.de \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=sravanhome@gmail.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=wens@csie.org \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).