All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID override
@ 2008-01-24 17:42 Juerg Haefliger
  2008-01-26 16:40 ` [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID Jean Delvare
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Juerg Haefliger @ 2008-01-24 17:42 UTC (permalink / raw)
  To: lm-sensors

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

The dme1737 has a second place where the Super-IO device ID is
checked. This has been missed by Jean's initial patch that adds
support for user-controlled Super-IO device ID override. This patch
fixes this issue.

Signed-off-by: Juerg Haefliger <juergh at gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: let-user-override-super-io-device-id.patch --]
[-- Type: text/x-patch; name=let-user-override-super-io-device-id.patch, Size: 9037 bytes --]

Index: linux/drivers/hwmon/dme1737.c
===================================================================
--- linux.orig/drivers/hwmon/dme1737.c	2008-01-24 09:05:05.000000000 -0800
+++ linux/drivers/hwmon/dme1737.c	2008-01-24 09:32:00.000000000 -0800
@@ -44,6 +44,10 @@
 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 @@
 	/* 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;
Index: linux/drivers/hwmon/f71805f.c
===================================================================
--- linux.orig/drivers/hwmon/f71805f.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/f71805f.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 	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;
Index: linux/drivers/hwmon/f71882fg.c
===================================================================
--- linux.orig/drivers/hwmon/f71882fg.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/f71882fg.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 		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;
Index: linux/drivers/hwmon/it87.c
===================================================================
--- linux.orig/drivers/hwmon/it87.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/it87.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 	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:
Index: linux/drivers/hwmon/pc87360.c
===================================================================
--- linux.orig/drivers/hwmon/pc87360.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/pc87360.c	2008-01-24 09:30:17.000000000 -0800
@@ -59,6 +59,10 @@
  " 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 @@
 	/* 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 */
Index: linux/drivers/hwmon/pc87427.c
===================================================================
--- linux.orig/drivers/hwmon/pc87427.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/pc87427.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 	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;
Index: linux/drivers/hwmon/smsc47b397.c
===================================================================
--- linux.orig/drivers/hwmon/smsc47b397.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/smsc47b397.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 	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();
Index: linux/drivers/hwmon/smsc47m1.c
===================================================================
--- linux.orig/drivers/hwmon/smsc47m1.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/smsc47m1.c	2008-01-24 09:30:17.000000000 -0800
@@ -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 @@
 	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
Index: linux/drivers/hwmon/vt1211.c
===================================================================
--- linux.orig/drivers/hwmon/vt1211.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/vt1211.c	2008-01-24 09:30:17.000000000 -0800
@@ -42,6 +42,10 @@
 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 @@
 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;
 	}
 
Index: linux/drivers/hwmon/w83627ehf.c
===================================================================
--- linux.orig/drivers/hwmon/w83627ehf.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/w83627ehf.c	2008-01-24 09:30:17.000000000 -0800
@@ -59,6 +59,10 @@
 	"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"
 
 /*
@@ -1445,8 +1449,11 @@
 
 	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;
Index: linux/drivers/hwmon/w83627hf.c
===================================================================
--- linux.orig/drivers/hwmon/w83627hf.c	2008-01-24 09:04:24.000000000 -0800
+++ linux/drivers/hwmon/w83627hf.c	2008-01-24 09:30:17.000000000 -0800
@@ -75,6 +75,10 @@
 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 @@
 	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;

[-- Attachment #3: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-31 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24 17:42 [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID override Juerg Haefliger
2008-01-26 16:40 ` [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID Jean Delvare
2008-01-26 16:54 ` Juerg Haefliger
2008-01-26 17:21 ` Jean Delvare
2008-01-31 13:36 ` [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device Mark M. Hoffman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.