aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-06 11:06:29 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-06 11:06:29 -0500
commit38f41f282f1f88b4038f019de51cb95984e569d5 (patch)
treed885feffa6639bfb8824c4e7a68135ceed436fe4 /drivers/i2c
parent4710317891e4824ce1510a6b5066abbd3e917750 (diff)
i2c-stub: Allow user to disable some commands
Add a module parameter to override the functionality bitfield. This lets the user disable some commands. This can be used to force a chip driver to take different code paths. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-stub.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c
index 52ebeda1a64b..0c770eabe85e 100644
--- a/drivers/i2c/busses/i2c-stub.c
+++ b/drivers/i2c/busses/i2c-stub.c
@@ -35,6 +35,10 @@ module_param_array(chip_addr, ushort, NULL, S_IRUGO);
35MODULE_PARM_DESC(chip_addr, 35MODULE_PARM_DESC(chip_addr,
36 "Chip addresses (up to 10, between 0x03 and 0x77)"); 36 "Chip addresses (up to 10, between 0x03 and 0x77)");
37 37
38static unsigned long functionality = ~0UL;
39module_param(functionality, ulong, S_IRUGO | S_IWUSR);
40MODULE_PARM_DESC(functionality, "Override functionality bitfield");
41
38struct stub_chip { 42struct stub_chip {
39 u8 pointer; 43 u8 pointer;
40 u16 words[256]; /* Byte operations use the LSB as per SMBus 44 u16 words[256]; /* Byte operations use the LSB as per SMBus
@@ -152,9 +156,9 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
152 156
153static u32 stub_func(struct i2c_adapter *adapter) 157static u32 stub_func(struct i2c_adapter *adapter)
154{ 158{
155 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 159 return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
156 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | 160 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
157 I2C_FUNC_SMBUS_I2C_BLOCK; 161 I2C_FUNC_SMBUS_I2C_BLOCK) & functionality;
158} 162}
159 163
160static const struct i2c_algorithm smbus_algorithm = { 164static const struct i2c_algorithm smbus_algorithm = {