aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 03:32:21 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:16 -0400
commit33e34dc6ee2cb2cf2d50e65c5b825d9ebb8b9e66 (patch)
tree965e5feaaa7c7802129205bff03ec5e0982a75ba /drivers/spi/spi.c
parent814a8d50eb1d88cedcef97567be53ee0d4512631 (diff)
SPI kerneldoc
Various documentation updates for the SPI infrastructure, to clarify things that may not have been clear, to cope with lack of editing, and fix omissions. Also, plug SPI into the kernel-api DocBook template, and fix all the resulting glitches in document generation. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: "Randy.Dunlap" <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 6657331eed93..c3219b29b5ac 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -152,6 +152,11 @@ static void spi_drv_shutdown(struct device *dev)
152 sdrv->shutdown(to_spi_device(dev)); 152 sdrv->shutdown(to_spi_device(dev));
153} 153}
154 154
155/**
156 * spi_register_driver - register a SPI driver
157 * @sdrv: the driver to register
158 * Context: can sleep
159 */
155int spi_register_driver(struct spi_driver *sdrv) 160int spi_register_driver(struct spi_driver *sdrv)
156{ 161{
157 sdrv->driver.bus = &spi_bus_type; 162 sdrv->driver.bus = &spi_bus_type;
@@ -183,7 +188,13 @@ static LIST_HEAD(board_list);
183static DECLARE_MUTEX(board_lock); 188static DECLARE_MUTEX(board_lock);
184 189
185 190
186/* On typical mainboards, this is purely internal; and it's not needed 191/**
192 * spi_new_device - instantiate one new SPI device
193 * @master: Controller to which device is connected
194 * @chip: Describes the SPI device
195 * Context: can sleep
196 *
197 * On typical mainboards, this is purely internal; and it's not needed
187 * after board init creates the hard-wired devices. Some development 198 * after board init creates the hard-wired devices. Some development
188 * platforms may not be able to use spi_register_board_info though, and 199 * platforms may not be able to use spi_register_board_info though, and
189 * this is exported so that for example a USB or parport based adapter 200 * this is exported so that for example a USB or parport based adapter
@@ -251,7 +262,12 @@ fail:
251} 262}
252EXPORT_SYMBOL_GPL(spi_new_device); 263EXPORT_SYMBOL_GPL(spi_new_device);
253 264
254/* 265/**
266 * spi_register_board_info - register SPI devices for a given board
267 * @info: array of chip descriptors
268 * @n: how many descriptors are provided
269 * Context: can sleep
270 *
255 * Board-specific early init code calls this (probably during arch_initcall) 271 * Board-specific early init code calls this (probably during arch_initcall)
256 * with segments of the SPI device table. Any device nodes are created later, 272 * with segments of the SPI device table. Any device nodes are created later,
257 * after the relevant parent SPI controller (bus_num) is defined. We keep 273 * after the relevant parent SPI controller (bus_num) is defined. We keep
@@ -337,9 +353,10 @@ static struct class spi_master_class = {
337/** 353/**
338 * spi_alloc_master - allocate SPI master controller 354 * spi_alloc_master - allocate SPI master controller
339 * @dev: the controller, possibly using the platform_bus 355 * @dev: the controller, possibly using the platform_bus
340 * @size: how much driver-private data to preallocate; the pointer to this 356 * @size: how much zeroed driver-private data to allocate; the pointer to this
341 * memory is in the class_data field of the returned class_device, 357 * memory is in the class_data field of the returned class_device,
342 * accessible with spi_master_get_devdata(). 358 * accessible with spi_master_get_devdata().
359 * Context: can sleep
343 * 360 *
344 * This call is used only by SPI master controller drivers, which are the 361 * This call is used only by SPI master controller drivers, which are the
345 * only ones directly touching chip registers. It's how they allocate 362 * only ones directly touching chip registers. It's how they allocate
@@ -375,6 +392,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
375/** 392/**
376 * spi_register_master - register SPI master controller 393 * spi_register_master - register SPI master controller
377 * @master: initialized master, originally from spi_alloc_master() 394 * @master: initialized master, originally from spi_alloc_master()
395 * Context: can sleep
378 * 396 *
379 * SPI master controllers connect to their drivers using some non-SPI bus, 397 * SPI master controllers connect to their drivers using some non-SPI bus,
380 * such as the platform bus. The final stage of probe() in that code 398 * such as the platform bus. The final stage of probe() in that code
@@ -437,6 +455,7 @@ static int __unregister(struct device *dev, void *unused)
437/** 455/**
438 * spi_unregister_master - unregister SPI master controller 456 * spi_unregister_master - unregister SPI master controller
439 * @master: the master being unregistered 457 * @master: the master being unregistered
458 * Context: can sleep
440 * 459 *
441 * This call is used only by SPI master controller drivers, which are the 460 * This call is used only by SPI master controller drivers, which are the
442 * only ones directly touching chip registers. 461 * only ones directly touching chip registers.
@@ -455,6 +474,7 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
455/** 474/**
456 * spi_busnum_to_master - look up master associated with bus_num 475 * spi_busnum_to_master - look up master associated with bus_num
457 * @bus_num: the master's bus number 476 * @bus_num: the master's bus number
477 * Context: can sleep
458 * 478 *
459 * This call may be used with devices that are registered after 479 * This call may be used with devices that are registered after
460 * arch init time. It returns a refcounted pointer to the relevant 480 * arch init time. It returns a refcounted pointer to the relevant
@@ -492,6 +512,7 @@ static void spi_complete(void *arg)
492 * spi_sync - blocking/synchronous SPI data transfers 512 * spi_sync - blocking/synchronous SPI data transfers
493 * @spi: device with which data will be exchanged 513 * @spi: device with which data will be exchanged
494 * @message: describes the data transfers 514 * @message: describes the data transfers
515 * Context: can sleep
495 * 516 *
496 * This call may only be used from a context that may sleep. The sleep 517 * This call may only be used from a context that may sleep. The sleep
497 * is non-interruptible, and has no timeout. Low-overhead controller 518 * is non-interruptible, and has no timeout. Low-overhead controller
@@ -508,7 +529,7 @@ static void spi_complete(void *arg)
508 * 529 *
509 * The return value is a negative error code if the message could not be 530 * The return value is a negative error code if the message could not be
510 * submitted, else zero. When the value is zero, then message->status is 531 * submitted, else zero. When the value is zero, then message->status is
511 * also defined: it's the completion code for the transfer, either zero 532 * also defined; it's the completion code for the transfer, either zero
512 * or a negative error code from the controller driver. 533 * or a negative error code from the controller driver.
513 */ 534 */
514int spi_sync(struct spi_device *spi, struct spi_message *message) 535int spi_sync(struct spi_device *spi, struct spi_message *message)
@@ -538,6 +559,7 @@ static u8 *buf;
538 * @n_tx: size of txbuf, in bytes 559 * @n_tx: size of txbuf, in bytes
539 * @rxbuf: buffer into which data will be read 560 * @rxbuf: buffer into which data will be read
540 * @n_rx: size of rxbuf, in bytes (need not be dma-safe) 561 * @n_rx: size of rxbuf, in bytes (need not be dma-safe)
562 * Context: can sleep
541 * 563 *
542 * This performs a half duplex MicroWire style transaction with the 564 * This performs a half duplex MicroWire style transaction with the
543 * device, sending txbuf and then reading rxbuf. The return value 565 * device, sending txbuf and then reading rxbuf. The return value
@@ -545,7 +567,8 @@ static u8 *buf;
545 * This call may only be used from a context that may sleep. 567 * This call may only be used from a context that may sleep.
546 * 568 *
547 * Parameters to this routine are always copied using a small buffer; 569 * Parameters to this routine are always copied using a small buffer;
548 * performance-sensitive or bulk transfer code should instead use 570 * portable code should never use this for more than 32 bytes.
571 * Performance-sensitive or bulk transfer code should instead use
549 * spi_{async,sync}() calls with dma-safe buffers. 572 * spi_{async,sync}() calls with dma-safe buffers.
550 */ 573 */
551int spi_write_then_read(struct spi_device *spi, 574int spi_write_then_read(struct spi_device *spi,