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

* Re: [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID
  2008-01-24 17:42 [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID override Juerg Haefliger
@ 2008-01-26 16:40 ` Jean Delvare
  2008-01-26 16:54 ` Juerg Haefliger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2008-01-26 16:40 UTC (permalink / raw)
  To: lm-sensors

Hi Juerg,

On Thu, 24 Jan 2008 09:42:52 -0800, Juerg Haefliger wrote:
> 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>

I'm confused. The patch you attached is exactly the same as the one I
sent originally. Did you send the wrong patch by any chance?

-- 
Jean Delvare

_______________________________________________
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

* Re: [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID
  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
  3 siblings, 0 replies; 5+ messages in thread
From: Juerg Haefliger @ 2008-01-26 16:54 UTC (permalink / raw)
  To: lm-sensors

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

Shoot, sorry about that. Attached  is the correct patch.

------
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>




On Jan 26, 2008 8:40 AM, Jean Delvare <khali@linux-fr.org> wrote:
> Hi Juerg,
>
>
> On Thu, 24 Jan 2008 09:42:52 -0800, Juerg Haefliger wrote:
> > 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>
>
> I'm confused. The patch you attached is exactly the same as the one I
> sent originally. Did you send the wrong patch by any chance?
>
> --
> Jean Delvare
>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dme1737-fix-super-io-override.patch --]
[-- Type: text/x-patch; name=dme1737-fix-super-io-override.patch, Size: 537 bytes --]

Index: linux/drivers/hwmon/dme1737.c
===================================================================
--- linux.orig/drivers/hwmon/dme1737.c	2008-01-24 09:32:47.000000000 -0800
+++ linux/drivers/hwmon/dme1737.c	2008-01-24 09:38:59.000000000 -0800
@@ -2023,7 +2023,7 @@
 
 	/* Check device ID
 	 * The DME1737 can return either 0x78 or 0x77 as its device ID. */
-	reg = dme1737_sio_inb(sio_cip, 0x20);
+	reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
 	if (!(reg == 0x77 || reg == 0x78)) {
 		err = -ENODEV;
 		goto exit;

[-- 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

* Re: [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID
  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
  3 siblings, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2008-01-26 17:21 UTC (permalink / raw)
  To: lm-sensors

On Sat, 26 Jan 2008 08:54:24 -0800, Juerg Haefliger wrote:
> Shoot, sorry about that. Attached  is the correct patch.
> 
> ------
> 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>
>
> Index: linux/drivers/hwmon/dme1737.c
> =================================> --- linux.orig/drivers/hwmon/dme1737.c	2008-01-24 09:32:47.000000000 -0800
> +++ linux/drivers/hwmon/dme1737.c	2008-01-24 09:38:59.000000000 -0800
> @@ -2023,7 +2023,7 @@
>  
>  	/* Check device ID
>  	 * The DME1737 can return either 0x78 or 0x77 as its device ID. */
> -	reg = dme1737_sio_inb(sio_cip, 0x20);
> +	reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
>  	if (!(reg = 0x77 || reg = 0x78)) {
>  		err = -ENODEV;
>  		goto exit;

Good catch. I had forgotten the hybrid nature of the dme1737 driver.

Acked-by: Jean Delvare <khali@linux-fr.org>

This could also be merged into my original patch. I'll leave it to Mark
how he wants to handle it.

Thanks,
-- 
Jean Delvare

_______________________________________________
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

* Re: [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device
  2008-01-24 17:42 [lm-sensors] [PATCH] hwmon/dme1737: fix Super-IO device ID override Juerg Haefliger
                   ` (2 preceding siblings ...)
  2008-01-26 17:21 ` Jean Delvare
@ 2008-01-31 13:36 ` Mark M. Hoffman
  3 siblings, 0 replies; 5+ messages in thread
From: Mark M. Hoffman @ 2008-01-31 13:36 UTC (permalink / raw)
  To: lm-sensors

Hi Juerg:

* Juerg Haefliger <juergh@gmail.com> [2008-01-26 08:54:24 -0800]:
> Shoot, sorry about that. Attached  is the correct patch.
> 
> ------
> 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>

Applied to hwmon-2.6.git/testing, thanks.

-- 
Mark M. Hoffman
mhoffman@lightlink.com


_______________________________________________
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.