Skip to contentSkip to conversation

i2c update to 2.6.0 for 2.4.7

PATCH In review J . A . Magallon 5 participants 9 messages Jul 25, 2001

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

PATCH 1/1 i2c update to 2.6.0 for 2.4.7

Hi.

This patch updates i2c support in kernel to 2.6.0. I have corrected original patch to use slab.h instead of malloc.h, a couple #endif's, and Comfigure.help references to other docs in <file:...> format.

It was done on 2.4.6-ac5, but should apply on 2.4.7. Only problem is those document references in <file:.......> format, that are not suitable for plain 2.4.7.

BTW, is there any chance to include lm_sensors also in mainstream kernel ?

TIA

Documentation/i2c/writing-clients +1 -1
@@ -34,5 +34,5 @@
     /* command        */  &foo_command,   /* May be NULL */
     /* inc_use        */  &foo_inc_use,   /* May be NULL */
-    /* dec_use        */  &foo_dev_use    /* May be NULL */
+    /* dec_use        */  &foo_dec_use    /* May be NULL */
   }
  
drivers/i2c/i2c-algo-bit.c +1 -1
@@ -22,5 +22,5 @@
    Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-algo-bit.c,v 1.27 2000/07/09 15:16:16 frodo Exp $ */
+/* $Id: i2c-algo-bit.c,v 1.29 2001/04/03 02:44:02 mds Exp $ */
 
 #include <linux/kernel.h>
drivers/i2c/i2c-algo-pcf.c +150 -213

494 lines not on this page · raw message

drivers/i2c/i2c-core.c +35 -3
@@ -21,5 +21,5 @@
    All SMBus-related things are written by Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-core.c,v 1.58 2000/10/29 22:57:38 frodo Exp $ */
+/* $Id: i2c-core.c,v 1.61 2001/06/05 01:50:31 mds Exp $ */
 
 #include <linux/module.h>
@@ -249,5 +249,5 @@
 			if ((res=client->driver->detach_client(client))) {
 				printk("i2c-core.o: adapter %s not "
-					"unregisted, because client at "
+					"unregistered, because client at "
 					"address %02x can't be detached. ",
 					adap->name, client->addr);
@@ -659,5 +659,5 @@
 	int order[I2C_CLIENT_MAX];
 
-	if (count < 0)
+	if (count > 4000)
 		return -EINVAL; 
 	len_total = file->f_pos + count;
@@ -1278,12 +1278,36 @@
 
 #ifndef MODULE
+#ifdef CONFIG_I2C_CHARDEV
 	extern int i2c_dev_init(void);
+#endif
+#ifdef CONFIG_I2C_ALGOBIT
 	extern int i2c_algo_bit_init(void);
+#endif
+#ifdef CONFIG_I2C_BITLP
 	extern int i2c_bitlp_init(void);
+#endif
+#ifdef CONFIG_I2C_BITELV
 	extern int i2c_bitelv_init(void);
+#endif
+#ifdef CONFIG_I2C_BITVELLE
 	extern int i2c_bitvelle_init(void);
+#endif
+#ifdef CONFIG_I2C_BITVIA
 	extern int i2c_bitvia_init(void);
+#endif
+
+#ifdef CONFIG_I2C_ALGOPCF
 	extern int i2c_algo_pcf_init(void);	
+#endif
+#ifdef CONFIG_I2C_PCFISA
 	extern int i2c_pcfisa_init(void);
+#endif
+
+#ifdef CONFIG_I2C_ALGO8XX
+	extern int i2c_algo_8xx_init(void);
+#endif
+#ifdef CONFIG_I2C_RPXLITE
+	extern int i2c_rpx_init(void);
+#endif
 
 /* This is needed for automatic patch generation: sensors code starts here */
@@ -1318,4 +1342,12 @@
 #ifdef CONFIG_I2C_ELEKTOR
 	i2c_pcfisa_init();
+#endif
+
+	/* --------------------- 8xx -------- */
+#ifdef CONFIG_I2C_ALGO8XX
+	i2c_algo_8xx_init();
+#endif
+#ifdef CONFIG_I2C_RPXLITE
+	i2c_rpx_init();
 #endif
 /* This is needed for automatic patch generation: sensors code starts here */
drivers/i2c/i2c-dev.c +2 -5
@@ -29,5 +29,5 @@
    <[email protected]> */
 
-/* $Id: i2c-dev.c,v 1.36 2000/09/22 02:19:35 mds Exp $ */
+/* $Id: i2c-dev.c,v 1.38 2001/04/27 17:53:04 frodo Exp $ */
 
 #include <linux/config.h>
@@ -242,7 +242,4 @@
 			return -EFAULT;
 
-		if(rdwr_arg.nmsgs > 2048)
-			return -EINVAL;
-			
 		rdwr_pa = (struct i2c_msg *)
 			kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), 
@@ -520,5 +517,5 @@
 			return res;
 		}
-	i2cdev_initialized ++;
+	i2cdev_initialized --;
 	}
 
drivers/i2c/i2c-elektor.c +122 -98

290 lines not on this page · raw message

include/linux/i2c-elektor.h +9 -5
@@ -23,5 +23,5 @@
    Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-elektor.h,v 1.4 2000/01/18 23:54:07 frodo Exp $ */
+/* $Id: i2c-elektor.h,v 1.5 2001/06/05 01:46:33 mds Exp $ */
 
 #ifndef I2C_PCF_ELEKTOR_H
@@ -29,8 +29,12 @@
 
 /*
- * This struct contains the hw-dependent functions of PCF8584 adapters to 
- * manipulate the registers, and to init any hw-specific features. 
- */
+ * This struct contains the hw-dependent functions of PCF8584 adapters to
+ * manipulate the registers, and to init any hw-specific features.
+ * vdovikin: removed: this module in real supports only one device,
+ * due to missing arguments in some functions, called from the algo-pcf module.
+ * Sometimes it's need to be rewriten -
+ * but for now just remove this for simpler reading */
 
+/*
 struct i2c_pcf_isa {
 	int pi_base;
@@ -39,5 +43,5 @@
 	int pi_own;
 };
-
+*/
 
 #endif /* PCF_ELEKTOR_H */
include/linux/i2c-id.h +37 -4

61 lines not on this page · raw message

drivers/i2c/i2c-proc.c +906 -0

906 lines not on this page · raw message

include/linux/i2c-proc.h +396 -0

396 lines not on this page · raw message

include/linux/i2c.h +14 -6
@@ -24,5 +24,5 @@
    Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c.h,v 1.42 2000/09/06 20:14:06 frodo Exp $ */
+/* $Id: i2c.h,v 1.45 2001/04/03 02:43:21 mds Exp $ */
 
 #ifndef I2C_H
@@ -203,5 +203,5 @@
 	unsigned int id;
 
-	/* If a adapter algorithm can't to I2C-level access, set master_xfer
+	/* If an adapter algorithm can't to I2C-level access, set master_xfer
 	   to NULL. If an adapter algorithm can do SMBus access, set 
 	   smbus_xfer. If set to NULL, the SMBus protocol is simulated
@@ -345,5 +345,5 @@
 extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
 
-/* Detect function. It itterates over all possible addresses itself.
+/* Detect function. It iterates over all possible addresses itself.
  * It will only call found_proc if some client is connected at the
  * specific address (unless a 'force' matched);
@@ -361,5 +361,5 @@
 
 /* This call returns a unique low identifier for each registered adapter,
- * or -1 if the adapter was not regisitered. 
+ * or -1 if the adapter was not registered. 
  */
 extern int i2c_adapter_id(struct i2c_adapter *adap);
@@ -455,6 +455,7 @@
  */
 				/* -> bit-adapter specific ioctls	*/
-#define I2C_RETRIES	0x0701	/* number times a device address should	*/
-				/* be polled when not acknowledging 	*/
+#define I2C_RETRIES	0x0701	/* number of times a device address      */
+				/* should be polled when not            */
+                                /* acknowledging 			*/
 #define I2C_TIMEOUT	0x0702	/* set timeout - call with int 		*/
 
@@ -549,4 +550,11 @@
                                         ignore, ignore_range, \
                                         force}
+
+/* Detect whether we are on the isa bus. If this returns true, all i2c
+   access will fail! */
+#define i2c_is_isa_client(clientptr) \
+        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
+#define i2c_is_isa_adapter(adapptr) \
+        ((adapptr)->algo->id == I2C_ALGO_ISA)
 
 #endif /* def __KERNEL__ */
drivers/i2c/Config.in +16 -0
@@ -21,8 +21,24 @@
    fi
 
+   if [ "$CONFIG_8xx" = "y" ]; then
+      dep_tristate 'MPC8xx CPM I2C interface' CONFIG_I2C_ALGO8XX $CONFIG_I2C
+      if [ "$CONFIG_RPXLITE" = "y" -o "$CONFIG_RPXCLASSIC" = "y" ]; then
+         dep_tristate '  Embedded Planet RPX Lite/Classic suppoort' CONFIG_I2C_RPXLITE $CONFIG_I2C_ALGO8XX
+      fi
+   fi
+
+   if [ "$CONFIG_405" = "y" ]; then
+      dep_tristate 'PPC 405 I2C Algorithm' CONFIG_I2C_PPC405_ALGO $CONFIG_I2C
+      if [ "CONFIG_PPC405_I2C_ALGO" != "n" ]; then
+         dep_tristate '  PPC 405 I2C Adapter' CONFIG_I2C_PPC405_ADAP $CONFIG_I2C_PPC405_ALGO
+      fi
+   fi
+
 # This is needed for automatic patch generation: sensors code starts here
 # This is needed for automatic patch generation: sensors code ends here
 
    dep_tristate 'I2C device interface' CONFIG_I2C_CHARDEV $CONFIG_I2C
+
+   dep_tristate 'I2C /proc interface' CONFIG_I2C_PROC $CONFIG_I2C
 
 fi
drivers/i2c/Makefile +2 -1
@@ -5,5 +5,5 @@
 O_TARGET := i2c.o
 
-export-objs	:= i2c-core.o i2c-algo-bit.o i2c-algo-pcf.o
+export-objs	:= i2c-core.o i2c-algo-bit.o i2c-algo-pcf.o i2c-proc.o
 
 obj-$(CONFIG_I2C)		+= i2c-core.o
@@ -15,4 +15,5 @@
 obj-$(CONFIG_I2C_ALGOPCF)	+= i2c-algo-pcf.o
 obj-$(CONFIG_I2C_ELEKTOR)	+= i2c-elektor.o
+obj-$(CONFIG_I2C_PROC)		+= i2c-proc.o
 
 # This is needed for automatic patch generation: sensors code starts here
Documentation/Configure.help +20 -11
@@ -13559,5 +13559,5 @@
   many micro controller applications and developed by Philips. SMBus,
   or System Management Bus is a subset of the I2C protocol. More
-  information is contained in the directory Documentation/i2c/,
+  information is contained in the directory <file:Documentation/i2c/>,
   especially in the file called "summary" there.
 
@@ -13571,9 +13571,9 @@
   specific driver for your bus adapter(s) below. If you say Y to
   "/proc file system" below, you will then get a /proc interface which
-  is documented in Documentation/i2c/proc-interface.
+  is documented in <file:Documentation/i2c/proc-interface>.
 
   This I2C support is also available as a module. If you want to
   compile it as a module, say M here and read
-  Documentation/modules.txt. The module will be called i2c-core.o.
+  <file:Documentation/modules.txt>. The module will be called i2c-core.o.
 
 I2C bit-banging interfaces
@@ -13584,5 +13584,5 @@
 
   This support is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-algo-bit.o.
 
@@ -13593,5 +13593,5 @@
 
   This driver is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-philips-par.o.
 
@@ -13605,5 +13605,5 @@
 
   This driver is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-elv.o.
 
@@ -13614,5 +13614,5 @@
 
   This driver is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-velleman.o.
 
@@ -13624,5 +13624,5 @@
 
   This support is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-algo-pcf.o.
 
@@ -13633,5 +13633,5 @@
 
   This driver is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-elektor.o.
 
@@ -13641,8 +13641,17 @@
   directory on your system. They make it possible to have user-space
   programs use the I2C bus. Information on how to do this is contained
-  in the file Documentation/i2c/dev-interface.
+  in the file <file:Documentation/i2c/dev-interface>.
 
   This code is also available as a module. If you want to compile
-  it as a module, say M here and read Documentation/modules.txt. The
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
+  module will be called i2c-dev.o.
+
+I2C /proc support
+CONFIG_I2C_PROC
+  This provides support for i2c device entries in the /proc filesystem.
+  The entries will be found in /proc/sys/dev/sensors.
+
+  This code is also available as a module. If you want to compile
+  it as a module, say M here and read <file:Documentation/modules.txt>. The
   module will be called i2c-dev.o.
 
Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.1 (Cooker) for i586
Linux werewolf 2.4.7 #1 SMP Mon Jul 23 01:55:36 CEST 2001 i686
#1 lore raw
Quoted 1 line · J . A . Magallon

BTW, is there any chance to include lm_sensors also in mainstream kernel ?

This is something that I would really like to see. I've been using the lm_sensors patch on several kernels on at least two different types of hardware with no problems whatsoever.

If there's no technical reason to keep it out, I think this would be a good candidate for integration.

Signature · 3 lines
-Steven
In a time of universal deceit, telling the truth is a revolutionary act.
			-- George Orwell
#2 lore raw
In reply to J . A . Magallon
Quoted 5 lines · J . A . Magallon

Hi.

This patch updates i2c support in kernel to 2.6.0. I have corrected original patch to use slab.h instead of malloc.h, a couple #endif's, and Comfigure.help references to other docs in <file:...> format.

It appears to be missing new files. The rpx and 405 bits aren't all there.

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
#3 lore raw
In reply to J . A . Magallon
Quoted 9 lines · On 20010725 Tom Rini wrote:
Quoted 5 lines · J . A . Magallon

Hi.

This patch updates i2c support in kernel to 2.6.0. I have corrected original patch to use slab.h instead of malloc.h, a couple #endif's, and Comfigure.help references to other docs in <file:...> format.

It appears to be missing new files. The rpx and 405 bits aren't all there.

Correct, the original patch generator skips them, both in 2.6.0 and latest cvs. Why ?
Will redo the patch...

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.1 (Cooker) for i586
Linux werewolf 2.4.7 #1 SMP Mon Jul 23 01:55:36 CEST 2001 i686
#5 lore raw
In reply to J . A . Magallon
Quoted 2 lines

It was done on 2.4.6-ac5, but should apply on 2.4.7. Only problem is those document references in <file:.......> format, that are not suitable for plain 2.4.7.

I sent Linus the <file: > fixes so they should be in 2.4.7

#6 lore raw
In reply to J . A . Magallon
Quoted 5 lines · On 20010725 Alan Cox wrote:
Quoted 2 lines

It was done on 2.4.6-ac5, but should apply on 2.4.7. Only problem is those document references in <file:.......> format, that are not suitable for plain 2.4.7.

I sent Linus the <file: > fixes so they should be in 2.4.7

In Documentation/Condigure.help in my tree (incrmentally patched without errors since 2.4.0), the only references
to Documentation/* in <file: > shape are in CONFIG_USB_CATC and CONFIG_NTFS_FS. The rest are plain Doc/* refs.

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.1 (Cooker) for i586
Linux werewolf 2.4.7 #1 SMP Mon Jul 23 01:55:36 CEST 2001 i686
#7 lore raw
In reply to J . A . Magallon
Quoted 9 lines · On 20010725 J . A . Magallon wrote:
Quoted 7 lines · On 20010725 Tom Rini wrote:
Quoted 5 lines · J . A . Magallon

Hi.

This patch updates i2c support in kernel to 2.6.0. I have corrected original patch to use slab.h instead of malloc.h, a couple #endif's, and Comfigure.help references to other docs in <file:...> format.

Quoted 7 lines
Quoted 2 lines

It appears to be missing new files. The rpx and 405 bits aren't all there.

Correct, the original patch generator skips them, both in 2.6.0 and latest cvs. Why ?
Will redo the patch...

I have been looking at that part, and seems like pretty half-done, even buggy. Can't you live without it ?

For example, in mkpatch/Config.in:

if [ "$CONFIG_8xx" = "y" ]; then
<well, there is a 8xx cpu variable in arch/ppc>
...
if [ "$CONFIG_405" = "y" ]; then
<I found no _405, should not it be _4xx ?>

      dep_tristate 'PPC 405 I2C Algorithm' CONFIG_I2C_PPC405_ALGO $CONFIG_I2C
                               look at this ^^^^^^^^^^^^^^^^^^^^
      if [ "CONFIG_PPC405_I2C_ALGO" != "n" ]; then
     <vs this ^^^^^^^^^^^^^^^^^^^^ >
         dep_tristate '  PPC 405 I2C Adapter' CONFIG_I2C_PPC405_ADAP $CONFIG_I2C

_PPC405_ALGO

I would not trust that part still.

BTW, I sent the patches about slab/malloc to the mantainer time ago, and cvs still uses malloc.

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.1 (Cooker) for i586
Linux werewolf 2.4.7 #1 SMP Mon Jul 23 01:55:36 CEST 2001 i686
#8 lore raw
In reply to J . A . Magallon
Quoted 14 lines · J . A . Magallon
Quoted 12 lines · On 20010725 J . A . Magallon wrote:
Quoted 9 lines · On 20010725 Tom Rini wrote:
Quoted 5 lines · J . A . Magallon

Hi.

This patch updates i2c support in kernel to 2.6.0. I have corrected original patch to use slab.h instead of malloc.h, a couple #endif's, and Comfigure.help references to other docs in <file:...> format.

It appears to be missing new files. The rpx and 405 bits aren't all there.

Quoted 7 lines
Quoted 4 lines

Correct, the original patch generator skips them, both in 2.6.0 and latest cvs. Why ?
Will redo the patch...

I have been looking at that part, and seems like pretty half-done, even buggy. Can't you live without it ?

The code actually works well, it just depends on other things which aren't yet in Linus' tree but should be soon. There might be typos however.

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/