* [PATCH 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-21 14:25 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-21 14:25 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 1/4] regmap: provide regmap_field helpers for simple bit operations 2022-05-21 14:25 ` Li Chen @ 2022-05-21 14:26 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test oerations for regmap, but not for regmap_field yet. So let's intoroduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..10b410734d9e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 1/4] regmap: provide regmap_field helpers for simple bit operations @ 2022-05-21 14:26 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test oerations for regmap, but not for regmap_field yet. So let's intoroduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..10b410734d9e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers 2022-05-21 14:25 ` Li Chen @ 2022-05-21 14:27 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:27 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers @ 2022-05-21 14:27 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:27 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers 2022-05-21 14:25 ` Li Chen @ 2022-05-21 14:28 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:28 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers @ 2022-05-21 14:28 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:28 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits 2022-05-21 14:25 ` Li Chen @ 2022-05-21 14:29 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:29 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..971b54bb478a 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits @ 2022-05-21 14:29 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-21 14:29 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..971b54bb478a 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits 2022-05-21 14:29 ` Li Chen @ 2022-05-22 16:03 ` kernel test robot -1 siblings, 0 replies; 44+ messages in thread From: kernel test robot @ 2022-05-22 16:03 UTC (permalink / raw) To: Li Chen, Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel Cc: kbuild-all Hi Li, Thank you for the patch! Yet something to improve: [auto build test ERROR on broonie-regmap/for-next] [also build test ERROR on linusw-pinctrl/devel broonie-sound/for-next v5.18-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20220522/202205222359.yQ35dVuB-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/73189e14ed111777ac60a95ae3008337c69589da git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352 git checkout 73189e14ed111777ac60a95ae3008337c69589da # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/pinctrl/pinctrl-st.c: In function 'st_pinconf_get_direction': >> drivers/pinctrl/pinctrl-st.c:587:53: error: 'od_value' undeclared (first use in this function); did you mean 'si_value'? 587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) | ^~~~~~~~ | si_value drivers/pinctrl/pinctrl-st.c:587:53: note: each undeclared identifier is reported only once for each function it appears in >> drivers/pinctrl/pinctrl-st.c:587:21: error: too many arguments to function 'regmap_field_test_bits' 587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) | ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/pinctrl/pinctrl-st.c:18: include/linux/regmap.h:1353:5: note: declared here 1353 | int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); | ^~~~~~~~~~~~~~~~~~~~~~ vim +587 drivers/pinctrl/pinctrl-st.c 572 573 static void st_pinconf_get_direction(struct st_pio_control *pc, 574 int pin, unsigned long *config) 575 { 576 if (pc->oe) { 577 if (regmap_field_test_bits(pc->oe, BIT(pin))) 578 ST_PINCONF_PACK_OE(*config); 579 } 580 581 if (pc->pu) { 582 if (regmap_field_test_bits(pc->pu, BIT(pin))) 583 ST_PINCONF_PACK_PU(*config); 584 } 585 586 if (pc->od) { > 587 if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) 588 ST_PINCONF_PACK_OD(*config); 589 } 590 } 591 -- 0-DAY CI Kernel Test Service https://01.org/lkp ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits @ 2022-05-22 16:03 ` kernel test robot 0 siblings, 0 replies; 44+ messages in thread From: kernel test robot @ 2022-05-22 16:03 UTC (permalink / raw) To: Li Chen, Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel Cc: kbuild-all Hi Li, Thank you for the patch! Yet something to improve: [auto build test ERROR on broonie-regmap/for-next] [also build test ERROR on linusw-pinctrl/devel broonie-sound/for-next v5.18-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20220522/202205222359.yQ35dVuB-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/73189e14ed111777ac60a95ae3008337c69589da git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352 git checkout 73189e14ed111777ac60a95ae3008337c69589da # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/pinctrl/pinctrl-st.c: In function 'st_pinconf_get_direction': >> drivers/pinctrl/pinctrl-st.c:587:53: error: 'od_value' undeclared (first use in this function); did you mean 'si_value'? 587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) | ^~~~~~~~ | si_value drivers/pinctrl/pinctrl-st.c:587:53: note: each undeclared identifier is reported only once for each function it appears in >> drivers/pinctrl/pinctrl-st.c:587:21: error: too many arguments to function 'regmap_field_test_bits' 587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) | ^~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/pinctrl/pinctrl-st.c:18: include/linux/regmap.h:1353:5: note: declared here 1353 | int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); | ^~~~~~~~~~~~~~~~~~~~~~ vim +587 drivers/pinctrl/pinctrl-st.c 572 573 static void st_pinconf_get_direction(struct st_pio_control *pc, 574 int pin, unsigned long *config) 575 { 576 if (pc->oe) { 577 if (regmap_field_test_bits(pc->oe, BIT(pin))) 578 ST_PINCONF_PACK_OE(*config); 579 } 580 581 if (pc->pu) { 582 if (regmap_field_test_bits(pc->pu, BIT(pin))) 583 ST_PINCONF_PACK_PU(*config); 584 } 585 586 if (pc->od) { > 587 if (regmap_field_test_bits(pc->od, &od_value, BIT(pin))) 588 ST_PINCONF_PACK_OD(*config); 589 } 590 } 591 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 0/4] Add regmap_field helpers for simple bit operations 2022-05-21 14:25 ` Li Chen @ 2022-05-23 2:22 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:22 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits Changelogs: v2: fix regmap_field_test_bits compile error in drivers/pinctrl/pinctrl-st.c drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-23 2:22 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:22 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits Changelogs: v2: fix regmap_field_test_bits compile error in drivers/pinctrl/pinctrl-st.c drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations 2022-05-23 2:22 ` Li Chen @ 2022-05-23 2:23 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:23 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test operations for regmap, but not for regmap_field yet. So let's introduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..10b410734d9e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations @ 2022-05-23 2:23 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:23 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test operations for regmap, but not for regmap_field yet. So let's introduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..10b410734d9e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations 2022-05-23 2:23 ` Li Chen @ 2022-05-23 3:09 ` Samuel Holland -1 siblings, 0 replies; 44+ messages in thread From: Samuel Holland @ 2022-05-23 3:09 UTC (permalink / raw) To: Li Chen, Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Philipp Zabel Hi, On 5/22/22 9:23 PM, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > We have set/clear/test operations for regmap, but not for regmap_field yet. > So let's introduce regmap_field helpers too. > > In many instances regmap_field_update_bits() is used for simple bit setting > and clearing. In these cases the last argument is redundant and we can > hide it with a static inline function. > > This adds three new helpers for simple bit operations: set_bits, > clear_bits and test_bits (the last one defined as a regular function). > > Signed-off-by: Li Chen <lchen@ambarella.com> > --- > drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ > include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+) > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > index 5e12f7cb5147..a37d6041b7bd 100644 > --- a/drivers/base/regmap/regmap.c > +++ b/drivers/base/regmap/regmap.c > @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, > } > EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); > > +/** > + * regmap_field_test_bits() - Check if all specified bits are set in a > + * register field. > + * > + * @field: Register field to operate on > + * @bits: Bits to test > + * > + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the > + * tested bits is not set and 1 if all tested bits are set. > + */ > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) > +{ > + unsigned int val, ret; > + > + ret = regmap_field_read(field, &val); > + if (ret) > + return ret; > + > + return (val & bits) == bits; > +} > +EXPORT_SYMBOL_GPL(regmap_field_test_bits); > + > /** > * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a > * register field with port ID > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > index de81a94d7b30..10b410734d9e 100644 > --- a/include/linux/regmap.h > +++ b/include/linux/regmap.h > @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, > NULL, false, false); > } > > +static inline int regmap_field_set_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + return regmap_field_update_bits_base(field, bits, 0, NULL, false, > + false); > +} > + > +static inline int regmap_field_clear_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + return regmap_field_update_bits_base(field, bits, bits, NULL, false, > + false); The contents of these two functions are swapped when compared to their names. Regards, Samuel > +} > + > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); > + > static inline int > regmap_field_force_update_bits(struct regmap_field *field, > unsigned int mask, unsigned int val) > @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, > return -EINVAL; > } > > +static inline int regmap_field_set_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > +static inline int regmap_field_clear_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > +static inline int regmap_field_test_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > static inline int regmap_fields_write(struct regmap_field *field, > unsigned int id, unsigned int val) > { > ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations @ 2022-05-23 3:09 ` Samuel Holland 0 siblings, 0 replies; 44+ messages in thread From: Samuel Holland @ 2022-05-23 3:09 UTC (permalink / raw) To: Li Chen, Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Philipp Zabel Hi, On 5/22/22 9:23 PM, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > We have set/clear/test operations for regmap, but not for regmap_field yet. > So let's introduce regmap_field helpers too. > > In many instances regmap_field_update_bits() is used for simple bit setting > and clearing. In these cases the last argument is redundant and we can > hide it with a static inline function. > > This adds three new helpers for simple bit operations: set_bits, > clear_bits and test_bits (the last one defined as a regular function). > > Signed-off-by: Li Chen <lchen@ambarella.com> > --- > drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ > include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+) > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > index 5e12f7cb5147..a37d6041b7bd 100644 > --- a/drivers/base/regmap/regmap.c > +++ b/drivers/base/regmap/regmap.c > @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, > } > EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); > > +/** > + * regmap_field_test_bits() - Check if all specified bits are set in a > + * register field. > + * > + * @field: Register field to operate on > + * @bits: Bits to test > + * > + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the > + * tested bits is not set and 1 if all tested bits are set. > + */ > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) > +{ > + unsigned int val, ret; > + > + ret = regmap_field_read(field, &val); > + if (ret) > + return ret; > + > + return (val & bits) == bits; > +} > +EXPORT_SYMBOL_GPL(regmap_field_test_bits); > + > /** > * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a > * register field with port ID > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > index de81a94d7b30..10b410734d9e 100644 > --- a/include/linux/regmap.h > +++ b/include/linux/regmap.h > @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, > NULL, false, false); > } > > +static inline int regmap_field_set_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + return regmap_field_update_bits_base(field, bits, 0, NULL, false, > + false); > +} > + > +static inline int regmap_field_clear_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + return regmap_field_update_bits_base(field, bits, bits, NULL, false, > + false); The contents of these two functions are swapped when compared to their names. Regards, Samuel > +} > + > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); > + > static inline int > regmap_field_force_update_bits(struct regmap_field *field, > unsigned int mask, unsigned int val) > @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, > return -EINVAL; > } > > +static inline int regmap_field_set_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > +static inline int regmap_field_clear_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > +static inline int regmap_field_test_bits(struct regmap_field *field, > + unsigned int bits) > +{ > + WARN_ONCE(1, "regmap API is disabled"); > + return -EINVAL; > +} > + > static inline int regmap_fields_write(struct regmap_field *field, > unsigned int id, unsigned int val) > { > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations 2022-05-23 3:09 ` Samuel Holland @ 2022-05-23 3:30 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:30 UTC (permalink / raw) To: Samuel Holland Cc: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Philipp Zabel Hi Samuel, ---- On Sun, 22 May 2022 20:09:55 -0700 Samuel Holland <samuel@sholland.org> wrote ---- > Hi, > > On 5/22/22 9:23 PM, Li Chen wrote: > > From: Li Chen <lchen@ambarella.com> > > > > We have set/clear/test operations for regmap, but not for regmap_field yet. > > So let's introduce regmap_field helpers too. > > > > In many instances regmap_field_update_bits() is used for simple bit setting > > and clearing. In these cases the last argument is redundant and we can > > hide it with a static inline function. > > > > This adds three new helpers for simple bit operations: set_bits, > > clear_bits and test_bits (the last one defined as a regular function). > > > > Signed-off-by: Li Chen <lchen@ambarella.com> > > --- > > drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ > > include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ > > 2 files changed, 59 insertions(+) > > > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > > index 5e12f7cb5147..a37d6041b7bd 100644 > > --- a/drivers/base/regmap/regmap.c > > +++ b/drivers/base/regmap/regmap.c > > @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, > > } > > EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); > > > > +/** > > + * regmap_field_test_bits() - Check if all specified bits are set in a > > + * register field. > > + * > > + * @field: Register field to operate on > > + * @bits: Bits to test > > + * > > + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the > > + * tested bits is not set and 1 if all tested bits are set. > > + */ > > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) > > +{ > > + unsigned int val, ret; > > + > > + ret = regmap_field_read(field, &val); > > + if (ret) > > + return ret; > > + > > + return (val & bits) == bits; > > +} > > +EXPORT_SYMBOL_GPL(regmap_field_test_bits); > > + > > /** > > * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a > > * register field with port ID > > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > > index de81a94d7b30..10b410734d9e 100644 > > --- a/include/linux/regmap.h > > +++ b/include/linux/regmap.h > > @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, > > NULL, false, false); > > } > > > > +static inline int regmap_field_set_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + return regmap_field_update_bits_base(field, bits, 0, NULL, false, > > + false); > > +} > > + > > +static inline int regmap_field_clear_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + return regmap_field_update_bits_base(field, bits, bits, NULL, false, > > + false); > > The contents of these two functions are swapped when compared to their names. Thanks for spotting this out! Fixed in v3. Regards, Li > > Regards, > Samuel > > > +} > > + > > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); > > + > > static inline int > > regmap_field_force_update_bits(struct regmap_field *field, > > unsigned int mask, unsigned int val) > > @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, > > return -EINVAL; > > } > > > > +static inline int regmap_field_set_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > +static inline int regmap_field_clear_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > +static inline int regmap_field_test_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > static inline int regmap_fields_write(struct regmap_field *field, > > unsigned int id, unsigned int val) > > { > > > > ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/4] regmap: provide regmap_field helpers for simple bit operations @ 2022-05-23 3:30 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:30 UTC (permalink / raw) To: Samuel Holland Cc: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Philipp Zabel Hi Samuel, ---- On Sun, 22 May 2022 20:09:55 -0700 Samuel Holland <samuel@sholland.org> wrote ---- > Hi, > > On 5/22/22 9:23 PM, Li Chen wrote: > > From: Li Chen <lchen@ambarella.com> > > > > We have set/clear/test operations for regmap, but not for regmap_field yet. > > So let's introduce regmap_field helpers too. > > > > In many instances regmap_field_update_bits() is used for simple bit setting > > and clearing. In these cases the last argument is redundant and we can > > hide it with a static inline function. > > > > This adds three new helpers for simple bit operations: set_bits, > > clear_bits and test_bits (the last one defined as a regular function). > > > > Signed-off-by: Li Chen <lchen@ambarella.com> > > --- > > drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ > > include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ > > 2 files changed, 59 insertions(+) > > > > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c > > index 5e12f7cb5147..a37d6041b7bd 100644 > > --- a/drivers/base/regmap/regmap.c > > +++ b/drivers/base/regmap/regmap.c > > @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, > > } > > EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); > > > > +/** > > + * regmap_field_test_bits() - Check if all specified bits are set in a > > + * register field. > > + * > > + * @field: Register field to operate on > > + * @bits: Bits to test > > + * > > + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the > > + * tested bits is not set and 1 if all tested bits are set. > > + */ > > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) > > +{ > > + unsigned int val, ret; > > + > > + ret = regmap_field_read(field, &val); > > + if (ret) > > + return ret; > > + > > + return (val & bits) == bits; > > +} > > +EXPORT_SYMBOL_GPL(regmap_field_test_bits); > > + > > /** > > * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a > > * register field with port ID > > diff --git a/include/linux/regmap.h b/include/linux/regmap.h > > index de81a94d7b30..10b410734d9e 100644 > > --- a/include/linux/regmap.h > > +++ b/include/linux/regmap.h > > @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, > > NULL, false, false); > > } > > > > +static inline int regmap_field_set_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + return regmap_field_update_bits_base(field, bits, 0, NULL, false, > > + false); > > +} > > + > > +static inline int regmap_field_clear_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + return regmap_field_update_bits_base(field, bits, bits, NULL, false, > > + false); > > The contents of these two functions are swapped when compared to their names. Thanks for spotting this out! Fixed in v3. Regards, Li > > Regards, > Samuel > > > +} > > + > > +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); > > + > > static inline int > > regmap_field_force_update_bits(struct regmap_field *field, > > unsigned int mask, unsigned int val) > > @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, > > return -EINVAL; > > } > > > > +static inline int regmap_field_set_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > +static inline int regmap_field_clear_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > +static inline int regmap_field_test_bits(struct regmap_field *field, > > + unsigned int bits) > > +{ > > + WARN_ONCE(1, "regmap API is disabled"); > > + return -EINVAL; > > +} > > + > > static inline int regmap_fields_write(struct regmap_field *field, > > unsigned int id, unsigned int val) > > { > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers 2022-05-23 2:22 ` Li Chen @ 2022-05-23 2:24 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:24 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers @ 2022-05-23 2:24 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:24 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers 2022-05-23 2:22 ` Li Chen @ 2022-05-23 2:25 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers @ 2022-05-23 2:25 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 4/4] pinctrl: st: Switch to use regmap_field_test_bits 2022-05-23 2:22 ` Li Chen @ 2022-05-23 2:25 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..198b4a9d263b 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v2 4/4] pinctrl: st: Switch to use regmap_field_test_bits @ 2022-05-23 2:25 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 2:25 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..198b4a9d263b 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 0/4] Add regmap_field helpers for simple bit operations 2022-05-23 2:22 ` Li Chen @ 2022-05-23 11:39 ` Mark Brown -1 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-05-23 11:39 UTC (permalink / raw) To: Li Chen Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel [-- Attachment #1: Type: text/plain, Size: 517 bytes --] On Sun, May 22, 2022 at 07:22:37PM -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. Please don't send new patches in reply to old patches or serieses, this makes it harder for both people and tools to understand what is going on - it can bury things in mailboxes and make it difficult to keep track of what current patches are, both for the new patches and the old ones. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-23 11:39 ` Mark Brown 0 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-05-23 11:39 UTC (permalink / raw) To: Li Chen Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel [-- Attachment #1.1: Type: text/plain, Size: 517 bytes --] On Sun, May 22, 2022 at 07:22:37PM -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. Please don't send new patches in reply to old patches or serieses, this makes it harder for both people and tools to understand what is going on - it can bury things in mailboxes and make it difficult to keep track of what current patches are, both for the new patches and the old ones. [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 0/4] Add regmap_field helpers for simple bit operations 2022-05-23 11:39 ` Mark Brown @ 2022-05-23 13:19 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 13:19 UTC (permalink / raw) To: Mark Brown Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel Hi Mark ---- On Mon, 23 May 2022 04:39:46 -0700 Mark Brown <broonie@kernel.org> wrote ---- > On Sun, May 22, 2022 at 07:22:37PM -0700, Li Chen wrote: > > From: Li Chen <lchen@ambarella.com> > > > > This series proposes to add simple bit operations for setting, clearing > > and testing specific bits with regmap_field. > > Please don't send new patches in reply to old patches or serieses, this > makes it harder for both people and tools to understand what is going > on - it can bury things in mailboxes and make it difficult to keep track > of what current patches are, both for the new patches and the old ones. > Thanks for letting me know, I won't do this again. Regards, Li ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-23 13:19 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 13:19 UTC (permalink / raw) To: Mark Brown Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel Hi Mark ---- On Mon, 23 May 2022 04:39:46 -0700 Mark Brown <broonie@kernel.org> wrote ---- > On Sun, May 22, 2022 at 07:22:37PM -0700, Li Chen wrote: > > From: Li Chen <lchen@ambarella.com> > > > > This series proposes to add simple bit operations for setting, clearing > > and testing specific bits with regmap_field. > > Please don't send new patches in reply to old patches or serieses, this > makes it harder for both people and tools to understand what is going > on - it can bury things in mailboxes and make it difficult to keep track > of what current patches are, both for the new patches and the old ones. > Thanks for letting me know, I won't do this again. Regards, Li _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 0/4] Add regmap_field helpers for simple bit operations 2022-05-21 14:25 ` Li Chen @ 2022-05-23 3:26 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits Changelogs: v2: fix regmap_field_test_bits compile error in drivers/pinctrl/pinctrl-st.c v3: fix regmap_field_clear_bits and regmap_field_set_bits implementation, reported by Samuel Holland drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 0/4] Add regmap_field helpers for simple bit operations @ 2022-05-23 3:26 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> This series proposes to add simple bit operations for setting, clearing and testing specific bits with regmap_field. Li Chen (4): regmap: provide regmap_field helpers for simple bit operations ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers pinctrl: st: Switch to use regmap_field_test_bits Changelogs: v2: fix regmap_field_test_bits compile error in drivers/pinctrl/pinctrl-st.c v3: fix regmap_field_clear_bits and regmap_field_set_bits implementation, reported by Samuel Holland drivers/base/regmap/regmap.c | 22 ++++++++ drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- drivers/pinctrl/pinctrl-st.c | 23 ++++---- include/linux/regmap.h | 37 +++++++++++++ sound/soc/sunxi/sun4i-codec.c | 78 +++++++++++---------------- 5 files changed, 99 insertions(+), 63 deletions(-) -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 1/4] regmap: provide regmap_field helpers for simple bit operations 2022-05-23 3:26 ` Li Chen @ 2022-05-23 3:26 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test operations for regmap, but not for regmap_field yet. So let's introduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..5f317403c520 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 1/4] regmap: provide regmap_field helpers for simple bit operations @ 2022-05-23 3:26 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:26 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> We have set/clear/test operations for regmap, but not for regmap_field yet. So let's introduce regmap_field helpers too. In many instances regmap_field_update_bits() is used for simple bit setting and clearing. In these cases the last argument is redundant and we can hide it with a static inline function. This adds three new helpers for simple bit operations: set_bits, clear_bits and test_bits (the last one defined as a regular function). Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/base/regmap/regmap.c | 22 +++++++++++++++++++++ include/linux/regmap.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 5e12f7cb5147..a37d6041b7bd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2208,6 +2208,28 @@ int regmap_field_update_bits_base(struct regmap_field *field, } EXPORT_SYMBOL_GPL(regmap_field_update_bits_base); +/** + * regmap_field_test_bits() - Check if all specified bits are set in a + * register field. + * + * @field: Register field to operate on + * @bits: Bits to test + * + * Returns -1 if the underlying regmap_field_read() fails, 0 if at least one of the + * tested bits is not set and 1 if all tested bits are set. + */ +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits) +{ + unsigned int val, ret; + + ret = regmap_field_read(field, &val); + if (ret) + return ret; + + return (val & bits) == bits; +} +EXPORT_SYMBOL_GPL(regmap_field_test_bits); + /** * regmap_fields_update_bits_base() - Perform a read/modify/write cycle a * register field with port ID diff --git a/include/linux/regmap.h b/include/linux/regmap.h index de81a94d7b30..5f317403c520 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1324,6 +1324,22 @@ static inline int regmap_field_update_bits(struct regmap_field *field, NULL, false, false); } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, bits, NULL, false, + false); +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + return regmap_field_update_bits_base(field, bits, 0, NULL, false, + false); +} + +int regmap_field_test_bits(struct regmap_field *field, unsigned int bits); + static inline int regmap_field_force_update_bits(struct regmap_field *field, unsigned int mask, unsigned int val) @@ -1757,6 +1773,27 @@ regmap_field_force_update_bits(struct regmap_field *field, return -EINVAL; } +static inline int regmap_field_set_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_clear_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + +static inline int regmap_field_test_bits(struct regmap_field *field, + unsigned int bits) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + static inline int regmap_fields_write(struct regmap_field *field, unsigned int id, unsigned int val) { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers 2022-05-23 3:26 ` Li Chen @ 2022-05-23 3:27 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:27 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers @ 2022-05-23 3:27 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:27 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to {regmap/regmap_field}_update_bits() with {regmap/regmap_field}_set_bits() and {regmap/regmap_field}_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- sound/soc/sunxi/sun4i-codec.c | 78 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 60712f24ade5..53e3f43816cc 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -250,37 +250,33 @@ struct sun4i_codec { static void sun4i_codec_start_playback(struct sun4i_codec *scodec) { /* Flush TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Enable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) { /* Disable DAC DRQ */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_DAC_DRQ_EN)); } static void sun4i_codec_start_capture(struct sun4i_codec *scodec) { /* Enable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); + regmap_field_set_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) { /* Disable ADC DRQ */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN), 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_ADC_DRQ_EN)); } static int sun4i_codec_trigger(struct snd_pcm_substream *substream, int cmd, @@ -323,8 +319,7 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, /* Flush RX FIFO */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_FIFO_FLUSH)); @@ -365,8 +360,7 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, u32 val; /* Flush the TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_FIFO_FLUSH)); /* Set TX FIFO Empty Trigger Level */ @@ -386,9 +380,8 @@ static int sun4i_codec_prepare_playback(struct snd_pcm_substream *substream, val); /* Send zeros when we have an underrun */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_SEND_LASAT)); return 0; }; @@ -485,33 +478,27 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, /* Set the number of channels we want to use */ if (params_channels(params) == 1) - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); else - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN)); /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), - 0); + regmap_field_clear_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + regmap_field_set_bits(scodec->reg_adc_fifoc, BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -543,24 +530,20 @@ static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, /* Set the number of sample bits to either 16 or 24 bits */ if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to padding the LSBs with 0 */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; } else { - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS), - 0); + regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, + BIT(SUN4I_CODEC_DAC_FIFOC_TX_SAMPLE_BITS)); /* Set TX FIFO mode to repeat the MSB */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE), + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, BIT(SUN4I_CODEC_DAC_FIFOC_TX_FIFO_MODE)); scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; @@ -624,8 +607,7 @@ static int sun4i_codec_startup(struct snd_pcm_substream *substream, * Stop issuing DRQ when we have room for less than 16 samples * in our TX FIFO */ - regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, - 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT, + regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, 3 << SUN4I_CODEC_DAC_FIFOC_DRQ_CLR_CNT); return clk_prepare_enable(scodec->clk_module); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers 2022-05-23 3:26 ` Li Chen @ 2022-05-23 3:28 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:28 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers @ 2022-05-23 3:28 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:28 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_update_bits() with regmap_field_clear_bits() for improved readability. Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/bcm/pinctrl-bcm6358.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6358.c b/drivers/pinctrl/bcm/pinctrl-bcm6358.c index 9f6cd7447887..b03dfcb171d1 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm6358.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c @@ -300,7 +300,7 @@ static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, return 0; /* disable all functions using this pin */ - return regmap_field_update_bits(priv->overlays, mask, 0); + return regmap_field_clear_bits(priv->overlays, mask); } static const struct pinctrl_ops bcm6358_pctl_ops = { -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 4/4] pinctrl: st: Switch to use regmap_field_test_bits 2022-05-23 3:26 ` Li Chen @ 2022-05-23 3:29 ` Li Chen -1 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:29 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..198b4a9d263b 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 4/4] pinctrl: st: Switch to use regmap_field_test_bits @ 2022-05-23 3:29 ` Li Chen 0 siblings, 0 replies; 44+ messages in thread From: Li Chen @ 2022-05-23 3:29 UTC (permalink / raw) To: Mark Brown, linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel From: Li Chen <lchen@ambarella.com> Appropriately change calls to regmap_field_read() with regmap_field_test_bits() for improved readability. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Li Chen <lchen@ambarella.com> --- drivers/pinctrl/pinctrl-st.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 0fea71fd9a00..198b4a9d263b 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info, static void st_pinconf_get_direction(struct st_pio_control *pc, int pin, unsigned long *config) { - unsigned int oe_value, pu_value, od_value; - if (pc->oe) { - regmap_field_read(pc->oe, &oe_value); - if (oe_value & BIT(pin)) + if (regmap_field_test_bits(pc->oe, BIT(pin))) ST_PINCONF_PACK_OE(*config); } if (pc->pu) { - regmap_field_read(pc->pu, &pu_value); - if (pu_value & BIT(pin)) + if (regmap_field_test_bits(pc->pu, BIT(pin))) ST_PINCONF_PACK_PU(*config); } if (pc->od) { - regmap_field_read(pc->od, &od_value); - if (od_value & BIT(pin)) + if (regmap_field_test_bits(pc->od, BIT(pin))) ST_PINCONF_PACK_OD(*config); } } @@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info, { const struct st_pctl_data *data = info->data; struct st_retime_packed *rt_p = &pc->rt.rt_p; - unsigned int delay_bits, delay, delay0, delay1, val; + unsigned int delay_bits, delay, delay0, delay1; int output = ST_PINCONF_UNPACK_OE(*config); - if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->retime, BIT(pin))) ST_PINCONF_PACK_RT(*config); - if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin))) ST_PINCONF_PACK_RT_CLK(*config, 1); - if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin))) ST_PINCONF_PACK_RT_CLKNOTDATA(*config); - if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin))) ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config); - if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin))) + if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin))) ST_PINCONF_PACK_RT_INVERTCLK(*config); regmap_field_read(rt_p->delay_0, &delay0); -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v3 0/4] Add regmap_field helpers for simple bit operations 2022-05-23 3:26 ` Li Chen @ 2022-06-15 16:59 ` Mark Brown -1 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-06-15 16:59 UTC (permalink / raw) To: Li Chen Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel [-- Attachment #1: Type: text/plain, Size: 1217 bytes --] On Sun, May 22, 2022 at 08:26:21PM -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. The following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56: Linux 5.19-rc1 (2022-06-05 17:18:54 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-field-bit-helpers for you to fetch changes up to f67be8b7ee90c292948c3ec6395673963cccaee6: regmap: provide regmap_field helpers for simple bit operations (2022-06-15 11:17:45 +0100) ---------------------------------------------------------------- regmap: Add regmap_field helpers for simple bit operations Add simple bit operations for setting, clearing and testing specific bits with regmap_field. ---------------------------------------------------------------- Li Chen (1): regmap: provide regmap_field helpers for simple bit operations drivers/base/regmap/regmap.c | 22 ++++++++++++++++++++++ include/linux/regmap.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v3 0/4] Add regmap_field helpers for simple bit operations @ 2022-06-15 16:59 ` Mark Brown 0 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-06-15 16:59 UTC (permalink / raw) To: Li Chen Cc: linux-kernel, Greg Kroah-Hartman, Rafael J. Wysocki, linux-gpio, Linus Walleij, linux-arm-kernel, Patrice Chotard, linux-sunxi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Philipp Zabel [-- Attachment #1.1: Type: text/plain, Size: 1217 bytes --] On Sun, May 22, 2022 at 08:26:21PM -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. The following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56: Linux 5.19-rc1 (2022-06-05 17:18:54 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-field-bit-helpers for you to fetch changes up to f67be8b7ee90c292948c3ec6395673963cccaee6: regmap: provide regmap_field helpers for simple bit operations (2022-06-15 11:17:45 +0100) ---------------------------------------------------------------- regmap: Add regmap_field helpers for simple bit operations Add simple bit operations for setting, clearing and testing specific bits with regmap_field. ---------------------------------------------------------------- Li Chen (1): regmap: provide regmap_field helpers for simple bit operations drivers/base/regmap/regmap.c | 22 ++++++++++++++++++++++ include/linux/regmap.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: (subset) [PATCH v3 0/4] Add regmap_field helpers for simple bit operations 2022-05-23 3:26 ` Li Chen @ 2022-06-15 17:08 ` Mark Brown -1 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-06-15 17:08 UTC (permalink / raw) To: linux-arm-kernel, tiwai, linus.walleij, lgirdwood, perex, linux-kernel, samuel, wens, linux-gpio, rafael, linux-sunxi, patrice.chotard, jernej.skrabec, p.zabel, lchen.firstlove, gregkh On Sun, 22 May 2022 20:26:21 -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. > > Li Chen (4): > regmap: provide regmap_field helpers for simple bit operations > ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers > pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers > pinctrl: st: Switch to use regmap_field_test_bits > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/4] regmap: provide regmap_field helpers for simple bit operations commit: f67be8b7ee90c292948c3ec6395673963cccaee6 [2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers commit: b23662406b1b225847b964e4549a5718c45f20d6 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 ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: (subset) [PATCH v3 0/4] Add regmap_field helpers for simple bit operations @ 2022-06-15 17:08 ` Mark Brown 0 siblings, 0 replies; 44+ messages in thread From: Mark Brown @ 2022-06-15 17:08 UTC (permalink / raw) To: linux-arm-kernel, tiwai, linus.walleij, lgirdwood, perex, linux-kernel, samuel, wens, linux-gpio, rafael, linux-sunxi, patrice.chotard, jernej.skrabec, p.zabel, lchen.firstlove, gregkh On Sun, 22 May 2022 20:26:21 -0700, Li Chen wrote: > From: Li Chen <lchen@ambarella.com> > > This series proposes to add simple bit operations for setting, clearing > and testing specific bits with regmap_field. > > Li Chen (4): > regmap: provide regmap_field helpers for simple bit operations > ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers > pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers > pinctrl: st: Switch to use regmap_field_test_bits > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/4] regmap: provide regmap_field helpers for simple bit operations commit: f67be8b7ee90c292948c3ec6395673963cccaee6 [2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers commit: b23662406b1b225847b964e4549a5718c45f20d6 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2022-06-15 17:09 UTC | newest] Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-05-21 14:25 [PATCH 0/4] Add regmap_field helpers for simple bit operations Li Chen 2022-05-21 14:25 ` Li Chen 2022-05-21 14:26 ` [PATCH 1/4] regmap: provide " Li Chen 2022-05-21 14:26 ` Li Chen 2022-05-21 14:27 ` [PATCH 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers Li Chen 2022-05-21 14:27 ` Li Chen 2022-05-21 14:28 ` [PATCH 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers Li Chen 2022-05-21 14:28 ` Li Chen 2022-05-21 14:29 ` [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits Li Chen 2022-05-21 14:29 ` Li Chen 2022-05-22 16:03 ` kernel test robot 2022-05-22 16:03 ` kernel test robot 2022-05-23 2:22 ` [PATCH v2 0/4] Add regmap_field helpers for simple bit operations Li Chen 2022-05-23 2:22 ` Li Chen 2022-05-23 2:23 ` [PATCH v2 1/4] regmap: provide " Li Chen 2022-05-23 2:23 ` Li Chen 2022-05-23 3:09 ` Samuel Holland 2022-05-23 3:09 ` Samuel Holland 2022-05-23 3:30 ` Li Chen 2022-05-23 3:30 ` Li Chen 2022-05-23 2:24 ` [PATCH v2 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers Li Chen 2022-05-23 2:24 ` Li Chen 2022-05-23 2:25 ` [PATCH v2 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers Li Chen 2022-05-23 2:25 ` Li Chen 2022-05-23 2:25 ` [PATCH v2 4/4] pinctrl: st: Switch to use regmap_field_test_bits Li Chen 2022-05-23 2:25 ` Li Chen 2022-05-23 11:39 ` [PATCH v2 0/4] Add regmap_field helpers for simple bit operations Mark Brown 2022-05-23 11:39 ` Mark Brown 2022-05-23 13:19 ` Li Chen 2022-05-23 13:19 ` Li Chen 2022-05-23 3:26 ` [PATCH v3 " Li Chen 2022-05-23 3:26 ` Li Chen 2022-05-23 3:26 ` [PATCH v3 1/4] regmap: provide " Li Chen 2022-05-23 3:26 ` Li Chen 2022-05-23 3:27 ` [PATCH v3 2/4] ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers Li Chen 2022-05-23 3:27 ` Li Chen 2022-05-23 3:28 ` [PATCH v3 3/4] pinctrl: bcm: Use regmap_field_{set/clear}_bits helpers Li Chen 2022-05-23 3:28 ` Li Chen 2022-05-23 3:29 ` [PATCH v3 4/4] pinctrl: st: Switch to use regmap_field_test_bits Li Chen 2022-05-23 3:29 ` Li Chen 2022-06-15 16:59 ` [PATCH v3 0/4] Add regmap_field helpers for simple bit operations Mark Brown 2022-06-15 16:59 ` Mark Brown 2022-06-15 17:08 ` (subset) " Mark Brown 2022-06-15 17:08 ` Mark Brown
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.