'\" t .\" Title: spi_setup .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Serial Peripheral Interface (SPI) .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "SPI_SETUP" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Serial Peripheral Interface (S" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" spi_setup \- setup SPI mode and clock rate .SH "SYNOPSIS" .HP \w'int\ spi_setup('u .BI "int spi_setup(struct\ spi_device\ *\ " "spi" ");" .SH "ARGUMENTS" .PP \fIspi\fR .RS 4 the device whose settings are being modified .RE .SH "CONTEXT" .PP can sleep, and no requests are queued to the device .SH "DESCRIPTION" .PP SPI protocol drivers may need to update the transfer mode if the device doesn\*(Aqt work with its default\&. They may likewise need to update clock rates or word sizes from initial values\&. This function changes those settings, and must be called from a context that can sleep\&. Except for SPI_CS_HIGH, which takes effect immediately, the changes take effect the next time the device is selected and data is transferred to or from it\&. When this function returns, the spi device is deselected\&. .PP Note that this call will fail if the protocol driver specifies an option that the underlying controller or its driver does not support\&. For example, not all hardware supports wire transfers using nine bit words, LSB\-first wire encoding, or active\-high chipselects\&. .SH "RETURN" .PP zero on success, else a negative error code\&. .SH "COPYRIGHT" .br