diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-25 04:51:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-25 04:51:41 -0400 |
commit | 82f85cf98f0eb60093e8b3d606711c2d49538478 (patch) | |
tree | 4f47b44021db56a591d0e7d8930963853493d80e /include/linux/spi | |
parent | 344a85117d9c9e652c0a40c6d74e39e02ceeca5d (diff) | |
parent | 235907422548aae38d03a545f20fceb728b70ddd (diff) |
Merge remote-tracking branch 'spi/topic/wr' into spi-next
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/spi.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 1619ed48e75d..8c62ba74dd91 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -853,6 +853,33 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) | |||
853 | return (status < 0) ? status : result; | 853 | return (status < 0) ? status : result; |
854 | } | 854 | } |
855 | 855 | ||
856 | /** | ||
857 | * spi_w8r16be - SPI synchronous 8 bit write followed by 16 bit big-endian read | ||
858 | * @spi: device with which data will be exchanged | ||
859 | * @cmd: command to be written before data is read back | ||
860 | * Context: can sleep | ||
861 | * | ||
862 | * This returns the (unsigned) sixteen bit number returned by the device in cpu | ||
863 | * endianness, or else a negative error code. Callable only from contexts that | ||
864 | * can sleep. | ||
865 | * | ||
866 | * This function is similar to spi_w8r16, with the exception that it will | ||
867 | * convert the read 16 bit data word from big-endian to native endianness. | ||
868 | * | ||
869 | */ | ||
870 | static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) | ||
871 | |||
872 | { | ||
873 | ssize_t status; | ||
874 | __be16 result; | ||
875 | |||
876 | status = spi_write_then_read(spi, &cmd, 1, &result, 2); | ||
877 | if (status < 0) | ||
878 | return status; | ||
879 | |||
880 | return be16_to_cpu(result); | ||
881 | } | ||
882 | |||
856 | /*---------------------------------------------------------------------------*/ | 883 | /*---------------------------------------------------------------------------*/ |
857 | 884 | ||
858 | /* | 885 | /* |