All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>,
	jic23@kernel.org,  robh@kernel.org, conor+dt@kernel.org,
	linux-iio@vger.kernel.org,  devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 06/11] iio: adc: adi-axi-adc: add filter type config
Date: Tue, 29 Apr 2025 09:18:06 +0100	[thread overview]
Message-ID: <bdf28693eeeebf93cfc6305679e154bdc515206c.camel@gmail.com> (raw)
In-Reply-To: <20250425112538.59792-7-antoniu.miclaus@analog.com>

On Fri, 2025-04-25 at 14:25 +0300, Antoniu Miclaus wrote:
> Add support for enabling/disabling filter based on the filter type
> provided.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---

You should either mention in the commit message that a new compatible (and thus
iio_backend_ops) is being added or split this into two patches. This is simple
enough that I don't really mind being in the same patch but still...

With the above (and a nit below):

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

> changes in v3:
>  - update the function to adapt to the backend interface.
>  drivers/iio/adc/adi-axi-adc.c | 38 +++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
> index 61ab7dce43be..2a3a6c3f5e59 100644
> --- a/drivers/iio/adc/adi-axi-adc.c
> +++ b/drivers/iio/adc/adi-axi-adc.c
> @@ -52,6 +52,7 @@
>  #define   AXI_AD485X_PACKET_FORMAT_20BIT	0x0
>  #define   AXI_AD485X_PACKET_FORMAT_24BIT	0x1
>  #define   AXI_AD485X_PACKET_FORMAT_32BIT	0x2
> +#define   AXI_AD408X_CNTRL_3_FILTER_EN_MSK	BIT(0)
>  
>  #define ADI_AXI_ADC_REG_DRP_STATUS		0x0074
>  #define   ADI_AXI_ADC_DRP_LOCKED		BIT(17)
> @@ -402,6 +403,19 @@ static int axi_adc_ad485x_oversampling_ratio_set(struct
> iio_backend *back,
>  	}
>  }
>  
> +static int axi_adc_ad408x_filter_type_set(struct iio_backend *back,
> +					  enum iio_backend_filter_type type)
> +{
> +	struct adi_axi_adc_state *st = iio_backend_get_priv(back);
> +
> +	if (type)

We could check for a max value and return -EINVAL...

> +		return regmap_set_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3,
> +				       AXI_AD408X_CNTRL_3_FILTER_EN_MSK);
> +
> +	return regmap_clear_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3,
> +				 AXI_AD408X_CNTRL_3_FILTER_EN_MSK);
> +}
> +
>  static struct iio_buffer *axi_adc_request_buffer(struct iio_backend *back,
>  						 struct iio_dev *indio_dev)
>  {
> @@ -582,6 +596,24 @@ static const struct iio_backend_info axi_ad485x = {
>  	.ops = &adi_ad485x_ops,
>  };
>  
> +static const struct iio_backend_ops adi_ad408x_ops = {
> +	.enable = axi_adc_enable,
> +	.disable = axi_adc_disable,
> +	.chan_enable = axi_adc_chan_enable,
> +	.chan_disable = axi_adc_chan_disable,
> +	.request_buffer = axi_adc_request_buffer,
> +	.free_buffer = axi_adc_free_buffer,
> +	.data_sample_trigger = axi_adc_data_sample_trigger,
> +	.filter_type_set = axi_adc_ad408x_filter_type_set,
> +	.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),
> +};
> +
> +static const struct iio_backend_info axi_ad408x = {
> +	.name = "axi-ad408x",
> +	.ops = &adi_ad408x_ops,
> +};
> +
>  static int adi_axi_adc_probe(struct platform_device *pdev)
>  {
>  	struct adi_axi_adc_state *st;
> @@ -697,9 +729,15 @@ static const struct axi_adc_info adc_ad7606 = {
>  	.has_child_nodes = true,
>  };
>  
> +static const struct axi_adc_info adi_axi_ad408x = {
> +	.version = ADI_AXI_PCORE_VER(10, 0, 'a'),
> +	.backend_info = &axi_ad408x,
> +};
> +
>  /* Match table for of_platform binding */
>  static const struct of_device_id adi_axi_adc_of_match[] = {
>  	{ .compatible = "adi,axi-adc-10.0.a", .data = &adc_generic },
> +	{ .compatible = "adi,axi-ad408x", .data = &adi_axi_ad408x },
>  	{ .compatible = "adi,axi-ad485x", .data = &adi_axi_ad485x },
>  	{ .compatible = "adi,axi-ad7606x", .data = &adc_ad7606 },
>  	{ /* end of list */ }

  reply	other threads:[~2025-04-29  8:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 11:25 [PATCH v3 00/11] Add support for AD4080 ADC Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 01/11] iio: backend: add support for filter config Antoniu Miclaus
2025-04-26 13:14   ` Jonathan Cameron
2025-04-29  8:14   ` Nuno Sá
2025-04-25 11:25 ` [PATCH v3 02/11] iio: backend: add support for data alignment Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 03/11] iio: backend: add support for sync status Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 04/11] iio: backend: add support for number of lanes Antoniu Miclaus
2025-04-29  8:19   ` Nuno Sá
2025-04-25 11:25 ` [PATCH v3 05/11] dt-bindings: iio: adc: add ad408x axi variant Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 06/11] iio: adc: adi-axi-adc: add filter type config Antoniu Miclaus
2025-04-29  8:18   ` Nuno Sá [this message]
2025-04-25 11:25 ` [PATCH v3 07/11] iio: adc: adi-axi-adc: add sync enable/disable Antoniu Miclaus
2025-04-29  8:28   ` Nuno Sá
2025-04-29 17:22   ` David Lechner
2025-04-25 11:25 ` [PATCH v3 08/11] iio: adc: adi-axi-adc: add sync status Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 09/11] iio: adc: adi-axi-adc: add num lanes support Antoniu Miclaus
2025-04-29  8:26   ` Nuno Sá
2025-04-29 17:26   ` David Lechner
2025-04-25 11:25 ` [PATCH v3 10/11] dt-bindings: iio: adc: add ad4080 Antoniu Miclaus
2025-04-25 11:25 ` [PATCH v3 11/11] iio: adc: ad4080: add driver support Antoniu Miclaus
2025-04-26 13:13   ` Jonathan Cameron
2025-04-26 16:48   ` kernel test robot
2025-04-29  8:46   ` Nuno Sá
2025-04-29 19:15   ` David Lechner
2025-04-30 12:31     ` Miclaus, Antoniu
2025-04-30 14:11       ` David Lechner

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=bdf28693eeeebf93cfc6305679e154bdc515206c.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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 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.