Skip to contentSkip to conversation

i2c driver fixes for 2.6.1

PATCH New Greg KH 2 participants 38 messages Jan 20, 2004 – Jan 31, 2004

Subsystems (8)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 i2c driver fixes for 2.6.1

Hi,

Here are some i2c driver fixes and updates for 2.6.1. There are a number of bug fixes here, and a few new drivers have been added to the tree.

Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.6

Individual patches will follow, sent to the sensors and linux-kernel lists.

thanks,

greg k-h

 Documentation/i2c/porting-clients      |    5 
 drivers/Kconfig                        |    2 
 drivers/char/Kconfig                   |    2 
 drivers/i2c/Kconfig                    |   32 
 drivers/i2c/algos/Kconfig              |    1 
 drivers/i2c/algos/i2c-algo-pcf.h       |    2 
 drivers/i2c/busses/Kconfig             |  101 ++-
 drivers/i2c/busses/Makefile            |    2 
 drivers/i2c/busses/i2c-ali1535.c       |    5 
 drivers/i2c/busses/i2c-ali15x3.c       |    5 
 drivers/i2c/busses/i2c-amd756.c        |    5 
 drivers/i2c/busses/i2c-amd8111.c       |    5 
 drivers/i2c/busses/i2c-elektor.c       |   19 
 drivers/i2c/busses/i2c-elv.c           |   17 
 drivers/i2c/busses/i2c-frodo.c         |    5 
 drivers/i2c/busses/i2c-i801.c          |    5 
 drivers/i2c/busses/i2c-i810.c          |    5 
 drivers/i2c/busses/i2c-ibm_iic.c       |    8 
 drivers/i2c/busses/i2c-iop3xx.c        |    9 
 drivers/i2c/busses/i2c-isa.c           |    5 
 drivers/i2c/busses/i2c-ite.c           |   24 
 drivers/i2c/busses/i2c-keywest.c       |   36 -
 drivers/i2c/busses/i2c-nforce2.c       |    5 
 drivers/i2c/busses/i2c-parport-light.c |  179 +++++
 drivers/i2c/busses/i2c-parport.c       |  273 ++++++++
 drivers/i2c/busses/i2c-parport.h       |   87 ++
 drivers/i2c/busses/i2c-philips-par.c   |    9 
 drivers/i2c/busses/i2c-piix4.c         |   12 
 drivers/i2c/busses/i2c-prosavage.c     |    5 
 drivers/i2c/busses/i2c-rpx.c           |    9 
 drivers/i2c/busses/i2c-savage4.c       |    5 
 drivers/i2c/busses/i2c-sis5595.c       |   10 
 drivers/i2c/busses/i2c-sis630.c        |    5 
 drivers/i2c/busses/i2c-sis96x.c        |    5 
 drivers/i2c/busses/i2c-velleman.c      |   14 
 drivers/i2c/busses/i2c-via.c           |    7 
 drivers/i2c/busses/i2c-viapro.c        |    5 
 drivers/i2c/busses/i2c-voodoo3.c       |    5 
 drivers/i2c/busses/scx200_acb.c        |   15 
 drivers/i2c/busses/scx200_i2c.c        |   10 
 drivers/i2c/chips/Kconfig              |   36 +
 drivers/i2c/chips/Makefile             |    7 
 drivers/i2c/chips/adm1021.c            |    5 
 drivers/i2c/chips/asb100.c             | 1059 ++++++++++++++++++++++++++++++++-
 drivers/i2c/chips/eeprom.c             |   67 +-
 drivers/i2c/chips/it87.c               |   13 
 drivers/i2c/chips/lm75.c               |    5 
 drivers/i2c/chips/lm78.c               |    7 
 drivers/i2c/chips/lm83.c               |    7 
 drivers/i2c/chips/lm85.c               |    5 
 drivers/i2c/chips/lm90.c               |  529 ++++++++++++++++
 drivers/i2c/chips/via686a.c            |    5 
 drivers/i2c/chips/w83781d.c            |   37 -
 drivers/i2c/chips/w83l785ts.c          |  314 +++++++++
 drivers/i2c/i2c-core.c                 |  114 +--
 drivers/i2c/i2c-dev.c                  |   10 
 drivers/i2c/i2c-sensor.c               |    5 
 drivers/ieee1394/Kconfig               |    9 
 drivers/media/video/Kconfig            |   13 
 drivers/media/video/saa7146.h          |    1 
 drivers/video/Kconfig                  |   21 
 include/linux/i2c-id.h                 |    3 
 62 files changed, 2966 insertions(+), 266 deletions(-)

-----

<ebs:ebshome.net>:
o I2C: IBM IIC compile fix

Greg Kroah-Hartman:
o I2C: remove unneeded CVS Id: lines
o I2C: add I2C_DEBUG_BUS config option and convert the i2c bus drivers to use it
o I2C: add I2C_DEBUG_CHIP config option and convert the i2c chip drivers to use it
o I2C: add I2C_DEBUG_CORE config option and convert the i2c core code to use it
o I2C: only select I2C_ITE if we are a MIPS system
o I2C: remove CONFIG_ISA dependancy for I2C_ISA as x86_64 does not have CONFIG_ISA
o I2C: move the Kconfig "source..." out of the drivers/char/ location

Jean Delvare:
o I2C: Autoselect i2c algos
o I2C: New driver: w83l785ts
o I2C: Fix i2c busses warnings with DEBUG
o I2C: Fix i2c-core.c with DEBUG
o I2C: Fix lm90.c with DEBUG
o I2C: speed up eeprom driver by a factor of 4
o I2C: i2c-i801 help
o I2C: clean up ISA dependancies
o I2C: restore correct vaio handling in eeprom driver
o I2C: Fix debug bug in lm83 driver
o I2C: Fix w83781d temp
o I2C: New chip driver: lm90
o I2C: New parport bus drivers
o I2C: i2c-rpx.c doesn't need ioports.h nor parport.h
o I2C: Typo in i2c/busses/Kconfig
o I2C: saa7146.h doesn't need i2c.h
o I2C: documentation update

Mark M. Hoffman:
o I2C: link asb100 in the proper order
o I2C: Add ported sensor chip driver: asb100

Matthew Wilcox:
o I2C: Kconfig cleanups

Tom Rini:
o I2C: module_parm fixes for i2c-piix4.c

author
#1 lore raw

PATCH 1/1 i2c driver fixes for 2.6.1

ChangeSet 1.1474.98.1, 2004/01/14 11:08:59-08:00, [email protected]

[PATCH] I2C: module_parm fixes for i2c-piix4.c

 drivers/i2c/busses/i2c-piix4.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-piix4.c +4 -3
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
@@ -31,6 +31,7 @@
 /* #define DEBUG 1 */
 
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/config.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
@@ -88,13 +89,13 @@
 /* If force is set to anything different from 0, we forcibly enable the
    PIIX4. DANGEROUS! */
 static int force = 0;
-MODULE_PARM(force, "i");
+module_param (force, int, 0);
 MODULE_PARM_DESC(force, "Forcibly enable the PIIX4. DANGEROUS!");
 
 /* If force_addr is set to anything different from 0, we forcibly enable
    the PIIX4 at the given address. VERY DANGEROUS! */
 static int force_addr = 0;
-MODULE_PARM(force_addr, "i");
+module_param (force_addr, int, 0);
 MODULE_PARM_DESC(force_addr,
 		 "Forcibly enable the PIIX4 at the given address. "
 		 "EXTREMELY DANGEROUS!");
@@ -102,7 +103,7 @@
 /* If fix_hstcfg is set to anything different from 0, we reset one of the
    registers to be a valid value. */
 static int fix_hstcfg = 0;
-MODULE_PARM(fix_hstcfg, "i");
+module_param (fix_hstcfg, int, 0);
 MODULE_PARM_DESC(fix_hstcfg,
 		"Fix config register. Needed on some boards (Force CPCI735).");
 
author
#2 lore raw

ChangeSet 1.1474.98.2, 2004/01/14 11:09:15-08:00, [email protected]

[PATCH] I2C: documentation update

Quoted 9 lines
Quoted 4 lines

They should be converted. From module.h:

	/* DEPRECATED: Do not use. */
	#define MODULE_PARM(var,type) 	\
	...

Note that realistically, it's not going away in 2.6, so mass migration doesn't really win anything. However, I never implemented mixing old and new style in the same module, so if you're adding a parameter, it makes sense to convert them all.

OK, I don't have much time for a mass conversion anyway. Greg, could you please apply the following patch to the "porting-clients" document so that at least the new drivers don't need to be converted afterwards?

 Documentation/i2c/porting-clients |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)
Documentation/i2c/porting-clients +4 -1
diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
@@ -92,7 +92,10 @@
   i2c_get_clientdata(client) instead.
 
 * [Interface] Init function should not print anything. Make sure
-  there is a MODULE_LICENSE() line.
+  there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
+  by module_param(). Note that module_param has a third parameter,
+  that you should set to 0 by default. See include/linux/moduleparam.h
+  for details.
 
 Coding policy:
 
author
#3 lore raw

ChangeSet 1.1474.98.3, 2004/01/14 11:10:53-08:00, [email protected]

[PATCH] I2C: Add ported sensor chip driver: asb100

This patch adds support for the ASB100 Bach sensor chip, which is found on some Asus mainboards. The port corresponds to lm_sensors CVS revision 1.5. The patch applies to and was tested against 2.6.1-rc1.

 drivers/i2c/chips/Kconfig  |   11 
 drivers/i2c/chips/Makefile |    1 
 drivers/i2c/chips/asb100.c | 1053 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c-id.h     |    1 
 4 files changed, 1066 insertions(+)
drivers/i2c/chips/Kconfig +11 -0
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -21,6 +21,17 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called adm1021.
 
+config SENSORS_ASB100
+	tristate "Asus ASB100 Bach"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the ASB100 Bach sensor
+	  chip found on some Asus mainboards.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called asb100.
+
 config SENSORS_EEPROM
 	tristate "EEPROM (DIMM) reader"
 	depends on I2C && EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
@@ -6,6 +6,7 @@
 obj-$(CONFIG_SENSORS_W83781D)	+= w83781d.o
 
 obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021.o
+obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
 obj-$(CONFIG_SENSORS_EEPROM)	+= eeprom.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
drivers/i2c/chips/asb100.c new file +1053 -0

1,053 lines not on this page · raw message

include/linux/i2c-id.h +1 -0
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
@@ -154,6 +154,7 @@
 #define I2C_DRIVERID_W83627HF 1038
 #define I2C_DRIVERID_LM85 1039
 #define I2C_DRIVERID_LM83 1040
+#define I2C_DRIVERID_ASB100 1043
 
 /*
  * ---- Adapter types ----------------------------------------------------
author
#4 lore raw

ChangeSet 1.1474.98.4, 2004/01/14 11:11:06-08:00, [email protected]

[PATCH] I2C: link asb100 in the proper order

Quoted 4 lines · Jean Delvare

Shouldn't the asb100 be listed first, the same way the w83781d is, since it has subclients? I would even put asb100 before w83781d, since for now the w83781d driver will try to handle ASB100 chips too, thus preventing the asb100 driver from being used if both drivers are built-in.

You're right, thanks

* * * * *

This patch fixes the link order for asb100 sensors chip driver.

 drivers/i2c/chips/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/chips/Makefile +2 -2
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
@@ -2,11 +2,11 @@
 # Makefile for the kernel hardware sensors chip drivers.
 #
 
-# w83781d goes first, as it can override other driver's addresses.
+# asb100, then w83781d go first, as they can override other drivers' addresses.
+obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
 obj-$(CONFIG_SENSORS_W83781D)	+= w83781d.o
 
 obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021.o
-obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
 obj-$(CONFIG_SENSORS_EEPROM)	+= eeprom.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
author
#5 lore raw

ChangeSet 1.1474.98.5, 2004/01/14 11:12:07-08:00, [email protected]

[PATCH] I2C: IBM IIC compile fix

please apply this trivial one-liner. It fixes compilation of IBM IIC driver.

 drivers/i2c/busses/i2c-ibm_iic.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-ibm_iic.c +1 -1
diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -601,7 +601,7 @@
 	
 	/* Register it with i2c layer */
 	adap = &dev->adap;
-	strcpy(adap->dev.name, "IBM IIC");
+	strcpy(adap->name, "IBM IIC");
 	i2c_set_adapdata(adap, dev);
 	adap->id = I2C_HW_OCP | iic_algo.id;
 	adap->algo = &iic_algo;
author
#6 lore raw

ChangeSet 1.1474.98.6, 2004/01/14 11:13:34-08:00, [email protected]

[PATCH] I2C: saa7146.h doesn't need i2c.h

 drivers/media/video/saa7146.h |    1 -
 1 files changed, 1 deletion(-)
drivers/media/video/saa7146.h +0 -1
diff -Nru a/drivers/media/video/saa7146.h b/drivers/media/video/saa7146.h
@@ -25,7 +25,6 @@
 #include <linux/types.h>
 #include <linux/wait.h>
 
-#include <linux/i2c.h>
 #include <linux/videodev.h>
 
 #ifndef O_NONCAP  
author
#7 lore raw

ChangeSet 1.1474.98.7, 2004/01/14 11:19:14-08:00, [email protected]

[PATCH] I2C: Typo in i2c/busses/Kconfig

Another simple patch for your collection. BTW I don't think that i2c-rpx can be used in 2.6 since it relies on an algorithm that hasn't been ported yet.

 drivers/i2c/busses/Kconfig |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +1 -1
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -187,7 +187,7 @@
 	  will be called i2c-prosavage.
 
 config I2C_RPXLITE
-	tristate "Embedded Planet RPX Lite/Classic suppoort"
+	tristate "Embedded Planet RPX Lite/Classic support"
 	depends on (RPXLITE || RPXCLASSIC) && I2C_ALGO8XX
 
 config I2C_SAVAGE4
author
#8 lore raw

ChangeSet 1.1474.98.8, 2004/01/14 11:19:29-08:00, [email protected]

[PATCH] I2C: i2c-rpx.c doesn't need ioports.h nor parport.h

One more simple patch... These headers are useless as far as I can see.

 drivers/i2c/busses/i2c-rpx.c |    2 --
 1 files changed, 2 deletions(-)
drivers/i2c/busses/i2c-rpx.c +0 -2
diff -Nru a/drivers/i2c/busses/i2c-rpx.c b/drivers/i2c/busses/i2c-rpx.c
@@ -12,11 +12,9 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/stddef.h>
-#include <linux/parport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-8xx.h>
 #include <asm/mpc8xx.h>
author
#9 lore raw

ChangeSet 1.1474.98.9, 2004/01/14 11:23:34-08:00, [email protected]

[PATCH] I2C: New parport bus drivers

These are replacements for the i2c-philips-par, i2c-elv and i2c-velleman drivers, as well as for the i2c-old i2c-parport driver as found under drivers/media/video in linux 2.4. My reason for writing them, as already discussed on the sensors and linux-kernel mailing-lists, is that all these drivers basically do the same thing, so I thought it would be easier to maintain a single driver instead of four. As Simon Vogl pointed out that using a direct I/O access (as done in i2c-elv and i2c-velleman) could be prefered over clean parport access (as done in i2c-philips-par) on embedded devices, I finally wrote two drivers instead of one. But both drivers support all devices, it's just a matter of how they are accessed (and wether the driver depends on the parport driver).

I made it so that the definition of the adapters (i.e. how to set and get SDA and SCL, basically) is completely separated from the code itself. Thus, adding support for a new adapter is simply adding a new set of data to the definition table, describing how the adapter works, in a single file.

This means that all simple parallel port adapters are virtually supported. The i2c-pport driver we have in i2c CVS isn't supported yet because it works a bit differently, but I believe that extending the current driver(s) to support it should be possible (although it can be discussed wether it's worth it).

You'll have to pass the type parameter that is correct for your board:
0 = Philips
2 = Velleman
3 = ELV
4 = ADM evaluation board

I could only test with my ADM eval board, and it worked OK with both drivers. If they are confirmed to work, we could get rid of all other parallel port i2c drivers in 2.6.
***

I think we should mark the i2c-philips-par, i2c-elv and i2c-velleman drivers as "deprecated" in i2c/busses/Kconfig. Is there a standard way to do so (like there is "&& EXPERIMENTAL" for new drivers)?

Thanks.

 drivers/i2c/busses/Kconfig             |   43 +++++
 drivers/i2c/busses/Makefile            |    2 
 drivers/i2c/busses/i2c-parport-light.c |  174 +++++++++++++++++++++
 drivers/i2c/busses/i2c-parport.c       |  266 +++++++++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-parport.h       |   87 ++++++++++
 5 files changed, 572 insertions(+)
drivers/i2c/busses/Kconfig +43 -0
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -155,6 +155,49 @@
 	  This support is also available as a module.  If so, the module 
 	  will be called i2c-philips-par.
 
+config I2C_PARPORT
+	tristate "Parallel port adapter"
+	depends on I2C_ALGOBIT && PARPORT
+	help
+	  This supports parallel port I2C adapters such as the ones made by
+	  Philips or Velleman, Analog Devices evaluation boards, and more.
+	  Basically any adapter using the parallel port as an I2C bus with
+	  no extra chipset is supported by this driver, or could be.
+
+	  This driver is a replacement for (and was inspired by) an older
+	  driver named i2c-philips-par.  The new driver supports more devices,
+	  and makes it easier to add support for new devices.
+	  
+	  Another driver exists, named i2c-parport-light, which doesn't depend
+	  on the parport driver.  This is meant for embedded systems. Don't say
+	  Y here if you intend to say Y or M there.
+
+	  This support is also available as a module.  If so, the module 
+	  will be called i2c-parport.
+
+config I2C_PARPORT_LIGHT
+	tristate "Parallel port adapter (light)"
+	depends on I2C_ALGOBIT 
+	help
+	  This supports parallel port I2C adapters such as the ones made by
+	  Philips or Velleman, Analog Devices evaluation boards, and more.
+	  Basically any adapter using the parallel port as an I2C bus with
+	  no extra chipset is supported by this driver, or could be.
+
+	  This driver is a light version of i2c-parport.  It doesn't depend
+	  on the parport driver, and uses direct I/O access instead.  This
+	  might be prefered on embedded systems where wasting memory for
+	  the clean but heavy parport handling is not an option.  The
+	  drawback is a reduced portability and the impossibility to
+	  dasiy-chain other parallel port devices.
+	  
+	  Don't say Y here if you said Y or M to i2c-parport.  Saying M to
+	  both is possible but both modules should not be loaded at the same
+	  time.
+
+	  This support is also available as a module.  If so, the module 
+	  will be called i2c-parport-light.
+
 config I2C_PIIX4
 	tristate "Intel PIIX4"
 	depends on I2C && PCI && EXPERIMENTAL && !64BIT
drivers/i2c/busses/Makefile +2 -0
diff -Nru a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
@@ -17,6 +17,8 @@
 obj-$(CONFIG_I2C_KEYWEST)	+= i2c-keywest.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
 obj-$(CONFIG_I2C_PHILIPSPAR)	+= i2c-philips-par.o
+obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
+obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
 obj-$(CONFIG_I2C_PIIX4)		+= i2c-piix4.o
 obj-$(CONFIG_I2C_PROSAVAGE)	+= i2c-prosavage.o
 obj-$(CONFIG_I2C_RPXLITE)	+= i2c-rpx.o
drivers/i2c/busses/i2c-parport-light.c new file +174 -0

174 lines not on this page · raw message

drivers/i2c/busses/i2c-parport.c new file +266 -0

266 lines not on this page · raw message

drivers/i2c/busses/i2c-parport.h new file +87 -0

87 lines not on this page · raw message

author
#10 lore raw

ChangeSet 1.1474.98.10, 2004/01/14 11:27:32-08:00, [email protected]

[PATCH] I2C: New chip driver: lm90

This is my LM90/ADM1032 i2c chip driver ported to Linux 2.6

 drivers/i2c/chips/Kconfig  |   11 
 drivers/i2c/chips/Makefile |    1 
 drivers/i2c/chips/lm90.c   |  520 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c-id.h     |    1 
 4 files changed, 533 insertions(+)
drivers/i2c/chips/Kconfig +11 -0
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -101,6 +101,17 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called lm85.
 
+config SENSORS_LM90
+	tristate "National Semiconductor LM90 and compatibles"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM90
+	  and Analog Devices ADM1032 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm90.
+
 config SENSORS_VIA686A
 	tristate "VIA686A"
 	depends on I2C && EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
@@ -13,4 +13,5 @@
 obj-$(CONFIG_SENSORS_LM78)	+= lm78.o
 obj-$(CONFIG_SENSORS_LM83)	+= lm83.o
 obj-$(CONFIG_SENSORS_LM85)	+= lm85.o
+obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
drivers/i2c/chips/lm90.c new file +520 -0

520 lines not on this page · raw message

include/linux/i2c-id.h +1 -0
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
@@ -154,6 +154,7 @@
 #define I2C_DRIVERID_W83627HF 1038
 #define I2C_DRIVERID_LM85 1039
 #define I2C_DRIVERID_LM83 1040
+#define I2C_DRIVERID_LM90 1042
 #define I2C_DRIVERID_ASB100 1043
 
 /*
author
#11 lore raw

ChangeSet 1.1474.98.11, 2004/01/14 11:27:58-08:00, [email protected]

[PATCH] I2C: Fix w83781d temp

This patch fixes the temperature handling in the w83781d driver:
1* Fix bad magnitude.
2* Use MMH's lm75.h.
3* Allow negative temperatures.

 drivers/i2c/chips/w83781d.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)
drivers/i2c/chips/w83781d.c +14 -16
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
@@ -43,6 +43,7 @@
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <asm/io.h>
+#include "lm75.h"
 
 /* RT Table support #defined so we can take it out if it gets bothersome */
 #define W83781D_RT			1
@@ -170,17 +171,14 @@
 					((val) == 255 ? 0 : \
 							1350000 / ((val) * (div))))
 
-#define TEMP_TO_REG(val)		(SENSORS_LIMIT(((val / 10) < 0 ? (((val / 10) - 5) / 10) : \
-									 ((val / 10) + 5) / 10), 0, 255))
-#define TEMP_FROM_REG(val)		((((val ) > 0x80 ? (val) - 0x100 : (val)) * 10) * 10)
-
-#define TEMP_ADD_TO_REG(val)		(SENSORS_LIMIT(((((val / 10) + 2) / 5) << 7),\
-                                              0, 0xffff))
-#define TEMP_ADD_FROM_REG(val)		((((val) >> 7) * 5) * 10)
-
-#define AS99127_TEMP_ADD_TO_REG(val)	(SENSORS_LIMIT((((((val / 10) + 2)*4)/10) \
-                                               << 7), 0, 0xffff))
-#define AS99127_TEMP_ADD_FROM_REG(val)	(((((val) >> 7) * 10) / 4) * 10)
+#define TEMP_TO_REG(val)		(SENSORS_LIMIT(((val) < 0 ? (val)+0x100*1000 \
+						: (val)) / 1000, 0, 0xff))
+#define TEMP_FROM_REG(val)		(((val) & 0x80 ? (val)-0x100 : (val)) * 1000)
+
+#define AS99127_TEMP_ADD_TO_REG(val)	(SENSORS_LIMIT((((val) < 0 ? (val)+0x10000*250 \
+						: (val)) / 250) << 7, 0, 0xffff))
+#define AS99127_TEMP_ADD_FROM_REG(val)	((((val) & 0x8000 ? (val)-0x10000 : (val)) \
+						>> 7) * 250)
 
 #define ALARMS_FROM_REG(val)		(val)
 #define PWM_FROM_REG(val)		(val)
@@ -437,8 +435,8 @@
 			return sprintf(buf,"%ld\n", \
 				(long)AS99127_TEMP_ADD_FROM_REG(data->reg##_add[nr-2])); \
 		} else { \
-			return sprintf(buf,"%ld\n", \
-				(long)TEMP_ADD_FROM_REG(data->reg##_add[nr-2])); \
+			return sprintf(buf,"%d\n", \
+				LM75_TEMP_FROM_REG(data->reg##_add[nr-2])); \
 		} \
 	} else {	/* TEMP1 */ \
 		return sprintf(buf,"%ld\n", (long)TEMP_FROM_REG(data->reg)); \
@@ -453,15 +451,15 @@
 { \
 	struct i2c_client *client = to_i2c_client(dev); \
 	struct w83781d_data *data = i2c_get_clientdata(client); \
-	u32 val; \
+	s32 val; \
 	 \
-	val = simple_strtoul(buf, NULL, 10); \
+	val = simple_strtol(buf, NULL, 10); \
 	 \
 	if (nr >= 2) {	/* TEMP2 and TEMP3 */ \
 		if (data->type == as99127f) \
 			data->temp_##reg##_add[nr-2] = AS99127_TEMP_ADD_TO_REG(val); \
 		else \
-			data->temp_##reg##_add[nr-2] = TEMP_ADD_TO_REG(val); \
+			data->temp_##reg##_add[nr-2] = LM75_TEMP_TO_REG(val); \
 		 \
 		w83781d_write_value(client, W83781D_REG_TEMP_##REG(nr), \
 				data->temp_##reg##_add[nr-2]); \
author
#12 lore raw

ChangeSet 1.1474.98.12, 2004/01/14 11:44:33-08:00, [email protected]

[PATCH] I2C: Fix debug bug in lm83 driver

The following patch fixes lm83 failing to compile if DEBUG is set.

 drivers/i2c/chips/lm83.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/chips/lm83.c +1 -1
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
@@ -270,7 +270,7 @@
 		    & 0x48) != 0x00) ||
 		    ((i2c_smbus_read_byte_data(new_client, LM83_REG_R_CONFIG)
 		    & 0x41) != 0x00)) {
-			dev_dbg(&client->dev,
+			dev_dbg(&adapter->dev,
 			    "LM83 detection failed at 0x%02x.\n", address);
 			goto exit_free;
 		}
author
#13 lore raw

ChangeSet 1.1474.98.13, 2004/01/14 11:52:05-08:00, [email protected]

[PATCH] I2C: Kconfig cleanups

This patch attempts to reduce the number of inappropriate questions being asked by menuconfig.

 drivers/i2c/Kconfig        |    6 +++---
 drivers/i2c/algos/Kconfig  |    1 +
 drivers/i2c/busses/Kconfig |    1 +
 drivers/i2c/chips/Kconfig  |    1 +
 4 files changed, 6 insertions(+), 3 deletions(-)
drivers/i2c/Kconfig +3 -3
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
@@ -37,9 +37,9 @@
 	  This support is also available as a module.  If so, the module 
 	  will be called i2c-dev.
 
-	source drivers/i2c/algos/Kconfig
-	source drivers/i2c/busses/Kconfig
-	source drivers/i2c/chips/Kconfig
+source drivers/i2c/algos/Kconfig
+source drivers/i2c/busses/Kconfig
+source drivers/i2c/chips/Kconfig
 
 endmenu
 
drivers/i2c/algos/Kconfig +1 -0
diff -Nru a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
@@ -3,6 +3,7 @@
 #
 
 menu "I2C Algorithms"
+	depends on I2C
 
 config I2C_ALGOBIT
 	tristate "I2C bit-banging interfaces"
drivers/i2c/busses/Kconfig +1 -0
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -3,6 +3,7 @@
 #
 
 menu "I2C Hardware Bus support"
+	depends on I2C
 
 config I2C_ALI1535
 	tristate "ALI 1535"
drivers/i2c/chips/Kconfig +1 -0
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -3,6 +3,7 @@
 #
 
 menu "I2C Hardware Sensors Chip support"
+	depends on I2C
 
 config I2C_SENSOR
 	tristate
author
#14 lore raw

ChangeSet 1.1474.98.14, 2004/01/15 10:34:52-08:00, [email protected]

[PATCH] I2C: move the Kconfig "source..." out of the drivers/char/ location

 drivers/Kconfig      |    2 ++
 drivers/char/Kconfig |    2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/Kconfig +2 -0
diff -Nru a/drivers/Kconfig b/drivers/Kconfig
@@ -38,6 +38,8 @@
 
 source "drivers/char/Kconfig"
 
+source "drivers/i2c/Kconfig"
+
 # source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"
drivers/char/Kconfig +0 -2
diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig
@@ -588,8 +588,6 @@
 	bool "Support for console on line printer"
 	depends on PC9800_OLDLP
 
-source "drivers/i2c/Kconfig"
-
 
 menu "Mice"
 
author
#15 lore raw

ChangeSet 1.1474.98.15, 2004/01/15 16:05:33-08:00, [email protected]

[PATCH] I2C: remove CONFIG_ISA dependancy for I2C_ISA as x86_64 does not have CONFIG_ISA

 drivers/i2c/busses/Kconfig |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +1 -1
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -108,7 +108,7 @@
 
 config I2C_ISA
 	tristate "ISA Bus support"
-	depends on I2C && ISA && EXPERIMENTAL
+	depends on I2C && EXPERIMENTAL
 	help
 	  If you say yes to this option, support will be included for i2c
 	  interfaces that are on the ISA bus.
author
#16 lore raw

ChangeSet 1.1474.98.16, 2004/01/15 17:28:54-08:00, [email protected]

[PATCH] I2C: restore correct vaio handling in eeprom driver

Here is a patch to the eeprom driver in 2.6.1 that changes the way Vaio eeproms are handled. In 2.6.1, the eeprom is readable only by root, which isn't consistent with the 2.4 driver which simple hides (i.e. fills it with zeroes) the first row (16 bytes) of the eeprom to regular users.

The patch restores a similar behaviour in the 2.6 driver.

 drivers/i2c/chips/eeprom.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
drivers/i2c/chips/eeprom.c +14 -13
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -62,6 +63,7 @@
 	char valid;			/* !=0 if following fields are valid */
 	unsigned long last_updated;	/* In jiffies */
 	u8 data[EEPROM_SIZE];		/* Register values */
+	enum eeprom_nature nature;
 };
 
 
@@ -127,7 +129,16 @@
 	if (off + count > EEPROM_SIZE)
 		count = EEPROM_SIZE - off;
 
-	memcpy(buf, &data->data[off], count);
+	/* Hide Vaio security settings to regular users (16 first bytes) */
+	if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
+		int in_row1 = 16 - off;
+		memset(buf, 0, in_row1);
+		if (count - in_row1 > 0)
+			memcpy(buf + in_row1, &data->data[16], count - in_row1);
+	} else {
+		memcpy(buf, &data->data[off], count);
+	}
+
 	return count;
 }
 
@@ -151,7 +162,6 @@
 	int i, cs;
 	struct i2c_client *new_client;
 	struct eeprom_data *data;
-	enum eeprom_nature nature = UNKNOWN;
 	int err = 0;
 
 	/* Make sure we aren't probing the ISA bus!! This is just a safety check
@@ -199,6 +209,7 @@
 			goto exit_kfree;
 	}
 
+	data->nature = UNKNOWN;
 	/* Detect the Vaio nature of EEPROMs.
 	   We use the "PCG-" prefix as the signature. */
 	if (address == 0x57) {
@@ -206,17 +217,7 @@
 		    i2c_smbus_read_byte_data(new_client, 0x81) == 'C' && 
 		    i2c_smbus_read_byte_data(new_client, 0x82) == 'G' &&
 		    i2c_smbus_read_byte_data(new_client, 0x83) == '-')
-			nature = VAIO;
-	}
-
-	/* If this is a VIAO, then we only allow root to read from this file,
-	   as BIOS passwords can be present here in plaintext */
-	switch (nature) {
- 	case VAIO:
-		eeprom_attr.attr.mode = S_IRUSR;
-		break;
-	default:
-		eeprom_attr.attr.mode = S_IRUGO;
+			data->nature = VAIO;
 	}
 
 	/* Fill in the remaining client fields */
author
#17 lore raw

ChangeSet 1.1474.98.17, 2004/01/16 14:12:27-08:00, [email protected]

[PATCH] I2C: clean up ISA dependancies

Quoting myself:

Quoted 5 lines

1* Elektor depends on ISA.
2* ELV and Velleman do not depend on ISA.
3* i2c-isa is M by default, and has an additional help text 4* via686a autoselects i2c-isa
5* i2c-isa doesn't depend on ISA

Here's the patch:

 drivers/i2c/busses/Kconfig |    6 +++---
 drivers/i2c/chips/Kconfig  |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/Kconfig +3 -3
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -49,7 +49,7 @@
 
 config I2C_ELEKTOR
 	tristate "Elektor ISA card"
-	depends on I2C_ALGOPCF && BROKEN_ON_SMP
+	depends on I2C_ALGOPCF && ISA && BROKEN_ON_SMP
 	help
 	  This supports the PCF8584 ISA bus I2C adapter.  Say Y if you own
 	  such an adapter.
@@ -59,7 +59,7 @@
 
 config I2C_ELV
 	tristate "ELV adapter"
-	depends on I2C_ALGOBIT && ISA
+	depends on I2C_ALGOBIT
 	help
 	  This supports parallel-port I2C adapters called ELV.  Say Y if you
 	  own such an adapter.
@@ -321,7 +321,7 @@
 
 config I2C_VELLEMAN
 	tristate "Velleman K8000 adapter"
-	depends on I2C_ALGOBIT && ISA
+	depends on I2C_ALGOBIT
 	help
 	  This supports the Velleman K8000 parallel-port I2C adapter.  Say Y
 	  if you own such an adapter.
drivers/i2c/chips/Kconfig +1 -0
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -117,6 +117,7 @@
 	tristate "VIA686A"
 	depends on I2C && EXPERIMENTAL
 	select I2C_SENSOR
+	select I2C_ISA
 	help
 	  If you say yes here you get support for the integrated sensors in
 	  Via 686A/B South Bridges.
author
#18 lore raw

ChangeSet 1.1474.98.18, 2004/01/16 14:12:54-08:00, [email protected]

[PATCH] I2C: i2c-i801 help

 drivers/i2c/busses/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +2 -1
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -73,12 +73,13 @@
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  801 family of mainboard I2C interfaces.  Specifically, the following
-	  versions of the chipset is supported:
+	  versions of the chipset are supported:
 	    82801AA
 	    82801AB
 	    82801BA
 	    82801CA/CAM
 	    82801DB
+	    82801EB
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-i801.
author
#19 lore raw

ChangeSet 1.1474.98.19, 2004/01/16 14:13:08-08:00, [email protected]

[PATCH] I2C: speed up eeprom driver by a factor of 4

Basically, I divide the eeprom in 8 32-byte slices. Each of it has a "valid" boolean (combined together into a bitfield) and a jiffies counter. Eeprom_update_client() is added a new parameter to specify which slice to update. Code updated accordingly. Finally, the read function updates only slices that need to be. The code is heavily inspired from what was done in the CVS driver, of course.

Three additional notes:

1* This fixes a bug in eeprom_update_client()'s refresh condition. We used to check jiffies before valid, although jiffies are not defined if valid isn't true. That was already fixed in our CVS driver but for some reason the fix did not go into 2.6 yet.

2* This also skips the update if the read if out of bounds. I think this is the thing to do.

3* It can be discussed wether eeprom_update_client() should take two slice parameters instead of one (start slice, end slice). This would make things slightly faster when consecutive slices are requested. Maybe the code would even be clearer. It wasn't done so far because the CVS driver wouldn't benefit from it (because the EEPROM's contents are split over several "output" files in that version of the driver) but I'll probably give it a try in 2.6.

 drivers/i2c/chips/eeprom.c |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)
drivers/i2c/chips/eeprom.c +22 -13
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
@@ -6,6 +6,11 @@
     Copyright (C) 2003 Greg Kroah-Hartman <[email protected]>
     Copyright (C) 2003 IBM Corp.
 
+    2004-01-16  Jean Delvare <[email protected]>
+    Divide the eeprom in 32-byte (arbitrary) slices. This significantly
+    speeds sensors up, as well as various scripts using the eeprom
+    module.
+
     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
@@ -60,8 +65,8 @@
 /* Each client has this additional data */
 struct eeprom_data {
 	struct semaphore update_lock;
-	char valid;			/* !=0 if following fields are valid */
-	unsigned long last_updated;	/* In jiffies */
+	u8 valid;			/* bitfield, bit!=0 if slice is valid */
+	unsigned long last_updated[8];	/* In jiffies, 8 slices */
 	u8 data[EEPROM_SIZE];		/* Register values */
 	enum eeprom_nature nature;
 };
@@ -83,35 +88,36 @@
 
 static int eeprom_id = 0;
 
-static void eeprom_update_client(struct i2c_client *client)
+static void eeprom_update_client(struct i2c_client *client, u8 slice)
 {
 	struct eeprom_data *data = i2c_get_clientdata(client);
 	int i, j;
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > 300 * HZ) |
-	    (jiffies < data->last_updated) || !data->valid) {
-		dev_dbg(&client->dev, "Starting eeprom update\n");
+	if (!(data->valid & (1 << slice)) ||
+	    (jiffies - data->last_updated[slice] > 300 * HZ) ||
+	    (jiffies < data->last_updated[slice])) {
+		dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice);
 
 		if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
-			for (i=0; i < EEPROM_SIZE; i += I2C_SMBUS_I2C_BLOCK_MAX)
+			for (i = slice << 5; i < (slice + 1) << 5; i += I2C_SMBUS_I2C_BLOCK_MAX)
 				if (i2c_smbus_read_i2c_block_data(client, i, data->data + i) != I2C_SMBUS_I2C_BLOCK_MAX)
 					goto exit;
 		} else {
-			if (i2c_smbus_write_byte(client, 0)) {
+			if (i2c_smbus_write_byte(client, slice << 5)) {
 				dev_dbg(&client->dev, "eeprom read start has failed!\n");
 				goto exit;
 			}
-			for (i = 0; i < EEPROM_SIZE; i++) {
+			for (i = slice << 5; i < (slice + 1) << 5; i++) {
 				j = i2c_smbus_read_byte(client);
 				if (j < 0)
 					goto exit;
 				data->data[i] = (u8) j;
 			}
 		}
-		data->last_updated = jiffies;
-		data->valid = 1;
+		data->last_updated[slice] = jiffies;
+		data->valid |= (1 << slice);
 	}
 exit:
 	up(&data->update_lock);
@@ -121,13 +127,16 @@
 {
 	struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
 	struct eeprom_data *data = i2c_get_clientdata(client);
-
-	eeprom_update_client(client);
+	u8 slice;
 
 	if (off > EEPROM_SIZE)
 		return 0;
 	if (off + count > EEPROM_SIZE)
 		count = EEPROM_SIZE - off;
+
+	/* Only refresh slices which contain requested bytes */
+	for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++)
+		eeprom_update_client(client, slice);
 
 	/* Hide Vaio security settings to regular users (16 first bytes) */
 	if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
author
#20 lore raw

ChangeSet 1.1474.98.20, 2004/01/19 12:49:37-08:00, [email protected]

[PATCH] I2C: Fix lm90.c with DEBUG

The recent patch that fixes lm83.c with DEBUG also applies to lm90.c. No wonder since I used the first as a template when porting the second. Patch follows.

 drivers/i2c/chips/lm90.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/chips/lm90.c +2 -2
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
@@ -320,8 +320,8 @@
 
 		if ((reg_config1 & 0x2A) != 0x00
 		 || reg_convrate > 0x0A) {
-			dev_dbg(&client->dev,
-				"LM90 detection failed at 0x%02x.\n"
+			dev_dbg(&adapter->dev,
+				"LM90 detection failed at 0x%02x.\n",
 				address);
 			goto exit_free;
 		}
author
#21 lore raw

ChangeSet 1.1474.98.21, 2004/01/19 12:49:57-08:00, [email protected]

[PATCH] I2C: Fix i2c-core.c with DEBUG

At the moment, i2c-core.c fails compiling with DEBUG. Following patch should fix that.

 drivers/i2c/i2c-core.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
@@ -373,7 +373,7 @@
 	}
 
 	DEB(dev_dbg(&adapter->dev, "client [%s] registered to adapter\n",
-			client->dev.name));
+			client->name));
 
 	if (client->flags & I2C_CLIENT_ALLOW_USE)
 		client->usage_count = 0;
author
#22 lore raw

ChangeSet 1.1474.98.22, 2004/01/19 12:50:11-08:00, [email protected]

[PATCH] I2C: Fix i2c busses warnings with DEBUG

Two bus drivers (i2c-via and scx200_acb.c) generate warnings when the whole i2c subsystem is compiled with -DDEBUG. Suggested changes follow.

 drivers/i2c/busses/i2c-via.c    |    2 +-
 drivers/i2c/busses/scx200_acb.c |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-via.c +1 -1
diff -Nru a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
@@ -21,7 +21,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#define DEBUG
+/* #define DEBUG */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
drivers/i2c/busses/scx200_acb.c +2 -4
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
@@ -47,9 +47,7 @@
 MODULE_PARM(base, "1-4i");
 MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
 
-#define DEBUG 0
-
-#if DEBUG
+#ifdef DEBUG
 #define DBG(x...) printk(KERN_DEBUG NAME ": " x)
 #else
 #define DBG(x...)
@@ -374,7 +372,7 @@
 	if (rc == 0 && size == I2C_SMBUS_WORD_DATA && rw == I2C_SMBUS_READ)
 	    	data->word = le16_to_cpu(cur_word);
 
-#if DEBUG
+#ifdef DEBUG
 	printk(KERN_DEBUG NAME ": transfer done, result: %d", rc);
 	if (buffer) {
 		int i;
author
#23 lore raw

ChangeSet 1.1474.98.23, 2004/01/19 12:52:59-08:00, [email protected]

[PATCH] I2C: New driver: w83l785ts

Here is a patch that adds a new chip driver to Linux 2.6.1 (+ previous patches). The w83l785ts driver handles a single chipset, the Winbond W83L785TS-S. I am the author of the original driver as found in lm_sensors 2.8.3. Wolfgang Ziegler AKA fago made an initial port to Linux 2.6, which I reviewed, and here it is.

 drivers/i2c/chips/Kconfig     |   12 +
 drivers/i2c/chips/Makefile    |    1 
 drivers/i2c/chips/w83l785ts.c |  309 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c-id.h        |    1 
 4 files changed, 323 insertions(+)
drivers/i2c/chips/Kconfig +12 -0
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
@@ -137,4 +137,16 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called w83781d.
 
+config SENSORS_W83L785TS
+	tristate "Winbond W83L785TS-S"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the Winbond W83L785TS-S
+	  sensor chip, which is used on the Asus A7N8X, among other
+	  motherboards.
+	  
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83l785ts.
+
 endmenu
drivers/i2c/chips/Makefile +1 -0
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
@@ -15,3 +15,4 @@
 obj-$(CONFIG_SENSORS_LM85)	+= lm85.o
 obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
+obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
drivers/i2c/chips/w83l785ts.c new file +309 -0

309 lines not on this page · raw message

include/linux/i2c-id.h +1 -0
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
@@ -156,6 +156,7 @@
 #define I2C_DRIVERID_LM83 1040
 #define I2C_DRIVERID_LM90 1042
 #define I2C_DRIVERID_ASB100 1043
+#define I2C_DRIVERID_W83L785TS 1047
 
 /*
  * ---- Adapter types ----------------------------------------------------
author
#24 lore raw

ChangeSet 1.1474.98.24, 2004/01/19 12:57:20-08:00, [email protected]

[PATCH] I2C: Autoselect i2c algos

I replaced all dependancies on algos with dependancies on I2C + select algo. There are some cases outside of the i2c subdirectory.

Also note that I slightly altered the condition to display the PCILynx comment. I think it's more logical that way. Without it, the user could get the message he/she needs I2C, go to enable it, come back and still not see the option.

 drivers/i2c/busses/Kconfig  |   42 ++++++++++++++++++++++++++++--------------
 drivers/ieee1394/Kconfig    |    7 ++++---
 drivers/media/video/Kconfig |    3 ++-
 drivers/video/Kconfig       |    3 ++-
 4 files changed, 36 insertions(+), 19 deletions(-)
drivers/i2c/busses/Kconfig +28 -14
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -49,7 +49,8 @@
 
 config I2C_ELEKTOR
 	tristate "Elektor ISA card"
-	depends on I2C_ALGOPCF && ISA && BROKEN_ON_SMP
+	depends on I2C && ISA && BROKEN_ON_SMP
+	select I2C_ALGOPCF
 	help
 	  This supports the PCF8584 ISA bus I2C adapter.  Say Y if you own
 	  such an adapter.
@@ -59,7 +60,8 @@
 
 config I2C_ELV
 	tristate "ELV adapter"
-	depends on I2C_ALGOBIT
+	depends on I2C
+	select I2C_ALGOBIT
 	help
 	  This supports parallel-port I2C adapters called ELV.  Say Y if you
 	  own such an adapter.
@@ -86,7 +88,8 @@
 
 config I2C_I810
 	tristate "Intel 810/815"
-	depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  810/815 family of mainboard I2C interfaces.  Specifically, the 
@@ -119,7 +122,8 @@
 
 config I2C_ITE
 	tristate "ITE I2C Adapter"
-	depends on I2C_ALGOITE
+	depends on I2C
+	select I2C_ALGOITE
 	help
 	  This supports the ITE8172 I2C peripheral found on some MIPS
 	  systems. Say Y if you have one of these. You should also say Y for
@@ -150,7 +154,8 @@
 
 config I2C_PHILIPSPAR
 	tristate "Philips style parallel port adapter"
-	depends on I2C_ALGOBIT && PARPORT
+	depends on I2C && PARPORT
+	select I2C_ALGOBIT
 	help
 	  This supports parallel-port I2C adapters made by Philips.
 
@@ -159,7 +164,8 @@
 
 config I2C_PARPORT
 	tristate "Parallel port adapter"
-	depends on I2C_ALGOBIT && PARPORT
+	depends on I2C && PARPORT
+	select I2C_ALGOBIT
 	help
 	  This supports parallel port I2C adapters such as the ones made by
 	  Philips or Velleman, Analog Devices evaluation boards, and more.
@@ -179,7 +185,8 @@
 
 config I2C_PARPORT_LIGHT
 	tristate "Parallel port adapter (light)"
-	depends on I2C_ALGOBIT 
+	depends on I2C
+	select I2C_ALGOBIT
 	help
 	  This supports parallel port I2C adapters such as the ones made by
 	  Philips or Velleman, Analog Devices evaluation boards, and more.
@@ -219,7 +226,8 @@
 
 config I2C_PROSAVAGE
 	tristate "S3/VIA (Pro)Savage"
-	depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the
 	  I2C bus and DDC bus of the S3VIA embedded Savage4 and ProSavage8
@@ -233,11 +241,13 @@
 
 config I2C_RPXLITE
 	tristate "Embedded Planet RPX Lite/Classic support"
-	depends on (RPXLITE || RPXCLASSIC) && I2C_ALGO8XX
+	depends on (RPXLITE || RPXCLASSIC) && I2C
+	select I2C_ALGO8XX
 
 config I2C_SAVAGE4
 	tristate "S3 Savage 4"
-	depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the 
 	  S3 Savage 4 I2C interface.
@@ -247,7 +257,8 @@
 
 config SCx200_I2C
 	tristate "NatSemi SCx200 I2C using GPIO pins"
-	depends on SCx200_GPIO && I2C_ALGOBIT
+	depends on SCx200_GPIO && I2C
+	select I2C_ALGOBIT
 	help
 	  Enable the use of two GPIO pins of a SCx200 processor as an I2C bus.
 
@@ -322,7 +333,8 @@
 
 config I2C_VELLEMAN
 	tristate "Velleman K8000 adapter"
-	depends on I2C_ALGOBIT
+	depends on I2C
+	select I2C_ALGOBIT
 	help
 	  This supports the Velleman K8000 parallel-port I2C adapter.  Say Y
 	  if you own such an adapter.
@@ -332,7 +344,8 @@
 
 config I2C_VIA
 	tristate "VIA 82C586B"
-	depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_ALGOBIT
 	help
 
 	  If you say yes to this option, support will be included for the VIA
@@ -362,7 +375,8 @@
 
 config I2C_VOODOO3
 	tristate "Voodoo 3"
-	depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_ALGOBIT
 	help
 
 	  If you say yes to this option, support will be included for the
drivers/ieee1394/Kconfig +4 -3
diff -Nru a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
@@ -51,12 +51,13 @@
 comment "Device Drivers"
 	depends on IEEE1394
 
-comment "Texas Instruments PCILynx requires I2C bit-banging"
-	depends on IEEE1394 && (I2C=n || I2C_ALGOBIT=n)
+comment "Texas Instruments PCILynx requires I2C"
+	depends on IEEE1394 && I2C=n
 
 config IEEE1394_PCILYNX
 	tristate "Texas Instruments PCILynx support"
-	depends on PCI && IEEE1394 && I2C_ALGOBIT
+	depends on PCI && IEEE1394 && I2C
+	select I2C_ALGOBIT
 	help
 	  Say Y here if you have an IEEE-1394 controller with the Texas
 	  Instruments PCILynx chip.  Note: this driver is written for revision
drivers/media/video/Kconfig +2 -1
diff -Nru a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
@@ -9,7 +9,8 @@
 
 config VIDEO_BT848
 	tristate "BT848 Video For Linux"
-	depends on VIDEO_DEV && PCI && I2C_ALGOBIT && SOUND
+	depends on VIDEO_DEV && PCI && I2C && SOUND
+	select I2C_ALGOBIT
 	---help---
 	  Support for BT848 based frame grabber/overlay boards. This includes
 	  the Miro, Hauppauge and STB boards. Please read the material in
drivers/video/Kconfig +2 -1
diff -Nru a/drivers/video/Kconfig b/drivers/video/Kconfig
@@ -579,7 +579,8 @@
 
 config FB_MATROX_I2C
 	tristate "Matrox I2C support"
-	depends on FB_MATROX && I2C_ALGOBIT
+	depends on FB_MATROX && I2C
+	select I2C_ALGOBIT
 	---help---
 	  This drivers creates I2C buses which are needed for accessing the
 	  DDC (I2C) bus present on all Matroxes, an I2C bus which
author
#25 lore raw

ChangeSet 1.1474.98.25, 2004/01/19 13:10:24-08:00, [email protected]

[PATCH] I2C: only select I2C_ITE if we are a MIPS system

 drivers/i2c/busses/Kconfig |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +1 -1
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
@@ -122,7 +122,7 @@
 
 config I2C_ITE
 	tristate "ITE I2C Adapter"
-	depends on I2C
+	depends on I2C && MIPS_ITE8172
 	select I2C_ALGOITE
 	help
 	  This supports the ITE8172 I2C peripheral found on some MIPS
author
#26 lore raw

ChangeSet 1.1474.98.26, 2004/01/19 15:06:56-08:00, [email protected]

[PATCH] I2C: add I2C_DEBUG_CORE config option and convert the i2c core code to use it.

This cleans up the mismatch of ways we could enable debugging messages.

 drivers/i2c/Kconfig      |    8 +++
 drivers/i2c/i2c-core.c   |  110 +++++++++++++++++++++--------------------------
 drivers/i2c/i2c-dev.c    |   10 ++--
 drivers/i2c/i2c-sensor.c |    5 +-
 4 files changed, 69 insertions(+), 64 deletions(-)
drivers/i2c/Kconfig +8 -0
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
@@ -41,5 +41,13 @@
 source drivers/i2c/busses/Kconfig
 source drivers/i2c/chips/Kconfig
 
+config I2C_DEBUG_CORE
+	bool "I2C Core debugging messages"
+	depends on I2C
+	help
+	  Say Y here if you want the I2C core to produce a bunch of debug
+	  messages to the system log.  Select this if you are having a
+	  problem with I2C support and want to see more of what is going on.
+
 endmenu
 
drivers/i2c/i2c-core.c +51 -59

307 lines not on this page · raw message

drivers/i2c/i2c-dev.c +6 -4
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
@@ -29,8 +29,10 @@
 /* The devfs code is contributed by Philipp Matthias Hahn 
    <[email protected]> */
 
-/* If you want debugging uncomment: */
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CORE
+#define DEBUG	1
+#endif
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -137,7 +139,7 @@
 	if (tmp==NULL)
 		return -ENOMEM;
 
-	pr_debug("i2c-dev.o: i2c-%d reading %d bytes.\n",
+	pr_debug("i2c-dev: i2c-%d reading %d bytes.\n",
 		iminor(file->f_dentry->d_inode), count);
 
 	ret = i2c_master_recv(client,tmp,count);
@@ -165,7 +167,7 @@
 		return -EFAULT;
 	}
 
-	pr_debug("i2c-dev.o: i2c-%d writing %d bytes.\n",
+	pr_debug("i2c-dev: i2c-%d writing %d bytes.\n",
 		iminor(file->f_dentry->d_inode), count);
 
 	ret = i2c_master_send(client,tmp,count);
drivers/i2c/i2c-sensor.c +4 -1
diff -Nru a/drivers/i2c/i2c-sensor.c b/drivers/i2c/i2c-sensor.c
@@ -19,7 +19,10 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CORE
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/kernel.h>
author
#27 lore raw

ChangeSet 1.1474.98.27, 2004/01/19 15:07:28-08:00, [email protected]

[PATCH] I2C: add I2C_DEBUG_CHIP config option and convert the i2c chip drivers to use it.

This cleans up the mismatch of ways we could enable debugging messages.

 drivers/i2c/Kconfig           |    9 +++++++++
 drivers/i2c/chips/adm1021.c   |    5 +++++
 drivers/i2c/chips/asb100.c    |    6 ++++--
 drivers/i2c/chips/eeprom.c    |    5 ++++-
 drivers/i2c/chips/it87.c      |   13 +++++++++----
 drivers/i2c/chips/lm75.c      |    5 ++++-
 drivers/i2c/chips/lm78.c      |    7 ++++++-
 drivers/i2c/chips/lm83.c      |    5 +++++
 drivers/i2c/chips/lm85.c      |    5 +++++
 drivers/i2c/chips/lm90.c      |    5 +++++
 drivers/i2c/chips/via686a.c   |    5 +++++
 drivers/i2c/chips/w83781d.c   |    7 ++++++-
 drivers/i2c/chips/w83l785ts.c |    5 +++++
 13 files changed, 72 insertions(+), 10 deletions(-)
drivers/i2c/Kconfig +9 -0
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
@@ -49,5 +49,14 @@
 	  messages to the system log.  Select this if you are having a
 	  problem with I2C support and want to see more of what is going on.
 
+config I2C_DEBUG_CHIP
+	bool "I2C Chip debugging messages"
+	depends on I2C
+	help
+	  Say Y here if you want the I2C chip drivers to produce a bunch of
+	  debug messages to the system log.  Select this if you are having
+	  a problem with I2C support and want to see more of what is going
+	  on.
+
 endmenu
 
drivers/i2c/chips/adm1021.c +5 -0
diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
@@ -19,6 +19,11 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
drivers/i2c/chips/asb100.c +4 -2
diff -Nru a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
@@ -36,7 +36,10 @@
     asb100	7	3	1	4	0x31	0x0694	yes	no
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -1035,7 +1038,6 @@
 
 static int __init asb100_init(void)
 {
-	printk(KERN_INFO "asb100 version %s\n", ASB100_VERSION);
 	return i2c_add_driver(&asb100_driver);
 }
 
drivers/i2c/chips/eeprom.c +4 -1
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
@@ -26,7 +26,10 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
 
 #include <linux/kernel.h>
 #include <linux/init.h>
drivers/i2c/chips/it87.c +9 -4
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
@@ -31,6 +31,11 @@
     type at module load time.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -667,10 +672,10 @@
 		}
 		else {
 			if (kind == 0)
-				printk
-				    ("it87.o: Ignoring 'force' parameter for unknown chip at "
-				     "adapter %d, address 0x%02x\n",
-				     i2c_adapter_id(adapter), address);
+				dev_info(&adapter->dev, 
+					"Ignoring 'force' parameter for unknown chip at "
+					"adapter %d, address 0x%02x\n",
+					i2c_adapter_id(adapter), address);
 			goto ERROR1;
 		}
 	}
drivers/i2c/chips/lm75.c +4 -1
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
@@ -18,7 +18,10 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/init.h>
drivers/i2c/chips/lm78.c +6 -1
diff -Nru a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
@@ -18,6 +18,11 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -615,7 +620,7 @@
 			kind = lm79;
 		else {
 			if (kind == 0)
-				printk(KERN_WARNING "lm78.o: Ignoring 'force' "
+				dev_warn(&adapter->dev, "Ignoring 'force' "
 					"parameter for unknown chip at "
 					"adapter %d, address 0x%02x\n",
 					i2c_adapter_id(adapter), address);
drivers/i2c/chips/lm83.c +5 -0
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
@@ -27,6 +27,11 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
drivers/i2c/chips/lm85.c +5 -0
diff -Nru a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c
@@ -22,6 +22,11 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
drivers/i2c/chips/lm90.c +5 -0
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
@@ -35,6 +35,11 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
drivers/i2c/chips/via686a.c +5 -0
diff -Nru a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
@@ -31,6 +31,11 @@
     Warning - only supports a single device.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
drivers/i2c/chips/w83781d.c +6 -1
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
@@ -36,6 +36,11 @@
 
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -1651,7 +1656,7 @@
 	if (time_after
 	    (jiffies - data->last_updated, (unsigned long) (HZ + HZ / 2))
 	    || time_before(jiffies, data->last_updated) || !data->valid) {
-		pr_debug(KERN_DEBUG "Starting device update\n");
+		pr_debug("Starting device update\n");
 
 		for (i = 0; i <= 8; i++) {
 			if ((data->type == w83783s || data->type == w83697hf)
drivers/i2c/chips/w83l785ts.c +5 -0
diff -Nru a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
@@ -27,6 +27,11 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_CHIP
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
author
#28 lore raw

ChangeSet 1.1474.98.28, 2004/01/19 15:07:53-08:00, [email protected]

[PATCH] I2C: add I2C_DEBUG_BUS config option and convert the i2c bus drivers to use it.

This cleans up the mismatch of ways we could enable debugging messages.

 drivers/i2c/Kconfig                    |    9 ++++++++
 drivers/i2c/busses/i2c-ali1535.c       |    5 +++-
 drivers/i2c/busses/i2c-ali15x3.c       |    5 +++-
 drivers/i2c/busses/i2c-amd756.c        |    5 +++-
 drivers/i2c/busses/i2c-amd8111.c       |    5 ++++
 drivers/i2c/busses/i2c-elektor.c       |   19 +++++++----------
 drivers/i2c/busses/i2c-elv.c           |   17 +++++++--------
 drivers/i2c/busses/i2c-frodo.c         |    5 ++++
 drivers/i2c/busses/i2c-i801.c          |    5 +++-
 drivers/i2c/busses/i2c-i810.c          |    5 ++++
 drivers/i2c/busses/i2c-ibm_iic.c       |    6 +++++
 drivers/i2c/busses/i2c-iop3xx.c        |    9 +++-----
 drivers/i2c/busses/i2c-isa.c           |    5 ++++
 drivers/i2c/busses/i2c-ite.c           |   24 ++++++++++------------
 drivers/i2c/busses/i2c-keywest.c       |   36 +++++++++++++++------------------
 drivers/i2c/busses/i2c-nforce2.c       |    5 ++++
 drivers/i2c/busses/i2c-parport-light.c |    5 ++++
 drivers/i2c/busses/i2c-parport.c       |    7 +++++-
 drivers/i2c/busses/i2c-philips-par.c   |    7 +++++-
 drivers/i2c/busses/i2c-piix4.c         |    5 +++-
 drivers/i2c/busses/i2c-prosavage.c     |    5 ++++
 drivers/i2c/busses/i2c-rpx.c           |    7 +++++-
 drivers/i2c/busses/i2c-savage4.c       |    5 ++++
 drivers/i2c/busses/i2c-sis5595.c       |   10 +++++----
 drivers/i2c/busses/i2c-sis630.c        |    5 +++-
 drivers/i2c/busses/i2c-sis96x.c        |    5 +++-
 drivers/i2c/busses/i2c-velleman.c      |   12 +++++------
 drivers/i2c/busses/i2c-via.c           |    5 +++-
 drivers/i2c/busses/i2c-viapro.c        |    5 ++++
 drivers/i2c/busses/i2c-voodoo3.c       |    5 ++++
 drivers/i2c/busses/scx200_acb.c        |    9 ++++++--
 drivers/i2c/busses/scx200_i2c.c        |   10 ++++++---
 32 files changed, 189 insertions(+), 83 deletions(-)
drivers/i2c/Kconfig +9 -0
diff -Nru a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
@@ -49,6 +49,15 @@
 	  messages to the system log.  Select this if you are having a
 	  problem with I2C support and want to see more of what is going on.
 
+config I2C_DEBUG_BUS
+	bool "I2C Bus debugging messages"
+	depends on I2C
+	help
+	  Say Y here if you want the I2C bus drivers to produce a bunch of
+	  debug messages to the system log.  Select this if you are having
+	  a problem with I2C support and want to see more of what is going
+	  on.
+
 config I2C_DEBUG_CHIP
 	bool "I2C Chip debugging messages"
 	depends on I2C
drivers/i2c/busses/i2c-ali1535.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
@@ -53,7 +53,10 @@
 
 /* Note: we assume there can only be one ALI1535, with one SMBus interface */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-ali15x3.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
@@ -60,7 +60,10 @@
 
 /* Note: we assume there can only be one ALI15X3, with one SMBus interface */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-amd756.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
@@ -37,7 +37,10 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-amd8111.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
@@ -8,6 +8,11 @@
  * the Free Software Foundation version 2.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
drivers/i2c/busses/i2c-elektor.c +8 -11
diff -Nru a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
@@ -25,6 +25,11 @@
 /* Partialy rewriten by Oleg I. Vdovikin for mmapped support of 
    for Alpha Processor Inc. UP-2000(+) boards */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
@@ -50,7 +55,6 @@
 static int clock  = 0x1c;
 static int own    = 0x55;
 static int mmapped;
-static int i2c_debug;
 
 /* vdovikin: removed static struct i2c_pcf_isa gpi; code - 
   this module in real supports only one device, due to missing arguments
@@ -60,12 +64,6 @@
 static wait_queue_head_t pcf_wait;
 static int pcf_pending;
 
-/* ----- global defines -----------------------------------------------	*/
-#define DEB(x)	if (i2c_debug>=1) x
-#define DEB2(x) if (i2c_debug>=2) x
-#define DEB3(x) if (i2c_debug>=3) x
-#define DEBE(x)	x	/* error messages 				*/
-
 /* ----- local functions ----------------------------------------------	*/
 
 static void pcf_isa_setbyte(void *data, int ctl, int val)
@@ -77,7 +75,7 @@
 		val |= I2C_PCF_ENI;
 	}
 
-	DEB3(printk(KERN_DEBUG "i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255));
+	pr_debug("i2c-elektor: Write 0x%X 0x%02X\n", address, val & 255);
 
 	switch (mmapped) {
 	case 0: /* regular I/O */
@@ -98,7 +96,7 @@
 	int address = ctl ? (base + 1) : base;
 	int val = mmapped ? readb(address) : inb(address);
 
-	DEB3(printk(KERN_DEBUG "i2c-elektor: Read 0x%X 0x%02X\n", address, val));
+	pr_debug("i2c-elektor: Read 0x%X 0x%02X\n", address, val);
 
 	return (val);
 }
@@ -196,7 +194,7 @@
 			/* yeap, we've found cypress, let's check config */
 			if (!pci_read_config_byte(cy693_dev, 0x47, &config)) {
 				
-				DEB3(printk(KERN_DEBUG "i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config));
+				pr_debug("i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config);
 
 				/* UP2000 board has this register set to 0xe1,
                                    but the most significant bit as seems can be 
@@ -280,7 +278,6 @@
 MODULE_PARM(clock, "i");
 MODULE_PARM(own, "i");
 MODULE_PARM(mmapped, "i");
-MODULE_PARM(i2c_debug, "i");
 
 module_init(i2c_pcfisa_init);
 module_exit(i2c_pcfisa_exit);
drivers/i2c/busses/i2c-elv.c +8 -9
diff -Nru a/drivers/i2c/busses/i2c-elv.c b/drivers/i2c/busses/i2c-elv.c
@@ -21,6 +21,11 @@
 /* With some changes from Kyösti Mälkki <[email protected]> and even
    Frodo Looijaard <[email protected]> */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -36,12 +41,6 @@
 static int base=0;
 static unsigned char port_data = 0;
 
-/* ----- global defines -----------------------------------------------	*/
-#define DEB(x)		/* should be reasonable open, close &c. 	*/
-#define DEB2(x) 	/* low level debugging - very slow 		*/
-#define DEBE(x)	x	/* error messages 				*/
-#define DEBINIT(x) x	/* detection status messages			*/
-
 /* --- Convenience defines for the parallel port:			*/
 #define BASE	(unsigned int)(data)
 #define DATA	BASE			/* Centronics data port		*/
@@ -89,7 +88,7 @@
 		return -ENODEV;
 
 	if (inb(base+1) & 0x80) {	/* BUSY should be high	*/
-		DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Busy was low.\n"));
+		pr_debug("i2c-elv: Busy was low.\n");
 		goto fail;
 	} 
 
@@ -97,7 +96,7 @@
 	udelay(400);
 	if (!(inb(base+1) && 0x10)) {
 		outb(0x04,base+2);
-		DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n"));
+		pr_debug("i2c-elv: Select was high.\n");
 		goto fail;
 	}
 
@@ -153,7 +152,7 @@
 			return -ENODEV;
 		}
 	}
-	printk(KERN_DEBUG "i2c-elv.o: found device at %#x.\n",base);
+	pr_debug("i2c-elv: found device at %#x.\n",base);
 	return 0;
 }
 
drivers/i2c/busses/i2c-frodo.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-frodo.c b/drivers/i2c/busses/i2c-frodo.c
@@ -12,6 +12,11 @@
  * version 2 as published by the Free Software Foundation.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
drivers/i2c/busses/i2c-i801.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
@@ -38,7 +38,10 @@
 
 /* Note: we assume there can only be one I801, with one SMBus interface */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-i810.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c
@@ -34,6 +34,11 @@
    i815			1132           
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
drivers/i2c/busses/i2c-ibm_iic.c +6 -0
diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -27,6 +27,12 @@
  * option) any later version.
  *
  */
+
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
drivers/i2c/busses/i2c-iop3xx.c +4 -5
diff -Nru a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
@@ -31,6 +31,10 @@
 
   ---------------------------------------------------------------------------*/
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -529,8 +533,3 @@
 MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>");
 MODULE_DESCRIPTION("IOP3xx iic algorithm and driver");
 MODULE_LICENSE("GPL");
-
-MODULE_PARM(i2c_debug,"i");
-
-MODULE_PARM_DESC(i2c_debug, "debug level - 0 off; 1 normal; 2,3 more verbose; 9 iic-protocol");
-
drivers/i2c/busses/i2c-isa.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
@@ -24,6 +24,11 @@
    the SMBus and the ISA bus very much easier. See lm78.c for an example
    of this. */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
drivers/i2c/busses/i2c-ite.c +11 -13
diff -Nru a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c
@@ -33,6 +33,11 @@
 /* With some changes from Kyösti Mälkki <[email protected]> and even
    Frodo Looijaard <[email protected]> */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
@@ -58,26 +63,21 @@
 static int clock = 0;
 static int own   = 0;
 
-static int i2c_debug=0;
 static struct iic_ite gpi;
 static wait_queue_head_t iic_wait;
 static int iic_pending;
 
-/* ----- global defines -----------------------------------------------	*/
-#define DEB(x)	if (i2c_debug>=1) x
-#define DEB2(x) if (i2c_debug>=2) x
-#define DEB3(x) if (i2c_debug>=3) x
-#define DEBE(x)	x	/* error messages 				*/
-
-
 /* ----- local functions ----------------------------------------------	*/
 
 static void iic_ite_setiic(void *data, int ctl, short val)
 {
         unsigned long j = jiffies + 10;
 
-	DEB3(printk(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff));
-	DEB3({while (time_before(jiffies, j)) schedule();})
+	pr_debug(" Write 0x%02x to 0x%x\n",(unsigned short)val, ctl&0xff);
+#ifdef DEBUG
+	while (time_before(jiffies, j))
+		schedule();
+#endif
 	outw(val,ctl);
 }
 
@@ -86,7 +86,7 @@
 	short val;
 
 	val = inw(ctl);
-	DEB3(printk("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff));  
+	pr_debug("Read 0x%02x from 0x%x\n",(unsigned short)val, ctl&0xff);
 	return (val);
 }
 
@@ -145,7 +145,6 @@
 	
    iic_pending = 1;
 
-   DEB2(printk("iic_ite_handler: in interrupt handler\n"));
    wake_up_interruptible(&iic_wait);
 }
 
@@ -263,7 +262,6 @@
 MODULE_PARM(irq, "i");
 MODULE_PARM(clock, "i");
 MODULE_PARM(own, "i");
-MODULE_PARM(i2c_debug,"i");
 
 
 /* Called when module is loaded or when kernel is initialized.
drivers/i2c/busses/i2c-keywest.c +17 -19
diff -Nru a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
@@ -43,6 +43,11 @@
     sound driver to be happy
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
@@ -65,20 +70,13 @@
 
 #include "i2c-keywest.h"
 
-#define DBG(x...) do {\
-	if (debug > 0) \
-		printk(KERN_DEBUG "KW:" x); \
-	} while(0)
-
 
 MODULE_AUTHOR("Benjamin Herrenschmidt <[email protected]>");
 MODULE_DESCRIPTION("I2C driver for Apple's Keywest");
 MODULE_LICENSE("GPL");
 MODULE_PARM(probe, "i");
-MODULE_PARM(debug, "i");
 
-int probe = 0;
-int debug = 0;
+static int probe = 0;
 
 static void
 do_stop(struct keywest_iface* iface, int result)
@@ -95,7 +93,7 @@
 	int ack;
 	int rearm_timer = 1;
 	
-	DBG("handle_interrupt(), got: %x, status: %x, state: %d\n",
+	pr_debug("handle_interrupt(), got: %x, status: %x, state: %d\n",
 		isr, read_reg(reg_status), iface->state);
 	if (isr == 0 && iface->state != state_stop) {
 		do_stop(iface, -1);
@@ -112,7 +110,7 @@
 			break;
 		}
 		ack = read_reg(reg_status);
-		DBG("ack on set address: %x\n", ack);
+		pr_debug("ack on set address: %x\n", ack);
 		if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
 			do_stop(iface, -1);
 			break;
@@ -127,7 +125,7 @@
 					| KW_I2C_CTL_AAK);
 		} else {
 			iface->state = state_write;
-			DBG("write byte: %x\n", *(iface->data));
+			pr_debug("write byte: %x\n", *(iface->data));
 			write_reg(reg_data, *(iface->data++));
 			iface->datalen--;
 		}
@@ -139,7 +137,7 @@
 			break;
 		}
 		*(iface->data++) = read_reg(reg_data);
-		DBG("read byte: %x\n", *(iface->data-1));
+		pr_debug("read byte: %x\n", *(iface->data-1));
 		iface->datalen--;
 		if (iface->datalen == 0)
 			iface->state = state_stop;
@@ -153,13 +151,13 @@
 		}
 		/* Check ack status */
 		ack = read_reg(reg_status);
-		DBG("ack on data write: %x\n", ack);
+		pr_debug("ack on data write: %x\n", ack);
 		if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
 			do_stop(iface, -1);
 			break;
 		}
 		if (iface->datalen) {
-			DBG("write byte: %x\n", *(iface->data));
+			pr_debug("write byte: %x\n", *(iface->data));
 			write_reg(reg_data, *(iface->data++));
 			iface->datalen--;
 		} else
@@ -203,7 +201,7 @@
 {
 	struct keywest_iface *iface = (struct keywest_iface *)data;
 
-	DBG("timeout !\n");
+	pr_debug("timeout !\n");
 	spin_lock_irq(&iface->lock);
 	if (handle_interrupt(iface, read_reg(reg_isr)))
 		mod_timer(&iface->timeout_timer, jiffies + POLL_TIMEOUT);
@@ -271,7 +269,7 @@
 
 	down(&iface->sem);
 
-	DBG("chan: %d, addr: 0x%x, transfer len: %d, read: %d\n",
+	pr_debug("chan: %d, addr: 0x%x, transfer len: %d, read: %d\n",
 		chan->chan_no, addr, len, read_write == I2C_SMBUS_READ);
 
 	iface->data = buffer;
@@ -306,7 +304,7 @@
 	wait_for_completion(&iface->complete);	
 
 	rc = iface->result;	
-	DBG("transfer done, result: %d\n", rc);
+	pr_debug("transfer done, result: %d\n", rc);
 
 	if (rc == 0 && size == I2C_SMBUS_WORD_DATA && read_write == I2C_SMBUS_READ)
 	    	data->word = le16_to_cpu(cur_word);
@@ -348,7 +346,7 @@
 			rc = -EINVAL;
 			break;
 		}
-		DBG("xfer: chan: %d, doing %s %d bytes to 0x%02x - %d of %d messages\n",
+		pr_debug("xfer: chan: %d, doing %s %d bytes to 0x%02x - %d of %d messages\n",
 		     chan->chan_no,
 		     pmsg->flags & I2C_M_RD ? "read" : "write",
                      pmsg->len, addr, i, num);
@@ -388,7 +386,7 @@
 		rc = iface->result;
 		if (rc == 0)
 			completed++;
-		DBG("transfer done, result: %d\n", rc);
+		pr_debug("transfer done, result: %d\n", rc);
 	}
 
 	/* Release sem */
drivers/i2c/busses/i2c-nforce2.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
@@ -32,6 +32,11 @@
 
 /* Note: we assume there can only be one nForce2, with two SMBus interfaces */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
drivers/i2c/busses/i2c-parport-light.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
@@ -24,6 +24,11 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  * ------------------------------------------------------------------------ */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
drivers/i2c/busses/i2c-parport.c +6 -1
diff -Nru a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
@@ -24,6 +24,11 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  * ------------------------------------------------------------------------ */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -162,7 +167,7 @@
 	}
 	memset(adapter, 0x00, sizeof(struct i2c_par));
 
-	printk(KERN_DEBUG "i2c-parport: attaching to %s\n", port->name);
+	pr_debug("i2c-parport: attaching to %s\n", port->name);
 	adapter->pdev = parport_register_device(port, "i2c-parport",
 		NULL, NULL, NULL, PARPORT_FLAG_EXCL, NULL);
 	if (!adapter->pdev) {
drivers/i2c/busses/i2c-philips-par.c +6 -1
diff -Nru a/drivers/i2c/busses/i2c-philips-par.c b/drivers/i2c/busses/i2c-philips-par.c
@@ -23,6 +23,11 @@
 
 /* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -158,7 +163,7 @@
 	}
 	memset (adapter, 0x00, sizeof(struct i2c_par));
 
-	/* printk(KERN_DEBUG "i2c-philips-par.o: attaching to %s\n", port->name); */
+	/* pr_debug("i2c-philips-par: attaching to %s\n", port->name); */
 
 	adapter->pdev = parport_register_device(port, "i2c-philips-par",
 						NULL, NULL, NULL, 
drivers/i2c/busses/i2c-piix4.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
@@ -28,7 +28,10 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
drivers/i2c/busses/i2c-prosavage.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c
@@ -54,6 +54,11 @@
  *    (Additional documentation needed :(
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-rpx.c +6 -1
diff -Nru a/drivers/i2c/busses/i2c-rpx.c b/drivers/i2c/busses/i2c-rpx.c
@@ -11,6 +11,11 @@
  * changed to eliminate RPXLite references.
  */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -82,7 +87,7 @@
 	rpx_iic_init(&rpx_data);
 
 	if (i2c_8xx_add_bus(&rpx_ops) < 0) {
-		printk("i2c-rpx: Unable to register with I2C\n");
+		printk(KERN_ERR "i2c-rpx: Unable to register with I2C\n");
 		return -ENODEV;
 	}
 
drivers/i2c/busses/i2c-savage4.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c
@@ -29,6 +29,11 @@
    it easier to add later.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
drivers/i2c/busses/i2c-sis5595.c +6 -4
diff -Nru a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
@@ -55,7 +55,10 @@
  * Add adapter resets
  */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -311,13 +314,12 @@
 		break;
 /*
 	case I2C_SMBUS_BLOCK_DATA:
-		printk("sis5595.o: Block data not yet implemented!\n");
+		printk(KERN_WARNING "sis5595.o: Block data not yet implemented!\n");
 		return -1;
 		break;
 */
 	default:
-		printk
-		    (KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size);
+		printk(KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size);
 		return -1;
 	}
 
drivers/i2c/busses/i2c-sis630.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
@@ -48,7 +48,10 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-/* #define DEBUG 1 */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/kernel.h>
 #include <linux/module.h>
drivers/i2c/busses/i2c-sis96x.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
@@ -32,7 +32,10 @@
     We assume there can only be one SiS96x with one SMBus interface.
 */
 
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/module.h>
 #include <linux/pci.h>
drivers/i2c/busses/i2c-velleman.c +6 -6
diff -Nru a/drivers/i2c/busses/i2c-velleman.c b/drivers/i2c/busses/i2c-velleman.c
@@ -20,6 +20,11 @@
 
 /* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
@@ -29,11 +34,6 @@
 #include <linux/i2c-algo-bit.h>
 #include <asm/io.h>
 
-/* ----- global defines -----------------------------------------------	*/
-#define DEB(x)		/* should be reasonable open, close &c. 	*/
-#define DEB2(x) 	/* low level debugging - very slow 		*/
-#define DEBE(x)	x	/* error messages 				*/
-
 					/* Pin Port  Inverted	name	*/
 #define I2C_SDA		0x02		/*  ctrl bit 1 	(inv)	*/
 #define I2C_SCL		0x08		/*  ctrl bit 3 	(inv)	*/
@@ -140,7 +140,7 @@
 			return -ENODEV;
 		}
 	}
-	printk(KERN_DEBUG "i2c-velleman: found device at %#x.\n",base);
+	pr_debug("i2c-velleman: found device at %#x.\n",base);
 	return 0;
 }
 
drivers/i2c/busses/i2c-via.c +4 -1
diff -Nru a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
@@ -21,7 +21,10 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* #define DEBUG */
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
 
 #include <linux/kernel.h>
 #include <linux/module.h>
drivers/i2c/busses/i2c-viapro.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
@@ -33,6 +33,11 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
drivers/i2c/busses/i2c-voodoo3.c +5 -0
diff -Nru a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c
@@ -27,6 +27,11 @@
 /* This interfaces to the I2C bus of the Voodoo3 to gain access to
     the BT869 and possibly other I2C devices. */
 
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
drivers/i2c/busses/scx200_acb.c +7 -2
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
@@ -25,6 +25,11 @@
 */
 
 #include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -373,7 +378,7 @@
 	    	data->word = le16_to_cpu(cur_word);
 
 #ifdef DEBUG
-	printk(KERN_DEBUG NAME ": transfer done, result: %d", rc);
+	DBG(": transfer done, result: %d", rc);
 	if (buffer) {
 		int i;
 		printk(" data:");
@@ -505,7 +510,7 @@
 	int i;
 	int rc;
 
-	printk(KERN_DEBUG NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
+	pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n");
 
 	/* Verify that this really is a SCx200 processor */
 	if (pci_find_device(PCI_VENDOR_ID_NS,
drivers/i2c/busses/scx200_i2c.c +7 -3
diff -Nru a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
@@ -22,6 +22,11 @@
 */
 
 #include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -88,15 +93,14 @@
 
 int scx200_i2c_init(void)
 {
-	printk(KERN_DEBUG NAME ": NatSemi SCx200 I2C Driver\n");
+	pr_debug(NAME ": NatSemi SCx200 I2C Driver\n");
 
 	if (!scx200_gpio_present()) {
 		printk(KERN_ERR NAME ": no SCx200 gpio pins available\n");
 		return -ENODEV;
 	}
 
-	printk(KERN_DEBUG NAME ": SCL=GPIO%02u, SDA=GPIO%02u\n", 
-	       scl, sda);
+	pr_debug(NAME ": SCL=GPIO%02u, SDA=GPIO%02u\n", scl, sda);
 
 	if (scl == -1 || sda == -1 || scl == sda) {
 		printk(KERN_ERR NAME ": scl and sda must be specified\n");
author
#29 lore raw

ChangeSet 1.1474.98.29, 2004/01/19 15:17:17-08:00, [email protected]

[PATCH] I2C: remove unneeded CVS Id: lines.

 drivers/i2c/algos/i2c-algo-pcf.h     |    2 --
 drivers/i2c/busses/i2c-philips-par.c |    2 --
 drivers/i2c/busses/i2c-velleman.c    |    2 --
 drivers/i2c/i2c-core.c               |    2 --
 4 files changed, 8 deletions(-)
drivers/i2c/algos/i2c-algo-pcf.h +0 -2
diff -Nru a/drivers/i2c/algos/i2c-algo-pcf.h b/drivers/i2c/algos/i2c-algo-pcf.h
@@ -21,8 +21,6 @@
 
 /* With some changes from Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-pcf8584.h,v 1.3 2000/01/18 23:54:07 frodo Exp $ */
-
 #ifndef I2C_PCF8584_H
 #define I2C_PCF8584_H 1
 
drivers/i2c/busses/i2c-philips-par.c +0 -2
diff -Nru a/drivers/i2c/busses/i2c-philips-par.c b/drivers/i2c/busses/i2c-philips-par.c
@@ -21,8 +21,6 @@
 /* With some changes from Kyösti Mälkki <[email protected]> and even
    Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-philips-par.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
-
 #include <linux/config.h>
 #ifdef CONFIG_I2C_DEBUG_BUS
 #define DEBUG	1
drivers/i2c/busses/i2c-velleman.c +0 -2
diff -Nru a/drivers/i2c/busses/i2c-velleman.c b/drivers/i2c/busses/i2c-velleman.c
@@ -18,8 +18,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		     */
 /* ------------------------------------------------------------------------- */
 
-/* $Id: i2c-velleman.c,v 1.29 2003/01/21 08:08:16 kmalkki Exp $ */
-
 #include <linux/config.h>
 #ifdef CONFIG_I2C_DEBUG_BUS
 #define DEBUG	1
drivers/i2c/i2c-core.c +0 -2
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
@@ -21,8 +21,6 @@
    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.95 2003/01/22 05:25:08 kmalkki Exp $ */
-
 #include <linux/config.h>
 #ifdef CONFIG_I2C_DEBUG_CORE
 #define DEBUG	1
#30 lore raw
In reply to Greg KH
Quoted 4 lines

Also note that I slightly altered the condition to display the PCILynx comment. I think it's more logical that way. Without it, the user could get the message he/she needs I2C, go to enable it, come back and still not see the option.

For the records, please let it be noted that this change is *not* included in the patch submitted by Greg.

That said, I still think it was a good idea. Not that it matters much to me since I don't use that driver, but anyway... Who should I contact to get it included?

Thanks.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
author
#31 lore raw
Quoted 11 lines · Jean Delvare
Quoted 4 lines

Also note that I slightly altered the condition to display the PCILynx comment. I think it's more logical that way. Without it, the user could get the message he/she needs I2C, go to enable it, come back and still not see the option.

For the records, please let it be noted that this change is *not* included in the patch submitted by Greg.

That said, I still think it was a good idea. Not that it matters much to me since I don't use that driver, but anyway... Who should I contact to get it included?

The ieee1394 maintainer?

#32 lore raw
Quoted 5 lines
Quoted 3 lines

That said, I still think it was a good idea. Not that it matters much to me since I don't use that driver, but anyway... Who should I contact to get it included?

The ieee1394 maintainer?

OK, done that. It is supposed to have been applied, although it's not in 2.6.2-rc3.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
author
#33 lore raw
Quoted 8 lines · Jean Delvare
Quoted 5 lines
Quoted 3 lines

That said, I still think it was a good idea. Not that it matters much to me since I don't use that driver, but anyway... Who should I contact to get it included?

The ieee1394 maintainer?

OK, done that. It is supposed to have been applied, although it's not in 2.6.2-rc3.

Give them time, iee1394 doesn't sync up with Linus as often as USB and I2C does :)

greg k-h

#34 lore raw
In reply to Greg KH

Quoting myself:

Quoted 22 lines

(...) Greg, could
you please apply the following patch to the "porting-clients" document so that at least the new drivers don't need to be converted afterwards?

 Documentation/i2c/porting-clients |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients

Documentation/i2c/porting-clients +3 -1
@@ -92,7 +92,10 @@
   i2c_get_clientdata(client) instead.
 
 * [Interface] Init function should not print anything. Make sure
-  there is a MODULE_LICENSE() line.
+  there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
+  by module_param(). Note that module_param has a third parameter,
+  that you should set to 0 by default. See

include/linux/moduleparam.h+ for details.

Quoted 1 line

Coding policy:

On second thought I think I shouldn't have done that change. I2c chip drivers use SENSORS_INSMOD_* macros which in the end include MODULE_PARM() calls.

Quoting Rusty Russell: "However, I never implemented mixing old and new style in the same module, so if you're adding a parameter, it makes sense to convert them all."

So maybe I shouldn't suggest that new drivers use the new style, since they will mix old and new in this case. What about forgetting about that doc change for now? Sorry for the trouble, I should have thought about that before submitting.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
author
#35 lore raw
Quoted 30 lines · Jean Delvare

Quoting myself:

Quoted 22 lines

(...) Greg, could
you please apply the following patch to the "porting-clients" document so that at least the new drivers don't need to be converted afterwards?

 Documentation/i2c/porting-clients |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients

Documentation/i2c/porting-clients +3 -1
@@ -92,7 +92,10 @@
   i2c_get_clientdata(client) instead.
 
 * [Interface] Init function should not print anything. Make sure
-  there is a MODULE_LICENSE() line.
+  there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
+  by module_param(). Note that module_param has a third parameter,
+  that you should set to 0 by default. See

include/linux/moduleparam.h+ for details.

Quoted 1 line

Coding policy:

On second thought I think I shouldn't have done that change. I2c chip drivers use SENSORS_INSMOD_* macros which in the end include MODULE_PARM() calls.

Quoted 8 lines

Quoting Rusty Russell: "However, I never implemented mixing old and new style in the same module, so if you're adding a parameter, it makes sense to convert them all."

So maybe I shouldn't suggest that new drivers use the new style, since they will mix old and new in this case. What about forgetting about that doc change for now? Sorry for the trouble, I should have thought about that before submitting.

Heh, feel free to port the SENSORS_INSMOD_* crap too if you want to. I really hate that code, and want to drop it entirely in 2.7 if possible...

Or just send me a patch, backing out your change, I'll apply that :)

thanks,

greg k-h

#36 lore raw
Quoted 1 line

Or just send me a patch, backing out your change, I'll apply that :)

Here you are. Sorry again for the noise.

--------------------------------

Undo a recent change to the i2c documentation. The change belongs to 2.7.

Documentation/i2c/porting-clients renamed from Documentation/i2c/porting-clients.orig +1 -4
@@ -92,10 +92,7 @@
   i2c_get_clientdata(client) instead.
 
 * [Interface] Init function should not print anything. Make sure
-  there is a MODULE_LICENSE() line. MODULE_PARM() is replaced
-  by module_param(). Note that module_param has a third parameter,
-  that you should set to 0 by default. See include/linux/moduleparam.h
-  for details.
+  there is a MODULE_LICENSE() line.
 
 Coding policy:
 
Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
author Applied
#37 lore raw
Quoted 3 lines · Jean Delvare
Quoted 1 line

Or just send me a patch, backing out your change, I'll apply that :)

Here you are. Sorry again for the noise.

Applied, thanks,

greg k-h