diff options
Diffstat (limited to 'include/linux/spi')
-rw-r--r-- | include/linux/spi/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 82 | ||||
-rw-r--r-- | include/linux/spi/spidev.h | 124 |
3 files changed, 176 insertions, 31 deletions
diff --git a/include/linux/spi/Kbuild b/include/linux/spi/Kbuild new file mode 100644 index 000000000000..d375a082986e --- /dev/null +++ b/include/linux/spi/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += spidev.h | |||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 4f0f8c2e58a5..b6bedc3ee95c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -32,11 +32,12 @@ extern struct bus_type spi_bus_type; | |||
32 | * @max_speed_hz: Maximum clock rate to be used with this chip | 32 | * @max_speed_hz: Maximum clock rate to be used with this chip |
33 | * (on this board); may be changed by the device's driver. | 33 | * (on this board); may be changed by the device's driver. |
34 | * The spi_transfer.speed_hz can override this for each transfer. | 34 | * The spi_transfer.speed_hz can override this for each transfer. |
35 | * @chip-select: Chipselect, distinguishing chips handled by "master". | 35 | * @chip_select: Chipselect, distinguishing chips handled by @master. |
36 | * @mode: The spi mode defines how data is clocked out and in. | 36 | * @mode: The spi mode defines how data is clocked out and in. |
37 | * This may be changed by the device's driver. | 37 | * This may be changed by the device's driver. |
38 | * The "active low" default for chipselect mode can be overridden, | 38 | * The "active low" default for chipselect mode can be overridden |
39 | * as can the "MSB first" default for each word in a transfer. | 39 | * (by specifying SPI_CS_HIGH) as can the "MSB first" default for |
40 | * each word in a transfer (by specifying SPI_LSB_FIRST). | ||
40 | * @bits_per_word: Data transfers involve one or more words; word sizes | 41 | * @bits_per_word: Data transfers involve one or more words; word sizes |
41 | * like eight or 12 bits are common. In-memory wordsizes are | 42 | * like eight or 12 bits are common. In-memory wordsizes are |
42 | * powers of two bytes (e.g. 20 bit samples use 32 bits). | 43 | * powers of two bytes (e.g. 20 bit samples use 32 bits). |
@@ -48,14 +49,18 @@ extern struct bus_type spi_bus_type; | |||
48 | * @controller_state: Controller's runtime state | 49 | * @controller_state: Controller's runtime state |
49 | * @controller_data: Board-specific definitions for controller, such as | 50 | * @controller_data: Board-specific definitions for controller, such as |
50 | * FIFO initialization parameters; from board_info.controller_data | 51 | * FIFO initialization parameters; from board_info.controller_data |
52 | * @modalias: Name of the driver to use with this device, or an alias | ||
53 | * for that name. This appears in the sysfs "modalias" attribute | ||
54 | * for driver coldplugging, and in uevents used for hotplugging | ||
51 | * | 55 | * |
52 | * An spi_device is used to interchange data between an SPI slave | 56 | * A @spi_device is used to interchange data between an SPI slave |
53 | * (usually a discrete chip) and CPU memory. | 57 | * (usually a discrete chip) and CPU memory. |
54 | * | 58 | * |
55 | * In "dev", the platform_data is used to hold information about this | 59 | * In @dev, the platform_data is used to hold information about this |
56 | * device that's meaningful to the device's protocol driver, but not | 60 | * device that's meaningful to the device's protocol driver, but not |
57 | * to its controller. One example might be an identifier for a chip | 61 | * to its controller. One example might be an identifier for a chip |
58 | * variant with slightly different functionality. | 62 | * variant with slightly different functionality; another might be |
63 | * information about how this particular board wires the chip's pins. | ||
59 | */ | 64 | */ |
60 | struct spi_device { | 65 | struct spi_device { |
61 | struct device dev; | 66 | struct device dev; |
@@ -77,13 +82,15 @@ struct spi_device { | |||
77 | void *controller_data; | 82 | void *controller_data; |
78 | const char *modalias; | 83 | const char *modalias; |
79 | 84 | ||
80 | // likely need more hooks for more protocol options affecting how | 85 | /* |
81 | // the controller talks to each chip, like: | 86 | * likely need more hooks for more protocol options affecting how |
82 | // - memory packing (12 bit samples into low bits, others zeroed) | 87 | * the controller talks to each chip, like: |
83 | // - priority | 88 | * - memory packing (12 bit samples into low bits, others zeroed) |
84 | // - drop chipselect after each word | 89 | * - priority |
85 | // - chipselect delays | 90 | * - drop chipselect after each word |
86 | // - ... | 91 | * - chipselect delays |
92 | * - ... | ||
93 | */ | ||
87 | }; | 94 | }; |
88 | 95 | ||
89 | static inline struct spi_device *to_spi_device(struct device *dev) | 96 | static inline struct spi_device *to_spi_device(struct device *dev) |
@@ -146,6 +153,11 @@ static inline struct spi_driver *to_spi_driver(struct device_driver *drv) | |||
146 | 153 | ||
147 | extern int spi_register_driver(struct spi_driver *sdrv); | 154 | extern int spi_register_driver(struct spi_driver *sdrv); |
148 | 155 | ||
156 | /** | ||
157 | * spi_unregister_driver - reverse effect of spi_register_driver | ||
158 | * @sdrv: the driver to unregister | ||
159 | * Context: can sleep | ||
160 | */ | ||
149 | static inline void spi_unregister_driver(struct spi_driver *sdrv) | 161 | static inline void spi_unregister_driver(struct spi_driver *sdrv) |
150 | { | 162 | { |
151 | if (sdrv) | 163 | if (sdrv) |
@@ -165,18 +177,20 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
165 | * @setup: updates the device mode and clocking records used by a | 177 | * @setup: updates the device mode and clocking records used by a |
166 | * device's SPI controller; protocol code may call this. This | 178 | * device's SPI controller; protocol code may call this. This |
167 | * must fail if an unrecognized or unsupported mode is requested. | 179 | * must fail if an unrecognized or unsupported mode is requested. |
180 | * It's always safe to call this unless transfers are pending on | ||
181 | * the device whose settings are being modified. | ||
168 | * @transfer: adds a message to the controller's transfer queue. | 182 | * @transfer: adds a message to the controller's transfer queue. |
169 | * @cleanup: frees controller-specific state | 183 | * @cleanup: frees controller-specific state |
170 | * | 184 | * |
171 | * Each SPI master controller can communicate with one or more spi_device | 185 | * Each SPI master controller can communicate with one or more @spi_device |
172 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 186 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
173 | * but not chip select signals. Each device may be configured to use a | 187 | * but not chip select signals. Each device may be configured to use a |
174 | * different clock rate, since those shared signals are ignored unless | 188 | * different clock rate, since those shared signals are ignored unless |
175 | * the chip is selected. | 189 | * the chip is selected. |
176 | * | 190 | * |
177 | * The driver for an SPI controller manages access to those devices through | 191 | * The driver for an SPI controller manages access to those devices through |
178 | * a queue of spi_message transactions, copyin data between CPU memory and | 192 | * a queue of spi_message transactions, copying data between CPU memory and |
179 | * an SPI slave device). For each such message it queues, it calls the | 193 | * an SPI slave device. For each such message it queues, it calls the |
180 | * message's completion function when the transaction completes. | 194 | * message's completion function when the transaction completes. |
181 | */ | 195 | */ |
182 | struct spi_master { | 196 | struct spi_master { |
@@ -280,27 +294,27 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
280 | * struct spi_transfer - a read/write buffer pair | 294 | * struct spi_transfer - a read/write buffer pair |
281 | * @tx_buf: data to be written (dma-safe memory), or NULL | 295 | * @tx_buf: data to be written (dma-safe memory), or NULL |
282 | * @rx_buf: data to be read (dma-safe memory), or NULL | 296 | * @rx_buf: data to be read (dma-safe memory), or NULL |
283 | * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped | 297 | * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped |
284 | * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped | 298 | * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped |
285 | * @len: size of rx and tx buffers (in bytes) | 299 | * @len: size of rx and tx buffers (in bytes) |
286 | * @speed_hz: Select a speed other then the device default for this | 300 | * @speed_hz: Select a speed other then the device default for this |
287 | * transfer. If 0 the default (from spi_device) is used. | 301 | * transfer. If 0 the default (from @spi_device) is used. |
288 | * @bits_per_word: select a bits_per_word other then the device default | 302 | * @bits_per_word: select a bits_per_word other then the device default |
289 | * for this transfer. If 0 the default (from spi_device) is used. | 303 | * for this transfer. If 0 the default (from @spi_device) is used. |
290 | * @cs_change: affects chipselect after this transfer completes | 304 | * @cs_change: affects chipselect after this transfer completes |
291 | * @delay_usecs: microseconds to delay after this transfer before | 305 | * @delay_usecs: microseconds to delay after this transfer before |
292 | * (optionally) changing the chipselect status, then starting | 306 | * (optionally) changing the chipselect status, then starting |
293 | * the next transfer or completing this spi_message. | 307 | * the next transfer or completing this @spi_message. |
294 | * @transfer_list: transfers are sequenced through spi_message.transfers | 308 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
295 | * | 309 | * |
296 | * SPI transfers always write the same number of bytes as they read. | 310 | * SPI transfers always write the same number of bytes as they read. |
297 | * Protocol drivers should always provide rx_buf and/or tx_buf. | 311 | * Protocol drivers should always provide @rx_buf and/or @tx_buf. |
298 | * In some cases, they may also want to provide DMA addresses for | 312 | * In some cases, they may also want to provide DMA addresses for |
299 | * the data being transferred; that may reduce overhead, when the | 313 | * the data being transferred; that may reduce overhead, when the |
300 | * underlying driver uses dma. | 314 | * underlying driver uses dma. |
301 | * | 315 | * |
302 | * If the transmit buffer is null, zeroes will be shifted out | 316 | * If the transmit buffer is null, zeroes will be shifted out |
303 | * while filling rx_buf. If the receive buffer is null, the data | 317 | * while filling @rx_buf. If the receive buffer is null, the data |
304 | * shifted in will be discarded. Only "len" bytes shift out (or in). | 318 | * shifted in will be discarded. Only "len" bytes shift out (or in). |
305 | * It's an error to try to shift out a partial word. (For example, by | 319 | * It's an error to try to shift out a partial word. (For example, by |
306 | * shifting out three bytes with word size of sixteen or twenty bits; | 320 | * shifting out three bytes with word size of sixteen or twenty bits; |
@@ -309,7 +323,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
309 | * In-memory data values are always in native CPU byte order, translated | 323 | * In-memory data values are always in native CPU byte order, translated |
310 | * from the wire byte order (big-endian except with SPI_LSB_FIRST). So | 324 | * from the wire byte order (big-endian except with SPI_LSB_FIRST). So |
311 | * for example when bits_per_word is sixteen, buffers are 2N bytes long | 325 | * for example when bits_per_word is sixteen, buffers are 2N bytes long |
312 | * and hold N sixteen bit words in CPU byte order. | 326 | * (@len = 2N) and hold N sixteen bit words in CPU byte order. |
313 | * | 327 | * |
314 | * When the word size of the SPI transfer is not a power-of-two multiple | 328 | * When the word size of the SPI transfer is not a power-of-two multiple |
315 | * of eight bits, those in-memory words include extra bits. In-memory | 329 | * of eight bits, those in-memory words include extra bits. In-memory |
@@ -318,7 +332,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
318 | * | 332 | * |
319 | * All SPI transfers start with the relevant chipselect active. Normally | 333 | * All SPI transfers start with the relevant chipselect active. Normally |
320 | * it stays selected until after the last transfer in a message. Drivers | 334 | * it stays selected until after the last transfer in a message. Drivers |
321 | * can affect the chipselect signal using cs_change: | 335 | * can affect the chipselect signal using cs_change. |
322 | * | 336 | * |
323 | * (i) If the transfer isn't the last one in the message, this flag is | 337 | * (i) If the transfer isn't the last one in the message, this flag is |
324 | * used to make the chipselect briefly go inactive in the middle of the | 338 | * used to make the chipselect briefly go inactive in the middle of the |
@@ -372,7 +386,7 @@ struct spi_transfer { | |||
372 | * @queue: for use by whichever driver currently owns the message | 386 | * @queue: for use by whichever driver currently owns the message |
373 | * @state: for use by whichever driver currently owns the message | 387 | * @state: for use by whichever driver currently owns the message |
374 | * | 388 | * |
375 | * An spi_message is used to execute an atomic sequence of data transfers, | 389 | * A @spi_message is used to execute an atomic sequence of data transfers, |
376 | * each represented by a struct spi_transfer. The sequence is "atomic" | 390 | * each represented by a struct spi_transfer. The sequence is "atomic" |
377 | * in the sense that no other spi_message may use that SPI bus until that | 391 | * in the sense that no other spi_message may use that SPI bus until that |
378 | * sequence completes. On some systems, many such sequences can execute as | 392 | * sequence completes. On some systems, many such sequences can execute as |
@@ -464,8 +478,9 @@ static inline void spi_message_free(struct spi_message *m) | |||
464 | } | 478 | } |
465 | 479 | ||
466 | /** | 480 | /** |
467 | * spi_setup -- setup SPI mode and clock rate | 481 | * spi_setup - setup SPI mode and clock rate |
468 | * @spi: the device whose settings are being modified | 482 | * @spi: the device whose settings are being modified |
483 | * Context: can sleep | ||
469 | * | 484 | * |
470 | * SPI protocol drivers may need to update the transfer mode if the | 485 | * SPI protocol drivers may need to update the transfer mode if the |
471 | * device doesn't work with the mode 0 default. They may likewise need | 486 | * device doesn't work with the mode 0 default. They may likewise need |
@@ -474,7 +489,7 @@ static inline void spi_message_free(struct spi_message *m) | |||
474 | * The changes take effect the next time the device is selected and data | 489 | * The changes take effect the next time the device is selected and data |
475 | * is transferred to or from it. | 490 | * is transferred to or from it. |
476 | * | 491 | * |
477 | * Note that this call wil fail if the protocol driver specifies an option | 492 | * Note that this call will fail if the protocol driver specifies an option |
478 | * that the underlying controller or its driver does not support. For | 493 | * that the underlying controller or its driver does not support. For |
479 | * example, not all hardware supports wire transfers using nine bit words, | 494 | * example, not all hardware supports wire transfers using nine bit words, |
480 | * LSB-first wire encoding, or active-high chipselects. | 495 | * LSB-first wire encoding, or active-high chipselects. |
@@ -487,9 +502,10 @@ spi_setup(struct spi_device *spi) | |||
487 | 502 | ||
488 | 503 | ||
489 | /** | 504 | /** |
490 | * spi_async -- asynchronous SPI transfer | 505 | * spi_async - asynchronous SPI transfer |
491 | * @spi: device with which data will be exchanged | 506 | * @spi: device with which data will be exchanged |
492 | * @message: describes the data transfers, including completion callback | 507 | * @message: describes the data transfers, including completion callback |
508 | * Context: any (irqs may be blocked, etc) | ||
493 | * | 509 | * |
494 | * This call may be used in_irq and other contexts which can't sleep, | 510 | * This call may be used in_irq and other contexts which can't sleep, |
495 | * as well as from task contexts which can sleep. | 511 | * as well as from task contexts which can sleep. |
@@ -535,6 +551,7 @@ extern int spi_sync(struct spi_device *spi, struct spi_message *message); | |||
535 | * @spi: device to which data will be written | 551 | * @spi: device to which data will be written |
536 | * @buf: data buffer | 552 | * @buf: data buffer |
537 | * @len: data buffer size | 553 | * @len: data buffer size |
554 | * Context: can sleep | ||
538 | * | 555 | * |
539 | * This writes the buffer and returns zero or a negative error code. | 556 | * This writes the buffer and returns zero or a negative error code. |
540 | * Callable only from contexts that can sleep. | 557 | * Callable only from contexts that can sleep. |
@@ -558,8 +575,9 @@ spi_write(struct spi_device *spi, const u8 *buf, size_t len) | |||
558 | * @spi: device from which data will be read | 575 | * @spi: device from which data will be read |
559 | * @buf: data buffer | 576 | * @buf: data buffer |
560 | * @len: data buffer size | 577 | * @len: data buffer size |
578 | * Context: can sleep | ||
561 | * | 579 | * |
562 | * This writes the buffer and returns zero or a negative error code. | 580 | * This reads the buffer and returns zero or a negative error code. |
563 | * Callable only from contexts that can sleep. | 581 | * Callable only from contexts that can sleep. |
564 | */ | 582 | */ |
565 | static inline int | 583 | static inline int |
@@ -585,6 +603,7 @@ extern int spi_write_then_read(struct spi_device *spi, | |||
585 | * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read | 603 | * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read |
586 | * @spi: device with which data will be exchanged | 604 | * @spi: device with which data will be exchanged |
587 | * @cmd: command to be written before data is read back | 605 | * @cmd: command to be written before data is read back |
606 | * Context: can sleep | ||
588 | * | 607 | * |
589 | * This returns the (unsigned) eight bit number returned by the | 608 | * This returns the (unsigned) eight bit number returned by the |
590 | * device, or else a negative error code. Callable only from | 609 | * device, or else a negative error code. Callable only from |
@@ -605,6 +624,7 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) | |||
605 | * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read | 624 | * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read |
606 | * @spi: device with which data will be exchanged | 625 | * @spi: device with which data will be exchanged |
607 | * @cmd: command to be written before data is read back | 626 | * @cmd: command to be written before data is read back |
627 | * Context: can sleep | ||
608 | * | 628 | * |
609 | * This returns the (unsigned) sixteen bit number returned by the | 629 | * This returns the (unsigned) sixteen bit number returned by the |
610 | * device, or else a negative error code. Callable only from | 630 | * device, or else a negative error code. Callable only from |
diff --git a/include/linux/spi/spidev.h b/include/linux/spi/spidev.h new file mode 100644 index 000000000000..7d700be57490 --- /dev/null +++ b/include/linux/spi/spidev.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * include/linux/spi/spidev.h | ||
3 | * | ||
4 | * Copyright (C) 2006 SWAPP | ||
5 | * Andrea Paterniani <a.paterniani@swapp-eng.it> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef SPIDEV_H | ||
23 | #define SPIDEV_H | ||
24 | |||
25 | |||
26 | /* User space versions of kernel symbols for SPI clocking modes, | ||
27 | * matching <linux/spi/spi.h> | ||
28 | */ | ||
29 | |||
30 | #define SPI_CPHA 0x01 | ||
31 | #define SPI_CPOL 0x02 | ||
32 | |||
33 | #define SPI_MODE_0 (0|0) | ||
34 | #define SPI_MODE_1 (0|SPI_CPHA) | ||
35 | #define SPI_MODE_2 (SPI_CPOL|0) | ||
36 | #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) | ||
37 | |||
38 | |||
39 | /*---------------------------------------------------------------------------*/ | ||
40 | |||
41 | /* IOCTL commands */ | ||
42 | |||
43 | #define SPI_IOC_MAGIC 'k' | ||
44 | |||
45 | /** | ||
46 | * struct spi_ioc_transfer - describes a single SPI transfer | ||
47 | * @tx_buf: Holds pointer to userspace buffer with transmit data, or null. | ||
48 | * If no data is provided, zeroes are shifted out. | ||
49 | * @rx_buf: Holds pointer to userspace buffer for receive data, or null. | ||
50 | * @len: Length of tx and rx buffers, in bytes. | ||
51 | * @speed_hz: Temporary override of the device's bitrate. | ||
52 | * @bits_per_word: Temporary override of the device's wordsize. | ||
53 | * @delay_usecs: If nonzero, how long to delay after the last bit transfer | ||
54 | * before optionally deselecting the device before the next transfer. | ||
55 | * @cs_change: True to deselect device before starting the next transfer. | ||
56 | * | ||
57 | * This structure is mapped directly to the kernel spi_transfer structure; | ||
58 | * the fields have the same meanings, except of course that the pointers | ||
59 | * are in a different address space (and may be of different sizes in some | ||
60 | * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). | ||
61 | * Zero-initialize the structure, including currently unused fields, to | ||
62 | * accomodate potential future updates. | ||
63 | * | ||
64 | * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). | ||
65 | * Pass it an array of related transfers, they'll execute together. | ||
66 | * Each transfer may be half duplex (either direction) or full duplex. | ||
67 | * | ||
68 | * struct spi_ioc_transfer mesg[4]; | ||
69 | * ... | ||
70 | * status = ioctl(fd, SPI_IOC_MESSAGE(4), mesg); | ||
71 | * | ||
72 | * So for example one transfer might send a nine bit command (right aligned | ||
73 | * in a 16-bit word), the next could read a block of 8-bit data before | ||
74 | * terminating that command by temporarily deselecting the chip; the next | ||
75 | * could send a different nine bit command (re-selecting the chip), and the | ||
76 | * last transfer might write some register values. | ||
77 | */ | ||
78 | struct spi_ioc_transfer { | ||
79 | __u64 tx_buf; | ||
80 | __u64 rx_buf; | ||
81 | |||
82 | __u32 len; | ||
83 | __u32 speed_hz; | ||
84 | |||
85 | __u16 delay_usecs; | ||
86 | __u8 bits_per_word; | ||
87 | __u8 cs_change; | ||
88 | __u32 pad; | ||
89 | |||
90 | /* If the contents of 'struct spi_ioc_transfer' ever change | ||
91 | * incompatibly, then the ioctl number (currently 0) must change; | ||
92 | * ioctls with constant size fields get a bit more in the way of | ||
93 | * error checking than ones (like this) where that field varies. | ||
94 | * | ||
95 | * NOTE: struct layout is the same in 64bit and 32bit userspace. | ||
96 | */ | ||
97 | }; | ||
98 | |||
99 | /* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */ | ||
100 | #define SPI_MSGSIZE(N) \ | ||
101 | ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ | ||
102 | ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0) | ||
103 | #define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) | ||
104 | |||
105 | |||
106 | /* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) */ | ||
107 | #define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) | ||
108 | #define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) | ||
109 | |||
110 | /* Read / Write SPI bit justification */ | ||
111 | #define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, __u8) | ||
112 | #define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, __u8) | ||
113 | |||
114 | /* Read / Write SPI device word length (1..N) */ | ||
115 | #define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, __u8) | ||
116 | #define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, __u8) | ||
117 | |||
118 | /* Read / Write SPI device default max speed hz */ | ||
119 | #define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) | ||
120 | #define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) | ||
121 | |||
122 | |||
123 | |||
124 | #endif /* SPIDEV_H */ | ||