Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: "Dileep Kumar Nagavarapu" <DileepKumar.Nagavarapu@amd.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Michal Simek" <michal.simek@amd.com>,
	"Conall O'Griofa" <conall.ogriofa@amd.com>
Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, git@amd.com,
	Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Subject: Re: [PATCH v3 4/6] iio: adc: xilinx-xadc: Add .setup_channels() to struct xadc_ops
Date: Sat, 1 Aug 2026 11:47:20 -0500	[thread overview]
Message-ID: <9d6d0f3f-ca6e-44e0-a280-c07a7d55453b@baylibre.com> (raw)
In-Reply-To: <20260729125455.95893-5-DileepKumar.Nagavarapu@amd.com>

On 7/29/26 7:54 AM, Dileep Kumar Nagavarapu wrote:
> Add .setup_channels() function pointer to struct xadc_ops to enable
> different interfaces to have custom channel setup logic.
> 
> Co-developed-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
> Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
> Signed-off-by: Dileep Kumar Nagavarapu <DileepKumar.Nagavarapu@amd.com>
> ---
>  drivers/iio/adc/xilinx-xadc-core.c     | 6 ++++--
>  drivers/iio/adc/xilinx-xadc-platform.c | 3 +++
>  drivers/iio/adc/xilinx-xadc.h          | 2 ++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index e3b1d5bebe98..d39ff54439ba 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -656,7 +656,7 @@ static const struct iio_info xadc_info = {
>  	.update_scan_mode = &xadc_update_scan_mode,
>  };
>  
> -static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
> +int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
>  {
>  	struct device *dev = indio_dev->dev.parent;
>  	struct xadc *xadc = iio_priv(indio_dev);
> @@ -762,6 +762,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL_NS_GPL(xadc_parse_dt, "IIO_XADC");

This function is only used once. Would be better to just move
it to the file that uses it instead of making a public function.

>  
>  static const char *const xadc_type_names[] = {
>  	[XADC_TYPE_S7] = "xadc",
> @@ -789,9 +790,10 @@ EXPORT_SYMBOL_NS_GPL(xadc_device_setup, "IIO_XADC");
>  int xadc_device_configure(struct device *dev, struct iio_dev *indio_dev, int irq,
>  			  unsigned int *conf0, unsigned int *bipolar_mask)
>  {
> +	struct xadc *xadc = iio_priv(indio_dev);
>  	int ret;
>  
> -	ret = xadc_parse_dt(indio_dev, conf0, irq);
> +	ret = xadc->ops->setup_channels(indio_dev, conf0, irq);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/iio/adc/xilinx-xadc-platform.c b/drivers/iio/adc/xilinx-xadc-platform.c
> index 38748a38da15..bd033315c72f 100644
> --- a/drivers/iio/adc/xilinx-xadc-platform.c
> +++ b/drivers/iio/adc/xilinx-xadc-platform.c
> @@ -405,6 +405,7 @@ static const struct xadc_ops xadc_zynq_ops = {
>  	.get_dclk_rate = xadc_zynq_get_dclk_rate,
>  	.interrupt_handler = xadc_zynq_interrupt_handler,
>  	.update_alarm = xadc_zynq_update_alarm,
> +	.setup_channels = xadc_parse_dt,
>  	.type = XADC_TYPE_S7,
>  	/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
>  	.temp_scale = 503975,
> @@ -509,6 +510,7 @@ static const struct xadc_ops xadc_7s_axi_ops = {
>  	.get_dclk_rate = xadc_axi_get_dclk,
>  	.update_alarm = xadc_axi_update_alarm,
>  	.interrupt_handler = xadc_axi_interrupt_handler,
> +	.setup_channels = xadc_parse_dt,
>  	.flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL,
>  	.type = XADC_TYPE_S7,
>  	/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
> @@ -523,6 +525,7 @@ static const struct xadc_ops xadc_us_axi_ops = {
>  	.get_dclk_rate = xadc_axi_get_dclk,
>  	.update_alarm = xadc_axi_update_alarm,
>  	.interrupt_handler = xadc_axi_interrupt_handler,
> +	.setup_channels = xadc_parse_dt,
>  	.flags = XADC_FLAGS_BUFFERED | XADC_FLAGS_IRQ_OPTIONAL,
>  	.type = XADC_TYPE_US,
>  	/**
> diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h
> index 3a9cc87c43b5..67efa093157e 100644
> --- a/drivers/iio/adc/xilinx-xadc.h
> +++ b/drivers/iio/adc/xilinx-xadc.h
> @@ -78,6 +78,7 @@ struct xadc_ops {
>  	void (*update_alarm)(struct xadc *xadc, unsigned int alarm);
>  	unsigned long (*get_dclk_rate)(struct xadc *xadc);
>  	irqreturn_t (*interrupt_handler)(int irq, void *devid);
> +	int (*setup_channels)(struct iio_dev *indio_dev, unsigned int *conf, int irq);
>  
>  	unsigned int flags;
>  	enum xadc_type type;
> @@ -223,6 +224,7 @@ static inline int xadc_write_adc_reg(struct xadc *xadc, unsigned int reg, u16 va
>  void xadc_write_reg(struct xadc *xadc, unsigned int reg, uint32_t val);
>  void xadc_read_reg(struct xadc *xadc, unsigned int reg, uint32_t *val);
>  struct iio_dev *xadc_device_setup(struct device *dev, int size, const struct xadc_ops **ops);
> +int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq);
>  int xadc_device_configure(struct device *dev, struct iio_dev *indio_dev,
>  			  int irq, unsigned int *conf0, unsigned int *bipolar_mask);
>  int xadc_read_samplerate(struct xadc *xadc);



  reply	other threads:[~2026-08-01 16:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 12:54 [PATCH v3 0/6] iio: adc: xilinx-xadc: Add I2C interface support for System Management Wizard Dileep Kumar Nagavarapu
2026-07-29 12:54 ` [PATCH v3 1/6] iio: adc: xilinx-xadc: Modernize driver code Dileep Kumar Nagavarapu
2026-07-29 13:43   ` Pandey, Radhey Shyam
2026-07-29 14:43   ` Joshua Crofts
2026-07-29 12:54 ` [PATCH v3 2/6] iio: adc: xilinx-xadc: Add helper functions for the device setup Dileep Kumar Nagavarapu
2026-07-29 12:54 ` [PATCH v3 3/6] iio: adc: xilinx-xadc: Split driver into core and platform files Dileep Kumar Nagavarapu
2026-07-30 19:52   ` Uwe Kleine-König
2026-08-10 16:40     ` Andy Shevchenko
2026-08-15  1:44       ` Jonathan Cameron
2026-07-29 12:54 ` [PATCH v3 4/6] iio: adc: xilinx-xadc: Add .setup_channels() to struct xadc_ops Dileep Kumar Nagavarapu
2026-08-01 16:47   ` David Lechner [this message]
2026-08-01 16:49     ` David Lechner
2026-07-29 12:54 ` [PATCH v3 5/6] iio: adc: xilinx-xadc: Add I2C interface support Dileep Kumar Nagavarapu
2026-07-29 12:54 ` [PATCH v3 6/6] iio: adc: xilinx-xadc: Correct Write edge in CFG Dileep Kumar Nagavarapu
2026-08-01 16:51   ` 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=9d6d0f3f-ca6e-44e0-a280-c07a7d55453b@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=DileepKumar.Nagavarapu@amd.com \
    --cc=andy@kernel.org \
    --cc=conall.ogriofa@amd.com \
    --cc=git@amd.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=nuno.sa@analog.com \
    --cc=sai.krishna.potthuri@amd.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