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 */
320 static int spi_loopback_test_probe(struct spi_device *spi)
325 spi->mode |= loop_req ? SPI_LOOP : 0;
326 spi->mode |= no_cs ? SPI_NO_CS : 0;
327 ret = spi_setup(spi);
329 dev_err(&spi->dev, "SPI setup with SPI_LOOP or SPI_NO_CS failed (%d)\n",
335 dev_info(&spi->dev, "Executing spi-loopback-tests\n");
337 ret = spi_test_run_tests(spi, spi_tests);
339 dev_info(&spi->dev, "Finished spi-loopback-tests with return: %i\n",
347 { .compatible = "linux,spi-loopback-test", },
360 .name = "spi-loopback-test",
404 static void spi_test_dump_message(struct spi_device *spi,
412 dev_info(&spi->dev, " spi_msg@%pK\n", msg);
414 dev_info(&spi->dev, " status: %i\n",
416 dev_info(&spi->dev, " frame_length: %i\n",
418 dev_info(&spi->dev, " actual_length: %i\n",
422 dev_info(&spi->dev, " spi_transfer@%pK\n", xfer);
423 dev_info(&spi->dev, " len: %i\n", xfer->len);
424 dev_info(&spi->dev, " tx_buf: %pK\n", xfer->tx_buf);
430 dev_info(&spi->dev, " rx_buf: %pK\n", xfer->rx_buf);
443 dev_info(&spi->dev,
470 static int spi_check_rx_ranges(struct spi_device *spi,
523 dev_err(&spi->dev,
535 static int spi_test_check_elapsed_time(struct spi_device *spi,
555 dev_err(&spi->dev,
565 static int spi_test_check_loopback_result(struct spi_device *spi,
576 ret = spi_check_rx_ranges(spi, msg, rx);
603 dev_err(&spi->dev,
620 dev_err(&spi->dev,
627 static int spi_test_translate(struct spi_device *spi,
661 dev_err(&spi->dev,
670 static int spi_test_fill_pattern(struct spi_device *spi,
743 dev_err(&spi->dev,
754 static int _spi_test_run_iter(struct spi_device *spi,
773 ret = spi_test_translate(spi, (void **)&x->tx_buf, x->len,
779 ret = spi_test_translate(spi, &x->rx_buf, x->len,
789 ret = spi_test_fill_pattern(spi, test);
795 ret = test->execute_msg(spi, test, tx, rx);
797 ret = spi_test_execute_msg(spi, test, tx, rx);
803 dev_err(&spi->dev,
816 static int spi_test_run_iter(struct spi_device *spi,
849 dev_warn_once(&spi->dev,
855 dev_warn_once(&spi->dev,
863 dev_info(&spi->dev, "Running test %s\n", test.description);
865 dev_info(&spi->dev,
883 return _spi_test_run_iter(spi, &test, tx, rx);
889 * @spi: @spi_device on which to run the @spi_message
896 int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test,
909 spi_test_dump_message(spi, msg, true);
912 /* run spi message */
913 ret = spi_sync(spi, msg);
916 dev_info(&spi->dev,
917 "spi-message timed out - rerunning...\n");
921 ret = spi_sync(spi, msg);
924 dev_err(&spi->dev,
932 dev_err(&spi->dev,
939 ret = spi_test_check_loopback_result(spi, msg, tx, rx);
943 ret = spi_test_check_elapsed_time(spi, test);
949 spi_test_dump_message(spi, msg,
961 * @spi: the spi_device to send the messages to
969 int spi_test_run_test(struct spi_device *spi, const struct spi_test *test,
979 dev_err(&spi->dev,
996 (spi->master->dma_alignment ? \
997 spi->master->dma_alignment : \
1007 ret = spi_test_run_iter(spi, test,
1024 * @spi: the spi device on which to run the tests
1030 int spi_test_run_tests(struct spi_device *spi,
1065 ret = test->run_test(spi, test, tx, rx);
1067 ret = spi_test_run_test(spi, test, tx, rx);