Commit 6471b68982d3bb1a593c3e183c804ecf830125d3

Authored by Jean Delvare
1 parent 38f41f282f

i2c-stub: Documentation update

There is nothing sensors-specific to i2c-stub.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

Showing 1 changed file with 2 additions and 2 deletions Inline Diff

Documentation/i2c/i2c-stub
1 MODULE: i2c-stub 1 MODULE: i2c-stub
2 2
3 DESCRIPTION: 3 DESCRIPTION:
4 4
5 This module is a very simple fake I2C/SMBus driver. It implements five 5 This module is a very simple fake I2C/SMBus driver. It implements five
6 types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, (r/w) 6 types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, (r/w)
7 word data, and (r/w) I2C block data. 7 word data, and (r/w) I2C block data.
8 8
9 You need to provide chip addresses as a module parameter when loading this 9 You need to provide chip addresses as a module parameter when loading this
10 driver, which will then only react to SMBus commands to these addresses. 10 driver, which will then only react to SMBus commands to these addresses.
11 11
12 No hardware is needed nor associated with this module. It will accept write 12 No hardware is needed nor associated with this module. It will accept write
13 quick commands to the specified addresses; it will respond to the other 13 quick commands to the specified addresses; it will respond to the other
14 commands (also to the specified addresses) by reading from or writing to 14 commands (also to the specified addresses) by reading from or writing to
15 arrays in memory. It will also spam the kernel logs for every command it 15 arrays in memory. It will also spam the kernel logs for every command it
16 handles. 16 handles.
17 17
18 A pointer register with auto-increment is implemented for all byte 18 A pointer register with auto-increment is implemented for all byte
19 operations. This allows for continuous byte reads like those supported by 19 operations. This allows for continuous byte reads like those supported by
20 EEPROMs, among others. 20 EEPROMs, among others.
21 21
22 The typical use-case is like this: 22 The typical use-case is like this:
23 1. load this module 23 1. load this module
24 2. use i2cset (from lm_sensors project) to pre-load some data 24 2. use i2cset (from the i2c-tools project) to pre-load some data
25 3. load the target sensors chip driver module 25 3. load the target chip driver module
26 4. observe its behavior in the kernel log 26 4. observe its behavior in the kernel log
27 27
28 There's a script named i2c-stub-from-dump in the i2c-tools package which 28 There's a script named i2c-stub-from-dump in the i2c-tools package which
29 can load register values automatically from a chip dump. 29 can load register values automatically from a chip dump.
30 30
31 PARAMETERS: 31 PARAMETERS:
32 32
33 int chip_addr[10]: 33 int chip_addr[10]:
34 The SMBus addresses to emulate chips at. 34 The SMBus addresses to emulate chips at.
35 35
36 unsigned long functionality: 36 unsigned long functionality:
37 Functionality override, to disable some commands. See I2C_FUNC_* 37 Functionality override, to disable some commands. See I2C_FUNC_*
38 constants in <linux/i2c.h> for the suitable values. For example, 38 constants in <linux/i2c.h> for the suitable values. For example,
39 value 0x1f0000 would only enable the quick, byte and byte data 39 value 0x1f0000 would only enable the quick, byte and byte data
40 commands. 40 commands.
41 41
42 CAVEATS: 42 CAVEATS:
43 43
44 If your target driver polls some byte or word waiting for it to change, the 44 If your target driver polls some byte or word waiting for it to change, the
45 stub could lock it up. Use i2cset to unlock it. 45 stub could lock it up. Use i2cset to unlock it.
46 46
47 If the hardware for your driver has banked registers (e.g. Winbond sensors 47 If the hardware for your driver has banked registers (e.g. Winbond sensors
48 chips) this module will not work well - although it could be extended to 48 chips) this module will not work well - although it could be extended to
49 support that pretty easily. 49 support that pretty easily.
50 50
51 If you spam it hard enough, printk can be lossy. This module really wants 51 If you spam it hard enough, printk can be lossy. This module really wants
52 something like relayfs. 52 something like relayfs.
53 53
54 54