Skip to contentSkip to conversation

i2c-amd766 driver for 2.5.50

PATCH Pavel Machek 1 participant 1 message Dec 1, 2002

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

Hi!

This brings amd766 driver along with adm1021 and lm75 to 2.5.50. Does it look mergeable? If so, please apply,

Pavel

MAINTAINERS +9 -0
@@ -750,6 +750,15 @@
 W:	http://www.tk.uni-linz.ac.at/~simon/private/i2c
 S:	Maintained
 
+SENSORS DRIVERS
+P:      Frodo Looijaard
+M:      [email protected]
+P:      Philip Edelbrock
+M:      [email protected]
+L:      [email protected]
+W:      http://www.lm-sensors.nu/
+S:      Maintained
+
 i386 BOOT CODE
 P:	Riley H. Williams
 M:	[email protected]
drivers/Makefile +2 -0
@@ -39,6 +39,8 @@
 obj-$(CONFIG_SERIO)		+= input/serio/
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
+obj-$(CONFIG_I2C_MAINBOARD)	+= i2c/busses/
+obj-$(CONFIG_SENSORS)		+= i2c/chips/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/
drivers/char/mem.c +13 -0
@@ -27,6 +27,12 @@
 #include <asm/io.h>
 #include <asm/pgalloc.h>
 
+#ifdef CONFIG_I2C_MAINBOARD
+extern void i2c_mainboard_init_all(void);
+#endif
+#ifdef CONFIG_SENSORS
+extern void sensors_init_all(void);
+#endif
 #ifdef CONFIG_I2C
 extern int i2c_init_all(void);
 #endif
@@ -683,6 +689,9 @@
 #ifdef CONFIG_I2C
 	i2c_init_all();
 #endif
+#ifdef CONFIG_I2C_MAINBOARD
+	i2c_mainboard_init_all();
+#endif
 #if defined (CONFIG_FB)
 	fbmem_init();
 #endif
@@ -703,6 +712,10 @@
 #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR)
 	tapechar_init();
 #endif
+#ifdef CONFIG_SENSORS
+	sensors_init_all();
+#endif
+
 	return 0;
 }
 
drivers/i2c/Kconfig +3 -0
@@ -193,5 +193,8 @@
 	  it as a module, say M here and read <file:Documentation/modules.txt>.
 	  The module will be called i2c-proc.o.
 
+	source drivers/i2c/busses/Kconfig
+	source drivers/i2c/chips/Kconfig
+
 endmenu
 
drivers/i2c/busses/Kconfig +39 -0
@@ -0,0 +1,39 @@
+#
+# Sensor device configuration
+# All depend on EXPERIMENTAL, I2C and I2C_PROC.
+#
+
+menu "I2C Hardware Sensors Mainboard support"
+
+config I2C_MAINBOARD
+	bool "Hardware sensors mainboard support"
+	depends on EXPERIMENTAL && I2C && I2C_PROC
+	help
+	  Many modern mainboards have some kind of I2C interface integrated. This
+	  is often in the form of a SMBus, or System Management Bus, which is
+	  basically the same as I2C but which uses only a subset of the I2C
+	  protocol.
+
+	  You will also want the latest user-space utilties: you can find them
+	  in the lm_sensors package, which you can download at 
+	  http://www.lm-sensors.nu
+
+config I2C_AMD756
+	tristate "  AMD 756/766"
+	depends on I2C_MAINBOARD
+	help
+	  If you say yes to this option, support will be included for the AMD
+	  756/766/768 mainboard I2C interfaces.
+
+	  This can also be built as a module which can be inserted and removed 
+	  while the kernel is running.  If you want to compile it as a module,
+	  say M here and read <file:Documentation/modules.txt>.
+
+	  The module will be called i2c-amd756.o.
+
+	  You will also need the latest user-space utilties: you can find them
+	  in the lm_sensors package, which you can download at 
+	  http://www.lm-sensors.nu
+
+endmenu
+
drivers/i2c/busses/Makefile +10 -0
@@ -0,0 +1,10 @@
+#
+# Makefile for the kernel hardware sensors bus drivers.
+#
+
+MOD_LIST_NAME := SENSORS_BUS_MODULES
+
+obj-$(CONFIG_I2C_MAINBOARD)	+= i2c-mainboard.o
+obj-$(CONFIG_I2C_AMD756)	+= i2c-amd756.o
+
+include $(TOPDIR)/Rules.make
drivers/i2c/busses/i2c-amd756.c +536 -0

536 lines not on this page · raw message

drivers/i2c/busses/i2c-mainboard.c +34 -0
@@ -0,0 +1,34 @@
+/*
+    i2c-mainboard.c - Part of lm_sensors, Linux kernel modules for hardware
+                monitoring
+    Copyright (c) 1998, 1999  Frodo Looijaard <[email protected]> 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* Not configurable as a module */
+
+#include <linux/init.h>
+
+extern int i2c_amd756_init(void);
+
+int __init i2c_mainboard_init_all(void)
+{
+#ifdef CONFIG_I2C_AMD756
+	i2c_amd756_init();
+#endif
+
+	return 0;
+}
drivers/i2c/chips/Kconfig +54 -0

54 lines not on this page · raw message

drivers/i2c/chips/Makefile +11 -0
@@ -0,0 +1,11 @@
+#
+# Makefile for the kernel hardware sensors chip drivers.
+#
+
+MOD_LIST_NAME := SENSORS_CHIPS_MODULES
+
+obj-$(CONFIG_SENSORS)		+= sensors.o
+obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021.o
+obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
+
+include $(TOPDIR)/Rules.make
drivers/i2c/chips/adm1021.c +646 -0

646 lines not on this page · raw message

drivers/i2c/chips/lm75.c +416 -0

416 lines not on this page · raw message

drivers/i2c/chips/sensors.c +37 -0
@@ -0,0 +1,37 @@
+/*
+    sensors.c - Part of lm_sensors, Linux kernel modules for hardware
+                monitoring
+    Copyright (c) 1998, 1999  Frodo Looijaard <[email protected]> 
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* Not configurable as a module */
+
+#include <linux/init.h>
+
+extern int sensors_adm1021_init(void);
+extern int sensors_lm75_init(void);
+
+int __init sensors_init_all(void)
+{
+#ifdef CONFIG_SENSORS_ADM1021
+	sensors_adm1021_init();
+#endif
+#ifdef CONFIG_SENSORS_LM75
+	sensors_lm75_init();
+#endif
+	return 0;
+}
drivers/i2c/i2c-core.c +10 -8
@@ -21,7 +21,7 @@
    All SMBus-related things are written by Frodo Looijaard <[email protected]>
    SMBus 2.0 support by Mark Studebaker <[email protected]>                */
 
-/* $Id: i2c-core.c,v 1.86 2002/09/12 06:47:26 ac9410 Exp $ */
+/* $Id: i2c-core.c,v 1.89 2002/11/03 16:47:16 mds Exp $ */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -77,7 +77,8 @@
 
 #ifdef CONFIG_PROC_FS
 
-static int i2cproc_init(void);
+int __init i2cproc_init(void);
+void __exit i2cproc_exit(void);
 static int i2cproc_cleanup(void);
 
 static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 
@@ -622,7 +623,8 @@
 	struct inode * inode = file->f_dentry->d_inode;
 	char *kbuf;
 	struct i2c_client *client;
-	int i,j,k,order_nr,len=0,len_total;
+	int i,j,k,order_nr,len=0;
+	size_t len_total;
 	int order[I2C_CLIENT_MAX];
 #define OUTPUT_LENGTH_PER_LINE 70
 
@@ -1331,15 +1333,15 @@
 		if (read_write == I2C_SMBUS_READ) {
 			msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX;
 		} else {
-			msg[0].len = data->block[0] + 2;
-			if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 2) {
+			msg[0].len = data->block[0] + 1;
+			if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) {
 				printk("i2c-core.o: i2c_smbus_xfer_emulated called with "
 				       "invalid block write size (%d)\n",
 				       data->block[0]);
 				return -1;
 			}
-			for (i = 0; i < data->block[0]; i++)
-				msgbuf0[i] = data->block[i+1];
+			for (i = 1; i <= data->block[0]; i++)
+				msgbuf0[i] = data->block[i];
 		}
 		break;
 	default:
@@ -1455,7 +1457,7 @@
 	return 0;
 }
 
-static void __exit i2c_exit(void)
+void __exit i2c_exit(void)
 {
 	i2cproc_cleanup();
 }
drivers/i2c/i2c-dev.c +14 -4
@@ -28,7 +28,7 @@
 /* The devfs code is contributed by Philipp Matthias Hahn 
    <[email protected]> */
 
-/* $Id: i2c-dev.c,v 1.46 2002/07/06 02:07:39 mds Exp $ */
+/* $Id: i2c-dev.c,v 1.48 2002/10/01 14:10:04 ac9410 Exp $ */
 
 #include <linux/config.h>
 #include <linux/kernel.h>
@@ -50,6 +50,10 @@
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 
+int __init i2c_dev_init(void);
+void __exit i2c_dev_exit(void);
+static int dev_cleanup(void);
+
 /* struct file_operations changed too often in the 2.1 series for nice code */
 
 static ssize_t i2cdev_read (struct file *file, char *buf, size_t count, 
@@ -445,7 +449,7 @@
 	return -1;
 }
 
-static void i2cdev_cleanup(void)
+static int dev_cleanup(void)
 {
 	int res;
 
@@ -467,6 +471,7 @@
 		}
 		i2cdev_initialized --;
 	}
+	return 0;
 }
 
 int __init i2c_dev_init(void)
@@ -488,13 +493,18 @@
 
 	if ((res = i2c_add_driver(&i2cdev_driver))) {
 		printk(KERN_ERR "i2c-dev.o: Driver registration failed, module not inserted.\n");
-		i2cdev_cleanup();
+		dev_cleanup();
 		return res;
 	}
 	i2cdev_initialized ++;
 	return 0;
 }
 
+void __exit i2c_dev_exit(void)
+{
+	dev_cleanup();
+}
+
 EXPORT_NO_SYMBOLS;
 
 MODULE_AUTHOR("Frodo Looijaard <[email protected]> and Simon G. Vogl <[email protected]>");
@@ -502,4 +512,4 @@
 MODULE_LICENSE("GPL");
 
 module_init(i2c_dev_init);
-module_exit(i2cdev_cleanup);
+module_exit(i2c_dev_exit);
drivers/i2c/i2c-proc.c +58 -2

98 lines not on this page · raw message

include/linux/i2c-proc.h +25 -0
@@ -348,6 +348,31 @@
                                                  {NULL}}; \
   SENSORS_INSMOD
 
+#define SENSORS_INSMOD_8(chip1,chip2,chip3,chip4,chip5,chip6,chip7,chip8) \
+  enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8 }; \
+  SENSORS_MODULE_PARM(force, \
+                      "List of adapter,address pairs to boldly assume " \
+                      "to be present"); \
+  SENSORS_MODULE_PARM_FORCE(chip1); \
+  SENSORS_MODULE_PARM_FORCE(chip2); \
+  SENSORS_MODULE_PARM_FORCE(chip3); \
+  SENSORS_MODULE_PARM_FORCE(chip4); \
+  SENSORS_MODULE_PARM_FORCE(chip5); \
+  SENSORS_MODULE_PARM_FORCE(chip6); \
+  SENSORS_MODULE_PARM_FORCE(chip7); \
+  SENSORS_MODULE_PARM_FORCE(chip8); \
+  static struct i2c_force_data forces[] = {{force,any_chip}, \
+                                                 {force_ ## chip1,chip1}, \
+                                                 {force_ ## chip2,chip2}, \
+                                                 {force_ ## chip3,chip3}, \
+                                                 {force_ ## chip4,chip4}, \
+                                                 {force_ ## chip5,chip5}, \
+                                                 {force_ ## chip6,chip6}, \
+                                                 {force_ ## chip7,chip7}, \
+                                                 {force_ ## chip8,chip8}, \
+                                                 {NULL}}; \
+  SENSORS_INSMOD
+
 typedef int i2c_found_addr_proc(struct i2c_adapter *adapter,
 				    int addr, unsigned short flags,
 				    int kind);
include/linux/sensors.h +690 -0

690 lines not on this page · raw message

Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?