Re: [PATCH v4] i5k_amb: New memory temperature sensor driver

Previous thread: Re: [GIT PULL] FireWire updates post 2.6.23 by Stefan Richter on Tuesday, October 16, 2007 - 3:40 pm. (2 messages)

Next thread: [PATCH] i5000_edac: No need to __stringify() KBUILD_BASENAME by Darrick J. Wong on Tuesday, October 16, 2007 - 4:10 pm. (1 message)
From: Darrick J. Wong
Date: Tuesday, October 16, 2007 - 4:06 pm

New driver to read FB-DIMM temperature sensors on systems with the
Intel 5000 series chipsets.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 drivers/hwmon/Kconfig   |   10 +
 drivers/hwmon/Makefile  |    1 
 drivers/hwmon/i5k_amb.c |  548 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h |    3 
 4 files changed, 562 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index b8854b9..c2acb37 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -215,6 +215,16 @@ config SENSORS_DS1621
 	  This driver can also be built as a module.  If so, the module
 	  will be called ds1621.
 
+config SENSORS_I5K_AMB
+	tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"
+	depends on PCI && EXPERIMENTAL
+	help
+	  If you say yes here you get support for FB-DIMM AMB temperature
+	  monitoring chips on systems with the Intel 5000 series chipset.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called i5k_amb.
+
 config SENSORS_F71805F
 	tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
 	depends on EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 2f592e2..914c48c 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
 obj-$(CONFIG_SENSORS_HDAPS)	+= hdaps.o
+obj-$(CONFIG_SENSORS_I5K_AMB)	+= i5k_amb.o
 obj-$(CONFIG_SENSORS_IBMPEX)	+= ibmpex.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_K8TEMP)	+= k8temp.o
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
new file mode 100644
index 0000000..3bde717
--- /dev/null
+++ b/drivers/hwmon/i5k_amb.c
@@ -0,0 +1,548 @@
+/*
+ * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB
+ * temperature sensors
+ * Copyright (C) 2007 IBM
+ *
+ * Author: Darrick J. Wong ...
From: Mark M. Hoffman
Date: Thursday, October 18, 2007 - 6:15 am

Hi:

Just a couple more things...



You're counting set bits the hard way.

		/* ignore the high-order bit, see "Ugly hack" comment above */





diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 3bde717..65ecc56 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -400,25 +400,12 @@ out:
 	return res;
 }
 
-static int __devinit i5k_channel_probe(struct i5k_amb_data *data, int which)
+static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
 {
 	struct pci_dev *pcidev;
-	unsigned long dev_id;
 	u16 val16;
 	int res = -ENODEV;
 
-	/* Two memory channels per FBD PCI device */
-	switch (which) {
-	case 0:
-		dev_id = PCI_DEVICE_ID_INTEL_5000_FBD0;
-		break;
-	case 1:
-		dev_id = PCI_DEVICE_ID_INTEL_5000_FBD1;
-		break;
-	default:
-		return -EINVAL;
-	}
-
 	/* Copy the DIMM presence map for these two channels */
 	pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
 	if (!pcidev)
@@ -426,11 +413,11 @@ static int __devinit i5k_channel_probe(struct i5k_amb_data *data, int which)
 
 	if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16))
 		goto out;
-	data->amb_present[which * 2] = val16;
+	amb_present[0] = val16;
 
 	if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16))
 		goto out;
-	data->amb_present[which * 2 + 1] = val16;
+	amb_present[1] = val16;
 
 	res = 0;
 
@@ -455,12 +442,14 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
 		goto err;
 
 	/* Copy the DIMM presence map for the first two channels */
-	res = i5k_channel_probe(data, 0);
+	res = i5k_channel_probe(&data->amb_present[0],
+			PCI_DEVICE_ID_INTEL_5000_FBD0);
 	if (res)
 		goto err;
 
 	/* Copy the DIMM presence map for the optional second two channels */
-	i5k_channel_probe(data, 1);
+	i5k_channel_probe(&data->amb_present[2], 
+			PCI_DEVICE_ID_INTEL_5000_FBD1);
 
 	/* Set up resource regions */
 	reso = request_mem_region(data->amb_base, data->amb_len, ...
From: Darrick J. Wong
Date: Thursday, October 18, 2007 - 1:22 pm

New driver to read FB-DIMM temperature sensors on systems with the
Intel 5000 series chipsets.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---

 drivers/hwmon/Kconfig   |   10 +
 drivers/hwmon/Makefile  |    1 
 drivers/hwmon/i5k_amb.c |  531 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h |    3 
 4 files changed, 545 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index b8854b9..c2acb37 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -215,6 +215,16 @@ config SENSORS_DS1621
 	  This driver can also be built as a module.  If so, the module
 	  will be called ds1621.
 
+config SENSORS_I5K_AMB
+	tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"
+	depends on PCI && EXPERIMENTAL
+	help
+	  If you say yes here you get support for FB-DIMM AMB temperature
+	  monitoring chips on systems with the Intel 5000 series chipset.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called i5k_amb.
+
 config SENSORS_F71805F
 	tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
 	depends on EXPERIMENTAL
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 2f592e2..914c48c 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
 obj-$(CONFIG_SENSORS_HDAPS)	+= hdaps.o
+obj-$(CONFIG_SENSORS_I5K_AMB)	+= i5k_amb.o
 obj-$(CONFIG_SENSORS_IBMPEX)	+= ibmpex.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_K8TEMP)	+= k8temp.o
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
new file mode 100644
index 0000000..7fdbe81
--- /dev/null
+++ b/drivers/hwmon/i5k_amb.c
@@ -0,0 +1,531 @@
+/*
+ * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB
+ * temperature sensors
+ * Copyright (C) 2007 IBM
+ *
+ * Author: Darrick J. Wong ...
From: Mark M. Hoffman
Date: Tuesday, October 23, 2007 - 4:03 am

Hi Darrick:


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

-- 
Mark M. Hoffman
mhoffman@lightlink.com

-

Previous thread: Re: [GIT PULL] FireWire updates post 2.6.23 by Stefan Richter on Tuesday, October 16, 2007 - 3:40 pm. (2 messages)

Next thread: [PATCH] i5000_edac: No need to __stringify() KBUILD_BASENAME by Darrick J. Wong on Tuesday, October 16, 2007 - 4:10 pm. (1 message)