Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: offload: Add offset parameter

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.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Link: https://patch.msgid.link/cd315e95c0bd8523f00e91c400abcd6a418e5924.1759760519.git.marcelo.schmitt@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Haslam and committed by
Mark Brown
b83fb1b1 3d66d3db

+12
+3
drivers/spi/spi-offload-trigger-pwm.c
··· 51 51 wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz); 52 52 /* REVISIT: 50% duty-cycle for now - may add config parameter later */ 53 53 wf.duty_length_ns = wf.period_length_ns / 2; 54 + wf.duty_offset_ns = periodic->offset_ns; 54 55 55 56 ret = pwm_round_waveform_might_sleep(st->pwm, &wf); 56 57 if (ret < 0) 57 58 return ret; 58 59 59 60 periodic->frequency_hz = DIV_ROUND_UP_ULL(NSEC_PER_SEC, wf.period_length_ns); 61 + periodic->offset_ns = wf.duty_offset_ns; 60 62 61 63 return 0; 62 64 } ··· 79 77 wf.period_length_ns = DIV_ROUND_UP_ULL(NSEC_PER_SEC, periodic->frequency_hz); 80 78 /* REVISIT: 50% duty-cycle for now - may add config parameter later */ 81 79 wf.duty_length_ns = wf.period_length_ns / 2; 80 + wf.duty_offset_ns = periodic->offset_ns; 82 81 83 82 return pwm_set_waveform_might_sleep(st->pwm, &wf, false); 84 83 }
+9
include/linux/spi/offload/types.h
··· 57 57 SPI_OFFLOAD_TRIGGER_PERIODIC, 58 58 }; 59 59 60 + /** 61 + * spi_offload_trigger_periodic - configuration parameters for periodic triggers 62 + * @frequency_hz: The rate that the trigger should fire in Hz. 63 + * @offset_ns: A delay in nanoseconds between when this trigger fires 64 + * compared to another trigger. This requires specialized hardware 65 + * that supports such synchronization with a delay between two or 66 + * more triggers. Set to 0 when not needed. 67 + */ 60 68 struct spi_offload_trigger_periodic { 61 69 u64 frequency_hz; 70 + u64 offset_ns; 62 71 }; 63 72 64 73 struct spi_offload_trigger_config {