1MODULE: 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 9You need to provide a chip address as a module parameter when loading 10this driver, which will then only react to SMBus commands to this address. 11 12No hardware is needed nor associated with this module. It will accept write 13quick commands to one address; it will respond to the other commands (also 14to one address) by reading from or writing to an array in memory. It will 15also spam the kernel logs for every command it handles. 16 17A pointer register with auto-increment is implemented for all byte 18operations. This allows for continuous byte reads like those supported by 19EEPROMs, among others. 20 21The typical use-case is like this: 22 1. load this module 23 2. use i2cset (from lm_sensors project) to pre-load some data 24 3. load the target sensors chip driver module 25 4. observe its behavior in the kernel log 26 27PARAMETERS: 28 29int chip_addr: 30 The SMBus address to emulate a chip at. 31 32CAVEATS: 33 34There are independent arrays for byte/data and word/data commands. Depending 35on if/how a target driver mixes them, you'll need to be careful. 36 37If your target driver polls some byte or word waiting for it to change, the 38stub could lock it up. Use i2cset to unlock it. 39 40If the hardware for your driver has banked registers (e.g. Winbond sensors 41chips) this module will not work well - although it could be extended to 42support that pretty easily. 43 44Only one chip address is supported - although this module could be 45extended to support more. 46 47If you spam it hard enough, printk can be lossy. This module really wants 48something like relayfs. 49