1 .\" Copyright (c) 1998, Nicolas Souchu
2 .\" Copyright (c) 2004, Joerg Wunsch
3 .\" Copyright (c) 2015, Michael Gmelin <freebsd@grem.de>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd SMB generic I/O device driver
40 character device driver provides generic I/O to any
43 To control SMB devices, use
45 with the ioctls described below.
46 Any of these ioctl commands takes a pointer to
50 #include <sys/types.h>
67 char *wbuf; /* use wdata if NULL */
69 char *rbuf; /* use rdata if NULL */
76 field is always used, and provides the address of the
78 The slave address is specified in the seven most significant bits
79 .Pq i.e., Dq "left-justified" .
80 The least significant bit of the slave address must be zero.
82 .Bl -column ".Dv SMB_QUICK_WRITE" -compact
83 .It Em Ioctl Ta Em Description
85 .It Dv SMB_QUICK_WRITE Ta
87 does not transfer any data.
88 It just issues the device address with write intent to the bus.
89 .It Dv SMB_QUICK_READ Ta
91 does not transfer any data.
92 It just issues the device address with read intent to the bus.
95 sends the byte provided in
100 reads a single byte from the device which is returned in
104 first sends the byte from
106 to the device, followed by the byte given in
110 first sends the byte from
112 to the device, followed by the word given in
114 Note that the SMBus byte-order is little-endian by definition.
117 first sends the byte from
119 to the device, then reads one byte of data from
121 Returned data is stored in
125 first sends the byte from
127 to the device, then reads one word of data from
129 Returned data is stored in
133 first sends the byte from
135 to the device, followed by the word provided in
137 It then reads one word of data from the device and returns it
142 first sends the byte from
144 to the device, followed by
146 bytes of data that are taken from the buffer pointed to by
148 The SMBus specification mandates that no more than 32 bytes of
149 data can be transferred in a single block read or write command,
152 is also used to access I2C devices, the limit has been increased
154 This value can be read from the constant
155 .Dv SMB_MAXBLOCKSIZE .
158 first sends the byte from
160 to the device, then reads
162 bytes of data that from the device.
163 This data is returned in the buffer pointed to by
167 sends an SMB roll-up transaction with flags that also allow it to
168 be used for (mostly) I2C pass-through and with 10-bit addresses.
169 This function can be utilized to roll up all of the above functions.
170 It first sends the byte from
172 to the device, followed by
174 bytes of data that are taken from the buffer pointed to by
178 bytes of data that from the device.
179 This data is returned in the buffer pointed to by
182 The following flags are allowed in
185 .Bd -literal -compact
186 SMB_TRANS_NOSTOP Do not send STOP at end
187 SMB_TRANS_NOCMD Ignore cmd field (do not tx)
188 SMB_TRANS_NOCNT Do not tx or rx count field
189 SMB_TRANS_7BIT Change address mode to 7-bit
190 SMB_TRANS_10BIT Change address mode to 10-bit
198 system calls are not implemented by this driver.
202 commands can cause the following driver-specific errors:
205 Device did not respond to selection.
209 Operation not supported by device (not supposed to happen).
211 General argument error.
212 .It Bq Er EWOULDBLOCK
213 SMBus transaction timed out.
221 manual page first appeared in
225 manual page was written by
228 .An Michael Gmelin Aq freebsd@grem.de .