From adff687d8cb0ed62b147a7e1d277846b3130d593 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 21 May 2010 18:40:54 +0200 Subject: i2c-i801: Let the user disable selected driver features Let the user disable selected features normally supported by the device. This makes it possible to work around possible driver or hardware bugs if the feature in question doesn't work as intended for whatever reason. Signed-off-by: Jean Delvare Cc: Felix Rubinstein --- drivers/i2c/busses/i2c-i801.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'drivers/i2c') diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 299b918455a3..f0fef343e19b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -138,6 +138,17 @@ static struct pci_dev *I801_dev; #define FEATURE_I2C_BLOCK_READ (1 << 3) static unsigned int i801_features; +static const char *i801_feature_names[] = { + "SMBus PEC", + "Block buffer", + "Block process call", + "I2C block read", +}; + +static unsigned int disable_features; +module_param(disable_features, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(disable_features, "Disable selected driver features"); + /* Make sure the SMBus host is ready to start transmitting. Return 0 if it is, -EBUSY if it is not. */ static int i801_check_pre(void) @@ -692,7 +703,7 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) { unsigned char temp; - int err; + int err, i; #if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE const char *vendor; #endif @@ -720,6 +731,14 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id break; } + /* Disable features on user request */ + for (i = 0; i < ARRAY_SIZE(i801_feature_names); i++) { + if (i801_features & disable_features & (1 << i)) + dev_notice(&dev->dev, "%s disabled by user\n", + i801_feature_names[i]); + } + i801_features &= ~disable_features; + err = pci_enable_device(dev); if (err) { dev_err(&dev->dev, "Failed to enable SMBus PCI device (%d)\n", -- cgit v1.2.3