blob: 89e69ad3436c6f62443335762797442605b1af1d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001MODULE: i2c-stub
2
3DESCRIPTION:
4
5This module is a very simple fake I2C/SMBus driver. It implements four
6types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, and
7(r/w) word data.
8
Jean Delvare9d90c1f2007-10-13 23:56:31 +02009You need to provide chip addresses as a module parameter when loading this
10driver, which will then only react to SMBus commands to these addresses.
Jean Delvare7a8d29c2006-08-13 23:46:44 +020011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012No hardware is needed nor associated with this module. It will accept write
Jean Delvare9d90c1f2007-10-13 23:56:31 +020013quick commands to the specified addresses; it will respond to the other
14commands (also to the specified addresses) by reading from or writing to
15arrays in memory. It will also spam the kernel logs for every command it
16handles.
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18A pointer register with auto-increment is implemented for all byte
19operations. This allows for continuous byte reads like those supported by
20EEPROMs, among others.
21
22The typical use-case is like this:
23 1. load this module
24 2. use i2cset (from lm_sensors project) to pre-load some data
25 3. load the target sensors chip driver module
26 4. observe its behavior in the kernel log
27
Jean Delvare7a8d29c2006-08-13 23:46:44 +020028PARAMETERS:
29
Jean Delvare9d90c1f2007-10-13 23:56:31 +020030int chip_addr[10]:
31 The SMBus addresses to emulate chips at.
Jean Delvare7a8d29c2006-08-13 23:46:44 +020032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033CAVEATS:
34
35There are independent arrays for byte/data and word/data commands. Depending
36on if/how a target driver mixes them, you'll need to be careful.
37
38If your target driver polls some byte or word waiting for it to change, the
39stub could lock it up. Use i2cset to unlock it.
40
41If the hardware for your driver has banked registers (e.g. Winbond sensors
42chips) this module will not work well - although it could be extended to
43support that pretty easily.
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045If you spam it hard enough, printk can be lossy. This module really wants
46something like relayfs.
47