Lines Matching defs:spi

3  *  linux/drivers/spi/spi-loopback-test.c
21 #include <linux/spi/spi.h>
23 #include "spi-test.h"
28 MODULE_PARM_DESC(simulate_only, "if not 0 do not execute the spi message");
30 /* dump spi messages */
358 static int spi_loopback_test_probe(struct spi_device *spi)
363 spi->mode |= loop_req ? SPI_LOOP : 0;
364 spi->mode |= no_cs ? SPI_NO_CS : 0;
365 ret = spi_setup(spi);
367 dev_err(&spi->dev, "SPI setup with SPI_LOOP or SPI_NO_CS failed (%d)\n",
373 dev_info(&spi->dev, "Executing spi-loopback-tests\n");
375 ret = spi_test_run_tests(spi, spi_tests);
377 dev_info(&spi->dev, "Finished spi-loopback-tests with return: %i\n",
385 { .compatible = "linux,spi-loopback-test", },
398 .name = "spi-loopback-test",
442 static void spi_test_dump_message(struct spi_device *spi,
450 dev_info(&spi->dev, " spi_msg@%pK\n", msg);
452 dev_info(&spi->dev, " status: %i\n",
454 dev_info(&spi->dev, " frame_length: %i\n",
456 dev_info(&spi->dev, " actual_length: %i\n",
460 dev_info(&spi->dev, " spi_transfer@%pK\n", xfer);
461 dev_info(&spi->dev, " len: %i\n", xfer->len);
462 dev_info(&spi->dev, " tx_buf: %pK\n", xfer->tx_buf);
468 dev_info(&spi->dev, " rx_buf: %pK\n", xfer->rx_buf);
481 dev_info(&spi->dev,
508 static int spi_check_rx_ranges(struct spi_device *spi,
561 dev_err(&spi->dev,
573 static int spi_test_check_elapsed_time(struct spi_device *spi,
593 dev_err(&spi->dev,
603 static int spi_test_check_loopback_result(struct spi_device *spi,
614 ret = spi_check_rx_ranges(spi, msg, rx);
641 dev_err(&spi->dev,
658 dev_err(&spi->dev,
665 static int spi_test_translate(struct spi_device *spi,
699 dev_err(&spi->dev,
708 static int spi_test_fill_pattern(struct spi_device *spi,
781 dev_err(&spi->dev,
792 static int _spi_test_run_iter(struct spi_device *spi,
811 ret = spi_test_translate(spi, (void **)&x->tx_buf, x->len,
817 ret = spi_test_translate(spi, &x->rx_buf, x->len,
827 ret = spi_test_fill_pattern(spi, test);
833 ret = test->execute_msg(spi, test, tx, rx);
835 ret = spi_test_execute_msg(spi, test, tx, rx);
841 dev_err(&spi->dev,
854 static int spi_test_run_iter(struct spi_device *spi,
887 dev_warn_once(&spi->dev,
893 dev_warn_once(&spi->dev,
901 dev_info(&spi->dev, "Running test %s\n", test.description);
903 dev_info(&spi->dev,
921 return _spi_test_run_iter(spi, &test, tx, rx);
927 * @spi: @spi_device on which to run the @spi_message
934 int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test,
947 spi_test_dump_message(spi, msg, true);
950 /* run spi message */
951 ret = spi_sync(spi, msg);
954 dev_info(&spi->dev,
955 "spi-message timed out - rerunning...\n");
959 ret = spi_sync(spi, msg);
962 dev_err(&spi->dev,
970 dev_err(&spi->dev,
977 ret = spi_test_check_loopback_result(spi, msg, tx, rx);
981 ret = spi_test_check_elapsed_time(spi, test);
987 spi_test_dump_message(spi, msg,
999 * @spi: the spi_device to send the messages to
1007 int spi_test_run_test(struct spi_device *spi, const struct spi_test *test,
1017 dev_err(&spi->dev,
1034 (spi->master->dma_alignment ? \
1035 spi->master->dma_alignment : \
1047 ret = spi_test_run_iter(spi, test,
1064 * @spi: the spi device on which to run the tests
1070 int spi_test_run_tests(struct spi_device *spi,
1105 ret = test->run_test(spi, test, tx, rx);
1107 ret = spi_test_run_test(spi, test, tx, rx);