linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jorge Marques <jorge.marques@analog.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"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>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 5/7] iio: adc: ad4062: Add IIO Trigger support
Date: Sat, 18 Oct 2025 17:14:25 +0100	[thread overview]
Message-ID: <20251018171425.7515d39f@jic23-huawei> (raw)
In-Reply-To: <20251013-staging-ad4062-v1-5-0f8ce7fef50c@analog.com>

On Mon, 13 Oct 2025 09:28:03 +0200
Jorge Marques <jorge.marques@analog.com> wrote:

> Adds support for IIO Trigger. Optionally, gp1 is assigned as Data Ready
> signal, if not present, fallback to an I3C IBI with the same role.
> The software trigger is allocated by the device, but must be attached by
> the user before enabling the buffer. The purpose is to not impede
> removing the driver due to the increased reference count when
> iio_trigger_set_immutable or iio_trigger_get is used.
> 
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>

A few things inline.
Thanks,

> diff --git a/drivers/iio/adc/ad4062.c b/drivers/iio/adc/ad4062.c
> index e55a69c62694a71a4e29f29b9a2bfeec3b16c990..40b7c10b8ce7145b010bb11e8e4698baacb6b3d3 100644
> --- a/drivers/iio/adc/ad4062.c
> +++ b/drivers/iio/adc/ad4062.c

> +static irqreturn_t ad4062_poll_handler(int irq, void *p)
> +{
> +	struct iio_poll_func *pf = p;
> +	struct iio_dev *indio_dev = pf->indio_dev;
> +	struct ad4062_state *st = iio_priv(indio_dev);
> +	u8 addr = AD4062_REG_CONV_TRIGGER;
> +	int ret;
> +
> +	/* Read current and trigger next conversion */
> +	struct i3c_priv_xfer t[2] = {
> +		{
> +			.data.in = &st->raw,

If it is safe to use addr on the stack, do we need to have
a dma safe buffer for raw?  I'm not sure for i3c!

> +			.len = 4,
> +			.rnw = true,
> +		},
> +		{
> +			.data.out = &addr,
> +			.len = 1,
> +			.rnw = false,
> +		}
> +	};
> +
> +	/* Separated transfers to not infeer repeated-start */
> +	ret = i3c_device_do_priv_xfers(st->i3cdev, &t[0], 1);
> +	if (ret)
> +		goto out;
> +	ret = i3c_device_do_priv_xfers(st->i3cdev, &t[1], 1);

Add a comment on this. I assume it's setting things up for the next
scan?

> +	if (ret)
> +		goto out;
> +
> +	iio_push_to_buffers_with_timestamp(indio_dev, &st->raw,
> +					   pf->timestamp);
> +
> +out:
> +	iio_trigger_notify_done(indio_dev->trig);
> +
> +	return IRQ_HANDLED;
>  }

> +
> +static int ad4062_triggered_buffer_predisable(struct iio_dev *indio_dev)
> +{
> +	struct ad4062_state *st = iio_priv(indio_dev);
> +
> +	pm_runtime_mark_last_busy(&st->i3cdev->dev);

Take a look at the changes across the tree recently.
Now pm_runtime_put_autosuspend() calls pm_runtime_mark_last_busy()
internally to avoid the need for this pair.

> +	pm_runtime_put_autosuspend(&st->i3cdev->dev);
> +	return 0;
> +}



  reply	other threads:[~2025-10-18 16:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13  7:27 [PATCH 0/7] Add support for AD4062 device family Jorge Marques
2025-10-13  7:27 ` [PATCH 1/7] dt-bindings: iio: adc: Add adi,ad4062 Jorge Marques
2025-10-13 19:50   ` Conor Dooley
2025-10-26 16:35     ` Jorge Marques
2025-10-18 15:11   ` Jonathan Cameron
2025-10-26 16:37     ` Jorge Marques
2025-10-13  7:28 ` [PATCH 2/7] docs: iio: New docs for ad4062 driver Jorge Marques
2025-10-18 15:21   ` Jonathan Cameron
2025-10-28 15:31     ` Jorge Marques
2025-11-02 12:37       ` Jonathan Cameron
2025-11-03 10:19         ` Jorge Marques
2025-11-03 12:22           ` Jorge Marques
2025-11-09 12:16             ` Jonathan Cameron
2025-11-09 12:31           ` Jonathan Cameron
2025-10-13  7:28 ` [PATCH 3/7] iio: adc: Add support for ad4062 Jorge Marques
2025-10-18 16:10   ` Jonathan Cameron
2025-11-23 19:48     ` Jorge Marques
2025-11-24  7:43       ` Andy Shevchenko
2025-11-24  8:57         ` Jorge Marques
2025-11-24  9:10           ` Andy Shevchenko
2025-12-06 16:31             ` Jonathan Cameron
2025-11-24  9:11           ` Andy Shevchenko
2025-11-24  9:24             ` Jorge Marques
2025-10-13  7:28 ` [PATCH 4/7] docs: iio: ad4062: Add IIO Trigger support Jorge Marques
2025-10-13  7:28 ` [PATCH 5/7] iio: adc: " Jorge Marques
2025-10-18 16:14   ` Jonathan Cameron [this message]
2025-11-23 19:48     ` Jorge Marques
2025-10-13  7:28 ` [PATCH 6/7] docs: iio: ad4062: Add IIO Events support Jorge Marques
2025-10-13  7:28 ` [PATCH 7/7] iio: adc: " Jorge Marques
2025-10-18 16:26   ` Jonathan Cameron
2025-11-23 19:48     ` Jorge Marques

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=20251018171425.7515d39f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jorge.marques@analog.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).