Skip to contentSkip to conversation

hwmon: Let the user override the detected

PATCH In review Jean Delvare 2 participants 4 messages Nov 9, 2007 – Dec 9, 2007

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: Let the user override the detected

While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and unintrusive.

---
Updated: s/overrule/override/.

 drivers/hwmon/dme1737.c    |    6 +++++-
 drivers/hwmon/f71805f.c    |    6 +++++-
 drivers/hwmon/f71882fg.c   |    6 +++++-
 drivers/hwmon/it87.c       |    6 +++++-
 drivers/hwmon/pc87360.c    |    6 +++++-
 drivers/hwmon/pc87427.c    |    6 +++++-
 drivers/hwmon/smsc47b397.c |    6 +++++-
 drivers/hwmon/smsc47m1.c   |    6 +++++-
 drivers/hwmon/vt1211.c     |    8 +++++++-
 drivers/hwmon/w83627ehf.c  |   11 +++++++++--
 drivers/hwmon/w83627hf.c   |    6 +++++-
 11 files changed, 61 insertions(+), 12 deletions(-)
drivers/hwmon/dme1737.c +5 -1
@@ -45,6 +45,10 @@ static int force_start;
 module_param(force_start, bool, 0);
 MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
 
@@ -2192,7 +2196,7 @@ static int __init dme1737_isa_detect(int
 	/* Check device ID
 	 * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and
 	 * SCH3116 (0x7f). */
-	reg = dme1737_sio_inb(sio_cip, 0x20);
+	reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
 	if (!(reg = 0x7c || reg = 0x7d || reg = 0x7f)) {
 		err = -ENODEV;
 		goto exit;
drivers/hwmon/f71805f.c +5 -1
@@ -42,6 +42,10 @@
 #include <linux/acpi.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "f71805f"
@@ -1502,7 +1506,7 @@ static int __init f71805f_find(int sioad
 	if (devid != SIO_FINTEK_ID)
 		goto exit;
 
-	devid = superio_inw(sioaddr, SIO_REG_DEVID);
+	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
 	switch (devid) {
 	case SIO_F71805F_ID:
 		sio_data->kind = f71805f;
drivers/hwmon/f71882fg.c +5 -1
@@ -75,6 +75,10 @@
 
 #define FAN_MIN_DETECT			366 /* Lowest detectable fanspeed */
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *f71882fg_pdev = NULL;
 
 /* Super-I/O Function prototypes */
@@ -844,7 +848,7 @@ static int __init f71882fg_find(int sioa
 		goto exit;
 	}
 
-	devid = superio_inw(sioaddr, SIO_REG_DEVID);
+	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
 	if (devid != SIO_F71882_ID) {
 		printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n");
 		goto exit;
drivers/hwmon/it87.c +5 -1
@@ -45,6 +45,10 @@
 
 enum chips { it87, it8712, it8716, it8718 };
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define	REG	0x2e	/* The register to read/write */
@@ -893,7 +897,7 @@ static int __init it87_find(unsigned sho
 	u16 chip_type;
 
 	superio_enter();
-	chip_type = superio_inw(DEVID);
+	chip_type = force_id ? force_id : superio_inw(DEVID);
 
 	switch (chip_type) {
 	case IT8705F_DEVID:
drivers/hwmon/pc87360.c +5 -1
@@ -60,6 +60,10 @@ MODULE_PARM_DESC(init,
  " 2: Forcibly enable all voltage and temperature channels, except in9\n"
  " 3: Forcibly enable all voltage and temperature channels, including in9");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /*
  * Super-I/O registers and operations
  */
@@ -827,7 +831,7 @@ static int __init pc87360_find(int sioad
 	/* No superio_enter */
 
 	/* Identify device */
-	val = superio_inb(sioaddr, DEVID);
+	val = force_id ? force_id : superio_inb(sioaddr, DEVID);
 	switch (val) {
 	case 0xE1: /* PC87360 */
 	case 0xE8: /* PC87363 */
drivers/hwmon/pc87427.c +5 -1
@@ -35,6 +35,10 @@
 #include <linux/acpi.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "pc87427"
@@ -560,7 +564,7 @@ static int __init pc87427_find(int sioad
 	int i, err = 0;
 
 	/* Identify device */
-	val = superio_inb(sioaddr, SIOREG_DEVID);
+	val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID);
 	if (val != 0xf2) {	/* PC87427 */
 		err = -ENODEV;
 		goto exit;
drivers/hwmon/smsc47b397.c +5 -1
@@ -39,6 +39,10 @@
 #include <linux/acpi.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "smsc47b397"
@@ -338,7 +342,7 @@ static int __init smsc47b397_find(unsign
 	u8 id, rev;
 
 	superio_enter();
-	id = superio_inb(SUPERIO_REG_DEVID);
+	id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
 
 	if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) {
 		superio_exit();
drivers/hwmon/smsc47m1.c +5 -1
@@ -40,6 +40,10 @@
 #include <linux/acpi.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "smsc47m1"
@@ -400,7 +404,7 @@ static int __init smsc47m1_find(unsigned
 	u8 val;
 
 	superio_enter();
-	val = superio_inb(SUPERIO_REG_DEVID);
+	val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
 
 	/*
 	 * SMSC LPC47M10x/LPC47M112/LPC47M13x (device id 0x59), LPC47M14x
drivers/hwmon/vt1211.c +7 -1
@@ -43,6 +43,10 @@ static int int_mode = -1;
 module_param(int_mode, int, 0);
 MODULE_PARM_DESC(int_mode, "Force the temperature interrupt mode");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "vt1211"
@@ -1285,10 +1289,12 @@ EXIT:
 static int __init vt1211_find(int sio_cip, unsigned short *address)
 {
 	int err = -ENODEV;
+	int devid;
 
 	superio_enter(sio_cip);
 
-	if (superio_inb(sio_cip, SIO_VT1211_DEVID) != SIO_VT1211_ID) {
+	devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID);
+	if (devid != SIO_VT1211_ID) {
 		goto EXIT;
 	}
 
drivers/hwmon/w83627ehf.c +9 -2
@@ -60,6 +60,10 @@ static const char * w83627ehf_device_nam
 	"w83627dhg",
 };
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 #define DRVNAME "w83627ehf"
 
 /*
@@ -1438,8 +1442,11 @@ static int __init w83627ehf_find(int sio
 
 	superio_enter(sioaddr);
 
-	val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8)
-	    | superio_inb(sioaddr, SIO_REG_DEVID + 1);
+	if (force_id)
+		val = force_id;
+	else
+		val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8)
+		    | superio_inb(sioaddr, SIO_REG_DEVID + 1);
 	switch (val & SIO_ID_MASK) {
 	case SIO_W83627EHF_ID:
 		sio_data->kind = w83627ehf;
drivers/hwmon/w83627hf.c +5 -1
@@ -76,6 +76,10 @@ static int init = 1;
 module_param(init, bool, 0);
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /* modified from kernel/include/traps.c */
 static int REG;		/* The register to read/write */
 #define	DEV	0x07	/* Register: Logical device select */
@@ -1015,7 +1019,7 @@ static int __init w83627hf_find(int sioa
 	VAL = sioaddr + 1;
 
 	superio_enter();
-	val= superio_inb(DEVID);
+	val = force_id ? force_id : superio_inb(DEVID);
 	switch (val) {
 	case W627_DEVID:
 		sio_data->type = w83627hf;
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Hi Jean:

Quoted 22 lines · Jean Delvare

While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and unintrusive.

---
Updated: s/overrule/override/.

Quoted 12 lines
 drivers/hwmon/dme1737.c    |    6 +++++-
 drivers/hwmon/f71805f.c    |    6 +++++-
 drivers/hwmon/f71882fg.c   |    6 +++++-
 drivers/hwmon/it87.c       |    6 +++++-
 drivers/hwmon/pc87360.c    |    6 +++++-
 drivers/hwmon/pc87427.c    |    6 +++++-
 drivers/hwmon/smsc47b397.c |    6 +++++-
 drivers/hwmon/smsc47m1.c   |    6 +++++-
 drivers/hwmon/vt1211.c     |    8 +++++++-
 drivers/hwmon/w83627ehf.c  |   11 +++++++++--
 drivers/hwmon/w83627hf.c   |    6 +++++-
 11 files changed, 61 insertions(+), 12 deletions(-)

Git refuses to apply this patch. Hmmm...

drivers/hwmon/f71805f.c line 42

Quoted 4 lines
drivers/hwmon/f71805f.c +0 -0
@@ -42,6 +42,10 @@
 #include <linux/acpi.h>

That line doesn't appear in any revision git knows about. I guess you based this off of some other development? Could you please respin it?

Quoted 10 lines
drivers/hwmon/f71805f.c +4 -0
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "f71805f"

drivers/hwmon/f71805f.c static int __init f71805f_find(int sioad · line 1512

Quoted 8 lines
drivers/hwmon/f71805f.c +1 -1
@@ -1502,7 +1506,7 @@ static int __init f71805f_find(int sioad
 	if (devid != SIO_FINTEK_ID)
 		goto exit;
 
-	devid = superio_inw(sioaddr, SIO_REG_DEVID);
+	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
 	switch (devid) {
 	case SIO_F71805F_ID:
 		sio_data->kind = f71805f;

Thanks & regards,

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author Acked-by Hans de Goede on v1 1/1
#2 lore raw
In reply to Jean Delvare

Hi Mark,

Quoted 40 lines · Mark M. Hoffman

Hi Jean:

Quoted 22 lines · Jean Delvare

While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and unintrusive.

---
Updated: s/overrule/override/.

Quoted 12 lines
 drivers/hwmon/dme1737.c    |    6 +++++-
 drivers/hwmon/f71805f.c    |    6 +++++-
 drivers/hwmon/f71882fg.c   |    6 +++++-
 drivers/hwmon/it87.c       |    6 +++++-
 drivers/hwmon/pc87360.c    |    6 +++++-
 drivers/hwmon/pc87427.c    |    6 +++++-
 drivers/hwmon/smsc47b397.c |    6 +++++-
 drivers/hwmon/smsc47m1.c   |    6 +++++-
 drivers/hwmon/vt1211.c     |    8 +++++++-
 drivers/hwmon/w83627ehf.c  |   11 +++++++++--
 drivers/hwmon/w83627hf.c   |    6 +++++-
 11 files changed, 61 insertions(+), 12 deletions(-)

Git refuses to apply this patch. Hmmm...

Quoted 7 lines

drivers/hwmon/f71805f.c line 42

Quoted 4 lines
drivers/hwmon/f71805f.c +0 -0
@@ -42,6 +42,10 @@
 #include <linux/acpi.h>

That line doesn't appear in any revision git knows about. I guess you based this off of some other development? Could you please respin it?

Oops, sorry. That line comes from the acpi vs. hwmon conflict checking patch that I have at the bottom of my local stack. I've now moved it at the top so that the patches I send to you will apply properly on top of your own stack. Here's an updated patch:

* * * * *

While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and unintrusive.

---
 drivers/hwmon/dme1737.c    |    6 +++++-
 drivers/hwmon/f71805f.c    |    6 +++++-
 drivers/hwmon/f71882fg.c   |    6 +++++-
 drivers/hwmon/it87.c       |    6 +++++-
 drivers/hwmon/pc87360.c    |    6 +++++-
 drivers/hwmon/pc87427.c    |    6 +++++-
 drivers/hwmon/smsc47b397.c |    6 +++++-
 drivers/hwmon/smsc47m1.c   |    6 +++++-
 drivers/hwmon/vt1211.c     |    8 +++++++-
 drivers/hwmon/w83627ehf.c  |   11 +++++++++--
 drivers/hwmon/w83627hf.c   |    6 +++++-
 11 files changed, 61 insertions(+), 12 deletions(-)
drivers/hwmon/dme1737.c +5 -1
@@ -44,6 +44,10 @@ static int force_start;
 module_param(force_start, bool, 0);
 MODULE_PARM_DESC(force_start, "Force the chip to start monitoring inputs");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
 
@@ -2191,7 +2195,7 @@ static int __init dme1737_isa_detect(int
 	/* Check device ID
 	 * We currently know about SCH3112 (0x7c), SCH3114 (0x7d), and
 	 * SCH3116 (0x7f). */
-	reg = dme1737_sio_inb(sio_cip, 0x20);
+	reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
 	if (!(reg = 0x7c || reg = 0x7d || reg = 0x7f)) {
 		err = -ENODEV;
 		goto exit;
drivers/hwmon/f71805f.c +5 -1
@@ -41,6 +41,10 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "f71805f"
@@ -1497,7 +1501,7 @@ static int __init f71805f_find(int sioad
 	if (devid != SIO_FINTEK_ID)
 		goto exit;
 
-	devid = superio_inw(sioaddr, SIO_REG_DEVID);
+	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
 	switch (devid) {
 	case SIO_F71805F_ID:
 		sio_data->kind = f71805f;
drivers/hwmon/f71882fg.c +5 -1
@@ -74,6 +74,10 @@
 
 #define FAN_MIN_DETECT			366 /* Lowest detectable fanspeed */
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *f71882fg_pdev = NULL;
 
 /* Super-I/O Function prototypes */
@@ -843,7 +847,7 @@ static int __init f71882fg_find(int sioa
 		goto exit;
 	}
 
-	devid = superio_inw(sioaddr, SIO_REG_DEVID);
+	devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
 	if (devid != SIO_F71882_ID) {
 		printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n");
 		goto exit;
drivers/hwmon/it87.c +5 -1
@@ -44,6 +44,10 @@
 
 enum chips { it87, it8712, it8716, it8718 };
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define	REG	0x2e	/* The register to read/write */
@@ -892,7 +896,7 @@ static int __init it87_find(unsigned sho
 	u16 chip_type;
 
 	superio_enter();
-	chip_type = superio_inw(DEVID);
+	chip_type = force_id ? force_id : superio_inw(DEVID);
 
 	switch (chip_type) {
 	case IT8705F_DEVID:
drivers/hwmon/pc87360.c +5 -1
@@ -59,6 +59,10 @@ MODULE_PARM_DESC(init,
  " 2: Forcibly enable all voltage and temperature channels, except in9\n"
  " 3: Forcibly enable all voltage and temperature channels, including in9");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /*
  * Super-I/O registers and operations
  */
@@ -826,7 +830,7 @@ static int __init pc87360_find(int sioad
 	/* No superio_enter */
 
 	/* Identify device */
-	val = superio_inb(sioaddr, DEVID);
+	val = force_id ? force_id : superio_inb(sioaddr, DEVID);
 	switch (val) {
 	case 0xE1: /* PC87360 */
 	case 0xE8: /* PC87363 */
drivers/hwmon/pc87427.c +5 -1
@@ -34,6 +34,10 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "pc87427"
@@ -555,7 +559,7 @@ static int __init pc87427_find(int sioad
 	int i, err = 0;
 
 	/* Identify device */
-	val = superio_inb(sioaddr, SIOREG_DEVID);
+	val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID);
 	if (val != 0xf2) {	/* PC87427 */
 		err = -ENODEV;
 		goto exit;
drivers/hwmon/smsc47b397.c +5 -1
@@ -38,6 +38,10 @@
 #include <linux/mutex.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "smsc47b397"
@@ -333,7 +337,7 @@ static int __init smsc47b397_find(unsign
 	u8 id, rev;
 
 	superio_enter();
-	id = superio_inb(SUPERIO_REG_DEVID);
+	id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
 
 	if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) {
 		superio_exit();
drivers/hwmon/smsc47m1.c +5 -1
@@ -39,6 +39,10 @@
 #include <linux/sysfs.h>
 #include <asm/io.h>
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "smsc47m1"
@@ -399,7 +403,7 @@ static int __init smsc47m1_find(unsigned
 	u8 val;
 
 	superio_enter();
-	val = superio_inb(SUPERIO_REG_DEVID);
+	val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
 
 	/*
 	 * SMSC LPC47M10x/LPC47M112/LPC47M13x (device id 0x59), LPC47M14x
drivers/hwmon/vt1211.c +7 -1
@@ -42,6 +42,10 @@ static int int_mode = -1;
 module_param(int_mode, int, 0);
 MODULE_PARM_DESC(int_mode, "Force the temperature interrupt mode");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 static struct platform_device *pdev;
 
 #define DRVNAME "vt1211"
@@ -1280,10 +1284,12 @@ EXIT:
 static int __init vt1211_find(int sio_cip, unsigned short *address)
 {
 	int err = -ENODEV;
+	int devid;
 
 	superio_enter(sio_cip);
 
-	if (superio_inb(sio_cip, SIO_VT1211_DEVID) != SIO_VT1211_ID) {
+	devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID);
+	if (devid != SIO_VT1211_ID) {
 		goto EXIT;
 	}
 
drivers/hwmon/w83627ehf.c +9 -2
@@ -59,6 +59,10 @@ static const char * w83627ehf_device_nam
 	"w83627dhg",
 };
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 #define DRVNAME "w83627ehf"
 
 /*
@@ -1437,8 +1441,11 @@ static int __init w83627ehf_find(int sio
 
 	superio_enter(sioaddr);
 
-	val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8)
-	    | superio_inb(sioaddr, SIO_REG_DEVID + 1);
+	if (force_id)
+		val = force_id;
+	else
+		val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8)
+		    | superio_inb(sioaddr, SIO_REG_DEVID + 1);
 	switch (val & SIO_ID_MASK) {
 	case SIO_W83627EHF_ID:
 		sio_data->kind = w83627ehf;
drivers/hwmon/w83627hf.c +5 -1
@@ -75,6 +75,10 @@ static int init = 1;
 module_param(init, bool, 0);
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
 
+static unsigned short force_id;
+module_param(force_id, ushort, 0);
+MODULE_PARM_DESC(force_id, "Override the detected device ID");
+
 /* modified from kernel/include/traps.c */
 static int REG;		/* The register to read/write */
 #define	DEV	0x07	/* Register: Logical device select */
@@ -1014,7 +1018,7 @@ static int __init w83627hf_find(int sioa
 	VAL = sioaddr + 1;
 
 	superio_enter();
-	val= superio_inb(DEVID);
+	val = force_id ? force_id : superio_inb(DEVID);
 	switch (val) {
 	case W627_DEVID:
 		sio_data->type = w83627hf;
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Jean Delvare

Hi Jean:

Quoted 26 lines · Jean Delvare

Oops, sorry. That line comes from the acpi vs. hwmon conflict checking patch that I have at the bottom of my local stack. I've now moved it at the top so that the patches I send to you will apply properly on top of your own stack. Here's an updated patch:

* * * * *

While it is possible to force SMBus-based hardware monitoring chip drivers to drive a not officially supported device, we do not have this possibility for Super-I/O-based drivers. That's unfortunate because sometimes newer chips are fully compatible and just forcing the driver to load would work. Instead of that we have to tell the users to recompile the kernel driver, which isn't an easy task for everyone.

So, I propose that we add a module parameter to all Super-I/O based hardware monitoring drivers, letting advanced users force the driver to load on their machine. The user has to provide the device ID of a supposedly compatible device. This requires looking at the source code or a datasheet, so I am confident that users can't randomly force a driver without knowing what they are doing. Thus this should be relatively safe.

As you can see from the code, the implementation is pretty simple and unintrusive.

Quoted 13 lines
---
 drivers/hwmon/dme1737.c    |    6 +++++-
 drivers/hwmon/f71805f.c    |    6 +++++-
 drivers/hwmon/f71882fg.c   |    6 +++++-
 drivers/hwmon/it87.c       |    6 +++++-
 drivers/hwmon/pc87360.c    |    6 +++++-
 drivers/hwmon/pc87427.c    |    6 +++++-
 drivers/hwmon/smsc47b397.c |    6 +++++-
 drivers/hwmon/smsc47m1.c   |    6 +++++-
 drivers/hwmon/vt1211.c     |    8 +++++++-
 drivers/hwmon/w83627ehf.c  |   11 +++++++++--
 drivers/hwmon/w83627hf.c   |    6 +++++-
 11 files changed, 61 insertions(+), 12 deletions(-)

This is a really nice idea. Applied to hwmon-2.6.git/testing, thanks.

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors