diff options
| author | Mark Brown <broonie@kernel.org> | 2015-11-04 06:02:03 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2015-11-04 06:02:03 -0500 |
| commit | 8c603485752ae844748db94148adc2b46e621d28 (patch) | |
| tree | 10e752655bc747f6d45d4afc50546e5d4dabfebc /include/linux | |
| parent | f0a2a049f5e33670448b189bfb05d73a5a37ff25 (diff) | |
| parent | 97d56dc6826896852dae1a2bdab7a42ecde32c6f (diff) | |
Merge remote-tracking branch 'spi/topic/doc' into spi-next
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/spi/spi.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 6b00f18f5e6b..635bff60eda5 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -51,6 +51,8 @@ extern struct bus_type spi_bus_type; | |||
| 51 | * @bytes_tx: number of bytes sent to device | 51 | * @bytes_tx: number of bytes sent to device |
| 52 | * @bytes_rx: number of bytes received from device | 52 | * @bytes_rx: number of bytes received from device |
| 53 | * | 53 | * |
| 54 | * @transfer_bytes_histo: | ||
| 55 | * transfer bytes histogramm | ||
| 54 | */ | 56 | */ |
| 55 | struct spi_statistics { | 57 | struct spi_statistics { |
| 56 | spinlock_t lock; /* lock for the whole structure */ | 58 | spinlock_t lock; /* lock for the whole structure */ |
| @@ -68,6 +70,8 @@ struct spi_statistics { | |||
| 68 | unsigned long long bytes_rx; | 70 | unsigned long long bytes_rx; |
| 69 | unsigned long long bytes_tx; | 71 | unsigned long long bytes_tx; |
| 70 | 72 | ||
| 73 | #define SPI_STATISTICS_HISTO_SIZE 17 | ||
| 74 | unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE]; | ||
| 71 | }; | 75 | }; |
| 72 | 76 | ||
| 73 | void spi_statistics_add_transfer_stats(struct spi_statistics *stats, | 77 | void spi_statistics_add_transfer_stats(struct spi_statistics *stats, |
| @@ -843,8 +847,10 @@ extern int spi_bus_unlock(struct spi_master *master); | |||
| 843 | * @len: data buffer size | 847 | * @len: data buffer size |
| 844 | * Context: can sleep | 848 | * Context: can sleep |
| 845 | * | 849 | * |
| 846 | * This writes the buffer and returns zero or a negative error code. | 850 | * This function writes the buffer @buf. |
| 847 | * Callable only from contexts that can sleep. | 851 | * Callable only from contexts that can sleep. |
| 852 | * | ||
| 853 | * Return: zero on success, else a negative error code. | ||
| 848 | */ | 854 | */ |
| 849 | static inline int | 855 | static inline int |
| 850 | spi_write(struct spi_device *spi, const void *buf, size_t len) | 856 | spi_write(struct spi_device *spi, const void *buf, size_t len) |
| @@ -867,8 +873,10 @@ spi_write(struct spi_device *spi, const void *buf, size_t len) | |||
| 867 | * @len: data buffer size | 873 | * @len: data buffer size |
| 868 | * Context: can sleep | 874 | * Context: can sleep |
| 869 | * | 875 | * |
| 870 | * This reads the buffer and returns zero or a negative error code. | 876 | * This function reads the buffer @buf. |
| 871 | * Callable only from contexts that can sleep. | 877 | * Callable only from contexts that can sleep. |
| 878 | * | ||
| 879 | * Return: zero on success, else a negative error code. | ||
| 872 | */ | 880 | */ |
| 873 | static inline int | 881 | static inline int |
| 874 | spi_read(struct spi_device *spi, void *buf, size_t len) | 882 | spi_read(struct spi_device *spi, void *buf, size_t len) |
| @@ -895,7 +903,7 @@ spi_read(struct spi_device *spi, void *buf, size_t len) | |||
| 895 | * | 903 | * |
| 896 | * For more specific semantics see spi_sync(). | 904 | * For more specific semantics see spi_sync(). |
| 897 | * | 905 | * |
| 898 | * It returns zero on success, else a negative error code. | 906 | * Return: Return: zero on success, else a negative error code. |
| 899 | */ | 907 | */ |
| 900 | static inline int | 908 | static inline int |
| 901 | spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, | 909 | spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, |
| @@ -919,9 +927,10 @@ extern int spi_write_then_read(struct spi_device *spi, | |||
| 919 | * @cmd: command to be written before data is read back | 927 | * @cmd: command to be written before data is read back |
| 920 | * Context: can sleep | 928 | * Context: can sleep |
| 921 | * | 929 | * |
| 922 | * This returns the (unsigned) eight bit number returned by the | 930 | * Callable only from contexts that can sleep. |
| 923 | * device, or else a negative error code. Callable only from | 931 | * |
| 924 | * contexts that can sleep. | 932 | * Return: the (unsigned) eight bit number returned by the |
| 933 | * device, or else a negative error code. | ||
| 925 | */ | 934 | */ |
| 926 | static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) | 935 | static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) |
| 927 | { | 936 | { |
| @@ -940,12 +949,13 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) | |||
| 940 | * @cmd: command to be written before data is read back | 949 | * @cmd: command to be written before data is read back |
| 941 | * Context: can sleep | 950 | * Context: can sleep |
| 942 | * | 951 | * |
| 943 | * This returns the (unsigned) sixteen bit number returned by the | ||
| 944 | * device, or else a negative error code. Callable only from | ||
| 945 | * contexts that can sleep. | ||
| 946 | * | ||
| 947 | * The number is returned in wire-order, which is at least sometimes | 952 | * The number is returned in wire-order, which is at least sometimes |
| 948 | * big-endian. | 953 | * big-endian. |
| 954 | * | ||
| 955 | * Callable only from contexts that can sleep. | ||
| 956 | * | ||
| 957 | * Return: the (unsigned) sixteen bit number returned by the | ||
| 958 | * device, or else a negative error code. | ||
| 949 | */ | 959 | */ |
| 950 | static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) | 960 | static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) |
| 951 | { | 961 | { |
| @@ -964,13 +974,13 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) | |||
| 964 | * @cmd: command to be written before data is read back | 974 | * @cmd: command to be written before data is read back |
| 965 | * Context: can sleep | 975 | * Context: can sleep |
| 966 | * | 976 | * |
| 967 | * This returns the (unsigned) sixteen bit number returned by the device in cpu | ||
| 968 | * endianness, or else a negative error code. Callable only from contexts that | ||
| 969 | * can sleep. | ||
| 970 | * | ||
| 971 | * This function is similar to spi_w8r16, with the exception that it will | 977 | * This function is similar to spi_w8r16, with the exception that it will |
| 972 | * convert the read 16 bit data word from big-endian to native endianness. | 978 | * convert the read 16 bit data word from big-endian to native endianness. |
| 973 | * | 979 | * |
| 980 | * Callable only from contexts that can sleep. | ||
| 981 | * | ||
| 982 | * Return: the (unsigned) sixteen bit number returned by the device in cpu | ||
| 983 | * endianness, or else a negative error code. | ||
| 974 | */ | 984 | */ |
| 975 | static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) | 985 | static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) |
| 976 | 986 | ||
