From: David Lechner <dlechner@baylibre.com>
To: "Pop Ioan Daniel" <pop.ioan-daniel@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Sergiu Cuciurean" <sergiu.cuciurean@analog.com>,
"Dragos Bogdan" <dragos.bogdan@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Olivier Moysan" <olivier.moysan@foss.st.com>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Matti Vaittinen" <mazziesaccount@gmail.com>,
"Tobias Sperling" <tobias.sperling@softing.com>,
"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
"Alisa-Dariana Roman" <alisadariana@gmail.com>,
"Esteban Blanc" <eblanc@baylibre.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] iio: adc: adi-axi-adc: add set decimation rate
Date: Thu, 8 May 2025 11:45:50 -0500 [thread overview]
Message-ID: <37ae4941-da7e-4298-8269-b5faf29fffdd@baylibre.com> (raw)
In-Reply-To: <20250508123107.3797042-3-pop.ioan-daniel@analog.com>
On 5/8/25 7:30 AM, Pop Ioan Daniel wrote:
> Add support for setting decimation rate.
>
> Signed-off-by: Pop Ioan Daniel <pop.ioan-daniel@analog.com>
> ---
> changes in v2:
> - update ADI_AXI_ADC_REG_CHAN_USR_CTRL_2 register in a per-channel register
> - rename ADI_AXI_ADC_DEC_RATE_MASK in
> ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK
> - add channel index parameter to keep axi_adc_set_dec_rate generic
> - remove ad7405 chip-specific struct
> drivers/iio/adc/adi-axi-adc.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
> index 9e8c30230791..33eb8f337e0b 100644
> --- a/drivers/iio/adc/adi-axi-adc.c
> +++ b/drivers/iio/adc/adi-axi-adc.c
> @@ -80,6 +80,9 @@
> #define ADI_AXI_ADC_REG_CHAN_CTRL_3(c) (0x0418 + (c) * 0x40)
> #define ADI_AXI_ADC_CHAN_PN_SEL_MASK GENMASK(19, 16)
>
> +#define ADI_AXI_ADC_REG_CHAN_USR_CTRL_2(c) (0x0424 + (c) * 0x40)
> +#define ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK GENMASK(15, 0)
> +
> /* IO Delays */
> #define ADI_AXI_ADC_REG_DELAY(l) (0x0800 + (l) * 0x4)
> #define AXI_ADC_DELAY_CTRL_MASK GENMASK(4, 0)
> @@ -242,6 +245,17 @@ static int axi_adc_test_pattern_set(struct iio_backend *back,
> }
> }
>
> +static int axi_adc_set_dec_rate(struct iio_backend *back, unsigned int chan,
> + unsigned int rate)
> +{
> + struct adi_axi_adc_state *st = iio_backend_get_priv(back);
> +
> + return regmap_update_bits(st->regmap,
> + ADI_AXI_ADC_REG_CHAN_USR_CTRL_2(chan),
> + ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK,
> + FIELD_PREP(ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK, rate));
Rate is getting a bit far past 80 chars, so would be nice to wrap that line.
> +}
> +
> static int axi_adc_read_chan_status(struct adi_axi_adc_state *st, unsigned int chan,
> unsigned int *status)
> {
> @@ -550,6 +564,7 @@ static const struct iio_backend_ops adi_axi_adc_ops = {
> .test_pattern_set = axi_adc_test_pattern_set,
> .chan_status = axi_adc_chan_status,
> .interface_type_get = axi_adc_interface_type_get,
> + .oversampling_ratio_set = axi_adc_set_dec_rate,
Would make more sense if function was named axi_adc_oversampling_ratio_set.
(Making the names match exactly (with namespace prefix added) make less info
you have to hold in your head when reading the driver.)
> .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access),
> .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status),
> };
next prev parent reply other threads:[~2025-05-08 16:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 12:30 [PATCH v2 0/4] Add support for AD7405/ADUM770x Pop Ioan Daniel
2025-05-08 12:30 ` [PATCH v2 1/4] iio: backend: update iio_backend_oversampling_ratio_set Pop Ioan Daniel
2025-05-08 16:41 ` David Lechner
2025-05-09 10:10 ` kernel test robot
2025-05-09 10:21 ` kernel test robot
2025-05-09 18:03 ` kernel test robot
2025-05-08 12:30 ` [PATCH v2 2/4] iio: adc: adi-axi-adc: add set decimation rate Pop Ioan Daniel
2025-05-08 16:45 ` David Lechner [this message]
2025-05-08 12:30 ` [PATCH v2 3/4] dt-bindings: iio: adc: add ad7405 Pop Ioan Daniel
2025-05-08 14:41 ` Conor Dooley
2025-05-09 13:45 ` Rob Herring (Arm)
2025-05-08 12:30 ` [PATCH v2 4/4] iio: adc: ad7405: add ad7405 driver Pop Ioan Daniel
2025-05-08 17:08 ` David Lechner
2025-05-11 14:45 ` Jonathan Cameron
2025-05-09 11:45 ` kernel test robot
2025-05-11 15:02 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37ae4941-da7e-4298-8269-b5faf29fffdd@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Michael.Hennerich@analog.com \
--cc=alisadariana@gmail.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dragos.bogdan@analog.com \
--cc=eblanc@baylibre.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=mazziesaccount@gmail.com \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=pop.ioan-daniel@analog.com \
--cc=robh@kernel.org \
--cc=sergiu.cuciurean@analog.com \
--cc=tobias.sperling@softing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox