Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / Documentation / i2c / i2c-stub
1 MODULE: i2c-stub
2
3 DESCRIPTION:
4
5 This module is a very simple fake I2C/SMBus driver.  It implements four
6 types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, and
7 (r/w) word data.
8
9 No hardware is needed nor associated with this module.  It will accept write
10 quick commands to all addresses; it will respond to the other commands (also
11 to all addresses) by reading from or writing to an array in memory.  It will
12 also spam the kernel logs for every command it handles.
13
14 A pointer register with auto-increment is implemented for all byte
15 operations.  This allows for continuous byte reads like those supported by
16 EEPROMs, among others.
17
18 The typical use-case is like this:
19         1. load this module
20         2. use i2cset (from lm_sensors project) to pre-load some data
21         3. load the target sensors chip driver module
22         4. observe its behavior in the kernel log
23
24 CAVEATS:
25
26 There are independent arrays for byte/data and word/data commands.  Depending
27 on if/how a target driver mixes them, you'll need to be careful.
28
29 If your target driver polls some byte or word waiting for it to change, the
30 stub could lock it up.  Use i2cset to unlock it.
31
32 If the hardware for your driver has banked registers (e.g. Winbond sensors
33 chips) this module will not work well - although it could be extended to
34 support that pretty easily.
35
36 If you spam it hard enough, printk can be lossy.  This module really wants
37 something like relayfs.
38