* [PATCH v3 0/1] Add SPI offload trigger offset @ 2025-09-26 19:00 Marcelo Schmitt 2025-09-26 19:01 ` [PATCH v3 1/1] spi: offload: Add offset parameter Marcelo Schmitt 2025-09-29 9:34 ` [PATCH v3 0/1] Add SPI offload trigger offset Mark Brown 0 siblings, 2 replies; 6+ messages in thread From: Marcelo Schmitt @ 2025-09-26 19:00 UTC (permalink / raw) To: linux-spi, linux-iio, linux-kernel Cc: broonie, jic23, nuno.sa, dlechner, ahaslam, andy, marcelo.schmitt1 Add SPI offload offset parameter needed to achieve high sample rates with ADCs that require some synchronization between a conversion start signal and the issue of data transfers. Change log v1 -> v2 - Using upper case: adc -> ADC. - Codestyle/readability improvements according to suggestions. Change log v2 -> v3 - Squashed SPI offload trigger commits. - Added documentation to offload trigger periodic parameters. - Picked up reviewed-by tags. The updates to the ADC driver that use these changes proposed to the SPI subsystem will go in a patch set titled 'Add SPI offload support to AD4030'. Link to v1: https://lore.kernel.org/linux-iio/cover.1756511030.git.marcelo.schmitt@analog.com/ Link to v2: https://lore.kernel.org/linux-spi/cover.1758206554.git.marcelo.schmitt@analog.com/ Axel Haslam (1): spi: offload: Add offset parameter drivers/spi/spi-offload-trigger-pwm.c | 3 +++ include/linux/spi/offload/types.h | 10 ++++++++++ 2 files changed, 13 insertions(+) base-commit: 7e2212429ec9a7b11644a7971d5d606d44ee4d78 -- 2.39.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] spi: offload: Add offset parameter 2025-09-26 19:00 [PATCH v3 0/1] Add SPI offload trigger offset Marcelo Schmitt @ 2025-09-26 19:01 ` Marcelo Schmitt 2025-09-26 20:10 ` David Lechner 2025-09-28 10:00 ` Jonathan Cameron 2025-09-29 9:34 ` [PATCH v3 0/1] Add SPI offload trigger offset Mark Brown 1 sibling, 2 replies; 6+ messages in thread From: Marcelo Schmitt @ 2025-09-26 19:01 UTC (permalink / raw) To: linux-spi, linux-iio, linux-kernel Cc: Axel Haslam, broonie, jic23, nuno.sa, dlechner, andy, marcelo.schmitt1 From: Axel Haslam <ahaslam@baylibre.com> Add an offset parameter that can be passed in the periodic trigger. This is useful for example when ADC drivers implement a separate periodic signal to trigger conversion and need offload to read the result with some delay. While at it, add some documentation to offload periodic trigger parameters. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> --- Change log v2 -> v3 - Squashed SPI offload trigger commits. - Added documentation to offload trigger periodic parameters. - Picked up reviewed-by tags. drivers/spi/spi-offload-trigger-pwm.c | 3 +++ include/linux/spi/offload/types.h | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/spi/spi-offload-trigger-pwm.c b/drivers/spi/spi-offload-trigger-pwm.c index 805ed41560df..3e8c19227edb 100644 --- a/drivers/spi/spi-offload-trigger-pwm.c +++ b/drivers/spi/spi-offload-trigger-pwm.c @@ -51,12 +51,14 @@ static int spi_offload_trigger_pwm_validate(struct spi_offload_trigger *trigger, wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz); /* REVISIT: 50% duty-cycle for now - may add config parameter later */ wf.duty_length_ns = wf.period_length_ns / 2; + wf.duty_offset_ns = periodic->offset_ns; ret = pwm_round_waveform_might_sleep(st->pwm, &wf); if (ret < 0) return ret; periodic->frequency_hz = DIV_ROUND_UP_ULL(NSEC_PER_SEC, wf.period_length_ns); + periodic->offset_ns = wf.duty_offset_ns; return 0; } @@ -77,6 +79,7 @@ static int spi_offload_trigger_pwm_enable(struct spi_offload_trigger *trigger, wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz); /* REVISIT: 50% duty-cycle for now - may add config parameter later */ wf.duty_length_ns = wf.period_length_ns / 2; + wf.duty_offset_ns = periodic->offset_ns; return pwm_set_waveform_might_sleep(st->pwm, &wf, false); } diff --git a/include/linux/spi/offload/types.h b/include/linux/spi/offload/types.h index 6f7892347871..b56d01ba0b2e 100644 --- a/include/linux/spi/offload/types.h +++ b/include/linux/spi/offload/types.h @@ -57,8 +57,18 @@ enum spi_offload_trigger_type { SPI_OFFLOAD_TRIGGER_PERIODIC, }; + +/** + * spi_offload_trigger_periodic - configuration parameters for periodic triggers + * @frequency_hz: The rate that the trigger should fire in Hz. + * @offset_ns: A delay in nanoseconds between when this trigger fires + * compared to another trigger. This requires specialized hardware + * that supports such synchronization with a delay between two or + * more triggers. Set to 0 when not needed. + */ struct spi_offload_trigger_periodic { u64 frequency_hz; + u64 offset_ns; }; struct spi_offload_trigger_config { -- 2.39.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] spi: offload: Add offset parameter 2025-09-26 19:01 ` [PATCH v3 1/1] spi: offload: Add offset parameter Marcelo Schmitt @ 2025-09-26 20:10 ` David Lechner 2025-09-28 10:00 ` Jonathan Cameron 1 sibling, 0 replies; 6+ messages in thread From: David Lechner @ 2025-09-26 20:10 UTC (permalink / raw) To: Marcelo Schmitt, linux-spi, linux-iio, linux-kernel Cc: Axel Haslam, broonie, jic23, nuno.sa, andy, marcelo.schmitt1 On 9/26/25 2:01 PM, Marcelo Schmitt wrote: > From: Axel Haslam <ahaslam@baylibre.com> > > Add an offset parameter that can be passed in the periodic trigger. > This is useful for example when ADC drivers implement a separate periodic > signal to trigger conversion and need offload to read the result with > some delay. While at it, add some documentation to offload periodic trigger > parameters. > > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> > --- Reviewed-by: David Lechner <dlechner@baylibre.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] spi: offload: Add offset parameter 2025-09-26 19:01 ` [PATCH v3 1/1] spi: offload: Add offset parameter Marcelo Schmitt 2025-09-26 20:10 ` David Lechner @ 2025-09-28 10:00 ` Jonathan Cameron 2025-09-28 13:49 ` Marcelo Schmitt 1 sibling, 1 reply; 6+ messages in thread From: Jonathan Cameron @ 2025-09-28 10:00 UTC (permalink / raw) To: Marcelo Schmitt Cc: linux-spi, linux-iio, linux-kernel, Axel Haslam, broonie, nuno.sa, dlechner, andy, marcelo.schmitt1 On Fri, 26 Sep 2025 16:01:05 -0300 Marcelo Schmitt <marcelo.schmitt@analog.com> wrote: > From: Axel Haslam <ahaslam@baylibre.com> > > Add an offset parameter that can be passed in the periodic trigger. > This is useful for example when ADC drivers implement a separate periodic > signal to trigger conversion and need offload to read the result with > some delay. While at it, add some documentation to offload periodic trigger > parameters. > > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Hi Axel, Marcelo, Is there a build time dependency on this for the ad4030 series? I'm assuming this will go via Mark's SPI tree, so this is really a question of do we need to ask him for an immutable branch or not. I don't think there is such a dependency but just wanted to check! Jonathan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] spi: offload: Add offset parameter 2025-09-28 10:00 ` Jonathan Cameron @ 2025-09-28 13:49 ` Marcelo Schmitt 0 siblings, 0 replies; 6+ messages in thread From: Marcelo Schmitt @ 2025-09-28 13:49 UTC (permalink / raw) To: Jonathan Cameron Cc: Marcelo Schmitt, linux-spi, linux-iio, linux-kernel, Axel Haslam, broonie, nuno.sa, dlechner, andy Hi Jonathan, Yes, current ad4030 series depends on this. Though, since this updates the SPI subsystem, I separated it from ad4030 set. I missed that aspect of the devel process. If we need an immutable branch to make this split series for ad4030 work, then yes, please, I'd like an immutable branch with this patch. On 09/28, Jonathan Cameron wrote: > On Fri, 26 Sep 2025 16:01:05 -0300 > Marcelo Schmitt <marcelo.schmitt@analog.com> wrote: > > > From: Axel Haslam <ahaslam@baylibre.com> > > > > Add an offset parameter that can be passed in the periodic trigger. > > This is useful for example when ADC drivers implement a separate periodic > > signal to trigger conversion and need offload to read the result with > > some delay. While at it, add some documentation to offload periodic trigger > > parameters. > > > > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> > > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> > > Hi Axel, Marcelo, > > Is there a build time dependency on this for the ad4030 series? > I'm assuming this will go via Mark's SPI tree, so this is really a question > of do we need to ask him for an immutable branch or not. > > I don't think there is such a dependency but just wanted to check! > > Jonathan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/1] Add SPI offload trigger offset 2025-09-26 19:00 [PATCH v3 0/1] Add SPI offload trigger offset Marcelo Schmitt 2025-09-26 19:01 ` [PATCH v3 1/1] spi: offload: Add offset parameter Marcelo Schmitt @ 2025-09-29 9:34 ` Mark Brown 1 sibling, 0 replies; 6+ messages in thread From: Mark Brown @ 2025-09-29 9:34 UTC (permalink / raw) To: Marcelo Schmitt Cc: linux-spi, linux-iio, linux-kernel, jic23, nuno.sa, dlechner, ahaslam, andy, marcelo.schmitt1 [-- Attachment #1: Type: text/plain, Size: 561 bytes --] On Fri, Sep 26, 2025 at 04:00:40PM -0300, Marcelo Schmitt wrote: > Add SPI offload offset parameter needed to achieve high sample rates with ADCs > that require some synchronization between a conversion start signal and the issue > of data transfers. Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-29 9:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-26 19:00 [PATCH v3 0/1] Add SPI offload trigger offset Marcelo Schmitt 2025-09-26 19:01 ` [PATCH v3 1/1] spi: offload: Add offset parameter Marcelo Schmitt 2025-09-26 20:10 ` David Lechner 2025-09-28 10:00 ` Jonathan Cameron 2025-09-28 13:49 ` Marcelo Schmitt 2025-09-29 9:34 ` [PATCH v3 0/1] Add SPI offload trigger offset Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox