Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172372
b: refs/heads/master
c: 38f41f2
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare committed Dec 6, 2009
1 parent 7d88d19 commit 5e7d913
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4710317891e4824ce1510a6b5066abbd3e917750
refs/heads/master: 38f41f282f1f88b4038f019de51cb95984e569d5
6 changes: 6 additions & 0 deletions trunk/Documentation/i2c/i2c-stub
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ PARAMETERS:
int chip_addr[10]:
The SMBus addresses to emulate chips at.

unsigned long functionality:
Functionality override, to disable some commands. See I2C_FUNC_*
constants in <linux/i2c.h> for the suitable values. For example,
value 0x1f0000 would only enable the quick, byte and byte data
commands.

CAVEATS:

If your target driver polls some byte or word waiting for it to change, the
Expand Down
8 changes: 6 additions & 2 deletions trunk/drivers/i2c/busses/i2c-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ module_param_array(chip_addr, ushort, NULL, S_IRUGO);
MODULE_PARM_DESC(chip_addr,
"Chip addresses (up to 10, between 0x03 and 0x77)");

static unsigned long functionality = ~0UL;
module_param(functionality, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(functionality, "Override functionality bitfield");

struct stub_chip {
u8 pointer;
u16 words[256]; /* Byte operations use the LSB as per SMBus
Expand Down Expand Up @@ -152,9 +156,9 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,

static u32 stub_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK;
I2C_FUNC_SMBUS_I2C_BLOCK) & functionality;
}

static const struct i2c_algorithm smbus_algorithm = {
Expand Down

0 comments on commit 5e7d913

Please sign in to comment.