Lines Matching refs:test
529 struct spi_test *test) in spi_test_check_elapsed_time() argument
535 for (i = 0; i < test->transfer_count; i++) { in spi_test_check_elapsed_time()
536 struct spi_transfer *xfer = test->transfers + i; in spi_test_check_elapsed_time()
547 if (test->elapsed_time < estimated_time) { in spi_test_check_elapsed_time()
550 test->elapsed_time, estimated_time); in spi_test_check_elapsed_time()
664 struct spi_test *test) in spi_test_fill_pattern() argument
666 struct spi_transfer *xfers = test->transfers; in spi_test_fill_pattern()
680 for (i = 0; i < test->transfer_count; i++) { in spi_test_fill_pattern()
692 switch (test->fill_option) { in spi_test_fill_pattern()
694 *tx_buf = test->fill_pattern; in spi_test_fill_pattern()
697 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
701 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
705 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
738 test->fill_option); in spi_test_fill_pattern()
748 struct spi_test *test, in _spi_test_run_iter() argument
751 struct spi_message *msg = &test->msg; in _spi_test_run_iter()
762 for (i = 0; i < test->transfer_count; i++) { in _spi_test_run_iter()
763 x = &test->transfers[i]; in _spi_test_run_iter()
782 ret = spi_test_fill_pattern(spi, test); in _spi_test_run_iter()
787 if (test->execute_msg) in _spi_test_run_iter()
788 ret = test->execute_msg(spi, test, tx, rx); in _spi_test_run_iter()
790 ret = spi_test_execute_msg(spi, test, tx, rx); in _spi_test_run_iter()
793 if (ret == test->expected_return) in _spi_test_run_iter()
798 ret, test->expected_return); in _spi_test_run_iter()
817 struct spi_test test; in spi_test_run_iter() local
821 memcpy(&test, testtemplate, sizeof(test)); in spi_test_run_iter()
826 if (!(test.iterate_transfer_mask & (BIT(test.transfer_count) - 1))) in spi_test_run_iter()
827 test.iterate_transfer_mask = 1; in spi_test_run_iter()
831 for (i = 0; i < test.transfer_count; i++) { in spi_test_run_iter()
832 if (test.transfers[i].tx_buf) in spi_test_run_iter()
834 if (test.transfers[i].rx_buf) in spi_test_run_iter()
844 test.description); in spi_test_run_iter()
850 test.description); in spi_test_run_iter()
856 dev_info(&spi->dev, "Running test %s\n", test.description); in spi_test_run_iter()
864 for (i = 0; i < test.transfer_count; i++) { in spi_test_run_iter()
866 if (!(test.iterate_transfer_mask & BIT(i))) in spi_test_run_iter()
868 test.transfers[i].len = len; in spi_test_run_iter()
869 if (test.transfers[i].tx_buf) in spi_test_run_iter()
870 test.transfers[i].tx_buf += tx_off; in spi_test_run_iter()
871 if (test.transfers[i].tx_buf) in spi_test_run_iter()
872 test.transfers[i].rx_buf += rx_off; in spi_test_run_iter()
876 return _spi_test_run_iter(spi, &test, tx, rx); in spi_test_run_iter()
889 int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test, in spi_test_execute_msg() argument
892 struct spi_message *msg = &test->msg; in spi_test_execute_msg()
907 test->elapsed_time = ktime_to_ns(ktime_sub(ktime_get(), start)); in spi_test_execute_msg()
936 ret = spi_test_check_elapsed_time(spi, test); in spi_test_execute_msg()
962 int spi_test_run_test(struct spi_device *spi, const struct spi_test *test, in spi_test_run_test() argument
971 if (test->transfer_count >= SPI_TEST_MAX_TRANSFERS) { in spi_test_run_test()
974 test->description, test->transfer_count); in spi_test_run_test()
988 var < (test->iterate_##var ? \ in spi_test_run_test()
991 test->iterate_##var) : \ in spi_test_run_test()
996 (len = test->iterate_len[idx_len]) != -1; idx_len++) { in spi_test_run_test()
1000 ret = spi_test_run_iter(spi, test, in spi_test_run_test()
1028 struct spi_test *test; in spi_test_run_tests() local
1051 for (test = tests, count = 0; test->description[0]; in spi_test_run_tests()
1052 test++, count++) { in spi_test_run_tests()
1057 if (test->run_test) in spi_test_run_tests()
1058 ret = test->run_test(spi, test, tx, rx); in spi_test_run_tests()
1060 ret = spi_test_run_test(spi, test, tx, rx); in spi_test_run_tests()