[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250910191520.69d2427e@jic23-huawei>
Date: Wed, 10 Sep 2025 19:15:20 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Petre Rodan <petre.rodan@...dimension.ro>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 11/14] iio: accel: bma220: add interrupt trigger
On Wed, 10 Sep 2025 10:57:16 +0300
Petre Rodan <petre.rodan@...dimension.ro> wrote:
> Add interrupt trigger.
>
> Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
One small thing inline,
Thanks,
Jonathan
> static irqreturn_t bma220_trigger_handler(int irq, void *p)
> {
> int ret;
> @@ -418,6 +437,25 @@ static void bma220_deinit(void *data_ptr)
> ERR_PTR(ret));
> }
>
> +static irqreturn_t bma220_irq_handler(int irq, void *private)
> +{
> + struct iio_dev *indio_dev = private;
> + struct bma220_data *data = iio_priv(indio_dev);
> + int rv;
> + u8 bma220_reg_if[2];
> +
> + guard(mutex)(&data->lock);
> + rv = regmap_bulk_read(data->regmap, BMA220_REG_IF0, bma220_reg_if,
> + sizeof(bma220_reg_if));
Given SPI needs DMA safe buffers and theory at least regmap could
have optimizations that don't bounce data in bulk accesses, please
use a DMA safe buffer here. Put one at the end of iio_priv().
Can share a cacheline with the scan.
> + if (rv)
> + return IRQ_NONE;
> +
> + if (FIELD_GET(BMA220_IF_DRDY, bma220_reg_if[1]))
> + iio_trigger_poll_nested(data->trig);
> +
> + return IRQ_HANDLED;
> +}
Powered by blists - more mailing lists