From: Jonathan Cameron <jic23@kernel.org>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
David Lechner <dlechner@baylibre.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: adc: ad7606: add SPI offload support
Date: Mon, 14 Apr 2025 19:24:22 +0100 [thread overview]
Message-ID: <20250414192422.039817b7@jic23-huawei> (raw)
In-Reply-To: <20250403-wip-bl-spi-offload-ad7606-v1-3-1b00cb638b12@baylibre.com>
> +static int ad7606_spi_offload_probe(struct device *dev,
> + struct iio_dev *indio_dev)
> +{
> + struct ad7606_state *st = iio_priv(indio_dev);
> + struct spi_device *spi = to_spi_device(dev);
> + struct spi_bus_data *bus_data;
> + struct dma_chan *rx_dma;
> + struct spi_offload_trigger_info trigger_info = {
> + .fwnode = dev_fwnode(dev),
> + .ops = &ad7606_offload_trigger_ops,
> + .priv = st,
> + };
> + int ret;
> +
> + bus_data = devm_kzalloc(dev, sizeof(*bus_data), GFP_KERNEL);
> + if (!bus_data)
> + return -ENOMEM;
> + st->bus_data = bus_data;
> +
> + bus_data->offload = devm_spi_offload_get(dev, spi,
> + &ad7606_spi_offload_config);
> + ret = PTR_ERR_OR_ZERO(bus_data->offload);
> + if (ret && ret != -ENODEV)
> + return dev_err_probe(dev, ret, "failed to get SPI offload\n");
> + /* Allow main ad7606_probe function to continue. */
> + if (ret == -ENODEV)
> + return 0;
> +
> + ret = devm_spi_offload_trigger_register(dev, &trigger_info);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to register offload trigger\n");
> +
> + bus_data->offload_trigger = devm_spi_offload_trigger_get(dev,
> + bus_data->offload, SPI_OFFLOAD_TRIGGER_DATA_READY);
> + if (IS_ERR(bus_data->offload_trigger))
> + return dev_err_probe(dev, PTR_ERR(bus_data->offload_trigger),
> + "failed to get offload trigger\n");
> +
> + /* TODO: PWM setup should be ok, done for the backend. PWM mutex ? */
> + rx_dma = devm_spi_offload_rx_stream_request_dma_chan(dev,
> + bus_data->offload);
> + if (IS_ERR(rx_dma))
> + return dev_err_probe(dev, PTR_ERR(rx_dma),
> + "failed to get offload RX DMA\n");
> +
> + ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
> + rx_dma, IIO_BUFFER_DIRECTION_IN);
> + if (ret)
should be ret; Thanks to 0-day for the report and fixed up.
> + return dev_err_probe(dev, PTR_ERR(rx_dma),
> + "failed to setup offload RX DMA\n");
> +
> + /* Use offload ops. */
> + indio_dev->setup_ops = &ad7606_offload_buffer_setup_ops;
> +
> + st->offload_en = true;
> +
> + return 0;
> +}
next prev parent reply other threads:[~2025-04-14 18:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 16:19 [PATCH 0/3] iio: ad7606: add SPI offload support Angelo Dureghello
2025-04-03 16:19 ` [PATCH 1/3] dt-bindings: iio: adc: adi,ad7606: add SPI offload properties Angelo Dureghello
2025-04-07 13:21 ` Rob Herring (Arm)
2025-04-03 16:19 ` [PATCH 2/3] doc: iio: ad7606: describe offload support Angelo Dureghello
2025-04-03 16:19 ` [PATCH 3/3] iio: adc: ad7606: add SPI " Angelo Dureghello
2025-04-05 15:40 ` Jonathan Cameron
2025-04-07 7:41 ` Angelo Dureghello
2025-04-07 18:58 ` Jonathan Cameron
2025-04-14 18:24 ` Jonathan Cameron [this message]
2025-04-14 19:59 ` Angelo Dureghello
2025-04-03 16:48 ` [PATCH 0/3] iio: " David Lechner
2025-04-07 18:55 ` 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=20250414192422.039817b7@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=adureghello@baylibre.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.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=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