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

spi: spidev_test: add support for word delay

Support setting the word delay using the -w/--word-delay command line
parameter. Note that spidev exposes word delay only as an u8, allowing
for a maximum of 255us of delay to be inserted.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
Link: https://patch.msgid.link/20241107-spidev-test-word-delay-v1-1-d4bba5569e39@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jonas Rebmann and committed by
Mark Brown
3ec83a37 c36212b2

+9 -2
+9 -2
tools/spi/spidev_test.c
··· 42 42 static char *output_file; 43 43 static uint32_t speed = 500000; 44 44 static uint16_t delay; 45 + static uint16_t word_delay; 45 46 static int verbose; 46 47 static int transfer_size; 47 48 static int iterations; ··· 125 124 .rx_buf = (unsigned long)rx, 126 125 .len = len, 127 126 .delay_usecs = delay, 127 + .word_delay_usecs = word_delay, 128 128 .speed_hz = speed, 129 129 .bits_per_word = bits, 130 130 }; ··· 174 172 175 173 static void print_usage(const char *prog) 176 174 { 177 - printf("Usage: %s [-2348CDFHILMNORSZbdilopsv]\n", prog); 175 + printf("Usage: %s [-2348CDFHILMNORSZbdilopsvw]\n", prog); 178 176 puts("general device settings:\n" 179 177 " -D --device device to use (default /dev/spidev1.1)\n" 180 178 " -s --speed max speed (Hz)\n" 181 179 " -d --delay delay (usec)\n" 180 + " -w --word-delay word delay (usec)\n" 182 181 " -l --loop loopback\n" 183 182 "spi mode:\n" 184 183 " -H --cpha clock phase\n" ··· 216 213 { "device", 1, 0, 'D' }, 217 214 { "speed", 1, 0, 's' }, 218 215 { "delay", 1, 0, 'd' }, 216 + { "word-delay", 1, 0, 'w' }, 219 217 { "loop", 0, 0, 'l' }, 220 218 { "cpha", 0, 0, 'H' }, 221 219 { "cpol", 0, 0, 'O' }, ··· 241 237 }; 242 238 int c; 243 239 244 - c = getopt_long(argc, argv, "D:s:d:b:i:o:lHOLC3ZFMNR248p:vS:I:", 240 + c = getopt_long(argc, argv, "D:s:d:w:b:i:o:lHOLC3ZFMNR248p:vS:I:", 245 241 lopts, NULL); 246 242 247 243 if (c == -1) ··· 256 252 break; 257 253 case 'd': 258 254 delay = atoi(optarg); 255 + break; 256 + case 'w': 257 + word_delay = atoi(optarg); 259 258 break; 260 259 case 'b': 261 260 bits = atoi(optarg);