Lines Matching refs:test
538 struct spi_test *test) in spi_test_check_elapsed_time() argument
544 for (i = 0; i < test->transfer_count; i++) { in spi_test_check_elapsed_time()
545 struct spi_transfer *xfer = test->transfers + i; in spi_test_check_elapsed_time()
556 if (test->elapsed_time < estimated_time) { in spi_test_check_elapsed_time()
559 test->elapsed_time, estimated_time); in spi_test_check_elapsed_time()
673 struct spi_test *test) in spi_test_fill_pattern() argument
675 struct spi_transfer *xfers = test->transfers; in spi_test_fill_pattern()
689 for (i = 0; i < test->transfer_count; i++) { in spi_test_fill_pattern()
701 switch (test->fill_option) { in spi_test_fill_pattern()
703 *tx_buf = test->fill_pattern; in spi_test_fill_pattern()
706 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
710 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
714 *tx_buf = GET_VALUE_BYTE(test->fill_pattern, in spi_test_fill_pattern()
747 test->fill_option); in spi_test_fill_pattern()
757 struct spi_test *test, in _spi_test_run_iter() argument
760 struct spi_message *msg = &test->msg; in _spi_test_run_iter()
771 for (i = 0; i < test->transfer_count; i++) { in _spi_test_run_iter()
772 x = &test->transfers[i]; in _spi_test_run_iter()
791 ret = spi_test_fill_pattern(spi, test); in _spi_test_run_iter()
796 if (test->execute_msg) in _spi_test_run_iter()
797 ret = test->execute_msg(spi, test, tx, rx); in _spi_test_run_iter()
799 ret = spi_test_execute_msg(spi, test, tx, rx); in _spi_test_run_iter()
802 if (ret == test->expected_return) in _spi_test_run_iter()
807 ret, test->expected_return); in _spi_test_run_iter()
826 struct spi_test test; in spi_test_run_iter() local
830 memcpy(&test, testtemplate, sizeof(test)); in spi_test_run_iter()
835 if (!(test.iterate_transfer_mask & (BIT(test.transfer_count) - 1))) in spi_test_run_iter()
836 test.iterate_transfer_mask = 1; in spi_test_run_iter()
840 for (i = 0; i < test.transfer_count; i++) { in spi_test_run_iter()
841 if (test.transfers[i].tx_buf) in spi_test_run_iter()
843 if (test.transfers[i].rx_buf) in spi_test_run_iter()
853 test.description); in spi_test_run_iter()
859 test.description); in spi_test_run_iter()
865 dev_info(&spi->dev, "Running test %s\n", test.description); in spi_test_run_iter()
873 for (i = 0; i < test.transfer_count; i++) { in spi_test_run_iter()
875 if (!(test.iterate_transfer_mask & BIT(i))) in spi_test_run_iter()
877 test.transfers[i].len = len; in spi_test_run_iter()
878 if (test.transfers[i].tx_buf) in spi_test_run_iter()
879 test.transfers[i].tx_buf += tx_off; in spi_test_run_iter()
880 if (test.transfers[i].tx_buf) in spi_test_run_iter()
881 test.transfers[i].rx_buf += rx_off; in spi_test_run_iter()
885 return _spi_test_run_iter(spi, &test, tx, rx); in spi_test_run_iter()
898 int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test, in spi_test_execute_msg() argument
901 struct spi_message *msg = &test->msg; in spi_test_execute_msg()
916 test->elapsed_time = ktime_to_ns(ktime_sub(ktime_get(), start)); in spi_test_execute_msg()
945 ret = spi_test_check_elapsed_time(spi, test); in spi_test_execute_msg()
971 int spi_test_run_test(struct spi_device *spi, const struct spi_test *test, in spi_test_run_test() argument
980 if (test->transfer_count >= SPI_TEST_MAX_TRANSFERS) { in spi_test_run_test()
983 test->description, test->transfer_count); in spi_test_run_test()
997 var < (test->iterate_##var ? \ in spi_test_run_test()
1000 test->iterate_##var) : \ in spi_test_run_test()
1005 (len = test->iterate_len[idx_len]) != -1; idx_len++) { in spi_test_run_test()
1009 ret = spi_test_run_iter(spi, test, in spi_test_run_test()
1037 struct spi_test *test; in spi_test_run_tests() local
1060 for (test = tests, count = 0; test->description[0]; in spi_test_run_tests()
1061 test++, count++) { in spi_test_run_tests()
1066 if (test->run_test) in spi_test_run_tests()
1067 ret = test->run_test(spi, test, tx, rx); in spi_test_run_tests()
1069 ret = spi_test_run_test(spi, test, tx, rx); in spi_test_run_tests()