| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/spi/spi-loopback-test.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Loopback test driver to test several typical spi_message conditions |
|---|
| 7 | 8 | * that a spi_master driver may encounter |
|---|
| 8 | 9 | * this can also get used for regression testing |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 12 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 13 | | - * (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | | - * GNU General Public License for more details. |
|---|
| 19 | 10 | */ |
|---|
| 20 | 11 | |
|---|
| 21 | 12 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 307 | 298 | { |
|---|
| 308 | 299 | .tx_buf = TX(0), |
|---|
| 309 | 300 | .rx_buf = RX(0), |
|---|
| 310 | | - .delay_usecs = 1000, |
|---|
| 301 | + .delay = { |
|---|
| 302 | + .value = 1000, |
|---|
| 303 | + .unit = SPI_DELAY_UNIT_USECS, |
|---|
| 304 | + }, |
|---|
| 311 | 305 | }, |
|---|
| 312 | 306 | { |
|---|
| 313 | 307 | .tx_buf = TX(0), |
|---|
| 314 | 308 | .rx_buf = RX(0), |
|---|
| 315 | | - .delay_usecs = 1000, |
|---|
| 309 | + .delay = { |
|---|
| 310 | + .value = 1000, |
|---|
| 311 | + .unit = SPI_DELAY_UNIT_USECS, |
|---|
| 312 | + }, |
|---|
| 316 | 313 | }, |
|---|
| 317 | 314 | }, |
|---|
| 318 | 315 | }, |
|---|
| .. | .. |
|---|
| 546 | 543 | unsigned long long nbits = (unsigned long long)BITS_PER_BYTE * |
|---|
| 547 | 544 | xfer->len; |
|---|
| 548 | 545 | |
|---|
| 549 | | - delay_usecs += xfer->delay_usecs; |
|---|
| 546 | + delay_usecs += xfer->delay.value; |
|---|
| 550 | 547 | if (!xfer->speed_hz) |
|---|
| 551 | 548 | continue; |
|---|
| 552 | 549 | estimated_time += div_u64(nbits * NSEC_PER_SEC, xfer->speed_hz); |
|---|
| .. | .. |
|---|
| 888 | 885 | /** |
|---|
| 889 | 886 | * spi_test_execute_msg - default implementation to run a test |
|---|
| 890 | 887 | * |
|---|
| 891 | | - * spi: @spi_device on which to run the @spi_message |
|---|
| 892 | | - * test: the test to execute, which already contains @msg |
|---|
| 893 | | - * tx: the tx buffer allocated for the test sequence |
|---|
| 894 | | - * rx: the rx buffer allocated for the test sequence |
|---|
| 888 | + * @spi: @spi_device on which to run the @spi_message |
|---|
| 889 | + * @test: the test to execute, which already contains @msg |
|---|
| 890 | + * @tx: the tx buffer allocated for the test sequence |
|---|
| 891 | + * @rx: the rx buffer allocated for the test sequence |
|---|
| 895 | 892 | * |
|---|
| 896 | 893 | * Returns: error code of spi_sync as well as basic error checking |
|---|
| 897 | 894 | */ |
|---|
| .. | .. |
|---|
| 960 | 957 | * including all the relevant iterations on: |
|---|
| 961 | 958 | * length and buffer alignment |
|---|
| 962 | 959 | * |
|---|
| 963 | | - * spi: the spi_device to send the messages to |
|---|
| 964 | | - * test: the test which we need to execute |
|---|
| 965 | | - * tx: the tx buffer allocated for the test sequence |
|---|
| 966 | | - * rx: the rx buffer allocated for the test sequence |
|---|
| 960 | + * @spi: the spi_device to send the messages to |
|---|
| 961 | + * @test: the test which we need to execute |
|---|
| 962 | + * @tx: the tx buffer allocated for the test sequence |
|---|
| 963 | + * @rx: the rx buffer allocated for the test sequence |
|---|
| 967 | 964 | * |
|---|
| 968 | 965 | * Returns: status code of spi_sync or other failures |
|---|
| 969 | 966 | */ |
|---|