All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] I2C patches for 2.6.12
@ 2005-06-22  5:16 Greg KH
  2005-06-22  5:17 ` [PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:16 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel, sensors

Here are a bunch of i2c patches that have been in the -mm tree for the
past few months.  There are a few new drivers in here, a bunch of
spelling fixes, lots of documentation updates, and a few other minor
things.

Please pull from:
	rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/i2c-2.6.git/
or from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6.git/
if it isn't synced up yet.

The full patch series will sent to the linux-kernel and sensors mailing lists,
if anyone wants to see them.

thanks,

greg k-h


 Documentation/feature-removal-schedule.txt |   10 
 Documentation/i2c/busses/i2c-sis69x        |    2 
 Documentation/i2c/chips/adm1021            |  111 +++
 Documentation/i2c/chips/adm1025            |   51 +
 Documentation/i2c/chips/adm1026            |   93 ++
 Documentation/i2c/chips/adm1031            |   35 
 Documentation/i2c/chips/adm9240            |  177 ++++
 Documentation/i2c/chips/asb100             |   72 +
 Documentation/i2c/chips/ds1621             |  108 ++
 Documentation/i2c/chips/eeprom             |   96 ++
 Documentation/i2c/chips/fscher             |  169 ++++
 Documentation/i2c/chips/gl518sm            |   74 ++
 Documentation/i2c/chips/it87               |   96 ++
 Documentation/i2c/chips/lm63               |   57 +
 Documentation/i2c/chips/lm75               |   65 +
 Documentation/i2c/chips/lm77               |   22 
 Documentation/i2c/chips/lm78               |   82 ++
 Documentation/i2c/chips/lm80               |   56 +
 Documentation/i2c/chips/lm83               |   76 ++
 Documentation/i2c/chips/lm85               |  221 +++++
 Documentation/i2c/chips/lm87               |   73 +
 Documentation/i2c/chips/lm90               |  121 +++
 Documentation/i2c/chips/lm92               |   37 +
 Documentation/i2c/chips/max1619            |   29 
 Documentation/i2c/chips/max6875            |   54 +
 Documentation/i2c/chips/pc87360            |  189 +++++
 Documentation/i2c/chips/pca9539            |   47 +
 Documentation/i2c/chips/pcf8574            |   69 +
 Documentation/i2c/chips/pcf8591            |   90 ++
 Documentation/i2c/chips/sis5595            |  106 ++
 Documentation/i2c/chips/smsc47b397         |  168 ++++
 Documentation/i2c/chips/smsc47b397.txt     |  146 ---
 Documentation/i2c/chips/smsc47m1           |   52 +
 Documentation/i2c/chips/via686a            |   65 +
 Documentation/i2c/chips/w83627hf           |   66 +
 Documentation/i2c/chips/w83781d            |  428 +++++++++++
 Documentation/i2c/chips/w83l785ts          |   39 +
 Documentation/i2c/porting-clients          |    2 
 Documentation/i2c/userspace-tools          |   39 +
 Documentation/i2c/writing-clients          |   64 -
 MAINTAINERS                                |   16 
 arch/ppc/platforms/83xx/mpc834x_sys.c      |   20 
 drivers/acorn/char/pcf8583.c               |    3 
 drivers/i2c/algos/i2c-algo-pca.c           |    8 
 drivers/i2c/algos/i2c-algo-sibyte.c        |    1 
 drivers/i2c/busses/Kconfig                 |   34 
 drivers/i2c/busses/i2c-ali1535.c           |    1 
 drivers/i2c/busses/i2c-ali15x3.c           |    1 
 drivers/i2c/busses/i2c-amd756.c            |    1 
 drivers/i2c/busses/i2c-amd8111.c           |    1 
 drivers/i2c/busses/i2c-au1550.c            |    1 
 drivers/i2c/busses/i2c-elektor.c           |    1 
 drivers/i2c/busses/i2c-frodo.c             |    1 
 drivers/i2c/busses/i2c-i801.c              |    1 
 drivers/i2c/busses/i2c-i810.c              |    1 
 drivers/i2c/busses/i2c-ibm_iic.c           |    2 
 drivers/i2c/busses/i2c-ibm_iic.h           |    1 
 drivers/i2c/busses/i2c-iop3xx.c            |    2 
 drivers/i2c/busses/i2c-isa.c               |    1 
 drivers/i2c/busses/i2c-ite.c               |    1 
 drivers/i2c/busses/i2c-ixp2000.c           |    5 
 drivers/i2c/busses/i2c-ixp4xx.c            |    5 
 drivers/i2c/busses/i2c-keywest.c           |    1 
 drivers/i2c/busses/i2c-mpc.c               |   18 
 drivers/i2c/busses/i2c-nforce2.c           |    1 
 drivers/i2c/busses/i2c-parport-light.c     |    1 
 drivers/i2c/busses/i2c-parport.c           |    3 
 drivers/i2c/busses/i2c-pca-isa.c           |    1 
 drivers/i2c/busses/i2c-piix4.c             |    1 
 drivers/i2c/busses/i2c-prosavage.c         |    1 
 drivers/i2c/busses/i2c-rpx.c               |    1 
 drivers/i2c/busses/i2c-s3c2410.c           |    3 
 drivers/i2c/busses/i2c-savage4.c           |    1 
 drivers/i2c/busses/i2c-sibyte.c            |    1 
 drivers/i2c/busses/i2c-sis5595.c           |    1 
 drivers/i2c/busses/i2c-sis630.c            |    1 
 drivers/i2c/busses/i2c-sis96x.c            |    1 
 drivers/i2c/busses/i2c-stub.c              |    1 
 drivers/i2c/busses/i2c-via.c               |    1 
 drivers/i2c/busses/i2c-viapro.c            |    1 
 drivers/i2c/busses/i2c-voodoo3.c           |    1 
 drivers/i2c/busses/scx200_acb.c            |    1 
 drivers/i2c/chips/Kconfig                  |  117 ++-
 drivers/i2c/chips/Makefile                 |   10 
 drivers/i2c/chips/adm1021.c                |    9 
 drivers/i2c/chips/adm1025.c                |    5 
 drivers/i2c/chips/adm1026.c                |    8 
 drivers/i2c/chips/adm1031.c                |    2 
 drivers/i2c/chips/adm9240.c                |  829 +++++++++++++++++++++-
 drivers/i2c/chips/asb100.c                 |    5 
 drivers/i2c/chips/atxp1.c                  |  385 ++++++++++
 drivers/i2c/chips/ds1337.c                 |  107 +-
 drivers/i2c/chips/ds1374.c                 |  272 +++++++
 drivers/i2c/chips/ds1621.c                 |    4 
 drivers/i2c/chips/eeprom.c                 |    1 
 drivers/i2c/chips/fscher.c                 |    1 
 drivers/i2c/chips/gl518sm.c                |    1 
 drivers/i2c/chips/isp1301_omap.c           |    1 
 drivers/i2c/chips/it87.c                   |  398 +++++-----
 drivers/i2c/chips/lm63.c                   |  274 +++----
 drivers/i2c/chips/lm75.c                   |    1 
 drivers/i2c/chips/lm77.c                   |    1 
 drivers/i2c/chips/lm78.c                   |    5 
 drivers/i2c/chips/lm80.c                   |    1 
 drivers/i2c/chips/lm83.c                   |  162 ++--
 drivers/i2c/chips/lm85.c                   |    5 
 drivers/i2c/chips/lm87.c                   |    1 
 drivers/i2c/chips/lm90.c                   |  281 ++++---
 drivers/i2c/chips/m41t00.c                 |    3 
 drivers/i2c/chips/max1619.c                |    1 
 drivers/i2c/chips/max6875.c                |  473 ++++++++++++
 drivers/i2c/chips/pc87360.c                |    1 
 drivers/i2c/chips/pca9539.c                |  192 +++++
 drivers/i2c/chips/pcf8574.c                |    6 
 drivers/i2c/chips/rtc8564.c                |    4 
 drivers/i2c/chips/sis5595.c                |    1 
 drivers/i2c/chips/smsc47m1.c               |   10 
 drivers/i2c/chips/tps65010.c               | 1072 +++++++++++++++++++++++++++++
 drivers/i2c/chips/via686a.c                |  303 ++++----
 drivers/i2c/chips/w83627ehf.c              |  870 +++++++++++++++++++++++
 drivers/i2c/chips/w83627hf.c               |    2 
 drivers/i2c/chips/w83781d.c                |   78 --
 drivers/i2c/chips/w83l785ts.c              |    1 
 drivers/i2c/i2c-core.c                     |  102 --
 drivers/i2c/i2c-dev.c                      |    3 
 drivers/macintosh/therm_windtunnel.c       |    6 
 drivers/media/video/adv7170.c              |   16 
 drivers/media/video/adv7175.c              |   16 
 drivers/media/video/bt819.c                |   16 
 drivers/media/video/bt832.c                |    4 
 drivers/media/video/bt856.c                |   16 
 drivers/media/video/msp3400.c              |    1 
 drivers/media/video/saa5246a.c             |    1 
 drivers/media/video/saa5249.c              |    1 
 drivers/media/video/saa7110.c              |   16 
 drivers/media/video/saa7111.c              |   16 
 drivers/media/video/saa7114.c              |   16 
 drivers/media/video/saa7134/saa6752hs.c    |    1 
 drivers/media/video/saa7185.c              |   16 
 drivers/media/video/tda7432.c              |    1 
 drivers/media/video/tda9840.c              |    1 
 drivers/media/video/tda9875.c              |    1 
 drivers/media/video/tda9887.c              |    1 
 drivers/media/video/tea6415c.c             |    1 
 drivers/media/video/tea6420.c              |    1 
 drivers/media/video/tuner-3036.c           |   23 
 drivers/media/video/tuner-core.c           |   11 
 drivers/media/video/tvaudio.c              |    1 
 drivers/media/video/tveeprom.c             |    1 
 drivers/media/video/vpx3220.c              |   16 
 drivers/video/matrox/matroxfb_maven.c      |    1 
 include/asm-arm/arch-omap/tps65010.h       |   76 ++
 include/linux/hwmon-sysfs.h                |   36 
 include/linux/i2c-id.h                     |    1 
 include/linux/i2c-sysfs.h                  |   36 
 include/linux/i2c-vid.h                    |   12 
 include/linux/i2c.h                        |   12 
 157 files changed, 8574 insertions(+), 1514 deletions(-)

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

Alexey Dobriyan:
  I2C: drivers/i2c/*: #include <linux/config.h> cleanup

Andrew Morton:
  I2C: fix ds1374 build

BGardner@Wabtec.com:
  max6875: new i2c device driver

bgardner@wabtec.com:
  I2C: add new pca9539 driver

Clemens Koller:
  I2C: rtc8564.c remove duplicate include

David Brownell:
  I2C: add i2c driver for TPS6501x

Dominik Hackl:
  I2C: include of jiffies.h for some i2c drivers

Grant Coady:
  I2C: add adm9240 driver documentation
  I2C: driver adm1021: remove die_code
  I2C: adm9240 driver cleanup
  I2C: remove <linux/delay.h> from via686a
  I2C: Setting w83627hf fan divisor 128 fails.
  I2C: sysfs names: rename to cpu0_vid, take 3
  I2C: add new hardware monitor driver: adm9240

Greg Kroah-Hartman:
  I2C: fix up ds1374.c driver so it will build.
  I2C: fix up some sysfs device attribute file parameters
  I2C: mark all functions static in atxp1 driver

Jean Delvare:
  I2C: w83781d: remove non-i2c sensor chips
  I2C: rename i2c-sysfs.h to hwmon-sysfs.h
  I2C: lm63 uses new sysfs callbacks
  I2C: drivers/i2c/chips/it87.c: use dynamic sysfs callbacks
  I2C: lm83 uses new sysfs callbacks
  I2C: pcf8574 driver cleanup
  I2C: lm90 uses new sysfs callbacks
  I2C: Sensors mailing list has moved
  I2C: Kill another macro abuse in via686a
  I2C: Coding style cleanups to via686a
  I2C: chips/Kconfig corrections
  I2C: Kill common macro abuse in chip drivers
  I2C: Remove redundancy from i2c-core.c
  I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1
  I2C: Fix bugs in the new w83627ehf driver
  I2C: New hardware monitoring driver: w83627ehf
  I2C: #include <linux/config.h> cleanup
  I2C: Merge unused address lists in some video drivers
  I2C: Kill address ranges in non-sensors i2c chip drivers

Kumar Gala:
  I2C: Allow for sharing of the interrupt line for i2c-mpc.c

Ladislav Michl:
  ds1337: export ds1337_do_command
  ds1337 driver works also with ds1339 chip
  I2C: ds1337: search by bus number
  I2C: ds1337 3/4
  I2C: ds1337 2/4
  I2C: ds1337: Make time format consistent with other RTC drivers
  I2C: ds1337: i2c_transfer() checking
  I2C: ds1337 1/4

Randy Vinson:
  I2C: Add support for Maxim/Dallas DS1374 Real-Time Clock Chip (1/2)
  I2C: Add support for Maxim/Dallas DS1374 Real-Time Clock Chip (2/2)

Rudolf Marek:
  I2C: documentation update 3/3
  I2C: documentation update 2/3
  I2C: KConfig update - some EXPERIMENTAL removal
  I2C: documentation update 1/3

Sebastian Witt:
  I2C: add new atxp1 driver
  I2C: i2c-vid.h: Support for VID to reg conversion

Steven Cole:
  Spelling fixes for drivers/i2c.

Sylvain Munaut:
  i2c: Race fix for i2c-mpc.c

Tobias Klauser:
  I2C: Spelling fixes for drivers/i2c/i2c-dev.c
  I2C: Spelling fixes for drivers/i2c/i2c-core.c
  I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c
  I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: i2c-vid.h: Support for VID to reg conversion
  2005-06-22  5:17 ` [PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers Greg KH
@ 2005-06-22  5:17   ` Greg KH
  2005-06-22  5:17     ` [PATCH] I2C: Merge unused address lists in some video drivers Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: se.witt

[PATCH] I2C: i2c-vid.h: Support for VID to reg conversion

Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module.
Removed uneeded switch case.

Signed-off-by: Sebastian Witt <se.witt@gmx.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 3886246a257e828248ce1e72ced00408a3557f0d
tree ef1a71bf68f653b277de964d5c3156c90f21cd2f
parent 792f156d61d327671f58829dc04ad5609152e393
author Sebastian Witt <se.witt@gmx.net> Wed, 13 Apr 2005 22:25:39 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:49 -0700

 include/linux/i2c-vid.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h
--- a/include/linux/i2c-vid.h
+++ b/include/linux/i2c-vid.h
@@ -97,3 +97,15 @@ static inline int vid_from_reg(int val, 
 		                     2050 - (val) * 50);
 	}
 }
+
+static inline int vid_to_reg(int val, int vrm)
+{
+	switch (vrm) {
+	case 91:		/* VRM 9.1 */
+	case 90:		/* VRM 9.0 */
+		return ((val >= 1100) && (val <= 1850) ?
+			((18499 - val * 10) / 25 + 5) / 10 : -1);
+	default:
+		return -1;
+	}
+}


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Merge unused address lists in some video drivers
  2005-06-22  5:17   ` [PATCH] I2C: i2c-vid.h: Support for VID to reg conversion Greg KH
@ 2005-06-22  5:17     ` Greg KH
  2005-06-22  5:17       ` [PATCH] I2C: rtc8564.c remove duplicate include Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Merge unused address lists in some video drivers

On top of my previous patch which removes the use of address ranges in
video i2c drivers, this one can save an additional few bytes of memory.
Most of these drivers which do not use I2C_CLIENT_INSMOD initialize the
unused address lists in a less than optimal way. This patch simply
optimizes this, by using a single one-element list instead of 3
different lists with two elements each.

This saves an average 63 bytes on these drivers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff -ruN linux-2.6.12-rc1-bk5.orig/drivers/media/video/adv7170.c linux-2.6.12-rc1-bk5/drivers/media/video/adv7170.c

---
commit 68cc9d0b714d7d533c0cfc257a62f7f7f4f22a11
tree 616ee332d4a489598141512cbc01f591e1e84dec
parent b3d5496ea5915fa4848fe307af9f7097f312e932
author Jean Delvare <khali@linux-fr.org> Sat, 02 Apr 2005 20:04:41 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:49 -0700

 drivers/media/video/adv7170.c    |   10 ++++------
 drivers/media/video/adv7175.c    |   10 ++++------
 drivers/media/video/bt819.c      |   10 ++++------
 drivers/media/video/bt856.c      |   10 ++++------
 drivers/media/video/saa7110.c    |   10 ++++------
 drivers/media/video/saa7111.c    |   10 ++++------
 drivers/media/video/saa7114.c    |   10 ++++------
 drivers/media/video/saa7185.c    |   10 ++++------
 drivers/media/video/tuner-3036.c |   10 ++++------
 drivers/media/video/vpx3220.c    |   10 ++++------
 10 files changed, 40 insertions(+), 60 deletions(-)

diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -385,15 +385,13 @@ static unsigned short normal_i2c[] =
 	I2C_CLIENT_END
 };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_adv7170;
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -435,15 +435,13 @@ static unsigned short normal_i2c[] =
 	I2C_CLIENT_END
 };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_adv7175;
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -501,15 +501,13 @@ static unsigned short normal_i2c[] = {
 	I2C_CLIENT_END,
 };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_bt819;
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
--- a/drivers/media/video/bt856.c
+++ b/drivers/media/video/bt856.c
@@ -289,15 +289,13 @@ bt856_command (struct i2c_client *client
  */
 static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_bt856;
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
--- a/drivers/media/video/saa7110.c
+++ b/drivers/media/video/saa7110.c
@@ -464,15 +464,13 @@ static unsigned short normal_i2c[] = {
 	I2C_CLIENT_END
 };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_saa7110;
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -483,15 +483,13 @@ saa7111_command (struct i2c_client *clie
  */
 static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_saa7111;
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -821,15 +821,13 @@ saa7114_command (struct i2c_client *clie
 static unsigned short normal_i2c[] =
     { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_saa7114;
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -381,15 +381,13 @@ saa7185_command (struct i2c_client *clie
  */
 static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver i2c_driver_saa7185;
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c
--- a/drivers/media/video/tuner-3036.c
+++ b/drivers/media/video/tuner-3036.c
@@ -35,15 +35,13 @@ static struct i2c_client client_template
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x60, 0x61, I2C_CLIENT_END };
-static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c	= normal_i2c,
-	.probe		= probe,
-	.ignore		= ignore,
-	.force		= force,
+	.probe		= &ignore,
+	.ignore		= &ignore,
+	.force		= &ignore,
 };
 
 /* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
--- a/drivers/media/video/vpx3220.c
+++ b/drivers/media/video/vpx3220.c
@@ -570,15 +570,13 @@ static unsigned short normal_i2c[] =
 	I2C_CLIENT_END
 };
 
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
+static unsigned short ignore = I2C_CLIENT_END;
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.probe			= probe,
-	.ignore			= ignore,
-	.force			= force
+	.probe			= &ignore,
+	.ignore			= &ignore,
+	.force			= &ignore,
 };
 
 static struct i2c_driver vpx3220_i2c_driver;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers
  2005-06-22  5:16 [GIT PATCH] I2C patches for 2.6.12 Greg KH
@ 2005-06-22  5:17 ` Greg KH
  2005-06-22  5:17   ` [PATCH] I2C: i2c-vid.h: Support for VID to reg conversion Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers

Some months ago, you killed the address ranges mechanism from all
sensors i2c chip drivers (both the module parameters and the in-code
address lists). I think it was a very good move, as the ranges can
easily be replaced by individual addresses, and this allowed for
significant cleanups in the i2c core (let alone the impressive size
shrink for all these drivers).

Unfortunately you did not do the same for non-sensors i2c chip drivers.
These need the address ranges even less, so we could get rid of the
ranges here as well for another significant i2c core cleanup. Here comes
a patch which does just that. Since the process is exactly the same as
what you did for the other drivers set already, I did not split this one
in parts.

A documentation update is included.

The change saves 308 bytes in the i2c core, and an average 1382 bytes
for chip drivers which use I2C_CLIENT_INSMOD, 126 bytes for those which
do not.

This change is required if we want to merge the sensors and non-sensors
i2c code (and we want to do this).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/Documentation/i2c/writing-clients
===================================================================

---
commit b3d5496ea5915fa4848fe307af9f7097f312e932
tree e358977311df194ebac13d57c5e8abf1a87bd65c
parent 2a5a68b840cbab31baab2d9b2e1e6de3b289ae1e
author Jean Delvare <khali@linux-fr.org> Sat, 02 Apr 2005 20:31:02 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:48 -0700

 Documentation/i2c/writing-clients       |   64 ++++++-------------------------
 drivers/acorn/char/pcf8583.c            |    3 -
 drivers/i2c/chips/isp1301_omap.c        |    1 
 drivers/i2c/chips/m41t00.c              |    3 -
 drivers/i2c/chips/rtc8564.c             |    3 -
 drivers/i2c/i2c-core.c                  |   35 -----------------
 drivers/macintosh/therm_windtunnel.c    |    6 ++-
 drivers/media/video/adv7170.c           |    6 ---
 drivers/media/video/adv7175.c           |    6 ---
 drivers/media/video/bt819.c             |    6 ---
 drivers/media/video/bt832.c             |    4 +-
 drivers/media/video/bt856.c             |    6 ---
 drivers/media/video/msp3400.c           |    1 
 drivers/media/video/saa5246a.c          |    1 
 drivers/media/video/saa5249.c           |    1 
 drivers/media/video/saa7110.c           |    6 ---
 drivers/media/video/saa7111.c           |    6 ---
 drivers/media/video/saa7114.c           |    6 ---
 drivers/media/video/saa7134/saa6752hs.c |    1 
 drivers/media/video/saa7185.c           |    6 ---
 drivers/media/video/tda7432.c           |    1 
 drivers/media/video/tda9840.c           |    1 
 drivers/media/video/tda9875.c           |    1 
 drivers/media/video/tda9887.c           |    1 
 drivers/media/video/tea6415c.c          |    1 
 drivers/media/video/tea6420.c           |    1 
 drivers/media/video/tuner-3036.c        |   13 ++----
 drivers/media/video/tuner-core.c        |   11 ++---
 drivers/media/video/tvaudio.c           |    1 
 drivers/media/video/tveeprom.c          |    1 
 drivers/media/video/vpx3220.c           |    6 ---
 drivers/video/matrox/matroxfb_maven.c   |    1 
 include/linux/i2c.h                     |   12 ------
 33 files changed, 28 insertions(+), 194 deletions(-)

diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -171,45 +171,31 @@ The following lists are used internally:
 
   normal_i2c: filled in by the module writer. 
      A list of I2C addresses which should normally be examined.
-   normal_i2c_range: filled in by the module writer.
-     A list of pairs of I2C addresses, each pair being an inclusive range of
-     addresses which should normally be examined.
    probe: insmod parameter. 
      A list of pairs. The first value is a bus number (-1 for any I2C bus), 
      the second is the address. These addresses are also probed, as if they 
      were in the 'normal' list.
-   probe_range: insmod parameter. 
-     A list of triples. The first value is a bus number (-1 for any I2C bus), 
-     the second and third are addresses.  These form an inclusive range of 
-     addresses that are also probed, as if they were in the 'normal' list.
    ignore: insmod parameter.
      A list of pairs. The first value is a bus number (-1 for any I2C bus), 
      the second is the I2C address. These addresses are never probed. 
      This parameter overrules 'normal' and 'probe', but not the 'force' lists.
-   ignore_range: insmod parameter. 
-     A list of triples. The first value is a bus number (-1 for any I2C bus), 
-     the second and third are addresses. These form an inclusive range of 
-     I2C addresses that are never probed.
-     This parameter overrules 'normal' and 'probe', but not the 'force' lists.
    force: insmod parameter. 
      A list of pairs. The first value is a bus number (-1 for any I2C bus),
      the second is the I2C address. A device is blindly assumed to be on
      the given address, no probing is done. 
 
-Fortunately, as a module writer, you just have to define the `normal' 
-and/or `normal_range' parameters. The complete declaration could look
-like this:
-
-  /* Scan 0x20 to 0x2f, 0x37, and 0x40 to 0x4f */
-  static unsigned short normal_i2c[] = { 0x37,I2C_CLIENT_END }; 
-  static unsigned short normal_i2c_range[] = { 0x20, 0x2f, 0x40, 0x4f, 
-                                               I2C_CLIENT_END };
+Fortunately, as a module writer, you just have to define the `normal_i2c' 
+parameter. The complete declaration could look like this:
+
+  /* Scan 0x37, and 0x48 to 0x4f */
+  static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
+                                         0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
   /* Magic definition of all other variables and things */
   I2C_CLIENT_INSMOD;
 
-Note that you *have* to call the two defined variables `normal_i2c' and
-`normal_i2c_range', without any prefix!
+Note that you *have* to call the defined variable `normal_i2c',
+without any prefix!
 
 
 Probing classes (sensors)
@@ -223,39 +209,17 @@ The following lists are used internally.
 
    normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END.
      A list of I2C addresses which should normally be examined.
-   normal_i2c_range: filled in by the module writer. Terminated by 
-     SENSORS_I2C_END
-     A list of pairs of I2C addresses, each pair being an inclusive range of
-     addresses which should normally be examined.
    normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END.
      A list of ISA addresses which should normally be examined.
-   normal_isa_range: filled in by the module writer. Terminated by 
-     SENSORS_ISA_END
-     A list of triples. The first two elements are ISA addresses, being an
-     range of addresses which should normally be examined. The third is the
-     modulo parameter: only addresses which are 0 module this value relative
-     to the first address of the range are actually considered.
    probe: insmod parameter. Initialize this list with SENSORS_I2C_END values.
      A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
      the ISA bus, -1 for any I2C bus), the second is the address. These
      addresses are also probed, as if they were in the 'normal' list.
-   probe_range: insmod parameter. Initialize this list with SENSORS_I2C_END 
-     values.
-     A list of triples. The first value is a bus number (SENSORS_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second and third are addresses. 
-     These form an inclusive range of addresses that are also probed, as
-     if they were in the 'normal' list.
    ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values.
      A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
      the ISA bus, -1 for any I2C bus), the second is the I2C address. These
      addresses are never probed. This parameter overrules 'normal' and 
      'probe', but not the 'force' lists.
-   ignore_range: insmod parameter. Initialize this list with SENSORS_I2C_END 
-      values.
-     A list of triples. The first value is a bus number (SENSORS_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second and third are addresses. 
-     These form an inclusive range of I2C addresses that are never probed.
-     This parameter overrules 'normal' and 'probe', but not the 'force' lists.
 
 Also used is a list of pointers to sensors_force_data structures:
    force_data: insmod parameters. A list, ending with an element of which
@@ -269,16 +233,14 @@ Also used is a list of pointers to senso
 So we have a generic insmod variabled `force', and chip-specific variables
 `force_CHIPNAME'.
 
-Fortunately, as a module writer, you just have to define the `normal' 
-and/or `normal_range' parameters, and define what chip names are used. 
+Fortunately, as a module writer, you just have to define the `normal_i2c' 
+and `normal_isa' parameters, and define what chip names are used. 
 The complete declaration could look like this:
-  /* Scan i2c addresses 0x20 to 0x2f, 0x37, and 0x40 to 0x4f
-  static unsigned short normal_i2c[] = {0x37,SENSORS_I2C_END};
-  static unsigned short normal_i2c_range[] = {0x20,0x2f,0x40,0x4f,
-                                              SENSORS_I2C_END};
+  /* Scan i2c addresses 0x37, and 0x48 to 0x4f */
+  static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
+                                         0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
   /* Scan ISA address 0x290 */
   static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END};
-  static unsigned int normal_isa_range[] = {SENSORS_ISA_END};
 
   /* Define chips foo and bar, as well as all module parameters and things */
   SENSORS_INSMOD_2(foo,bar);
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c
--- a/drivers/acorn/char/pcf8583.c
+++ b/drivers/acorn/char/pcf8583.c
@@ -26,11 +26,8 @@ static unsigned short normal_addr[] = { 
 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_addr,
-	.normal_i2c_range	= ignore,
 	.probe			= ignore,
-	.probe_range		= ignore,
 	.ignore			= ignore,
-	.ignore_range		= ignore,
 	.force			= ignore,
 };
 
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -145,7 +145,6 @@ static inline void notresponding(struct 
 static unsigned short normal_i2c[] = {
 	ISP_BASE, ISP_BASE + 1,
 	I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 I2C_CLIENT_INSMOD;
 
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
--- a/drivers/i2c/chips/m41t00.c
+++ b/drivers/i2c/chips/m41t00.c
@@ -40,11 +40,8 @@ static unsigned short normal_addr[] = { 
 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_addr,
-	.normal_i2c_range	= ignore,
 	.probe			= ignore,
-	.probe_range		= ignore,
 	.ignore			= ignore,
-	.ignore_range		= ignore,
 	.force			= ignore,
 };
 
diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- a/drivers/i2c/chips/rtc8564.c
+++ b/drivers/i2c/chips/rtc8564.c
@@ -66,11 +66,8 @@ static unsigned short normal_addr[] = { 
 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_addr,
-	.normal_i2c_range	= ignore,
 	.probe			= ignore,
-	.probe_range		= ignore,
 	.ignore			= ignore,
-	.ignore_range		= ignore,
 	.force			= ignore,
 };
 
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -742,18 +742,6 @@ int i2c_probe(struct i2c_adapter *adapte
 				found = 1;
 			}
 		}
-		for (i = 0;
-		     !found && (address_data->ignore_range[i] != I2C_CLIENT_END);
-		     i += 3) {
-			if (((adap_id == address_data->ignore_range[i]) ||
-			    ((address_data->ignore_range[i]==ANY_I2C_BUS))) &&
-			    (addr >= address_data->ignore_range[i+1]) &&
-			    (addr <= address_data->ignore_range[i+2])) {
-				dev_dbg(&adapter->dev, "found ignore_range parameter for adapter %d, "
-					"addr %04x\n", adap_id,addr);
-				found = 1;
-			}
-		}
 		if (found) 
 			continue;
 
@@ -770,17 +758,6 @@ int i2c_probe(struct i2c_adapter *adapte
 		}
 
 		for (i = 0;
-		     !found && (address_data->normal_i2c_range[i] != I2C_CLIENT_END);
-		     i += 2) {
-			if ((addr >= address_data->normal_i2c_range[i]) &&
-			    (addr <= address_data->normal_i2c_range[i+1])) {
-				found = 1;
-				dev_dbg(&adapter->dev, "found normal i2c_range entry for adapter %d, "
-					"addr %04x\n", adap_id,addr);
-			}
-		}
-
-		for (i = 0;
 		     !found && (address_data->probe[i] != I2C_CLIENT_END);
 		     i += 2) {
 			if (((adap_id == address_data->probe[i]) ||
@@ -791,18 +768,6 @@ int i2c_probe(struct i2c_adapter *adapte
 					"addr %04x\n", adap_id,addr);
 			}
 		}
-		for (i = 0;
-		     !found && (address_data->probe_range[i] != I2C_CLIENT_END);
-		     i += 3) {
-			if (((adap_id == address_data->probe_range[i]) ||
-			   (address_data->probe_range[i] == ANY_I2C_BUS)) &&
-			   (addr >= address_data->probe_range[i+1]) &&
-			   (addr <= address_data->probe_range[i+2])) {
-				found = 1;
-				dev_dbg(&adapter->dev, "found probe_range parameter for adapter %d, "
-					"addr %04x\n", adap_id,addr);
-			}
-		}
 		if (!found) 
 			continue;
 
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -51,8 +51,10 @@
 static int 			do_probe( struct i2c_adapter *adapter, int addr, int kind);
 
 /* scan 0x48-0x4f (DS1775) and 0x2c-2x2f (ADM1030) */
-static unsigned short		normal_i2c[] = { 0x49, 0x2c, I2C_CLIENT_END };
-static unsigned short		normal_i2c_range[] = { 0x48, 0x4f, 0x2c, 0x2f, I2C_CLIENT_END };
+static unsigned short		normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
+						 0x4c, 0x4d, 0x4e, 0x4f,
+						 0x2c, 0x2d, 0x2e, 0x2f,
+						 I2C_CLIENT_END };
 
 I2C_CLIENT_INSMOD;
 
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -384,21 +384,15 @@ static unsigned short normal_i2c[] =
 	I2C_ADV7171 >> 1, (I2C_ADV7171 >> 1) + 1,
 	I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -434,21 +434,15 @@ static unsigned short normal_i2c[] =
 	I2C_ADV7176 >> 1, (I2C_ADV7176 >> 1) + 1,
 	I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -500,21 +500,15 @@ static unsigned short normal_i2c[] = {
 	I2C_BT819 >> 1,
 	I2C_CLIENT_END,
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -39,8 +39,8 @@
 MODULE_LICENSE("GPL");
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = {I2C_CLIENT_END};
-static unsigned short normal_i2c_range[] = {I2C_BT832_ALT1>>1,I2C_BT832_ALT2>>1,I2C_CLIENT_END};
+static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1,
+				       I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 /* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
--- a/drivers/media/video/bt856.c
+++ b/drivers/media/video/bt856.c
@@ -288,21 +288,15 @@ bt856_command (struct i2c_client *client
  * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
  */
 static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -147,7 +147,6 @@ static unsigned short normal_i2c[] = {
 	I2C_MSP3400C_ALT  >> 1,
 	I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END};
 I2C_CLIENT_INSMOD;
 
 /* ----------------------------------------------------------------------- */
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -64,7 +64,6 @@ static struct video_device saa_template;
 
 /* Addresses to scan */
 static unsigned short normal_i2c[]	 = { I2C_ADDRESS, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 static struct i2c_client client_template;
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -132,7 +132,6 @@ static struct video_device saa_template;
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {34>>1,I2C_CLIENT_END};
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
 I2C_CLIENT_INSMOD;
 
 static struct i2c_client client_template;
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
--- a/drivers/media/video/saa7110.c
+++ b/drivers/media/video/saa7110.c
@@ -463,21 +463,15 @@ static unsigned short normal_i2c[] = {
 	(I2C_SAA7110 >> 1) + 1,
 	I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -482,21 +482,15 @@ saa7111_command (struct i2c_client *clie
  * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
  */
 static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -820,21 +820,15 @@ saa7114_command (struct i2c_client *clie
  */
 static unsigned short normal_i2c[] =
     { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -22,7 +22,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
 I2C_CLIENT_INSMOD;
 
 MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -380,21 +380,15 @@ saa7185_command (struct i2c_client *clie
  * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
  */
 static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -74,7 +74,6 @@ static unsigned short normal_i2c[] = {
 	I2C_TDA7432 >> 1,
 	I2C_CLIENT_END,
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END, I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 /* Structure of address and subaddresses for the tda7432 */
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c
--- a/drivers/media/video/tda9840.c
+++ b/drivers/media/video/tda9840.c
@@ -43,7 +43,6 @@ MODULE_PARM_DESC(debug, "Turn on/off dev
 
 /* addresses to scan, found only at 0x42 (7-Bit) */
 static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 /* magic definition of all other variables and things */
 I2C_CLIENT_INSMOD;
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -44,7 +44,6 @@ static unsigned short normal_i2c[] =  {
     I2C_TDA9875 >> 1,
     I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
 I2C_CLIENT_INSMOD;
 
 /* This is a superset of the TDA9875 */
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -33,7 +33,6 @@ static unsigned short normal_i2c[] = {
 	0x96 >>1,
 	I2C_CLIENT_END,
 };
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END,I2C_CLIENT_END};
 I2C_CLIENT_INSMOD;
 
 /* insmod options */
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c
--- a/drivers/media/video/tea6415c.c
+++ b/drivers/media/video/tea6415c.c
@@ -43,7 +43,6 @@ MODULE_PARM_DESC(debug, "Turn on/off dev
 
 /* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */
 static unsigned short normal_i2c[] = { I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 /* magic definition of all other variables and things */
 I2C_CLIENT_INSMOD;
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c
--- a/drivers/media/video/tea6420.c
+++ b/drivers/media/video/tea6420.c
@@ -40,7 +40,6 @@ MODULE_PARM_DESC(debug, "Turn on/off dev
 
 /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */
 static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 /* magic definition of all other variables and things */
 I2C_CLIENT_INSMOD;
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c
--- a/drivers/media/video/tuner-3036.c
+++ b/drivers/media/video/tuner-3036.c
@@ -34,19 +34,16 @@ static int this_adap;
 static struct i2c_client client_template;
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = {I2C_CLIENT_END};
-static unsigned short normal_i2c_range[] = {0x60, 0x61, I2C_CLIENT_END};
+static unsigned short normal_i2c[] = { 0x60, 0x61, I2C_CLIENT_END };
 static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2]  = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END };
 
 static struct i2c_client_address_data addr_data = {
-	normal_i2c, normal_i2c_range, 
-	probe, probe_range, 
-	ignore, ignore_range, 
-	force
+	.normal_i2c	= normal_i2c,
+	.probe		= probe,
+	.ignore		= ignore,
+	.force		= force,
 };
 
 /* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -28,10 +28,8 @@
 /* standard i2c insmod options */
 static unsigned short normal_i2c[] = {
 	0x4b, /* tda8290 */
-	I2C_CLIENT_END
-};
-static unsigned short normal_i2c_range[] = {
-	0x60, 0x6f,
+	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+	0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
 	I2C_CLIENT_END
 };
 I2C_CLIENT_INSMOD;
@@ -225,9 +223,8 @@ static int tuner_attach(struct i2c_adapt
 static int tuner_probe(struct i2c_adapter *adap)
 {
 	if (0 != addr) {
-		normal_i2c[0]       = addr;
-		normal_i2c_range[0] = addr;
-		normal_i2c_range[1] = addr;
+		normal_i2c[0] = addr;
+		normal_i2c[1] = I2C_CLIENT_END;
 	}
 	this_adap = 0;
 
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -148,7 +148,6 @@ static unsigned short normal_i2c[] = {
 	I2C_TDA9874   >> 1,
 	I2C_PIC16C54  >> 1,
 	I2C_CLIENT_END };
-static unsigned short normal_i2c_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 static struct i2c_driver driver;
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -482,7 +482,6 @@ static unsigned short normal_i2c[] = {
 	0xa0 >> 1,
 	I2C_CLIENT_END,
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 struct i2c_driver i2c_driver_tveeprom;
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
--- a/drivers/media/video/vpx3220.c
+++ b/drivers/media/video/vpx3220.c
@@ -569,21 +569,15 @@ static unsigned short normal_i2c[] =
     { I2C_VPX3220 >> 1, (I2C_VPX3220 >> 1) + 4,
 	I2C_CLIENT_END
 };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
 static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
                                                                                 
 static struct i2c_client_address_data addr_data = {
 	.normal_i2c		= normal_i2c,
-	.normal_i2c_range	= normal_i2c_range,
 	.probe			= probe,
-	.probe_range		= probe_range,
 	.ignore			= ignore,
-	.ignore_range		= ignore_range,
 	.force			= force
 };
 
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
--- a/drivers/video/matrox/matroxfb_maven.c
+++ b/drivers/video/matrox/matroxfb_maven.c
@@ -1230,7 +1230,6 @@ static int maven_shutdown_client(struct 
 }
 
 static unsigned short normal_i2c[] = { MAVEN_I2CID, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { MAVEN_I2CID, MAVEN_I2CID, I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 static struct i2c_driver maven_driver;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -290,11 +290,8 @@ static inline void i2c_set_adapdata (str
  */
 struct i2c_client_address_data {
 	unsigned short *normal_i2c;
-	unsigned short *normal_i2c_range;
 	unsigned short *probe;
-	unsigned short *probe_range;
 	unsigned short *ignore;
-	unsigned short *ignore_range;
 	unsigned short *force;
 };
 
@@ -563,24 +560,15 @@ union i2c_smbus_data {
 #define I2C_CLIENT_INSMOD \
   I2C_CLIENT_MODULE_PARM(probe, \
                       "List of adapter,address pairs to scan additionally"); \
-  I2C_CLIENT_MODULE_PARM(probe_range, \
-                      "List of adapter,start-addr,end-addr triples to scan " \
-                      "additionally"); \
   I2C_CLIENT_MODULE_PARM(ignore, \
                       "List of adapter,address pairs not to scan"); \
-  I2C_CLIENT_MODULE_PARM(ignore_range, \
-                      "List of adapter,start-addr,end-addr triples not to " \
-                      "scan"); \
   I2C_CLIENT_MODULE_PARM(force, \
                       "List of adapter,address pairs to boldly assume " \
                       "to be present"); \
 	static struct i2c_client_address_data addr_data = {		\
 			.normal_i2c = 		normal_i2c,		\
-			.normal_i2c_range =	normal_i2c_range,	\
 			.probe =		probe,			\
-			.probe_range =		probe_range,		\
 			.ignore =		ignore,			\
-			.ignore_range =		ignore_range,		\
 			.force =		force,			\
 		}
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: rtc8564.c remove duplicate include
  2005-06-22  5:17     ` [PATCH] I2C: Merge unused address lists in some video drivers Greg KH
@ 2005-06-22  5:17       ` Greg KH
  2005-06-22  5:17         ` [PATCH] I2C: ds1337 1/4 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: clemens.koller

[PATCH] I2C: rtc8564.c remove duplicate include

[PATCH] I2C rtc8564.c remove duplicate include

Trivial fix: removes duplicate include line.

Signed-off-by: Clemens Koller <clemens.koller@anagramm.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 792f156d61d327671f58829dc04ad5609152e393
tree 4dd7af551142c79867620b20e3f8d91dfa402529
parent 68cc9d0b714d7d533c0cfc257a62f7f7f4f22a11
author Clemens Koller <clemens.koller@anagramm.de> Mon, 11 Apr 2005 11:49:14 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:49 -0700

 drivers/i2c/chips/rtc8564.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- a/drivers/i2c/chips/rtc8564.c
+++ b/drivers/i2c/chips/rtc8564.c
@@ -19,7 +19,6 @@
 #include <linux/string.h>
 #include <linux/rtc.h>		/* get the user-level API */
 #include <linux/init.h>
-#include <linux/init.h>
 
 #include "rtc8564.h"
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] ds1337 driver works also with ds1339 chip
  2005-06-22  5:17                       ` [PATCH] I2C: ds1337: search by bus number Greg KH
@ 2005-06-22  5:17                         ` Greg KH
  2005-06-22  5:17                           ` [PATCH] ds1337: export ds1337_do_command Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] ds1337 driver works also with ds1339 chip

On Wed, May 04, 2005 at 12:07:11PM +0200, Jean Delvare wrote:
> Additionally, I would welcome an additional patch documenting the fact
> that the ds1337 driver will work fine with the Dallas DS1339 real-time
> clock chip.

Document the fact that ds1337 driver works also with DS1339 real-time
clock chip.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 912b9c0c52b95696165e84d67fdab2af81a2213e
tree a5f560a549354680bd68991e29a15380306650c4
parent 86919833dbeac668762ae7056ead2d35d070f622
author Ladislav Michl <ladis@linux-mips.org> Tue, 10 May 2005 14:08:04 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:52 -0700

 drivers/i2c/chips/Kconfig  |    4 ++--
 drivers/i2c/chips/ds1337.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -379,12 +379,12 @@ menu "Other I2C Chip support"
 	depends on I2C
 
 config SENSORS_DS1337
-	tristate "Dallas Semiconductor DS1337 Real Time Clock"
+	tristate "Dallas Semiconductor DS1337 and DS1339 Real Time Clock"
 	depends on I2C && EXPERIMENTAL
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for Dallas Semiconductor
-	  DS1337 real-time clock chips. 
+	  DS1337 and DS1339 real-time clock chips.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called ds1337.
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
- * Driver for Dallas Semiconductor DS1337 real time clock chip
+ * Driver for Dallas Semiconductor DS1337 and DS1339 real time clock chip
  */
 
 #include <linux/config.h>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337 1/4
  2005-06-22  5:17       ` [PATCH] I2C: rtc8564.c remove duplicate include Greg KH
@ 2005-06-22  5:17         ` Greg KH
  2005-06-22  5:17           ` [PATCH] I2C: mark all functions static in atxp1 driver Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337 1/4

Use i2c_transfer to send message, so we get proper bus locking.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 3e9d0ba1305cd7c6efd2ab3a003e58a27da1796b
tree bdbcf0d4fca8ed72cb59ae89fa9e513bd2c3da3e
parent 69113efac29e5f1b7a03dd4fdca5ede6901f4eb8
author Ladislav Michl <ladis@linux-mips.org> Fri, 08 Apr 2005 15:00:21 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:50 -0700

 drivers/i2c/chips/ds1337.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2005 James Chapman <jchapman@katalix.com>
  *
- *	based on linux/drivers/acron/char/pcf8583.c
+ *	based on linux/drivers/acorn/char/pcf8583.c
  *  Copyright (C) 2000 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
@@ -119,8 +119,7 @@ static int ds1337_get_datetime(struct i2
 	msg[1].len = sizeof(buf);
 	msg[1].buf = &buf[0];
 
-	result = client->adapter->algo->master_xfer(client->adapter,
-						    &msg[0], 2);
+	result = i2c_transfer(client->adapter, msg, 2);
 
 	dev_dbg(&client->adapter->dev,
 		"%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
@@ -194,8 +193,7 @@ static int ds1337_set_datetime(struct i2
 	msg[0].len = sizeof(buf);
 	msg[0].buf = &buf[0];
 
-	result = client->adapter->algo->master_xfer(client->adapter,
-						    &msg[0], 1);
+	result = i2c_transfer(client->adapter, msg, 1);
 	if (result < 0) {
 		dev_err(&client->adapter->dev, "ds1337[%d]: error "
 			"writing data! %d\n", data->id, result);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337: Make time format consistent with other RTC drivers
  2005-06-22  5:17               ` [PATCH] I2C: ds1337: i2c_transfer() checking Greg KH
@ 2005-06-22  5:17                 ` Greg KH
  2005-06-22  5:17                   ` [PATCH] I2C: ds1337 2/4 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337: Make time format consistent with other RTC drivers

Make time format consistent with other RTC drivers.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 0b46e334d77b2d3b8b3aa665c81c4afbe9f1f458
tree ecf82d1aa2a4416835a082500970df3784e1194e
parent d01b79d0613ebb6810bb48baf6e53e9319701fea
author Ladislav Michl <ladis@linux-mips.org> Wed, 04 May 2005 08:13:13 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:51 -0700

 drivers/i2c/chips/ds1337.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -130,8 +130,8 @@ static int ds1337_get_datetime(struct i2
 		dt->tm_wday = BCD2BIN(buf[3]) - 1;
 		dt->tm_mday = BCD2BIN(buf[4]);
 		val = buf[5] & 0x7f;
-		dt->tm_mon = BCD2BIN(val);
-		dt->tm_year = 1900 + BCD2BIN(buf[6]);
+		dt->tm_mon = BCD2BIN(val) - 1;
+		dt->tm_year = BCD2BIN(buf[6]);
 		if (buf[5] & 0x80)
 			dt->tm_year += 100;
 
@@ -171,12 +171,11 @@ static int ds1337_set_datetime(struct i2
 	buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
 	buf[4] = BIN2BCD(dt->tm_wday) + 1;
 	buf[5] = BIN2BCD(dt->tm_mday);
-	buf[6] = BIN2BCD(dt->tm_mon);
-	if (dt->tm_year >= 2000) {
-		val = dt->tm_year - 2000;
+	buf[6] = BIN2BCD(dt->tm_mon) + 1;
+	val = dt->tm_year;
+	if (val >= 100) {
+		val -= 100;
 		buf[6] |= (1 << 7);
-	} else {
-		val = dt->tm_year - 1900;
 	}
 	buf[7] = BIN2BCD(val);
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: add new atxp1 driver
  2005-06-22  5:17           ` [PATCH] I2C: mark all functions static in atxp1 driver Greg KH
@ 2005-06-22  5:17             ` Greg KH
  2005-06-22  5:17               ` [PATCH] I2C: ds1337: i2c_transfer() checking Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: se.witt

[PATCH] I2C: add new atxp1 driver

Adds support for the Attansic ATXP1 I2C device, found on some x86
plattforms to change CPU and other voltages.  Depends on the previous
i2c-vid.h patch.

Signed-off-by: Sebastian Witt <se.witt@gmx.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 9cb7d18433ea6db04b3999e8d0b8f52fba551c2d
tree 0feff7401b43c5b3b2def0ae64db8f6c385a596b
parent 3886246a257e828248ce1e72ced00408a3557f0d
author Sebastian Witt <se.witt@gmx.net> Wed, 13 Apr 2005 22:27:53 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:50 -0700

 drivers/i2c/chips/Kconfig  |   13 ++
 drivers/i2c/chips/Makefile |    1 
 drivers/i2c/chips/atxp1.c  |  361 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 375 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -62,6 +62,19 @@ config SENSORS_ASB100
 	  This driver can also be built as a module.  If so, the module
 	  will be called asb100.
 
+config SENSORS_ATXP1
+	tristate "Attansic ATXP1 VID controller"
+	depends on I2C && EXPERIMENTAL
+	help
+	  If you say yes here you get support for the Attansic ATXP1 VID
+	  controller.
+
+	  If your board have such a chip, you are able to control your CPU
+	  core and other voltages.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called atxp1.
+
 config SENSORS_DS1621
 	tristate "Dallas Semiconductor DS1621 and DS1625"
 	depends on I2C && EXPERIMENTAL
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021
 obj-$(CONFIG_SENSORS_ADM1025)	+= adm1025.o
 obj-$(CONFIG_SENSORS_ADM1026)	+= adm1026.o
 obj-$(CONFIG_SENSORS_ADM1031)	+= adm1031.o
+obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_DS1337)	+= ds1337.o
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_EEPROM)	+= eeprom.o
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/i2c/chips/atxp1.c
new file mode 100644
--- /dev/null
+++ b/drivers/i2c/chips/atxp1.c
@@ -0,0 +1,361 @@
+/*
+    atxp1.c - kernel module for setting CPU VID and general purpose
+                     I/Os using the Attansic ATXP1 chip.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/i2c-vid.h>
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
+MODULE_VERSION("0.6.2");
+MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
+
+#define ATXP1_VID	0x00
+#define ATXP1_CVID	0x01
+#define ATXP1_GPIO1	0x06
+#define ATXP1_GPIO2	0x0a
+#define ATXP1_VIDENA	0x20
+#define ATXP1_VIDMASK	0x1f
+#define ATXP1_GPIO1MASK	0x0f
+
+static unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+
+SENSORS_INSMOD_1(atxp1);
+
+static int atxp1_attach_adapter(struct i2c_adapter * adapter);
+static int atxp1_detach_client(struct i2c_client * client);
+static struct atxp1_data * atxp1_update_device(struct device *dev);
+static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind);
+
+static struct i2c_driver atxp1_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "atxp1",
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter = atxp1_attach_adapter,
+	.detach_client	= atxp1_detach_client,
+};
+
+struct atxp1_data {
+	struct i2c_client client;
+	struct semaphore update_lock;
+	unsigned long last_updated;
+	u8 valid;
+	struct {
+		u8 vid;		/* VID output register */
+		u8 cpu_vid; /* VID input from CPU */
+		u8 gpio1;   /* General purpose I/O register 1 */
+		u8 gpio2;   /* General purpose I/O register 2 */
+	} reg;
+	u8 vrm;			/* Detected CPU VRM */
+};
+
+static struct atxp1_data * atxp1_update_device(struct device *dev)
+{
+	struct i2c_client *client;
+	struct atxp1_data *data;
+
+	client = to_i2c_client(dev);
+	data = i2c_get_clientdata(client);
+
+	down(&data->update_lock);
+
+	if ((jiffies - data->last_updated > HZ) ||
+	    (jiffies < data->last_updated) ||
+	    !data->valid) {
+
+		/* Update local register data */
+		data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID);
+		data->reg.cpu_vid = i2c_smbus_read_byte_data(client, ATXP1_CVID);
+		data->reg.gpio1 = i2c_smbus_read_byte_data(client, ATXP1_GPIO1);
+		data->reg.gpio2 = i2c_smbus_read_byte_data(client, ATXP1_GPIO2);
+
+		data->valid = 1;
+	}
+
+	up(&data->update_lock);
+
+	return(data);
+}
+
+/* sys file functions for cpu0_vid */
+ssize_t atxp1_showvcore(struct device *dev, char *buf)
+{
+	int size;
+	struct atxp1_data *data;
+
+	data = atxp1_update_device(dev);
+
+	size = sprintf(buf, "%d\n", vid_from_reg(data->reg.vid & ATXP1_VIDMASK, data->vrm));
+
+	return size;
+}
+
+ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count)
+{
+	struct atxp1_data *data;
+	struct i2c_client *client;
+	char vid;
+	char cvid;
+	unsigned int vcore;
+
+	client = to_i2c_client(dev);
+	data = atxp1_update_device(dev);
+
+	vcore = simple_strtoul(buf, NULL, 10);
+	vcore /= 25;
+	vcore *= 25;
+
+	/* Calculate VID */
+	vid = vid_to_reg(vcore, data->vrm);
+
+	if (vid < 0) {
+		dev_err(dev, "VID calculation failed.\n");
+		return -1;
+	}
+
+	/* If output enabled, use control register value. Otherwise original CPU VID */
+	if (data->reg.vid & ATXP1_VIDENA)
+		cvid = data->reg.vid & ATXP1_VIDMASK;
+	else
+		cvid = data->reg.cpu_vid;
+
+	/* Nothing changed, aborting */
+	if (vid == cvid)
+		return count;
+
+	dev_info(dev, "Setting VCore to %d mV (0x%02x)\n", vcore, vid);
+
+	/* Write every 25 mV step to increase stability */
+	if (cvid > vid) {
+		for (; cvid >= vid; cvid--) {
+        		i2c_smbus_write_byte_data(client, ATXP1_VID, cvid | ATXP1_VIDENA);
+		}
+	}
+	else {
+		for (; cvid <= vid; cvid++) {
+        		i2c_smbus_write_byte_data(client, ATXP1_VID, cvid | ATXP1_VIDENA);
+		}
+	}
+
+	data->valid = 0;
+
+	return count;
+}
+
+/* CPU core reference voltage
+    unit: millivolt
+*/
+static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore);
+
+/* sys file functions for GPIO1 */
+ssize_t atxp1_showgpio1(struct device *dev, char *buf)
+{
+	int size;
+	struct atxp1_data *data;
+
+	data = atxp1_update_device(dev);
+
+	size = sprintf(buf, "0x%02x\n", data->reg.gpio1 & ATXP1_GPIO1MASK);
+
+	return size;
+}
+
+ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count)
+{
+	struct atxp1_data *data;
+	struct i2c_client *client;
+	unsigned int value;
+
+	client = to_i2c_client(dev);
+	data = atxp1_update_device(dev);
+
+	value = simple_strtoul(buf, NULL, 16);
+
+	value &= ATXP1_GPIO1MASK;
+
+	if (value != (data->reg.gpio1 & ATXP1_GPIO1MASK)) {
+		dev_info(dev, "Writing 0x%x to GPIO1.\n", value);
+
+		i2c_smbus_write_byte_data(client, ATXP1_GPIO1, value);
+
+		data->valid = 0;
+	}
+
+	return count;
+}
+
+/* GPIO1 data register
+    unit: Four bit as hex (e.g. 0x0f)
+*/
+static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1);
+
+/* sys file functions for GPIO2 */
+ssize_t atxp1_showgpio2(struct device *dev, char *buf)
+{
+	int size;
+	struct atxp1_data *data;
+
+	data = atxp1_update_device(dev);
+
+	size = sprintf(buf, "0x%02x\n", data->reg.gpio2);
+
+	return size;
+}
+
+ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count)
+{
+	struct atxp1_data *data;
+	struct i2c_client *client;
+	unsigned int value;
+
+	client = to_i2c_client(dev);
+	data = atxp1_update_device(dev);
+
+	value = simple_strtoul(buf, NULL, 16) & 0xff;
+
+	if (value != data->reg.gpio2) {
+		dev_info(dev, "Writing 0x%x to GPIO1.\n", value);
+
+		i2c_smbus_write_byte_data(client, ATXP1_GPIO2, value);
+
+		data->valid = 0;
+	}
+
+	return count;
+}
+
+/* GPIO2 data register
+    unit: Eight bit as hex (e.g. 0xff)
+*/
+static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2);
+
+
+static int atxp1_attach_adapter(struct i2c_adapter *adapter)
+{
+	return i2c_detect(adapter, &addr_data, &atxp1_detect);
+};
+
+static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client * new_client;
+	struct atxp1_data * data;
+	int err = 0;
+	u8 temp;
+
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+		goto exit;
+
+	if (!(data = kmalloc(sizeof(struct atxp1_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	memset(data, 0, sizeof(struct atxp1_data));
+	new_client = &data->client;
+	i2c_set_clientdata(new_client, data);
+
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &atxp1_driver;
+	new_client->flags = 0;
+
+	/* Detect ATXP1, checking if vendor ID registers are all zero */
+	if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) &&
+	     (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) &&
+	     (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) &&
+	     (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) {
+
+		/* No vendor ID, now checking if registers 0x10,0x11 (non-existent)
+		 * showing the same as register 0x00 */
+		temp = i2c_smbus_read_byte_data(new_client, 0x00);
+
+		if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) &&
+			 (i2c_smbus_read_byte_data(new_client, 0x11) == temp) ))
+			goto exit_free;
+	}
+
+	/* Get VRM */
+	data->vrm = i2c_which_vrm();
+
+	if ((data->vrm != 90) && (data->vrm != 91)) {
+		dev_err(&new_client->dev, "Not supporting VRM %d.%d\n",
+				data->vrm / 10, data->vrm % 10);
+		goto exit_free;
+	}
+
+	strncpy(new_client->name, "atxp1", I2C_NAME_SIZE);
+
+	data->valid = 0;
+
+	init_MUTEX(&data->update_lock);
+
+	err = i2c_attach_client(new_client);
+
+	if (err)
+	{
+		dev_err(&new_client->dev, "Attach client error.\n");
+		goto exit_free;
+	}
+
+	device_create_file(&new_client->dev, &dev_attr_gpio1);
+	device_create_file(&new_client->dev, &dev_attr_gpio2);
+	device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
+
+	dev_info(&new_client->dev, "Using VRM: %d.%d\n",
+			 data->vrm / 10, data->vrm % 10);
+
+	return 0;
+
+exit_free:
+	kfree(data);
+exit:
+	return err;
+};
+
+static int atxp1_detach_client(struct i2c_client * client)
+{
+	int err;
+
+	err = i2c_detach_client(client);
+
+	if (err)
+		dev_err(&client->dev, "Failed to detach client.\n");
+	else
+		kfree(i2c_get_clientdata(client));
+
+	return err;
+};
+
+static int __init atxp1_init(void)
+{
+	return i2c_add_driver(&atxp1_driver);
+};
+
+static void __exit atxp1_exit(void)
+{
+	i2c_del_driver(&atxp1_driver);
+};
+
+module_init(atxp1_init);
+module_exit(atxp1_exit);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: mark all functions static in atxp1 driver
  2005-06-22  5:17         ` [PATCH] I2C: ds1337 1/4 Greg KH
@ 2005-06-22  5:17           ` Greg KH
  2005-06-22  5:17             ` [PATCH] I2C: add new " Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: gregkh

[PATCH] I2C: mark all functions static in atxp1 driver

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 69113efac29e5f1b7a03dd4fdca5ede6901f4eb8
tree 5decc38a1b2f5ede2f8d987c1f749f28a5432556
parent 9cb7d18433ea6db04b3999e8d0b8f52fba551c2d
author Greg K-H <gregkh@suse.de> Tue, 05 Apr 2005 18:00:47 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:50 -0700

 drivers/i2c/chips/atxp1.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/chips/atxp1.c b/drivers/i2c/chips/atxp1.c
--- a/drivers/i2c/chips/atxp1.c
+++ b/drivers/i2c/chips/atxp1.c
@@ -99,7 +99,7 @@ static struct atxp1_data * atxp1_update_
 }
 
 /* sys file functions for cpu0_vid */
-ssize_t atxp1_showvcore(struct device *dev, char *buf)
+static ssize_t atxp1_showvcore(struct device *dev, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -111,7 +111,7 @@ ssize_t atxp1_showvcore(struct device *d
 	return size;
 }
 
-ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
@@ -169,7 +169,7 @@ ssize_t atxp1_storevcore(struct device *
 static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore);
 
 /* sys file functions for GPIO1 */
-ssize_t atxp1_showgpio1(struct device *dev, char *buf)
+static ssize_t atxp1_showgpio1(struct device *dev, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -181,7 +181,7 @@ ssize_t atxp1_showgpio1(struct device *d
 	return size;
 }
 
-ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
@@ -211,7 +211,7 @@ ssize_t atxp1_storegpio1(struct device *
 static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1);
 
 /* sys file functions for GPIO2 */
-ssize_t atxp1_showgpio2(struct device *dev, char *buf)
+static ssize_t atxp1_showgpio2(struct device *dev, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -223,7 +223,7 @@ ssize_t atxp1_showgpio2(struct device *d
 	return size;
 }
 
-ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337 3/4
  2005-06-22  5:17                   ` [PATCH] I2C: ds1337 2/4 Greg KH
@ 2005-06-22  5:17                     ` Greg KH
  2005-06-22  5:17                       ` [PATCH] I2C: ds1337: search by bus number Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337 3/4

dev_{dbg,err} functions should print client's device name. data->id can
be dropped from message, because device is determined by bus it hangs on
(it has fixed address).

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit d01b79d0613ebb6810bb48baf6e53e9319701fea
tree 49f92093fae3b372011b1f2855cf581d9a1ad1e4
parent 6069ffde15472da9d041a58df490d388bb175d51
author Ladislav Michl <ladis@linux-mips.org> Fri, 08 Apr 2005 15:06:39 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:51 -0700

 drivers/i2c/chips/ds1337.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -95,7 +95,6 @@ static inline int ds1337_read(struct i2c
  */
 static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
 {
-	struct ds1337_data *data = i2c_get_clientdata(client);
 	int result;
 	u8 buf[7];
 	u8 val;
@@ -103,9 +102,7 @@ static int ds1337_get_datetime(struct i2
 	u8 offs = 0;
 
 	if (!dt) {
-		dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n",
-			__FUNCTION__);
-
+		dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
 		return -EINVAL;
 	}
 
@@ -121,8 +118,7 @@ static int ds1337_get_datetime(struct i2
 
 	result = i2c_transfer(client->adapter, msg, 2);
 
-	dev_dbg(&client->adapter->dev,
-		"%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
+	dev_dbg(&client->dev, "%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
 		__FUNCTION__, result, buf[0], buf[1], buf[2], buf[3],
 		buf[4], buf[5], buf[6]);
 
@@ -139,14 +135,13 @@ static int ds1337_get_datetime(struct i2
 		if (buf[5] & 0x80)
 			dt->tm_year += 100;
 
-		dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, "
+		dev_dbg(&client->dev, "%s: secs=%d, mins=%d, "
 			"hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
 			__FUNCTION__, dt->tm_sec, dt->tm_min,
 			dt->tm_hour, dt->tm_mday,
 			dt->tm_mon, dt->tm_year, dt->tm_wday);
 	} else {
-		dev_err(&client->adapter->dev, "ds1337[%d]: error reading "
-			"data! %d\n", data->id, result);
+		dev_err(&client->dev, "error reading data! %d\n", result);
 		result = -EIO;
 	}
 
@@ -155,20 +150,17 @@ static int ds1337_get_datetime(struct i2
 
 static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
 {
-	struct ds1337_data *data = i2c_get_clientdata(client);
 	int result;
 	u8 buf[8];
 	u8 val;
 	struct i2c_msg msg[1];
 
 	if (!dt) {
-		dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n",
-			__FUNCTION__);
-
+		dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
 		return -EINVAL;
 	}
 
-	dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, hours=%d, "
+	dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
 		"mday=%d, mon=%d, year=%d, wday=%d\n", __FUNCTION__,
 		dt->tm_sec, dt->tm_min, dt->tm_hour,
 		dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday);
@@ -195,8 +187,7 @@ static int ds1337_set_datetime(struct i2
 
 	result = i2c_transfer(client->adapter, msg, 1);
 	if (result < 0) {
-		dev_err(&client->adapter->dev, "ds1337[%d]: error "
-			"writing data! %d\n", data->id, result);
+		dev_err(&client->dev, "error writing data! %d\n", result);
 		result = -EIO;
 	} else {
 		result = 0;
@@ -208,7 +199,7 @@ static int ds1337_set_datetime(struct i2
 static int ds1337_command(struct i2c_client *client, unsigned int cmd,
 			  void *arg)
 {
-	dev_dbg(&client->adapter->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
+	dev_dbg(&client->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
 
 	switch (cmd) {
 	case DS1337_GET_DATE:


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337: i2c_transfer() checking
  2005-06-22  5:17             ` [PATCH] I2C: add new " Greg KH
@ 2005-06-22  5:17               ` Greg KH
  2005-06-22  5:17                 ` [PATCH] I2C: ds1337: Make time format consistent with other RTC drivers Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337: i2c_transfer() checking

i2c_transfer returns number of sucessfully transfered messages. Change
error checking to accordingly. (ds1337_set_datetime never returned
sucess)

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 00588243053bb40d0406c7843833f8fae81294ab
tree abf967a76d51f002a878ce6e6544c0b1c6cde62e
parent 0b46e334d77b2d3b8b3aa665c81c4afbe9f1f458
author Ladislav Michl <ladis@linux-mips.org> Wed, 04 May 2005 08:13:54 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:51 -0700

 drivers/i2c/chips/ds1337.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -122,7 +122,7 @@ static int ds1337_get_datetime(struct i2
 		__FUNCTION__, result, buf[0], buf[1], buf[2], buf[3],
 		buf[4], buf[5], buf[6]);
 
-	if (result >= 0) {
+	if (result == 2) {
 		dt->tm_sec = BCD2BIN(buf[0]);
 		dt->tm_min = BCD2BIN(buf[1]);
 		val = buf[2] & 0x3f;
@@ -140,12 +140,12 @@ static int ds1337_get_datetime(struct i2
 			__FUNCTION__, dt->tm_sec, dt->tm_min,
 			dt->tm_hour, dt->tm_mday,
 			dt->tm_mon, dt->tm_year, dt->tm_wday);
-	} else {
-		dev_err(&client->dev, "error reading data! %d\n", result);
-		result = -EIO;
+
+		return 0;
 	}
 
-	return result;
+	dev_err(&client->dev, "error reading data! %d\n", result);
+	return -EIO;
 }
 
 static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
@@ -185,14 +185,11 @@ static int ds1337_set_datetime(struct i2
 	msg[0].buf = &buf[0];
 
 	result = i2c_transfer(client->adapter, msg, 1);
-	if (result < 0) {
-		dev_err(&client->dev, "error writing data! %d\n", result);
-		result = -EIO;
-	} else {
-		result = 0;
-	}
+	if (result == 1)
+		return 0;
 
-	return result;
+	dev_err(&client->dev, "error writing data! %d\n", result);
+	return -EIO;
 }
 
 static int ds1337_command(struct i2c_client *client, unsigned int cmd,


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337 2/4
  2005-06-22  5:17                 ` [PATCH] I2C: ds1337: Make time format consistent with other RTC drivers Greg KH
@ 2005-06-22  5:17                   ` Greg KH
  2005-06-22  5:17                     ` [PATCH] I2C: ds1337 3/4 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337 2/4

Use correct macros to convert between bdc and bin. See linux/bcd.h

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 6069ffde15472da9d041a58df490d388bb175d51
tree 0e1b536969aafe6bb3a9a567be46a61b8be91886
parent 3e9d0ba1305cd7c6efd2ab3a003e58a27da1796b
author Ladislav Michl <ladis@linux-mips.org> Fri, 08 Apr 2005 15:02:16 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:51 -0700

 drivers/i2c/chips/ds1337.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -127,15 +127,15 @@ static int ds1337_get_datetime(struct i2
 		buf[4], buf[5], buf[6]);
 
 	if (result >= 0) {
-		dt->tm_sec = BCD_TO_BIN(buf[0]);
-		dt->tm_min = BCD_TO_BIN(buf[1]);
+		dt->tm_sec = BCD2BIN(buf[0]);
+		dt->tm_min = BCD2BIN(buf[1]);
 		val = buf[2] & 0x3f;
-		dt->tm_hour = BCD_TO_BIN(val);
-		dt->tm_wday = BCD_TO_BIN(buf[3]) - 1;
-		dt->tm_mday = BCD_TO_BIN(buf[4]);
+		dt->tm_hour = BCD2BIN(val);
+		dt->tm_wday = BCD2BIN(buf[3]) - 1;
+		dt->tm_mday = BCD2BIN(buf[4]);
 		val = buf[5] & 0x7f;
-		dt->tm_mon = BCD_TO_BIN(val);
-		dt->tm_year = 1900 + BCD_TO_BIN(buf[6]);
+		dt->tm_mon = BCD2BIN(val);
+		dt->tm_year = 1900 + BCD2BIN(buf[6]);
 		if (buf[5] & 0x80)
 			dt->tm_year += 100;
 
@@ -174,19 +174,19 @@ static int ds1337_set_datetime(struct i2
 		dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday);
 
 	buf[0] = 0;		/* reg offset */
-	buf[1] = BIN_TO_BCD(dt->tm_sec);
-	buf[2] = BIN_TO_BCD(dt->tm_min);
-	buf[3] = BIN_TO_BCD(dt->tm_hour) | (1 << 6);
-	buf[4] = BIN_TO_BCD(dt->tm_wday) + 1;
-	buf[5] = BIN_TO_BCD(dt->tm_mday);
-	buf[6] = BIN_TO_BCD(dt->tm_mon);
+	buf[1] = BIN2BCD(dt->tm_sec);
+	buf[2] = BIN2BCD(dt->tm_min);
+	buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
+	buf[4] = BIN2BCD(dt->tm_wday) + 1;
+	buf[5] = BIN2BCD(dt->tm_mday);
+	buf[6] = BIN2BCD(dt->tm_mon);
 	if (dt->tm_year >= 2000) {
 		val = dt->tm_year - 2000;
 		buf[6] |= (1 << 7);
 	} else {
 		val = dt->tm_year - 1900;
 	}
-	buf[7] = BIN_TO_BCD(val);
+	buf[7] = BIN2BCD(val);
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: ds1337: search by bus number
  2005-06-22  5:17                     ` [PATCH] I2C: ds1337 3/4 Greg KH
@ 2005-06-22  5:17                       ` Greg KH
  2005-06-22  5:17                         ` [PATCH] ds1337 driver works also with ds1339 chip Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] I2C: ds1337: search by bus number

Chip is searched by bus number rather than its own proprietary id.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 86919833dbeac668762ae7056ead2d35d070f622
tree 5c704a3c8fb85f44cde1102d7e6f09508427be4d
parent 00588243053bb40d0406c7843833f8fae81294ab
author Ladislav Michl <ladis@linux-mips.org> Wed, 04 May 2005 08:14:38 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:52 -0700

 drivers/i2c/chips/ds1337.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -69,13 +69,11 @@ static struct i2c_driver ds1337_driver =
 struct ds1337_data {
 	struct i2c_client client;
 	struct list_head list;
-	int id;
 };
 
 /*
  * Internal variables
  */
-static int ds1337_id;
 static LIST_HEAD(ds1337_clients);
 
 static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
@@ -213,7 +211,7 @@ static int ds1337_command(struct i2c_cli
  * Public API for access to specific device. Useful for low-level
  * RTC access from kernel code.
  */
-int ds1337_do_command(int id, int cmd, void *arg)
+int ds1337_do_command(int bus, int cmd, void *arg)
 {
 	struct list_head *walk;
 	struct list_head *tmp;
@@ -221,7 +219,7 @@ int ds1337_do_command(int id, int cmd, v
 
 	list_for_each_safe(walk, tmp, &ds1337_clients) {
 		data = list_entry(walk, struct ds1337_data, list);
-		if (data->id == id)
+		if (data->client.adapter->nr == bus)
 			return ds1337_command(&data->client, cmd, arg);
 	}
 
@@ -331,7 +329,6 @@ static int ds1337_detect(struct i2c_adap
 	ds1337_init_client(new_client);
 
 	/* Add client to local list */
-	data->id = ds1337_id++;
 	list_add(&data->list, &ds1337_clients);
 
 	return 0;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Allow for sharing of the interrupt line for i2c-mpc.c
  2005-06-22  5:17                                       ` [PATCH] I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1 Greg KH
@ 2005-06-22  5:17                                         ` Greg KH
  2005-06-22  5:17                                           ` [PATCH] Spelling fixes for drivers/i2c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: galak

[PATCH] I2C: Allow for sharing of the interrupt line for i2c-mpc.c

I2C-MPC: Allow for sharing of the interrupt line

On the MPC8548 devices we have multiple I2C-MPC buses however they are on the
same interrupt line.  Made request_irq pass SA_SHIRQ now so the second bus can
register for the same IRQ.

Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 30aedcb33970367e50b5edf373e9cd1a5cebcbe1
tree 8b94e494c2fd0d8c874500bc1b0733eef64d831b
parent 44bbe87e9017efa050bb1b506c6822f1f3bb94d7
author Kumar Gala <galak@freescale.com> Tue, 03 May 2005 18:50:38 -0500
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:55 -0700

 drivers/i2c/busses/i2c-mpc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -325,7 +325,7 @@ static int __devinit mpc_i2c_probe(struc
 	if (i2c->irq != OCP_IRQ_NA)
 	{
 		if ((result = request_irq(ocp->def->irq, mpc_i2c_isr,
-					  0, "i2c-mpc", i2c)) < 0) {
+					  SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
 			printk(KERN_ERR
 			       "i2c-mpc - failed to attach interrupt\n");
 			goto fail_irq;
@@ -424,7 +424,7 @@ static int fsl_i2c_probe(struct device *
 
 	if (i2c->irq != 0)
 		if ((result = request_irq(i2c->irq, mpc_i2c_isr,
-					  0, "fsl-i2c", i2c)) < 0) {
+					  SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
 			printk(KERN_ERR
 			       "i2c-mpc - failed to attach interrupt\n");
 			goto fail_irq;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: #include <linux/config.h> cleanup
  2005-06-22  5:17                             ` [PATCH] I2C: add new hardware monitor driver: adm9240 Greg KH
@ 2005-06-22  5:17                               ` Greg KH
  2005-06-22  5:17                                 ` [PATCH] I2C: drivers/i2c/*: " Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: #include <linux/config.h> cleanup

Hi Alexey,

> Files that don't use CONFIG_* stuff shouldn't include config.h
> Files that use CONFIG_* stuff should include config.h
>
> It's that simple. ;-)

I agree. This won't change anything though, as all drivers include
either device.h or module.h, which in turn include config.h. But you are
still correct, so I approve your patch.

For completeness, I would propose the following on top of your own
patch:

i2c bus drivers do not need to define DEBUG themselves, as the Kconfig
system takes care of it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit a551ef79d9413727f76d22dc47b5b15d1d03073b
tree 4b43e032dc6b6cb5de78ce700b12762ab71483e0
parent f0bb60e7b1a0a26c25d8cbf81dda7afbc8bd2982
author Jean Delvare <khali@linux-fr.org> Sat, 16 Apr 2005 18:49:22 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:53 -0700

 drivers/i2c/busses/i2c-ixp2000.c |    5 -----
 drivers/i2c/busses/i2c-ixp4xx.c  |    5 -----
 2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -26,11 +26,6 @@
  * 'enabled' to drive the GPIOs.
  */
 
-#include <linux/config.h>
-#ifdef CONFIG_I2C_DEBUG_BUS
-#define DEBUG	1
-#endif
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -26,11 +26,6 @@
  *       that is passed as the platform_data to this driver.
  */
 
-#include <linux/config.h>
-#ifdef CONFIG_I2C_DEBUG_BUS
-#define DEBUG	1
-#endif
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: New hardware monitoring driver: w83627ehf
  2005-06-22  5:17                                 ` [PATCH] I2C: drivers/i2c/*: " Greg KH
@ 2005-06-22  5:17                                   ` Greg KH
  2005-06-22  5:17                                     ` [PATCH] I2C: Fix bugs in the new w83627ehf driver Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: New hardware monitoring driver: w83627ehf

This is a new hardware monitoring driver, w83627ehf, which supports the
Winbond W83627EHF Super-I/O chip. The driver is not complete, but
already usable. It only implements fan speed and temperature monitoring,
while the chip also supports voltage inputs with VID, PWM output and
temperature sensor selection. I have no more time to work on this, but
anyone with supported hardware could add the missing functionalities
later.

This driver is largely derived from the w83627hf driver.

Thanks to Leon Moonen and Steve Cliffe for tesing the preliminary
versions of my driver and reporting the problems they encountered.

Thanks to Grant Coady for noticing and fixing various corner cases in
the fan management. This third version of the driver hopefully addresses
all the issues the original version had.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 08e7e2789e0da49eadeb17121e24af22efeee84b
tree 0e7edd2ffc4ad0a3b1e5c5fe070fb1bc460696cf
parent 40b5cda28aafe3744d8808c21f7959e472a9ecb1
author Jean Delvare <khali@linux-fr.org> Mon, 25 Apr 2005 22:43:25 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:54 -0700

 drivers/i2c/chips/Kconfig     |   14 +
 drivers/i2c/chips/Makefile    |    1 
 drivers/i2c/chips/w83627ehf.c |  839 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 854 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -384,6 +384,20 @@ config SENSORS_W83627HF
 	  This driver can also be built as a module.  If so, the module
 	  will be called w83627hf.
 
+config SENSORS_W83627EHF
+	tristate "Winbond W83627EHF"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get preliminary support for the hardware
+	  monitoring functionality of the Winbond W83627EHF Super-I/O chip.
+	  Only fan and temperature inputs are supported at the moment, while
+	  the chip does much more than that.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83627ehf.
+
 endmenu
 
 menu "Other I2C Chip support"
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
+obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
 
diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/i2c/chips/w83627ehf.c
new file mode 100644
--- /dev/null
+++ b/drivers/i2c/chips/w83627ehf.c
@@ -0,0 +1,839 @@
+/*
+    w83627ehf - Driver for the hardware monitoring functionality of
+                the Winbond W83627EHF Super-I/O chip
+    Copyright (C) 2005  Jean Delvare <khali@linux-fr.org>
+
+    Shamelessly ripped from the w83627hf driver
+    Copyright (C) 2003  Mark Studebaker
+
+    Thanks to Leon Moonen, Steve Cliffe and Grant Coady for their help
+    in testing and debugging this driver.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+    Supports the following chips:
+
+    Chip        #vin    #fan    #pwm    #temp   chip_id man_id
+    w83627ehf   -       5       -       3       0x88    0x5ca3
+
+    This is a preliminary version of the driver, only supporting the
+    fan and temperature inputs. The chip does much more than that.
+*/
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <asm/io.h>
+#include "lm75.h"
+
+/* Addresses to scan
+   The actual ISA address is read from Super-I/O configuration space */
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
+static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
+
+/* Insmod parameters */
+SENSORS_INSMOD_1(w83627ehf);
+
+/*
+ * Super-I/O constants and functions
+ */
+
+static int REG;		/* The register to read/write */
+static int VAL;		/* The value to read/write */
+
+#define W83627EHF_LD_HWM	0x0b
+
+#define SIO_REG_LDSEL		0x07	/* Logical device select */
+#define SIO_REG_DEVID		0x20	/* Device ID (2 bytes) */
+#define SIO_REG_ENABLE		0x30	/* Logical device enable */
+#define SIO_REG_ADDR		0x60	/* Logical device address (2 bytes) */
+
+#define SIO_W83627EHF_ID	0x8840
+#define SIO_ID_MASK		0xFFC0
+
+static inline void
+superio_outb(int reg, int val)
+{
+	outb(reg, REG);
+	outb(val, VAL);
+}
+
+static inline int
+superio_inb(int reg)
+{
+	outb(reg, REG);
+	return inb(VAL);
+}
+
+static inline void
+superio_select(int ld)
+{
+	outb(SIO_REG_LDSEL, REG);
+	outb(ld, VAL);
+}
+
+static inline void
+superio_enter(void)
+{
+	outb(0x87, REG);
+	outb(0x87, REG);
+}
+
+static inline void
+superio_exit(void)
+{
+	outb(0x02, REG);
+	outb(0x02, VAL);
+}
+
+/*
+ * ISA constants
+ */
+
+#define REGION_LENGTH		8
+#define ADDR_REG_OFFSET		5
+#define DATA_REG_OFFSET		6
+
+#define W83627EHF_REG_BANK		0x4E
+#define W83627EHF_REG_CONFIG		0x40
+#define W83627EHF_REG_CHIP_ID		0x49
+#define W83627EHF_REG_MAN_ID		0x4F
+
+static const u16 W83627EHF_REG_FAN[] = { 0x28, 0x29, 0x2a, 0x3f, 0x553 };
+static const u16 W83627EHF_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d, 0x3e, 0x55c };
+
+#define W83627EHF_REG_TEMP1		0x27
+#define W83627EHF_REG_TEMP1_HYST	0x3a
+#define W83627EHF_REG_TEMP1_OVER	0x39
+static const u16 W83627EHF_REG_TEMP[] = { 0x150, 0x250 };
+static const u16 W83627EHF_REG_TEMP_HYST[] = { 0x153, 0x253 };
+static const u16 W83627EHF_REG_TEMP_OVER[] = { 0x155, 0x255 };
+static const u16 W83627EHF_REG_TEMP_CONFIG[] = { 0x152, 0x252 };
+
+/* Fan clock dividers are spread over the following five registers */
+#define W83627EHF_REG_FANDIV1		0x47
+#define W83627EHF_REG_FANDIV2		0x4B
+#define W83627EHF_REG_VBAT		0x5D
+#define W83627EHF_REG_DIODE		0x59
+#define W83627EHF_REG_SMI_OVT		0x4C
+
+/*
+ * Conversions
+ */
+
+static inline unsigned int
+fan_from_reg(u8 reg, unsigned int div)
+{
+	if (reg == 0 || reg == 255)
+		return 0;
+	return 1350000U / (reg * div);
+}
+
+static inline unsigned int
+div_from_reg(u8 reg)
+{
+	return 1 << reg;
+}
+
+static inline int
+temp1_from_reg(s8 reg)
+{
+	return reg * 1000;
+}
+
+static inline s8
+temp1_to_reg(int temp)
+{
+	if (temp <= -128000)
+		return -128;
+	if (temp >= 127000)
+		return 127;
+	if (temp < 0)
+		return (temp - 500) / 1000;
+	return (temp + 500) / 1000;
+}
+
+/*
+ * Data structures and manipulation thereof
+ */
+
+struct w83627ehf_data {
+	struct i2c_client client;
+	struct semaphore lock;
+
+	struct semaphore update_lock;
+	char valid;		/* !=0 if following fields are valid */
+	unsigned long last_updated;	/* In jiffies */
+
+	/* Register values */
+	u8 fan[5];
+	u8 fan_min[5];
+	u8 fan_div[5];
+	u8 has_fan;		/* some fan inputs can be disabled */
+	s8 temp1;
+	s8 temp1_max;
+	s8 temp1_max_hyst;
+	s16 temp[2];
+	s16 temp_max[2];
+	s16 temp_max_hyst[2];
+};
+
+static inline int is_word_sized(u16 reg)
+{
+	return (((reg & 0xff00) == 0x100
+	      || (reg & 0xff00) == 0x200)
+	     && ((reg & 0x00ff) == 0x50
+	      || (reg & 0x00ff) == 0x53
+	      || (reg & 0x00ff) == 0x55));
+}
+
+/* We assume that the default bank is 0, thus the following two functions do
+   nothing for registers which live in bank 0. For others, they respectively
+   set the bank register to the correct value (before the register is
+   accessed), and back to 0 (afterwards). */
+static inline void w83627ehf_set_bank(struct i2c_client *client, u16 reg)
+{
+	if (reg & 0xff00) {
+		outb_p(W83627EHF_REG_BANK, client->addr + ADDR_REG_OFFSET);
+		outb_p(reg >> 8, client->addr + DATA_REG_OFFSET);
+	}
+}
+
+static inline void w83627ehf_reset_bank(struct i2c_client *client, u16 reg)
+{
+	if (reg & 0xff00) {
+		outb_p(W83627EHF_REG_BANK, client->addr + ADDR_REG_OFFSET);
+		outb_p(0, client->addr + DATA_REG_OFFSET);
+	}
+}
+
+static u16 w83627ehf_read_value(struct i2c_client *client, u16 reg)
+{
+	struct w83627ehf_data *data = i2c_get_clientdata(client);
+	int res, word_sized = is_word_sized(reg);
+
+	down(&data->lock);
+
+	w83627ehf_set_bank(client, reg);
+	outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
+	res = inb_p(client->addr + DATA_REG_OFFSET);
+	if (word_sized) {
+		outb_p((reg & 0xff) + 1,
+		       client->addr + ADDR_REG_OFFSET);
+		res = (res << 8) + inb_p(client->addr + DATA_REG_OFFSET);
+	}
+	w83627ehf_reset_bank(client, reg);
+
+	up(&data->lock);
+
+	return res;
+}
+
+static int w83627ehf_write_value(struct i2c_client *client, u16 reg, u16 value)
+{
+	struct w83627ehf_data *data = i2c_get_clientdata(client);
+	int word_sized = is_word_sized(reg);
+
+	down(&data->lock);
+
+	w83627ehf_set_bank(client, reg);
+	outb_p(reg & 0xff, client->addr + ADDR_REG_OFFSET);
+	if (word_sized) {
+		outb_p(value >> 8, client->addr + DATA_REG_OFFSET);
+		outb_p((reg & 0xff) + 1,
+		       client->addr + ADDR_REG_OFFSET);
+	}
+	outb_p(value & 0xff, client->addr + DATA_REG_OFFSET);
+	w83627ehf_reset_bank(client, reg);
+
+	up(&data->lock);
+	return 0;
+}
+
+/* This function assumes that the caller holds data->update_lock */
+static void w83627ehf_write_fan_div(struct i2c_client *client, int nr)
+{
+	struct w83627ehf_data *data = i2c_get_clientdata(client);
+	u8 reg;
+
+	switch (nr) {
+	case 0:
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0xcf)
+		    | ((data->fan_div[0] & 0x03) << 4);
+		w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg);
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xdf)
+		    | ((data->fan_div[0] & 0x04) << 3);
+		w83627ehf_write_value(client, W83627EHF_REG_VBAT, reg);
+		break;
+	case 1:
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV1) & 0x3f)
+		    | ((data->fan_div[1] & 0x03) << 6);
+		w83627ehf_write_value(client, W83627EHF_REG_FANDIV1, reg);
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0xbf)
+		    | ((data->fan_div[1] & 0x04) << 4);
+		w83627ehf_write_value(client, W83627EHF_REG_VBAT, reg);
+		break;
+	case 2:
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_FANDIV2) & 0x3f)
+		    | ((data->fan_div[2] & 0x03) << 6);
+		w83627ehf_write_value(client, W83627EHF_REG_FANDIV2, reg);
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_VBAT) & 0x7f)
+		    | ((data->fan_div[2] & 0x04) << 5);
+		w83627ehf_write_value(client, W83627EHF_REG_VBAT, reg);
+		break;
+	case 3:
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0xfc)
+		    | (data->fan_div[3] & 0x03);
+		w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg);
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_SMI_OVT) & 0x7f)
+		    | ((data->fan_div[3] & 0x04) << 5);
+		w83627ehf_write_value(client, W83627EHF_REG_SMI_OVT, reg);
+		break;
+	case 4:
+		reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73)
+		    | ((data->fan_div[4] & 0x03) << 3)
+		    | ((data->fan_div[4] & 0x04) << 5);
+		w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg);
+		break;
+	}
+}
+
+static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct w83627ehf_data *data = i2c_get_clientdata(client);
+	int i;
+
+	down(&data->update_lock);
+
+	if (time_after(jiffies, data->last_updated + HZ)
+	 || !data->valid) {
+		/* Fan clock dividers */
+		i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1);
+		data->fan_div[0] = (i >> 4) & 0x03;
+		data->fan_div[1] = (i >> 6) & 0x03;
+		i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV2);
+		data->fan_div[2] = (i >> 6) & 0x03;
+		i = w83627ehf_read_value(client, W83627EHF_REG_VBAT);
+		data->fan_div[0] |= (i >> 3) & 0x04;
+		data->fan_div[1] |= (i >> 4) & 0x04;
+		data->fan_div[2] |= (i >> 5) & 0x04;
+		if (data->has_fan & ((1 << 3) | (1 << 4))) {
+			i = w83627ehf_read_value(client, W83627EHF_REG_DIODE);
+			data->fan_div[3] = i & 0x03;
+			data->fan_div[4] = ((i >> 2) & 0x03)
+					 | ((i >> 5) & 0x04);
+		}
+		if (data->has_fan & (1 << 3)) {
+			i = w83627ehf_read_value(client, W83627EHF_REG_SMI_OVT);
+			data->fan_div[3] |= (i >> 5) & 0x04;
+		}
+
+		/* Measured fan speeds and limits */
+		for (i = 0; i < 5; i++) {
+			if (!(data->has_fan & (1 << i)))
+				continue;
+
+			data->fan[i] = w83627ehf_read_value(client,
+				       W83627EHF_REG_FAN[i]);
+			data->fan_min[i] = w83627ehf_read_value(client,
+					   W83627EHF_REG_FAN_MIN[i]);
+
+			/* If we failed to measure the fan speed and clock
+			   divider can be increased, let's try that for next
+			   time */
+			if (data->fan[i] == 0xff
+			 && data->fan_div[i] < 0x07) {
+			 	dev_dbg(&client->dev, "Increasing fan %d "
+					"clock divider from %u to %u\n",
+					i, div_from_reg(data->fan_div[i]),
+					div_from_reg(data->fan_div[i] + 1));
+				data->fan_div[i]++;
+				w83627ehf_write_fan_div(client, i);
+				/* Preserve min limit if possible */
+				if (data->fan_min[i] >= 2
+				 && data->fan_min[i] != 255)
+					w83627ehf_write_value(client,
+						W83627EHF_REG_FAN_MIN[i],
+						(data->fan_min[i] /= 2));
+			}
+		}
+
+		/* Measured temperatures and limits */
+		data->temp1 = w83627ehf_read_value(client,
+			      W83627EHF_REG_TEMP1);
+		data->temp1_max = w83627ehf_read_value(client,
+				  W83627EHF_REG_TEMP1_OVER);
+		data->temp1_max_hyst = w83627ehf_read_value(client,
+				       W83627EHF_REG_TEMP1_HYST);
+		for (i = 0; i < 2; i++) {
+			data->temp[i] = w83627ehf_read_value(client,
+					W83627EHF_REG_TEMP[i]);
+			data->temp_max[i] = w83627ehf_read_value(client,
+					    W83627EHF_REG_TEMP_OVER[i]);
+			data->temp_max_hyst[i] = w83627ehf_read_value(client,
+						 W83627EHF_REG_TEMP_HYST[i]);
+		}
+
+		data->last_updated = jiffies;
+		data->valid = 1;
+	}
+
+	up(&data->update_lock);
+	return data;
+}
+
+/*
+ * Sysfs callback functions
+ */
+
+#define show_fan_reg(reg) \
+static ssize_t \
+show_##reg(struct device *dev, char *buf, int nr) \
+{ \
+	struct w83627ehf_data *data = w83627ehf_update_device(dev); \
+	return sprintf(buf, "%d\n", \
+		       fan_from_reg(data->reg[nr], \
+				    div_from_reg(data->fan_div[nr]))); \
+}
+show_fan_reg(fan);
+show_fan_reg(fan_min);
+
+static ssize_t
+show_fan_div(struct device *dev, char *buf, int nr)
+{
+	struct w83627ehf_data *data = w83627ehf_update_device(dev);
+	return sprintf(buf, "%u\n",
+		       div_from_reg(data->fan_div[nr]));
+}
+
+static ssize_t
+store_fan_min(struct device *dev, const char *buf, size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct w83627ehf_data *data = i2c_get_clientdata(client);
+	unsigned int val = simple_strtoul(buf, NULL, 10);
+	unsigned int reg;
+	u8 new_div;
+
+	down(&data->update_lock);
+	if (!val) {
+		/* No min limit, alarm disabled */
+		data->fan_min[nr] = 255;
+		new_div = data->fan_div[nr]; /* No change */
+		dev_info(dev, "fan%u low limit and alarm disabled\n", nr + 1);
+	} else if ((reg = 1350000U / val) >= 128 * 255) {
+		/* Speed below this value cannot possibly be represented,
+		   even with the highest divider (128) */
+		data->fan_min[nr] = 254;
+		new_div = 7; /* 128 == (1 << 7) */
+		dev_warn(dev, "fan%u low limit %u below minimum %u, set to "
+			 "minimum\n", nr + 1, val, fan_from_reg(254, 128));
+	} else if (!reg) {
+		/* Speed above this value cannot possibly be represented,
+		   even with the lowest divider (1) */
+		data->fan_min[nr] = 1;
+		new_div = 0; /* 1 == (1 << 0) */
+		dev_warn(dev, "fan%u low limit %u above maximum %u, set to "
+			 "maximum\n", nr + 1, val, fan_from_reg(1, 0));
+	} else {
+		/* Automatically pick the best divider, i.e. the one such
+		   that the min limit will correspond to a register value
+		   in the 96..192 range */
+		new_div = 0;
+		while (reg > 192 && new_div < 7) {
+			reg >>= 1;
+			new_div++;
+		}
+		data->fan_min[nr] = reg;
+	}
+
+	/* Write both the fan clock divider (if it changed) and the new
+	   fan min (unconditionally) */
+	if (new_div != data->fan_div[nr]) {
+		if (new_div > data->fan_div[nr])
+			data->fan[nr] >>= (data->fan_div[nr] - new_div);
+		else
+			data->fan[nr] <<= (new_div - data->fan_div[nr]);
+
+		dev_dbg(dev, "fan%u clock divider changed from %u to %u\n",
+			nr + 1, div_from_reg(data->fan_div[nr]),
+			div_from_reg(new_div));
+		data->fan_div[nr] = new_div;
+		w83627ehf_write_fan_div(client, nr);
+	}
+	w83627ehf_write_value(client, W83627EHF_REG_FAN_MIN[nr],
+			      data->fan_min[nr]);
+	up(&data->update_lock);
+
+	return count;
+}
+
+#define sysfs_fan_offset(offset) \
+static ssize_t \
+show_reg_fan_##offset(struct device *dev, char *buf) \
+{ \
+	return show_fan(dev, buf, offset-1); \
+} \
+static DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
+		   show_reg_fan_##offset, NULL);
+
+#define sysfs_fan_min_offset(offset) \
+static ssize_t \
+show_reg_fan##offset##_min(struct device *dev, char *buf) \
+{ \
+	return show_fan_min(dev, buf, offset-1); \
+} \
+static ssize_t \
+store_reg_fan##offset##_min(struct device *dev, const char *buf, \
+			    size_t count) \
+{ \
+	return store_fan_min(dev, buf, count, offset-1); \
+} \
+static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
+		   show_reg_fan##offset##_min, \
+		   store_reg_fan##offset##_min);
+
+#define sysfs_fan_div_offset(offset) \
+static ssize_t \
+show_reg_fan##offset##_div(struct device *dev, char *buf) \
+{ \
+	return show_fan_div(dev, buf, offset - 1); \
+} \
+static DEVICE_ATTR(fan##offset##_div, S_IRUGO, \
+		   show_reg_fan##offset##_div, NULL);
+
+sysfs_fan_offset(1);
+sysfs_fan_min_offset(1);
+sysfs_fan_div_offset(1);
+sysfs_fan_offset(2);
+sysfs_fan_min_offset(2);
+sysfs_fan_div_offset(2);
+sysfs_fan_offset(3);
+sysfs_fan_min_offset(3);
+sysfs_fan_div_offset(3);
+sysfs_fan_offset(4);
+sysfs_fan_min_offset(4);
+sysfs_fan_div_offset(4);
+sysfs_fan_offset(5);
+sysfs_fan_min_offset(5);
+sysfs_fan_div_offset(5);
+
+#define show_temp1_reg(reg) \
+static ssize_t \
+show_##reg(struct device *dev, char *buf) \
+{ \
+	struct w83627ehf_data *data = w83627ehf_update_device(dev); \
+	return sprintf(buf, "%d\n", temp1_from_reg(data->reg)); \
+}
+show_temp1_reg(temp1);
+show_temp1_reg(temp1_max);
+show_temp1_reg(temp1_max_hyst);
+
+#define store_temp1_reg(REG, reg) \
+static ssize_t \
+store_temp1_##reg(struct device *dev, const char *buf, size_t count) \
+{ \
+	struct i2c_client *client = to_i2c_client(dev); \
+	struct w83627ehf_data *data = i2c_get_clientdata(client); \
+	u32 val = simple_strtoul(buf, NULL, 10); \
+ \
+	down(&data->update_lock); \
+	data->temp1_##reg = temp1_to_reg(val); \
+	w83627ehf_write_value(client, W83627EHF_REG_TEMP1_##REG, \
+			      data->temp1_##reg); \
+	up(&data->update_lock); \
+	return count; \
+}
+store_temp1_reg(OVER, max);
+store_temp1_reg(HYST, max_hyst);
+
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1, NULL);
+static DEVICE_ATTR(temp1_max, S_IRUGO| S_IWUSR,
+		   show_temp1_max, store_temp1_max);
+static DEVICE_ATTR(temp1_max_hyst, S_IRUGO| S_IWUSR,
+		   show_temp1_max_hyst, store_temp1_max_hyst);
+
+#define show_temp_reg(reg) \
+static ssize_t \
+show_##reg (struct device *dev, char *buf, int nr) \
+{ \
+	struct w83627ehf_data *data = w83627ehf_update_device(dev); \
+	return sprintf(buf, "%d\n", \
+		       LM75_TEMP_FROM_REG(data->reg[nr])); \
+}
+show_temp_reg(temp);
+show_temp_reg(temp_max);
+show_temp_reg(temp_max_hyst);
+
+#define store_temp_reg(REG, reg) \
+static ssize_t \
+store_##reg (struct device *dev, const char *buf, size_t count, int nr) \
+{ \
+	struct i2c_client *client = to_i2c_client(dev); \
+	struct w83627ehf_data *data = i2c_get_clientdata(client); \
+	u32 val = simple_strtoul(buf, NULL, 10); \
+ \
+	down(&data->update_lock); \
+	data->reg[nr] = LM75_TEMP_TO_REG(val); \
+	w83627ehf_write_value(client, W83627EHF_REG_TEMP_##REG[nr], \
+			      data->reg[nr]); \
+	up(&data->update_lock); \
+	return count; \
+}
+store_temp_reg(OVER, temp_max);
+store_temp_reg(HYST, temp_max_hyst);
+
+#define sysfs_temp_offset(offset) \
+static ssize_t \
+show_reg_temp##offset (struct device *dev, char *buf) \
+{ \
+	return show_temp(dev, buf, offset - 2); \
+} \
+static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
+		   show_reg_temp##offset, NULL);
+
+#define sysfs_temp_reg_offset(reg, offset) \
+static ssize_t \
+show_reg_temp##offset##_##reg(struct device *dev, char *buf) \
+{ \
+	return show_temp_##reg(dev, buf, offset - 2); \
+} \
+static ssize_t \
+store_reg_temp##offset##_##reg(struct device *dev, const char *buf, \
+			       size_t count) \
+{ \
+	return store_temp_##reg(dev, buf, count, offset - 2); \
+} \
+static DEVICE_ATTR(temp##offset##_##reg, S_IRUGO| S_IWUSR, \
+		   show_reg_temp##offset##_##reg, \
+		   store_reg_temp##offset##_##reg);
+
+sysfs_temp_offset(2);
+sysfs_temp_reg_offset(max, 2);
+sysfs_temp_reg_offset(max_hyst, 2);
+sysfs_temp_offset(3);
+sysfs_temp_reg_offset(max, 3);
+sysfs_temp_reg_offset(max_hyst, 3);
+
+/*
+ * Driver and client management
+ */
+
+static struct i2c_driver w83627ehf_driver;
+
+static void w83627ehf_init_client(struct i2c_client *client)
+{
+	int i;
+	u8 tmp;
+
+	/* Start monitoring is needed */
+	tmp = w83627ehf_read_value(client, W83627EHF_REG_CONFIG);
+	if (!(tmp & 0x01))
+		w83627ehf_write_value(client, W83627EHF_REG_CONFIG,
+				      tmp | 0x01);
+
+	/* Enable temp2 and temp3 if needed */
+	for (i = 0; i < 2; i++) {
+		tmp = w83627ehf_read_value(client,
+					   W83627EHF_REG_TEMP_CONFIG[i]);
+		if (tmp & 0x01)
+			w83627ehf_write_value(client,
+					      W83627EHF_REG_TEMP_CONFIG[i],
+					      tmp & 0xfe);
+	}
+}
+
+static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *client;
+	struct w83627ehf_data *data;
+	int i, err = 0;
+
+	if (!i2c_is_isa_adapter(adapter))
+		return 0;
+
+	if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) {
+		err = -EBUSY;
+		goto exit;
+	}
+
+	if (!(data = kmalloc(sizeof(struct w83627ehf_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit_release;
+	}
+	memset(data, 0, sizeof(struct w83627ehf_data));
+
+	client = &data->client;
+	i2c_set_clientdata(client, data);
+	client->addr = address;
+	init_MUTEX(&data->lock);
+	client->adapter = adapter;
+	client->driver = &w83627ehf_driver;
+	client->flags = 0;
+
+	strlcpy(client->name, "w83627ehf", I2C_NAME_SIZE);
+	data->valid = 0;
+	init_MUTEX(&data->update_lock);
+
+	/* Tell the i2c layer a new client has arrived */
+	if ((err = i2c_attach_client(client)))
+		goto exit_free;
+
+	/* Initialize the chip */
+	w83627ehf_init_client(client);
+
+	/* A few vars need to be filled upon startup */
+	for (i = 0; i < 5; i++)
+		data->fan_min[i] = w83627ehf_read_value(client,
+				   W83627EHF_REG_FAN_MIN[i]);
+
+	/* It looks like fan4 and fan5 pins can be alternatively used
+	   as fan on/off switches */
+	data->has_fan = 0x07; /* fan1, fan2 and fan3 */
+	i = w83627ehf_read_value(client, W83627EHF_REG_FANDIV1);
+	if (i & (1 << 2))
+		data->has_fan |= (1 << 3);
+	if (i & (1 << 0))
+		data->has_fan |= (1 << 4);
+
+	/* Register sysfs hooks */
+	device_create_file(&client->dev, &dev_attr_fan1_input);
+	device_create_file(&client->dev, &dev_attr_fan1_min);
+	device_create_file(&client->dev, &dev_attr_fan1_div);
+	device_create_file(&client->dev, &dev_attr_fan2_input);
+	device_create_file(&client->dev, &dev_attr_fan2_min);
+	device_create_file(&client->dev, &dev_attr_fan2_div);
+	device_create_file(&client->dev, &dev_attr_fan3_input);
+	device_create_file(&client->dev, &dev_attr_fan3_min);
+	device_create_file(&client->dev, &dev_attr_fan3_div);
+
+	if (data->has_fan & (1 << 3)) {
+		device_create_file(&client->dev, &dev_attr_fan4_input);
+		device_create_file(&client->dev, &dev_attr_fan4_min);
+		device_create_file(&client->dev, &dev_attr_fan4_div);
+	}
+	if (data->has_fan & (1 << 4)) {
+		device_create_file(&client->dev, &dev_attr_fan5_input);
+		device_create_file(&client->dev, &dev_attr_fan5_min);
+		device_create_file(&client->dev, &dev_attr_fan5_div);
+	}
+
+	device_create_file(&client->dev, &dev_attr_temp1_input);
+	device_create_file(&client->dev, &dev_attr_temp1_max);
+	device_create_file(&client->dev, &dev_attr_temp1_max_hyst);
+	device_create_file(&client->dev, &dev_attr_temp2_input);
+	device_create_file(&client->dev, &dev_attr_temp2_max);
+	device_create_file(&client->dev, &dev_attr_temp2_max_hyst);
+	device_create_file(&client->dev, &dev_attr_temp3_input);
+	device_create_file(&client->dev, &dev_attr_temp3_max);
+	device_create_file(&client->dev, &dev_attr_temp3_max_hyst);
+
+	return 0;
+
+exit_free:
+	kfree(data);
+exit_release:
+	release_region(address, REGION_LENGTH);
+exit:
+	return err;
+}
+
+static int w83627ehf_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, w83627ehf_detect);
+}
+
+static int w83627ehf_detach_client(struct i2c_client *client)
+{
+	int err;
+
+	if ((err = i2c_detach_client(client))) {
+		dev_err(&client->dev, "Client deregistration failed, "
+			"client not detached.\n");
+		return err;
+	}
+	release_region(client->addr, REGION_LENGTH);
+	kfree(i2c_get_clientdata(client));
+
+	return 0;
+}
+
+static struct i2c_driver w83627ehf_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "w83627ehf",
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= w83627ehf_attach_adapter,
+	.detach_client	= w83627ehf_detach_client,
+};
+
+static int __init w83627ehf_find(int sioaddr, int *address)
+{
+	u16 val;
+
+	REG = sioaddr;
+	VAL = sioaddr + 1;
+	superio_enter();
+
+	val = (superio_inb(SIO_REG_DEVID) << 8)
+	    | superio_inb(SIO_REG_DEVID + 1);
+	if ((val & SIO_ID_MASK) != SIO_W83627EHF_ID) {
+		superio_exit();
+		return -ENODEV;
+	}
+
+	superio_select(W83627EHF_LD_HWM);
+	val = (superio_inb(SIO_REG_ADDR) << 8)
+	    | superio_inb(SIO_REG_ADDR + 1);
+	*address = val & ~(REGION_LENGTH - 1);
+	if (*address == 0) {
+		superio_exit();
+		return -ENODEV;
+	}
+
+	/* Activate logical device if needed */
+	val = superio_inb(SIO_REG_ENABLE);
+	if (!(val & 0x01))
+		superio_outb(SIO_REG_ENABLE, val | 0x01);
+
+	superio_exit();
+	return 0;
+}
+
+static int __init sensors_w83627ehf_init(void)
+{
+	if (w83627ehf_find(0x2e, &normal_isa[0])
+	 && w83627ehf_find(0x4e, &normal_isa[0]))
+		return -ENODEV;
+
+	return i2c_add_driver(&w83627ehf_driver);
+}
+
+static void __exit sensors_w83627ehf_exit(void)
+{
+	i2c_del_driver(&w83627ehf_driver);
+}
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("W83627EHF driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_w83627ehf_init);
+module_exit(sensors_w83627ehf_exit);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: drivers/i2c/*: #include <linux/config.h> cleanup
  2005-06-22  5:17                               ` [PATCH] I2C: #include <linux/config.h> cleanup Greg KH
@ 2005-06-22  5:17                                 ` Greg KH
  2005-06-22  5:17                                   ` [PATCH] I2C: New hardware monitoring driver: w83627ehf Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: adobriyan

[PATCH] I2C: drivers/i2c/*: #include <linux/config.h> cleanup

Files that don't use CONFIG_* stuff shouldn't include config.h
Files that use CONFIG_* stuff should include config.h

It's that simple. ;-)

Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit f0bb60e7b1a0a26c25d8cbf81dda7afbc8bd2982
tree 93dc5302d0299e8167c2affc1d65a705219c0d88
parent da17838c5e7256976c34c5d051dc8fb3c6f364b7
author Alexey Dobriyan <adobriyan@mail.ru> Sat, 16 Apr 2005 18:10:02 +0000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:53 -0700

 drivers/i2c/algos/i2c-algo-sibyte.c    |    1 -
 drivers/i2c/busses/i2c-ali1535.c       |    1 -
 drivers/i2c/busses/i2c-ali15x3.c       |    1 -
 drivers/i2c/busses/i2c-amd756.c        |    1 -
 drivers/i2c/busses/i2c-amd8111.c       |    1 -
 drivers/i2c/busses/i2c-au1550.c        |    1 -
 drivers/i2c/busses/i2c-elektor.c       |    1 -
 drivers/i2c/busses/i2c-frodo.c         |    1 -
 drivers/i2c/busses/i2c-i801.c          |    1 -
 drivers/i2c/busses/i2c-i810.c          |    1 -
 drivers/i2c/busses/i2c-ibm_iic.h       |    1 -
 drivers/i2c/busses/i2c-isa.c           |    1 -
 drivers/i2c/busses/i2c-ite.c           |    1 -
 drivers/i2c/busses/i2c-keywest.c       |    1 -
 drivers/i2c/busses/i2c-nforce2.c       |    1 -
 drivers/i2c/busses/i2c-parport-light.c |    1 -
 drivers/i2c/busses/i2c-parport.c       |    1 -
 drivers/i2c/busses/i2c-pca-isa.c       |    1 -
 drivers/i2c/busses/i2c-piix4.c         |    1 -
 drivers/i2c/busses/i2c-prosavage.c     |    1 -
 drivers/i2c/busses/i2c-rpx.c           |    1 -
 drivers/i2c/busses/i2c-s3c2410.c       |    1 +
 drivers/i2c/busses/i2c-savage4.c       |    1 -
 drivers/i2c/busses/i2c-sibyte.c        |    1 -
 drivers/i2c/busses/i2c-sis5595.c       |    1 -
 drivers/i2c/busses/i2c-sis630.c        |    1 -
 drivers/i2c/busses/i2c-sis96x.c        |    1 -
 drivers/i2c/busses/i2c-stub.c          |    1 -
 drivers/i2c/busses/i2c-via.c           |    1 -
 drivers/i2c/busses/i2c-viapro.c        |    1 -
 drivers/i2c/busses/i2c-voodoo3.c       |    1 -
 drivers/i2c/busses/scx200_acb.c        |    1 -
 drivers/i2c/chips/adm1021.c            |    1 -
 drivers/i2c/chips/adm1025.c            |    1 -
 drivers/i2c/chips/adm1026.c            |    1 -
 drivers/i2c/chips/ds1337.c             |    1 -
 drivers/i2c/chips/eeprom.c             |    1 -
 drivers/i2c/chips/fscher.c             |    1 -
 drivers/i2c/chips/gl518sm.c            |    1 -
 drivers/i2c/chips/it87.c               |    1 -
 drivers/i2c/chips/lm63.c               |    1 -
 drivers/i2c/chips/lm75.c               |    1 -
 drivers/i2c/chips/lm77.c               |    1 -
 drivers/i2c/chips/lm78.c               |    1 -
 drivers/i2c/chips/lm80.c               |    1 -
 drivers/i2c/chips/lm83.c               |    1 -
 drivers/i2c/chips/lm85.c               |    1 -
 drivers/i2c/chips/lm87.c               |    1 -
 drivers/i2c/chips/lm90.c               |    1 -
 drivers/i2c/chips/max1619.c            |    1 -
 drivers/i2c/chips/pc87360.c            |    1 -
 drivers/i2c/chips/via686a.c            |    1 -
 drivers/i2c/chips/w83781d.c            |    1 -
 drivers/i2c/chips/w83l785ts.c          |    1 -
 drivers/i2c/i2c-core.c                 |    1 -
 drivers/i2c/i2c-dev.c                  |    1 -
 56 files changed, 1 insertions(+), 55 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-sibyte.c b/drivers/i2c/algos/i2c-algo-sibyte.c
--- a/drivers/i2c/algos/i2c-algo-sibyte.c
+++ b/drivers/i2c/algos/i2c-algo-sibyte.c
@@ -24,7 +24,6 @@
 
 /* Ported for SiByte SOCs by Broadcom Corporation.  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -53,7 +53,6 @@
 
 /* Note: we assume there can only be one ALI1535, with one SMBus interface */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -60,7 +60,6 @@
 
 /* Note: we assume there can only be one ALI15X3, with one SMBus interface */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -37,7 +37,6 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -8,7 +8,6 @@
  * the Free Software Foundation version 2.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -27,7 +27,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -25,7 +25,6 @@
 /* Partialy rewriten by Oleg I. Vdovikin for mmapped support of 
    for Alpha Processor Inc. UP-2000(+) boards */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-frodo.c b/drivers/i2c/busses/i2c-frodo.c
--- a/drivers/i2c/busses/i2c-frodo.c
+++ b/drivers/i2c/busses/i2c-frodo.c
@@ -12,7 +12,6 @@
  * version 2 as published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -41,7 +41,6 @@
 
 /* Note: we assume there can only be one I801, with one SMBus interface */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c
--- a/drivers/i2c/busses/i2c-i810.c
+++ b/drivers/i2c/busses/i2c-i810.c
@@ -34,7 +34,6 @@
    i815			1132           
 */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-ibm_iic.h b/drivers/i2c/busses/i2c-ibm_iic.h
--- a/drivers/i2c/busses/i2c-ibm_iic.h
+++ b/drivers/i2c/busses/i2c-ibm_iic.h
@@ -22,7 +22,6 @@
 #ifndef __I2C_IBM_IIC_H_
 #define __I2C_IBM_IIC_H_
 
-#include <linux/config.h>
 #include <linux/i2c.h> 
 
 struct iic_regs {
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -24,7 +24,6 @@
    the SMBus and the ISA bus very much easier. See lm78.c for an example
    of this. */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c
--- a/drivers/i2c/busses/i2c-ite.c
+++ b/drivers/i2c/busses/i2c-ite.c
@@ -33,7 +33,6 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
--- a/drivers/i2c/busses/i2c-keywest.c
+++ b/drivers/i2c/busses/i2c-keywest.c
@@ -46,7 +46,6 @@
     sound driver to be happy
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -37,7 +37,6 @@
 
 /* Note: we assume there can only be one nForce2, with two SMBus interfaces */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -24,7 +24,6 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  * ------------------------------------------------------------------------ */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -24,7 +24,6 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  * ------------------------------------------------------------------------ */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -17,7 +17,6 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -28,7 +28,6 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
diff --git a/drivers/i2c/busses/i2c-prosavage.c b/drivers/i2c/busses/i2c-prosavage.c
--- a/drivers/i2c/busses/i2c-prosavage.c
+++ b/drivers/i2c/busses/i2c-prosavage.c
@@ -54,7 +54,6 @@
  *    (Additional documentation needed :(
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/pci.h>
diff --git a/drivers/i2c/busses/i2c-rpx.c b/drivers/i2c/busses/i2c-rpx.c
--- a/drivers/i2c/busses/i2c-rpx.c
+++ b/drivers/i2c/busses/i2c-rpx.c
@@ -11,7 +11,6 @@
  * changed to eliminate RPXLite references.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c
--- a/drivers/i2c/busses/i2c-savage4.c
+++ b/drivers/i2c/busses/i2c-savage4.c
@@ -29,7 +29,6 @@
    it easier to add later.
 */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -17,7 +17,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/i2c-algo-sibyte.h>
 #include <asm/sibyte/sb1250_regs.h>
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -55,7 +55,6 @@
  * Add adapter resets
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -48,7 +48,6 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -32,7 +32,6 @@
     We assume there can only be one SiS96x with one SMBus interface.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c
--- a/drivers/i2c/busses/i2c-stub.c
+++ b/drivers/i2c/busses/i2c-stub.c
@@ -21,7 +21,6 @@
 
 #define DEBUG 1
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -21,7 +21,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -33,7 +33,6 @@
    Note: we assume there can only be one device, with one SMBus interface.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c
--- a/drivers/i2c/busses/i2c-voodoo3.c
+++ b/drivers/i2c/busses/i2c-voodoo3.c
@@ -27,7 +27,6 @@
 /* This interfaces to the I2C bus of the Voodoo3 to gain access to
     the BT869 and possibly other I2C devices. */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -24,7 +24,6 @@
 
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c
+++ b/drivers/i2c/chips/adm1021.c
@@ -19,7 +19,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c
--- a/drivers/i2c/chips/adm1025.c
+++ b/drivers/i2c/chips/adm1025.c
@@ -45,7 +45,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
--- a/drivers/i2c/chips/adm1026.c
+++ b/drivers/i2c/chips/adm1026.c
@@ -23,7 +23,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -13,7 +13,6 @@
  * Driver for Dallas Semiconductor DS1337 and DS1339 real time clock chip
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -26,7 +26,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
diff --git a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c
--- a/drivers/i2c/chips/fscher.c
+++ b/drivers/i2c/chips/fscher.c
@@ -26,7 +26,6 @@
  *  and Philip Edelbrock <phil@netroedge.com>
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c
--- a/drivers/i2c/chips/gl518sm.c
+++ b/drivers/i2c/chips/gl518sm.c
@@ -36,7 +36,6 @@
  * 2004-01-31  Code review and approval. (Jean Delvare)
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c
+++ b/drivers/i2c/chips/it87.c
@@ -31,7 +31,6 @@
     type at module load time.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c
--- a/drivers/i2c/chips/lm63.c
+++ b/drivers/i2c/chips/lm63.c
@@ -37,7 +37,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c
+++ b/drivers/i2c/chips/lm75.c
@@ -18,7 +18,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm77.c b/drivers/i2c/chips/lm77.c
--- a/drivers/i2c/chips/lm77.c
+++ b/drivers/i2c/chips/lm77.c
@@ -25,7 +25,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
--- a/drivers/i2c/chips/lm78.c
+++ b/drivers/i2c/chips/lm78.c
@@ -18,7 +18,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c
--- a/drivers/i2c/chips/lm80.c
+++ b/drivers/i2c/chips/lm80.c
@@ -21,7 +21,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c
+++ b/drivers/i2c/chips/lm83.c
@@ -27,7 +27,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c
--- a/drivers/i2c/chips/lm85.c
+++ b/drivers/i2c/chips/lm85.c
@@ -23,7 +23,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm87.c b/drivers/i2c/chips/lm87.c
--- a/drivers/i2c/chips/lm87.c
+++ b/drivers/i2c/chips/lm87.c
@@ -52,7 +52,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c
+++ b/drivers/i2c/chips/lm90.c
@@ -70,7 +70,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/max1619.c b/drivers/i2c/chips/max1619.c
--- a/drivers/i2c/chips/max1619.c
+++ b/drivers/i2c/chips/max1619.c
@@ -26,7 +26,6 @@
  */
 
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/pc87360.c b/drivers/i2c/chips/pc87360.c
--- a/drivers/i2c/chips/pc87360.c
+++ b/drivers/i2c/chips/pc87360.c
@@ -33,7 +33,6 @@
  *  the standard Super-I/O addresses is used (0x2E/0x2F or 0x4E/0x4F).
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -30,7 +30,6 @@
     Warning - only supports a single device.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c
+++ b/drivers/i2c/chips/w83781d.c
@@ -35,7 +35,6 @@
 
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
--- a/drivers/i2c/chips/w83l785ts.c
+++ b/drivers/i2c/chips/w83l785ts.c
@@ -30,7 +30,6 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/init.h>
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -21,7 +21,6 @@
    All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
    SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com>                */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -29,7 +29,6 @@
 /* The devfs code is contributed by Philipp Matthias Hahn 
    <pmhahn@titan.lahn.de> */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/fs.h>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] ds1337: export ds1337_do_command
  2005-06-22  5:17                         ` [PATCH] ds1337 driver works also with ds1339 chip Greg KH
@ 2005-06-22  5:17                           ` Greg KH
  2005-06-22  5:17                             ` [PATCH] I2C: add new hardware monitor driver: adm9240 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: ladis

[PATCH] ds1337: export ds1337_do_command

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit da17838c5e7256976c34c5d051dc8fb3c6f364b7
tree 179d41ec3c1e01263cae06cee297ebcf35769aa7
parent 912b9c0c52b95696165e84d67fdab2af81a2213e
author Ladislav Michl <ladis@linux-mips.org> Wed, 11 May 2005 10:32:54 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:52 -0700

 drivers/i2c/chips/ds1337.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -380,5 +380,7 @@ MODULE_AUTHOR("James Chapman <jchapman@k
 MODULE_DESCRIPTION("DS1337 RTC driver");
 MODULE_LICENSE("GPL");
 
+EXPORT_SYMBOL_GPL(ds1337_do_command);
+
 module_init(ds1337_init);
 module_exit(ds1337_exit);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Fix bugs in the new w83627ehf driver
  2005-06-22  5:17                                   ` [PATCH] I2C: New hardware monitoring driver: w83627ehf Greg KH
@ 2005-06-22  5:17                                     ` Greg KH
  2005-06-22  5:17                                       ` [PATCH] I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Fix bugs in the new w83627ehf driver

These are the fixes for the bug you spotted in my new w83627ehf driver:
	- Explicit division by 0.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit b9110b1c893f45ec66ae39e359decdfad84525be
tree 0fcb89b2f770df7995445b4e74251549bea6baf6
parent 08e7e2789e0da49eadeb17121e24af22efeee84b
author Jean Delvare <khali@linux-fr.org> Mon, 02 May 2005 23:08:22 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:54 -0700

 drivers/i2c/chips/w83627ehf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/i2c/chips/w83627ehf.c
--- a/drivers/i2c/chips/w83627ehf.c
+++ b/drivers/i2c/chips/w83627ehf.c
@@ -450,7 +450,7 @@ store_fan_min(struct device *dev, const 
 		data->fan_min[nr] = 1;
 		new_div = 0; /* 1 == (1 << 0) */
 		dev_warn(dev, "fan%u low limit %u above maximum %u, set to "
-			 "maximum\n", nr + 1, val, fan_from_reg(1, 0));
+			 "maximum\n", nr + 1, val, fan_from_reg(1, 1));
 	} else {
 		/* Automatically pick the best divider, i.e. the one such
 		   that the min limit will correspond to a register value


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: add new hardware monitor driver: adm9240
  2005-06-22  5:17                           ` [PATCH] ds1337: export ds1337_do_command Greg KH
@ 2005-06-22  5:17                             ` Greg KH
  2005-06-22  5:17                               ` [PATCH] I2C: #include <linux/config.h> cleanup Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: add new hardware monitor driver: adm9240

Completion of Michiel Rook's port of adm9240 to 2.6 with addition
of auto fan clock divider based on Jean Delvare's algorithm, and
replaces scaling macros with static inlines.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 40b5cda28aafe3744d8808c21f7959e472a9ecb1
tree cd332f677f3c7855fcd026300cf284af08d0846b
parent a551ef79d9413727f76d22dc47b5b15d1d03073b
author Grant Coady <grant_lkml@dodo.com.au> Sat, 30 Apr 2005 21:41:29 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:53 -0700

 drivers/i2c/chips/Kconfig   |   11 +
 drivers/i2c/chips/Makefile  |    1 
 drivers/i2c/chips/adm9240.c |  768 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 780 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -51,6 +51,17 @@ config SENSORS_ADM1031
 	  This driver can also be built as a module.  If so, the module
 	  will be called adm1031.
 
+config SENSORS_ADM9240
+	tristate "Analog Devices ADM9240 and compatibles"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM9240,
+	  Dallas DS1780, National Semiconductor LM81 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm9240.
+
 config SENSORS_ASB100
 	tristate "Asus ASB100 Bach"
 	depends on I2C && EXPERIMENTAL
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021
 obj-$(CONFIG_SENSORS_ADM1025)	+= adm1025.o
 obj-$(CONFIG_SENSORS_ADM1026)	+= adm1026.o
 obj-$(CONFIG_SENSORS_ADM1031)	+= adm1031.o
+obj-$(CONFIG_SENSORS_ADM9240)	+= adm9240.o
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_DS1337)	+= ds1337.o
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
diff --git a/drivers/i2c/chips/adm9240.c b/drivers/i2c/chips/adm9240.c
new file mode 100644
--- /dev/null
+++ b/drivers/i2c/chips/adm9240.c
@@ -0,0 +1,768 @@
+/*
+ * adm9240.c	Part of lm_sensors, Linux kernel modules for hardware
+ * 		monitoring
+ *
+ * Copyright (C) 1999	Frodo Looijaard <frodol@dds.nl>
+ *			Philip Edelbrock <phil@netroedge.com>
+ * Copyright (C) 2003	Michiel Rook <michiel@grendelproject.nl>
+ * Copyright (C) 2005	Grant Coady <gcoady@gmail.com> with valuable
+ * 				guidance from Jean Delvare
+ *
+ * Driver supports	Analog Devices		ADM9240
+ *			Dallas Semiconductor	DS1780
+ *			National Semiconductor	LM81
+ *
+ * ADM9240 is the reference, DS1780 and LM81 are register compatibles
+ *
+ * Voltage	Six inputs are scaled by chip, VID also reported
+ * Temperature	Chip temperature to 0.5'C, maximum and max_hysteris
+ * Fans		2 fans, low speed alarm, automatic fan clock divider
+ * Alarms	16-bit map of active alarms
+ * Analog Out	0..1250 mV output
+ *
+ * Chassis Intrusion: clear CI latch with 'echo 1 > chassis_clear'
+ *
+ * Test hardware: Intel SE440BX-2 desktop motherboard --Grant
+ *
+ * LM81 extended temp reading not implemented
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/i2c-vid.h>
+
+/* Addresses to scan */
+static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
+					I2C_CLIENT_END };
+
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+
+/* Insmod parameters */
+SENSORS_INSMOD_3(adm9240, ds1780, lm81);
+
+/* ADM9240 registers */
+#define ADM9240_REG_MAN_ID		0x3e
+#define ADM9240_REG_DIE_REV		0x3f
+#define ADM9240_REG_CONFIG		0x40
+
+#define ADM9240_REG_IN(nr)		(0x20 + (nr))   /* 0..5 */
+#define ADM9240_REG_IN_MAX(nr)		(0x2b + (nr) * 2)
+#define ADM9240_REG_IN_MIN(nr)		(0x2c + (nr) * 2)
+#define ADM9240_REG_FAN(nr)		(0x28 + (nr))   /* 0..1 */
+#define ADM9240_REG_FAN_MIN(nr)		(0x3b + (nr))
+#define ADM9240_REG_INT(nr)		(0x41 + (nr))
+#define ADM9240_REG_INT_MASK(nr)	(0x43 + (nr))
+#define ADM9240_REG_TEMP		0x27
+#define ADM9240_REG_TEMP_HIGH		0x39
+#define ADM9240_REG_TEMP_HYST		0x3a
+#define ADM9240_REG_ANALOG_OUT		0x19
+#define ADM9240_REG_CHASSIS_CLEAR	0x46
+#define ADM9240_REG_VID_FAN_DIV		0x47
+#define ADM9240_REG_I2C_ADDR		0x48
+#define ADM9240_REG_VID4		0x49
+#define ADM9240_REG_TEMP_CONF		0x4b
+
+/* generalised scaling with integer rounding */
+static inline int SCALE(long val, int mul, int div)
+{
+	if (val < 0)
+		return (val * mul - div / 2) / div;
+	else
+		return (val * mul + div / 2) / div;
+}
+
+/* adm9240 internally scales voltage measurements */
+static const u16 nom_mv[] = { 2500, 2700, 3300, 5000, 12000, 2700 };
+
+static inline unsigned int IN_FROM_REG(u8 reg, int n)
+{
+	return SCALE(reg, nom_mv[n], 192);
+}
+
+static inline u8 IN_TO_REG(unsigned long val, int n)
+{
+	return SENSORS_LIMIT(SCALE(val, 192, nom_mv[n]), 0, 255);
+}
+
+/* temperature range: -40..125, 127 disables temperature alarm */
+static inline s8 TEMP_TO_REG(long val)
+{
+	return SENSORS_LIMIT(SCALE(val, 1, 1000), -40, 127);
+}
+
+/* two fans, each with low fan speed limit */
+static inline unsigned int FAN_FROM_REG(u8 reg, u8 div)
+{
+	if (!reg) /* error */
+		return -1;
+
+	if (reg == 255)
+		return 0;
+
+	return SCALE(1350000, 1, reg * div);
+}
+
+/* analog out 0..1250mV */
+static inline u8 AOUT_TO_REG(unsigned long val)
+{
+	return SENSORS_LIMIT(SCALE(val, 255, 1250), 0, 255);
+}
+
+static inline unsigned int AOUT_FROM_REG(u8 reg)
+{
+	return SCALE(reg, 1250, 255);
+}
+
+static int adm9240_attach_adapter(struct i2c_adapter *adapter);
+static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind);
+static void adm9240_init_client(struct i2c_client *client);
+static int adm9240_detach_client(struct i2c_client *client);
+static struct adm9240_data *adm9240_update_device(struct device *dev);
+
+/* driver data */
+static struct i2c_driver adm9240_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "adm9240",
+	.id		= I2C_DRIVERID_ADM9240,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= adm9240_attach_adapter,
+	.detach_client	= adm9240_detach_client,
+};
+
+/* per client data */
+struct adm9240_data {
+	enum chips type;
+	struct i2c_client client;
+	struct semaphore update_lock;
+	char valid;
+	unsigned long last_updated_measure;
+	unsigned long last_updated_config;
+
+	u8 in[6];		/* ro	in0_input */
+	u8 in_max[6];		/* rw	in0_max */
+	u8 in_min[6];		/* rw	in0_min */
+	u8 fan[2];		/* ro	fan1_input */
+	u8 fan_min[2];		/* rw	fan1_min */
+	u8 fan_div[2];		/* rw	fan1_div, read-only accessor */
+	s16 temp;		/* ro	temp1_input, 9-bit sign-extended */
+	s8 temp_high;		/* rw	temp1_max */
+	s8 temp_hyst;		/* rw	temp1_max_hyst */
+	u16 alarms;		/* ro	alarms */
+	u8 aout;		/* rw	analog_out */
+	u8 vid;			/* ro	vid */
+	u8 vrm;			/* --	vrm set on startup, no accessor */
+};
+
+/* i2c byte read/write interface */
+static int adm9240_read_value(struct i2c_client *client, u8 reg)
+{
+	return i2c_smbus_read_byte_data(client, reg);
+}
+
+static int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value)
+{
+	return i2c_smbus_write_byte_data(client, reg, value);
+}
+
+/*** sysfs accessors ***/
+
+/* temperature */
+#define show_temp(value, scale)					\
+static ssize_t show_##value(struct device *dev, char *buf)	\
+{								\
+	struct adm9240_data *data = adm9240_update_device(dev);	\
+	return sprintf(buf, "%d\n", data->value * scale);	\
+}
+show_temp(temp_high, 1000);
+show_temp(temp_hyst, 1000);
+show_temp(temp, 500);
+
+#define set_temp(value, reg)					\
+static ssize_t set_##value(struct device *dev, const char *buf,	\
+		size_t count)					\
+{								\
+	struct i2c_client *client = to_i2c_client(dev);		\
+	struct adm9240_data *data = adm9240_update_device(dev);	\
+	long temp = simple_strtoul(buf, NULL, 10);		\
+								\
+	down(&data->update_lock);				\
+	data->value = TEMP_TO_REG(temp);			\
+	adm9240_write_value(client, reg, data->value);		\
+	up(&data->update_lock);					\
+	return count;						\
+}
+
+set_temp(temp_high, ADM9240_REG_TEMP_HIGH);
+set_temp(temp_hyst, ADM9240_REG_TEMP_HYST);
+
+static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
+		show_temp_high, set_temp_high);
+static DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
+		show_temp_hyst, set_temp_hyst);
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
+
+/* voltage */
+static ssize_t show_in(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in[nr], nr));
+}
+
+static ssize_t show_in_min(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in_min[nr], nr));
+}
+
+static ssize_t show_in_max(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in_max[nr], nr));
+}
+
+static ssize_t set_in_min(struct device *dev, const char *buf,
+		size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+
+	down(&data->update_lock);
+	data->in_min[nr] = IN_TO_REG(val, nr);
+	adm9240_write_value(client, ADM9240_REG_IN_MIN(nr), data->in_min[nr]);
+	up(&data->update_lock);
+	return count;
+}
+
+static ssize_t set_in_max(struct device *dev, const char *buf,
+		size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+
+	down(&data->update_lock);
+	data->in_max[nr] = IN_TO_REG(val, nr);
+	adm9240_write_value(client, ADM9240_REG_IN_MAX(nr), data->in_max[nr]);
+	up(&data->update_lock);
+	return count;
+}
+
+#define show_in_offset(offset)						\
+static ssize_t show_in##offset(struct device *dev, char *buf)		\
+{									\
+	return show_in(dev, buf, offset);				\
+}									\
+static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL);	\
+static ssize_t show_in##offset##_min(struct device *dev, char *buf)	\
+{									\
+	return show_in_min(dev, buf, offset);				\
+}									\
+static ssize_t show_in##offset##_max(struct device *dev, char *buf)	\
+{									\
+	return show_in_max(dev, buf, offset);				\
+}									\
+static ssize_t								\
+set_in##offset##_min(struct device *dev, const char *buf, size_t count)	\
+{									\
+	return set_in_min(dev, buf, count, offset);			\
+}									\
+static ssize_t								\
+set_in##offset##_max(struct device *dev, const char *buf, size_t count)	\
+{									\
+	return set_in_max(dev, buf, count, offset);			\
+}									\
+static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR,			\
+		show_in##offset##_min, set_in##offset##_min);		\
+static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR,			\
+		show_in##offset##_max, set_in##offset##_max);
+
+show_in_offset(0);
+show_in_offset(1);
+show_in_offset(2);
+show_in_offset(3);
+show_in_offset(4);
+show_in_offset(5);
+
+/* fans */
+static ssize_t show_fan(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],
+				1 << data->fan_div[nr]));
+}
+
+static ssize_t show_fan_min(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr],
+				1 << data->fan_div[nr]));
+}
+
+static ssize_t show_fan_div(struct device *dev, char *buf, int nr)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", 1 << data->fan_div[nr]);
+}
+
+/* write new fan div, callers must hold data->update_lock */
+static void adm9240_write_fan_div(struct i2c_client *client, int nr,
+		u8 fan_div)
+{
+	u8 reg, old, shift = (nr + 2) * 2;
+
+	reg = adm9240_read_value(client, ADM9240_REG_VID_FAN_DIV);
+	old = (reg >> shift) & 3;
+	reg &= ~(3 << shift);
+	reg |= (fan_div << shift);
+	adm9240_write_value(client, ADM9240_REG_VID_FAN_DIV, reg);
+	dev_dbg(&client->dev, "fan%d clock divider changed from %u "
+			"to %u\n", nr + 1, 1 << old, 1 << fan_div);
+}
+
+/* 
+ * set fan speed low limit:
+ *
+ * - value is zero: disable fan speed low limit alarm
+ *
+ * - value is below fan speed measurement range: enable fan speed low
+ *   limit alarm to be asserted while fan speed too slow to measure
+ *
+ * - otherwise: select fan clock divider to suit fan speed low limit,
+ *   measurement code may adjust registers to ensure fan speed reading
+ */
+static ssize_t set_fan_min(struct device *dev, const char *buf,
+		size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+	u8 new_div;
+
+	down(&data->update_lock);
+
+	if (!val) {
+		data->fan_min[nr] = 255;
+		new_div = data->fan_div[nr];
+
+		dev_dbg(&client->dev, "fan%u low limit set disabled\n",
+				nr + 1);
+
+	} else if (val < 1350000 / (8 * 254)) {
+		new_div = 3;
+		data->fan_min[nr] = 254;
+
+		dev_dbg(&client->dev, "fan%u low limit set minimum %u\n",
+				nr + 1, FAN_FROM_REG(254, 1 << new_div));
+
+	} else {
+		unsigned int new_min = 1350000 / val;
+
+		new_div = 0;
+		while (new_min > 192 && new_div < 3) {
+			new_div++;
+			new_min /= 2;
+		}
+		if (!new_min) /* keep > 0 */
+			new_min++;
+
+		data->fan_min[nr] = new_min;
+
+		dev_dbg(&client->dev, "fan%u low limit set fan speed %u\n",
+				nr + 1, FAN_FROM_REG(new_min, 1 << new_div));
+	}
+
+	if (new_div != data->fan_div[nr]) {
+		data->fan_div[nr] = new_div;
+		adm9240_write_fan_div(client, nr, new_div);
+	}
+	adm9240_write_value(client, ADM9240_REG_FAN_MIN(nr),
+			data->fan_min[nr]);
+
+	up(&data->update_lock);
+	return count;
+}
+
+#define show_fan_offset(offset)						\
+static ssize_t show_fan_##offset (struct device *dev, char *buf)	\
+{									\
+return show_fan(dev, buf, offset - 1);					\
+}									\
+static ssize_t show_fan_##offset##_div (struct device *dev, char *buf)	\
+{									\
+return show_fan_div(dev, buf, offset - 1);				\
+}									\
+static ssize_t show_fan_##offset##_min (struct device *dev, char *buf)	\
+{									\
+return show_fan_min(dev, buf, offset - 1);				\
+}									\
+static ssize_t set_fan_##offset##_min (struct device *dev, 		\
+const char *buf, size_t count)						\
+{									\
+return set_fan_min(dev, buf, count, offset - 1);			\
+}									\
+static DEVICE_ATTR(fan##offset##_input, S_IRUGO, 			\
+		show_fan_##offset, NULL);				\
+static DEVICE_ATTR(fan##offset##_div, S_IRUGO, 				\
+		show_fan_##offset##_div, NULL);				\
+static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, 		\
+		show_fan_##offset##_min, set_fan_##offset##_min);
+
+show_fan_offset(1);
+show_fan_offset(2);
+
+/* alarms */
+static ssize_t show_alarms(struct device *dev, char *buf)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%u\n", data->alarms);
+}
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+
+/* vid */
+static ssize_t show_vid(struct device *dev, char *buf)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
+}
+static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
+
+/* analog output */
+static ssize_t show_aout(struct device *dev, char *buf)
+{
+	struct adm9240_data *data = adm9240_update_device(dev);
+	return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout));
+}
+
+static ssize_t set_aout(struct device *dev, const char *buf, size_t count)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtol(buf, NULL, 10);
+
+	down(&data->update_lock);
+	data->aout = AOUT_TO_REG(val);
+	adm9240_write_value(client, ADM9240_REG_ANALOG_OUT, data->aout);
+	up(&data->update_lock);
+	return count;
+}
+static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
+
+/* chassis_clear */
+static ssize_t chassis_clear(struct device *dev, const char *buf, size_t count)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	unsigned long val = simple_strtol(buf, NULL, 10);
+
+	if (val == 1) {
+		adm9240_write_value(client, ADM9240_REG_CHASSIS_CLEAR, 0x80);
+		dev_dbg(&client->dev, "chassis intrusion latch cleared\n");
+	}
+	return count;
+}
+static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear);
+
+
+/*** sensor chip detect and driver install ***/
+
+static int adm9240_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client;
+	struct adm9240_data *data;
+	int err = 0;
+	const char *name = "";
+	u8 man_id, die_rev;
+
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+		goto exit;
+
+	if (!(data = kmalloc(sizeof(struct adm9240_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+	memset(data, 0, sizeof(struct adm9240_data));
+
+	new_client = &data->client;
+	i2c_set_clientdata(new_client, data);
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &adm9240_driver;
+	new_client->flags = 0;
+
+	if (kind == 0) {
+		kind = adm9240;
+	}
+
+	if (kind < 0) {
+
+		/* verify chip: reg address should match i2c address */
+		if (adm9240_read_value(new_client, ADM9240_REG_I2C_ADDR)
+				!= address) {
+			dev_err(&adapter->dev, "detect fail: address match, "
+					"0x%02x\n", address);
+			goto exit_free;
+		}
+
+		/* check known chip manufacturer */
+		man_id = adm9240_read_value(new_client, ADM9240_REG_MAN_ID);
+
+		if (man_id == 0x23) {
+			kind = adm9240;
+		} else if (man_id == 0xda) {
+			kind = ds1780;
+		} else if (man_id == 0x01) {
+			kind = lm81;
+		} else {
+			dev_err(&adapter->dev, "detect fail: unknown manuf, "
+					"0x%02x\n", man_id);
+			goto exit_free;
+		}
+
+		/* successful detect, print chip info */
+		die_rev = adm9240_read_value(new_client, ADM9240_REG_DIE_REV);
+		dev_info(&adapter->dev, "found %s revision %u\n",
+				man_id == 0x23 ? "ADM9240" :
+				man_id == 0xda ? "DS1780" : "LM81", die_rev);
+	}
+
+	/* either forced or detected chip kind */
+	if (kind == adm9240) {
+		name = "adm9240";
+	} else if (kind == ds1780) {
+		name = "ds1780";
+	} else if (kind == lm81) {
+		name = "lm81";
+	}
+
+	/* fill in the remaining client fields and attach */
+	strlcpy(new_client->name, name, I2C_NAME_SIZE);
+	data->type = kind;
+	init_MUTEX(&data->update_lock);
+
+	if ((err = i2c_attach_client(new_client)))
+		goto exit_free;
+
+	adm9240_init_client(new_client);
+
+	/* populate sysfs filesystem */
+	device_create_file(&new_client->dev, &dev_attr_in0_input);
+	device_create_file(&new_client->dev, &dev_attr_in0_min);
+	device_create_file(&new_client->dev, &dev_attr_in0_max);
+	device_create_file(&new_client->dev, &dev_attr_in1_input);
+	device_create_file(&new_client->dev, &dev_attr_in1_min);
+	device_create_file(&new_client->dev, &dev_attr_in1_max);
+	device_create_file(&new_client->dev, &dev_attr_in2_input);
+	device_create_file(&new_client->dev, &dev_attr_in2_min);
+	device_create_file(&new_client->dev, &dev_attr_in2_max);
+	device_create_file(&new_client->dev, &dev_attr_in3_input);
+	device_create_file(&new_client->dev, &dev_attr_in3_min);
+	device_create_file(&new_client->dev, &dev_attr_in3_max);
+	device_create_file(&new_client->dev, &dev_attr_in4_input);
+	device_create_file(&new_client->dev, &dev_attr_in4_min);
+	device_create_file(&new_client->dev, &dev_attr_in4_max);
+	device_create_file(&new_client->dev, &dev_attr_in5_input);
+	device_create_file(&new_client->dev, &dev_attr_in5_min);
+	device_create_file(&new_client->dev, &dev_attr_in5_max);
+	device_create_file(&new_client->dev, &dev_attr_temp1_max);
+	device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst);
+	device_create_file(&new_client->dev, &dev_attr_temp1_input);
+	device_create_file(&new_client->dev, &dev_attr_fan1_input);
+	device_create_file(&new_client->dev, &dev_attr_fan1_div);
+	device_create_file(&new_client->dev, &dev_attr_fan1_min);
+	device_create_file(&new_client->dev, &dev_attr_fan2_input);
+	device_create_file(&new_client->dev, &dev_attr_fan2_div);
+	device_create_file(&new_client->dev, &dev_attr_fan2_min);
+	device_create_file(&new_client->dev, &dev_attr_alarms);
+	device_create_file(&new_client->dev, &dev_attr_aout_output);
+	device_create_file(&new_client->dev, &dev_attr_chassis_clear);
+	device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
+
+	return 0;
+exit_free:
+	kfree(new_client);
+exit:
+	return err;
+}
+
+static int adm9240_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, adm9240_detect);
+}
+
+static int adm9240_detach_client(struct i2c_client *client)
+{
+	int err;
+
+	if ((err = i2c_detach_client(client))) {
+		dev_err(&client->dev, "Client deregistration failed, "
+				"client not detached.\n");
+		return err;
+	}
+
+	kfree(i2c_get_clientdata(client));
+	return 0;
+}
+
+static void adm9240_init_client(struct i2c_client *client)
+{
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	u8 conf = adm9240_read_value(client, ADM9240_REG_CONFIG);
+	u8 mode = adm9240_read_value(client, ADM9240_REG_TEMP_CONF) & 3;
+
+	data->vrm = i2c_which_vrm(); /* need this to report vid as mV */
+
+	if (conf & 1) { /* measurement cycle running: report state */
+
+		dev_info(&client->dev, "status: config 0x%02x mode %u\n",
+				conf, mode);
+
+	} else { /* cold start: open limits before starting chip */
+		int i;
+
+		for (i = 0; i < 6; i++)
+		{
+			adm9240_write_value(client,
+					ADM9240_REG_IN_MIN(i), 0);
+			adm9240_write_value(client,
+					ADM9240_REG_IN_MAX(i), 255);
+		}
+		adm9240_write_value(client, ADM9240_REG_FAN_MIN(0), 255);
+		adm9240_write_value(client, ADM9240_REG_FAN_MIN(1), 255);
+		adm9240_write_value(client, ADM9240_REG_TEMP_HIGH, 127);
+		adm9240_write_value(client, ADM9240_REG_TEMP_HYST, 127);
+
+		/* start measurement cycle */
+		adm9240_write_value(client, ADM9240_REG_CONFIG, 1);
+
+		dev_info(&client->dev, "cold start: config was 0x%02x "
+				"mode %u\n", conf, mode);
+	}
+}
+
+static struct adm9240_data *adm9240_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct adm9240_data *data = i2c_get_clientdata(client);
+	int i;
+
+	down(&data->update_lock);
+
+	/* minimum measurement cycle: 1.75 seconds */
+	if (time_after(jiffies, data->last_updated_measure + (HZ * 7 / 4))
+			|| !data->valid) {
+
+		for (i = 0; i < 6; i++) /* read voltages */
+		{
+			data->in[i] = adm9240_read_value(client,
+					ADM9240_REG_IN(i));
+		}
+		data->alarms = adm9240_read_value(client,
+					ADM9240_REG_INT(0)) |
+					adm9240_read_value(client,
+					ADM9240_REG_INT(1)) << 8;
+
+		/* read temperature: assume temperature changes less than
+		 * 0.5'C per two measurement cycles thus ignore possible
+		 * but unlikely aliasing error on lsb reading. --Grant */
+		data->temp = ((adm9240_read_value(client,
+					ADM9240_REG_TEMP) << 8) |
+					adm9240_read_value(client,
+					ADM9240_REG_TEMP_CONF)) / 128;
+
+		for (i = 0; i < 2; i++) /* read fans */
+		{
+			data->fan[i] = adm9240_read_value(client,
+					ADM9240_REG_FAN(i));
+
+			/* adjust fan clock divider on overflow */
+			if (data->valid && data->fan[i] == 255 &&
+					data->fan_div[i] < 3) {
+
+				adm9240_write_fan_div(client, i,
+						++data->fan_div[i]);
+
+				/* adjust fan_min if active, but not to 0 */
+				if (data->fan_min[i] < 255 &&
+						data->fan_min[i] >= 2)
+					data->fan_min[i] /= 2;
+			}
+		}
+		data->last_updated_measure = jiffies;
+	}
+
+	/* minimum config reading cycle: 300 seconds */
+	if (time_after(jiffies, data->last_updated_config + (HZ * 300))
+			|| !data->valid) {
+
+		for (i = 0; i < 6; i++)
+		{
+			data->in_min[i] = adm9240_read_value(client,
+					ADM9240_REG_IN_MIN(i));
+			data->in_max[i] = adm9240_read_value(client,
+					ADM9240_REG_IN_MAX(i));
+		}
+		for (i = 0; i < 2; i++)
+		{
+			data->fan_min[i] = adm9240_read_value(client,
+					ADM9240_REG_FAN_MIN(i));
+		}
+		data->temp_high = adm9240_read_value(client,
+				ADM9240_REG_TEMP_HIGH);
+		data->temp_hyst = adm9240_read_value(client,
+				ADM9240_REG_TEMP_HYST);
+
+		/* read fan divs and 5-bit VID */
+		i = adm9240_read_value(client, ADM9240_REG_VID_FAN_DIV);
+		data->fan_div[0] = (i >> 4) & 3;
+		data->fan_div[1] = (i >> 6) & 3;
+		data->vid = i & 0x0f;
+		data->vid |= (adm9240_read_value(client,
+					ADM9240_REG_VID4) & 1) << 4;
+		/* read analog out */
+		data->aout = adm9240_read_value(client,
+				ADM9240_REG_ANALOG_OUT);
+
+		data->last_updated_config = jiffies;
+		data->valid = 1;
+	}
+	up(&data->update_lock);
+	return data;
+}
+
+static int __init sensors_adm9240_init(void)
+{
+	return i2c_add_driver(&adm9240_driver);
+}
+
+static void __exit sensors_adm9240_exit(void)
+{
+	i2c_del_driver(&adm9240_driver);
+}
+
+MODULE_AUTHOR("Michiel Rook <michiel@grendelproject.nl>, "
+		"Grant Coady <gcoady@gmail.com> and others");
+MODULE_DESCRIPTION("ADM9240/DS1780/LM81 driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_adm9240_init);
+module_exit(sensors_adm9240_exit);
+


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1
  2005-06-22  5:17                                     ` [PATCH] I2C: Fix bugs in the new w83627ehf driver Greg KH
@ 2005-06-22  5:17                                       ` Greg KH
  2005-06-22  5:17                                         ` [PATCH] I2C: Allow for sharing of the interrupt line for i2c-mpc.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1

This simple patch adds support for the SMSC LPC47M15x and LPC47M192
chips to the smsc47m1 hardware monitoring driver. These chips are
compatible with the other ones already supported by the driver, so I see
no reason not to support them, especially when the Linux 2.4 version of
the driver does already.

I also modified the info printks to name the chips by their real name.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit ec5ce552d946a55c1e504054627c9068fb7afb8a
tree 88a4ff89a92939fbc6da3b92d80a6025a3351432
parent b9110b1c893f45ec66ae39e359decdfad84525be
author Jean Delvare <khali@linux-fr.org> Tue, 26 Apr 2005 22:09:43 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:54 -0700

 drivers/i2c/chips/Kconfig    |    2 +-
 drivers/i2c/chips/smsc47m1.c |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -331,7 +331,7 @@ config SENSORS_SMSC47M1
 	help
 	  If you say yes here you get support for the integrated fan
 	  monitoring and control capabilities of the SMSC LPC47B27x,
-	  LPC47M10x, LPC47M13x and LPC47M14x chips.
+	  LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 chips.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called smsc47m1.
diff --git a/drivers/i2c/chips/smsc47m1.c b/drivers/i2c/chips/smsc47m1.c
--- a/drivers/i2c/chips/smsc47m1.c
+++ b/drivers/i2c/chips/smsc47m1.c
@@ -372,14 +372,16 @@ static int smsc47m1_find(int *address)
 	 * SMSC LPC47M10x/LPC47M13x (device id 0x59), LPC47M14x (device id
 	 * 0x5F) and LPC47B27x (device id 0x51) have fan control.
 	 * The LPC47M15x and LPC47M192 chips "with hardware monitoring block"
-	 * can do much more besides (device id 0x60, unsupported).
+	 * can do much more besides (device id 0x60).
 	 */
 	if (val == 0x51)
-		printk(KERN_INFO "smsc47m1: Found SMSC47B27x\n");
+		printk(KERN_INFO "smsc47m1: Found SMSC LPC47B27x\n");
 	else if (val == 0x59)
-		printk(KERN_INFO "smsc47m1: Found SMSC47M10x/SMSC47M13x\n");
+		printk(KERN_INFO "smsc47m1: Found SMSC LPC47M10x/LPC47M13x\n");
 	else if (val == 0x5F)
-		printk(KERN_INFO "smsc47m1: Found SMSC47M14x\n");
+		printk(KERN_INFO "smsc47m1: Found SMSC LPC47M14x\n");
+	else if (val == 0x60)
+		printk(KERN_INFO "smsc47m1: Found SMSC LPC47M15x/LPC47M192\n");
 	else {
 		superio_exit();
 		return -ENODEV;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Setting w83627hf fan divisor 128 fails.
  2005-06-22  5:17                                               ` [PATCH] I2C: sysfs names: rename to cpu0_vid, take 3 Greg KH
@ 2005-06-22  5:17                                                 ` Greg KH
  2005-06-22  5:17                                                   ` [PATCH] I2C: remove <linux/delay.h> from via686a Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: Setting w83627hf fan divisor 128 fails.

Jarkko Lavinen provided patch to fix: "couldn't set the divisor 128
through fan1_div sysfs entry even though the chip supports it and
setting divisors 1..64 worked. This was due to POWER_TO_REG() only
checking 2's powers 0 till 5 but not 6."

This patch applies that fix to w83627hf and w83781d drivers.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit abc01922477104e8d72b494902aff37135c409e7
tree 7ef178b1a14e89c88bac1a976c238c91fc1697ee
parent b9826b3ee8faa468a26782e3bf37716a73d96730
author Grant Coady <grant_lkml@dodo.com.au> Thu, 12 May 2005 13:41:51 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:56 -0700

 drivers/i2c/chips/w83627hf.c |    2 +-
 drivers/i2c/chips/w83781d.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/chips/w83627hf.c b/drivers/i2c/chips/w83627hf.c
--- a/drivers/i2c/chips/w83627hf.c
+++ b/drivers/i2c/chips/w83627hf.c
@@ -264,7 +264,7 @@ static inline u8 DIV_TO_REG(long val)
 {
 	int i;
 	val = SENSORS_LIMIT(val, 1, 128) >> 1;
-	for (i = 0; i < 6; i++) {
+	for (i = 0; i < 7; i++) {
 		if (val == 0)
 			break;
 		val >>= 1;
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c
+++ b/drivers/i2c/chips/w83781d.c
@@ -192,7 +192,7 @@ DIV_TO_REG(long val, enum chips type)
 	val = SENSORS_LIMIT(val, 1,
 			    ((type == w83781d
 			      || type == as99127f) ? 8 : 128)) >> 1;
-	for (i = 0; i < 6; i++) {
+	for (i = 0; i < 7; i++) {
 		if (val == 0)
 			break;
 		val >>= 1;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Kill common macro abuse in chip drivers
  2005-06-22  5:17                                                   ` [PATCH] I2C: remove <linux/delay.h> from via686a Greg KH
@ 2005-06-22  5:17                                                     ` Greg KH
  2005-06-22  5:17                                                       ` [PATCH] I2C: adm9240 driver cleanup Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Kill common macro abuse in chip drivers

This patch kills a common macro abuse in i2c chip drivers: defining
ALARMS_FROM_REG returning its argument unchanged. Dropping the macro
makes the code somewhat more readable IMHO.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 68188ba7de2db9999ff08a4544a78b2f10eb08bd
tree 37e0406d7f2b6ace2bc73043bda0c745d3aa5e37
parent ff3240946d6a3d9f2ecf273f7330e09eec5484eb
author Jean Delvare <khali@linux-fr.org> Mon, 16 May 2005 18:52:38 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:57 -0700

 drivers/i2c/chips/asb100.c  |    4 +---
 drivers/i2c/chips/it87.c    |    4 +---
 drivers/i2c/chips/lm85.c    |    4 +---
 drivers/i2c/chips/via686a.c |    4 +---
 drivers/i2c/chips/w83781d.c |    3 +--
 5 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- a/drivers/i2c/chips/asb100.c
+++ b/drivers/i2c/chips/asb100.c
@@ -169,8 +169,6 @@ static int ASB100_PWM_FROM_REG(u8 reg)
 	return reg * 16;
 }
 
-#define ALARMS_FROM_REG(val) (val)
-
 #define DIV_FROM_REG(val) (1 << (val))
 
 /* FAN DIV: 1, 2, 4, or 8 (defaults to 2)
@@ -557,7 +555,7 @@ device_create_file(&client->dev, &dev_at
 static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct asb100_data *data = asb100_update_device(dev);
-	return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c
+++ b/drivers/i2c/chips/it87.c
@@ -172,8 +172,6 @@ static inline u8 FAN_TO_REG(long rpm, in
 					((val)+500)/1000),-128,127))
 #define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
 
-#define ALARMS_FROM_REG(val) (val)
-
 #define PWM_TO_REG(val)   ((val) >> 1)
 #define PWM_FROM_REG(val) (((val)&0x7f) << 1)
 
@@ -665,7 +663,7 @@ show_pwm_offset(3);
 static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct it87_data *data = it87_update_device(dev);
-	return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
diff --git a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c
--- a/drivers/i2c/chips/lm85.c
+++ b/drivers/i2c/chips/lm85.c
@@ -284,8 +284,6 @@ static int ZONE_TO_REG( int zone )
 /* i2c-vid.h defines vid_from_reg() */
 #define VID_FROM_REG(val,vrm) (vid_from_reg((val),(vrm)))
 
-#define ALARMS_FROM_REG(val) (val)
-
 /* Unlike some other drivers we DO NOT set initial limits.  Use
  * the config file to set limits.  Some users have reported
  * motherboards shutting down when we set limits in a previous
@@ -480,7 +478,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUS
 static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct lm85_data *data = lm85_update_device(dev);
-	return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -292,8 +292,6 @@ static inline long TEMP_FROM_REG10(u16 v
 	        tempLUT[eightBits + 1] * twoBits) * 25;
 }
 
-#define ALARMS_FROM_REG(val) (val)
-
 #define DIV_FROM_REG(val) (1 << (val))
 #define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
 
@@ -570,7 +568,7 @@ show_fan_offset(2);
 /* Alarms */
 static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c
+++ b/drivers/i2c/chips/w83781d.c
@@ -172,7 +172,6 @@ FAN_TO_REG(long rpm, int div)
 						: (val)) / 1000, 0, 0xff))
 #define TEMP_FROM_REG(val)		(((val) & 0x80 ? (val)-0x100 : (val)) * 1000)
 
-#define ALARMS_FROM_REG(val)		(val)
 #define PWM_FROM_REG(val)		(val)
 #define PWM_TO_REG(val)			(SENSORS_LIMIT((val),0,255))
 #define BEEP_MASK_FROM_REG(val,type)	((type) == as99127f ? \
@@ -523,7 +522,7 @@ static ssize_t
 show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct w83781d_data *data = w83781d_update_device(dev);
-	return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 
 static


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Remove redundancy from i2c-core.c
  2005-06-22  5:17                                           ` [PATCH] Spelling fixes for drivers/i2c Greg KH
@ 2005-06-22  5:17                                             ` Greg KH
  2005-06-22  5:17                                               ` [PATCH] I2C: sysfs names: rename to cpu0_vid, take 3 Greg KH
  2005-06-22  7:37                                               ` [PATCH] I2C: Remove redundancy from i2c-core.c Thomas Schneller
  0 siblings, 2 replies; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Remove redundancy from i2c-core.c

Call i2c_transfer() from i2c_master_send() and i2c_master_recv() to
avoid the redundant code that was in all three functions.  It also
removes unnecessary debug statements as suggested by Jean Delvare.

This is important for the non-blocking interfaces because they will
have to handle a non-blocking interface in this area.  Having it in
one place greatly simplifies the changes.

Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 815f55f280fb2781ba1c2a350516b73e55119c60
tree 48c06bd1650d44aa274989ce2696eb5091d3805c
parent 30aedcb33970367e50b5edf373e9cd1a5cebcbe1
author Jean Delvare <khali@linux-fr.org> Sat, 07 May 2005 22:58:46 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:55 -0700

 drivers/i2c/i2c-core.c |   64 +++++++++++++++---------------------------------
 1 files changed, 20 insertions(+), 44 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -611,27 +611,16 @@ int i2c_master_send(struct i2c_client *c
 	struct i2c_adapter *adap=client->adapter;
 	struct i2c_msg msg;
 
-	if (client->adapter->algo->master_xfer) {
-		msg.addr   = client->addr;
-		msg.flags = client->flags & I2C_M_TEN;
-		msg.len = count;
-		msg.buf = (char *)buf;
+	msg.addr = client->addr;
+	msg.flags = client->flags & I2C_M_TEN;
+	msg.len = count;
+	msg.buf = (char *)buf;
 	
-		dev_dbg(&client->adapter->dev, "master_send: writing %d bytes.\n",
-			count);
-	
-		down(&adap->bus_lock);
-		ret = adap->algo->master_xfer(adap,&msg,1);
-		up(&adap->bus_lock);
-
-		/* if everything went ok (i.e. 1 msg transmitted), return #bytes
-		 * transmitted, else error code.
-		 */
-		return (ret == 1 )? count : ret;
-	} else {
-		dev_err(&client->adapter->dev, "I2C level transfers not supported\n");
-		return -ENOSYS;
-	}
+	ret = i2c_transfer(adap, &msg, 1);
+
+	/* If everything went ok (i.e. 1 msg transmitted), return #bytes
+	   transmitted, else error code. */
+	return (ret == 1) ? count : ret;
 }
 
 int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
@@ -639,31 +628,18 @@ int i2c_master_recv(struct i2c_client *c
 	struct i2c_adapter *adap=client->adapter;
 	struct i2c_msg msg;
 	int ret;
-	if (client->adapter->algo->master_xfer) {
-		msg.addr   = client->addr;
-		msg.flags = client->flags & I2C_M_TEN;
-		msg.flags |= I2C_M_RD;
-		msg.len = count;
-		msg.buf = buf;
 
-		dev_dbg(&client->adapter->dev, "master_recv: reading %d bytes.\n",
-			count);
-	
-		down(&adap->bus_lock);
-		ret = adap->algo->master_xfer(adap,&msg,1);
-		up(&adap->bus_lock);
-	
-		dev_dbg(&client->adapter->dev, "master_recv: return:%d (count:%d, addr:0x%02x)\n",
-			ret, count, client->addr);
-	
-		/* if everything went ok (i.e. 1 msg transmitted), return #bytes
-	 	* transmitted, else error code.
-	 	*/
-		return (ret == 1 )? count : ret;
-	} else {
-		dev_err(&client->adapter->dev, "I2C level transfers not supported\n");
-		return -ENOSYS;
-	}
+	msg.addr = client->addr;
+	msg.flags = client->flags & I2C_M_TEN;
+	msg.flags |= I2C_M_RD;
+	msg.len = count;
+	msg.buf = buf;
+
+	ret = i2c_transfer(adap, &msg, 1);
+
+	/* If everything went ok (i.e. 1 msg transmitted), return #bytes
+	   transmitted, else error code. */
+	return (ret == 1) ? count : ret;
 }
 
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: sysfs names: rename to cpu0_vid, take 3
  2005-06-22  5:17                                             ` [PATCH] I2C: Remove redundancy from i2c-core.c Greg KH
@ 2005-06-22  5:17                                               ` Greg KH
  2005-06-22  5:17                                                 ` [PATCH] I2C: Setting w83627hf fan divisor 128 fails Greg KH
  2005-06-22  7:37                                               ` [PATCH] I2C: Remove redundancy from i2c-core.c Thomas Schneller
  1 sibling, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: sysfs names: rename to cpu0_vid, take 3

This small patch changes two drivers, adm1025 and adm1026, to
report vid as cpu0_vid sysfs name as used by the other drivers.

Added duplicated names and six month warning for old names to
be removed as requested.  Compile tested.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 937df8df907ce63b0f7e19adf6e3cdef1687fac3
tree 4ac2a146290bcda4c741fa82b3a09e2d42f773b5
parent abc01922477104e8d72b494902aff37135c409e7
author Grant Coady <grant_lkml@dodo.com.au> Thu, 12 May 2005 11:59:29 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:56 -0700

 Documentation/feature-removal-schedule.txt |   10 ++++++++++
 drivers/i2c/chips/adm1025.c                |    4 ++++
 drivers/i2c/chips/adm1026.c                |    5 ++++-
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -83,3 +83,13 @@ Why:	Deprecated in favour of the new ioc
 	more efficient.  You should really be using libraw1394 for raw1394
 	access anyway.
 Who:	Jody McIntyre <scjody@steamballoon.com>
+
+---------------------------
+
+What:	i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid
+When:	November 2005
+Files:	drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c
+Why:	Match the other drivers' name for the same function, duplicate names
+	will be available until removal of old names.
+Who:	Grant Coady <gcoady@gmail.com>
+
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c
--- a/drivers/i2c/chips/adm1025.c
+++ b/drivers/i2c/chips/adm1025.c
@@ -286,7 +286,9 @@ static ssize_t show_vid(struct device *d
 	struct adm1025_data *data = adm1025_update_device(dev);
 	return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm));
 }
+/* in1_ref is deprecated in favour of cpu0_vid, remove after 2005-11-11 */
 static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL);
+static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
 
 static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -436,7 +438,9 @@ static int adm1025_detect(struct i2c_ada
 	device_create_file(&new_client->dev, &dev_attr_temp1_max);
 	device_create_file(&new_client->dev, &dev_attr_temp2_max);
 	device_create_file(&new_client->dev, &dev_attr_alarms);
+	/* in1_ref is deprecated, remove after 2005-11-11 */
 	device_create_file(&new_client->dev, &dev_attr_in1_ref);
+	device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
 	device_create_file(&new_client->dev, &dev_attr_vrm);
 
 	/* Pin 11 is either in4 (+12V) or VID4 */
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
--- a/drivers/i2c/chips/adm1026.c
+++ b/drivers/i2c/chips/adm1026.c
@@ -1224,8 +1224,9 @@ static ssize_t show_vid_reg(struct devic
 	struct adm1026_data *data = adm1026_update_device(dev);
 	return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm));
 }
-
+/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
 static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL);
+static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
 
 static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -1665,7 +1666,9 @@ int adm1026_detect(struct i2c_adapter *a
 	device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable);
 	device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable);
 	device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable);
+	/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */
 	device_create_file(&new_client->dev, &dev_attr_vid);
+	device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
 	device_create_file(&new_client->dev, &dev_attr_vrm);
 	device_create_file(&new_client->dev, &dev_attr_alarms);
 	device_create_file(&new_client->dev, &dev_attr_alarm_mask);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: adm9240 driver cleanup
  2005-06-22  5:17                                                     ` [PATCH] I2C: Kill common macro abuse in chip drivers Greg KH
@ 2005-06-22  5:17                                                       ` Greg KH
  2005-06-22  5:17                                                         ` [PATCH] I2C: include of jiffies.h for some i2c drivers Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: adm9240 driver cleanup

This patch adds an info print of detected VRM stolen from Sebastian
Witt's atxp1 sriver.  ADM9240 already has vrm accessor removed.

Write no-op and whitespace fixes removed :)

Couple of comments changed, tested on 2.6.11.9.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 8e8f9289cc5b781d583d5aed935abf060207bbd3
tree d058803efab6b2f359ca750ec50e73681da3ce8d
parent 937df8df907ce63b0f7e19adf6e3cdef1687fac3
author Grant Coady <grant_lkml@dodo.com.au> Fri, 13 May 2005 20:26:10 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:57 -0700

 drivers/i2c/chips/adm9240.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/chips/adm9240.c b/drivers/i2c/chips/adm9240.c
--- a/drivers/i2c/chips/adm9240.c
+++ b/drivers/i2c/chips/adm9240.c
@@ -165,7 +165,7 @@ struct adm9240_data {
 	s8 temp_high;		/* rw	temp1_max */
 	s8 temp_hyst;		/* rw	temp1_max_hyst */
 	u16 alarms;		/* ro	alarms */
-	u8 aout;		/* rw	analog_out */
+	u8 aout;		/* rw	aout_output */
 	u8 vid;			/* ro	vid */
 	u8 vrm;			/* --	vrm set on startup, no accessor */
 };
@@ -192,7 +192,7 @@ static ssize_t show_##value(struct devic
 }
 show_temp(temp_high, 1000);
 show_temp(temp_hyst, 1000);
-show_temp(temp, 500);
+show_temp(temp, 500); /* 0.5'C per bit */
 
 #define set_temp(value, reg)					\
 static ssize_t set_##value(struct device *dev, const char *buf,	\
@@ -630,6 +630,9 @@ static void adm9240_init_client(struct i
 
 	data->vrm = i2c_which_vrm(); /* need this to report vid as mV */
 
+	dev_info(&client->dev, "Using VRM: %d.%d\n", data->vrm / 10,
+			data->vrm % 10);
+
 	if (conf & 1) { /* measurement cycle running: report state */
 
 		dev_info(&client->dev, "status: config 0x%02x mode %u\n",


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: remove <linux/delay.h> from via686a
  2005-06-22  5:17                                                 ` [PATCH] I2C: Setting w83627hf fan divisor 128 fails Greg KH
@ 2005-06-22  5:17                                                   ` Greg KH
  2005-06-22  5:17                                                     ` [PATCH] I2C: Kill common macro abuse in chip drivers Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: remove <linux/delay.h> from via686a

In my cross-reference checking of sysfs names, the via686a needs
special case treatment as it the only driver expands S_IWUSR to
00200 with gcc -E.  (00200 is the correct value for S_IWUSR).

This is caused by the driver including <linux/delay.h>, it compiles
fine without that header but I am unable to test drive the change.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit b9826b3ee8faa468a26782e3bf37716a73d96730
tree e714c037b2862cf8c592311c09958ffba818259d
parent 815f55f280fb2781ba1c2a350516b73e55119c60
author Grant Coady <grant_lkml@dodo.com.au> Fri, 06 May 2005 17:40:51 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:56 -0700

 drivers/i2c/chips/via686a.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -33,7 +33,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] Spelling fixes for drivers/i2c.
  2005-06-22  5:17                                         ` [PATCH] I2C: Allow for sharing of the interrupt line for i2c-mpc.c Greg KH
@ 2005-06-22  5:17                                           ` Greg KH
  2005-06-22  5:17                                             ` [PATCH] I2C: Remove redundancy from i2c-core.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: elenstev

[PATCH] Spelling fixes for drivers/i2c.

 Here are some spelling corrections for drivers/i2c.

 occured -> occurred
 intialization -> initialization
 Everytime -> Every time
 transfering -> transferring
 relevent -> relevant
 continous -> continuous
 neccessary -> necessary
 explicitely -> explicitly
 Celcius -> Celsius
 differenciate -> differentiate

Signed-off-by: Steven Cole <elenstev@mesatop.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 44bbe87e9017efa050bb1b506c6822f1f3bb94d7
tree 62656712b3707592fb8fb8e152a200e71dbbb150
parent ec5ce552d946a55c1e504054627c9068fb7afb8a
author Steven Cole <elenstev@mesatop.com> Tue, 03 May 2005 18:21:25 -0600
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:55 -0700

 drivers/i2c/algos/i2c-algo-pca.c |    4 ++--
 drivers/i2c/busses/i2c-ibm_iic.c |    2 +-
 drivers/i2c/busses/i2c-iop3xx.c  |    2 +-
 drivers/i2c/busses/i2c-s3c2410.c |    2 +-
 drivers/i2c/chips/adm1031.c      |    2 +-
 drivers/i2c/chips/ds1621.c       |    4 ++--
 drivers/i2c/chips/it87.c         |    4 ++--
 drivers/i2c/chips/lm63.c         |    4 ++--
 drivers/i2c/chips/lm78.c         |    4 ++--
 drivers/i2c/chips/lm83.c         |    2 +-
 drivers/i2c/chips/lm90.c         |    8 ++++----
 11 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -49,7 +49,7 @@ static int i2c_debug=0;
 /*
  * Generate a start condition on the i2c bus.
  *
- * returns after the start condition has occured
+ * returns after the start condition has occurred
  */
 static void pca_start(struct i2c_algo_pca_data *adap)
 {
@@ -64,7 +64,7 @@ static void pca_start(struct i2c_algo_pc
 /*
  * Generate a repeated start condition on the i2c bus 
  *
- * return after the repeated start condition has occured
+ * return after the repeated start condition has occurred
  */
 static void pca_repeated_start(struct i2c_algo_pca_data *adap)
 {
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -695,7 +695,7 @@ static int __devinit iic_probe(struct oc
 
 	dev->irq = iic_force_poll ? -1 : ocp->def->irq;
 	if (dev->irq >= 0){
-		/* Disable interrupts until we finish intialization,
+		/* Disable interrupts until we finish initialization,
 		   assumes level-sensitive IRQ setup...
 		 */
 		iic_interrupt_mode(dev, 0);
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -85,7 +85,7 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx
 	u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE;
 
 	/* 
-	 * Everytime unit enable is asserted, GPOD needs to be cleared
+	 * Every time unit enable is asserted, GPOD needs to be cleared
 	 * on IOP321 to avoid data corruption on the bus.
 	 */
 #ifdef CONFIG_ARCH_IOP321
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -534,7 +534,7 @@ static int s3c24xx_i2c_doxfer(struct s3c
 /* s3c24xx_i2c_xfer
  *
  * first port of call from the i2c bus code when an message needs
- * transfering across the i2c bus.
+ * transferring across the i2c bus.
 */
 
 static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
diff --git a/drivers/i2c/chips/adm1031.c b/drivers/i2c/chips/adm1031.c
--- a/drivers/i2c/chips/adm1031.c
+++ b/drivers/i2c/chips/adm1031.c
@@ -440,7 +440,7 @@ pwm_reg(2);
 
 /*
  * That function checks the cases where the fan reading is not
- * relevent.  It is used to provide 0 as fan reading when the fan is
+ * relevant.  It is used to provide 0 as fan reading when the fan is
  * not supposed to run
  */
 static int trust_fan_readings(struct adm1031_data *data, int chan)
diff --git a/drivers/i2c/chips/ds1621.c b/drivers/i2c/chips/ds1621.c
--- a/drivers/i2c/chips/ds1621.c
+++ b/drivers/i2c/chips/ds1621.c
@@ -121,7 +121,7 @@ static int ds1621_write_value(struct i2c
 static void ds1621_init_client(struct i2c_client *client)
 {
 	int reg = ds1621_read_value(client, DS1621_REG_CONF);
-	/* switch to continous conversion mode */
+	/* switch to continuous conversion mode */
 	reg &= ~ DS1621_REG_CONFIG_1SHOT;
 
 	/* setup output polarity */
@@ -303,7 +303,7 @@ static struct ds1621_data *ds1621_update
 		data->temp_max = ds1621_read_value(client,
 						    DS1621_REG_TEMP_MAX);
 
-		/* reset alarms if neccessary */
+		/* reset alarms if necessary */
 		new_conf = data->conf;
 		if (data->temp < data->temp_min)
 			new_conf &= ~DS1621_ALARM_TEMP_LOW;
diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c
+++ b/drivers/i2c/chips/it87.c
@@ -953,7 +953,7 @@ static int it87_detach_client(struct i2c
 	return 0;
 }
 
-/* The SMBus locks itself, but ISA access must be locked explicitely! 
+/* The SMBus locks itself, but ISA access must be locked explicitly! 
    We don't want to lock the whole ISA bus, so we lock each client
    separately.
    We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks,
@@ -973,7 +973,7 @@ static int it87_read_value(struct i2c_cl
 		return i2c_smbus_read_byte_data(client, reg);
 }
 
-/* The SMBus locks itself, but ISA access muse be locked explicitely! 
+/* The SMBus locks itself, but ISA access muse be locked explicitly! 
    We don't want to lock the whole ISA bus, so we lock each client
    separately.
    We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks,
diff --git a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c
--- a/drivers/i2c/chips/lm63.c
+++ b/drivers/i2c/chips/lm63.c
@@ -98,9 +98,9 @@ SENSORS_INSMOD_1(lm63);
  * Conversions and various macros
  * For tachometer counts, the LM63 uses 16-bit values.
  * For local temperature and high limit, remote critical limit and hysteresis
- * value, it uses signed 8-bit values with LSB = 1 degree Celcius.
+ * value, it uses signed 8-bit values with LSB = 1 degree Celsius.
  * For remote temperature, low and high limits, it uses signed 11-bit values
- * with LSB = 0.125 degree Celcius, left-justified in 16-bit registers.
+ * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers.
  */
 
 #define FAN_FROM_REG(reg)	((reg) == 0xFFFC || (reg) == 0 ? 0 : \
diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
--- a/drivers/i2c/chips/lm78.c
+++ b/drivers/i2c/chips/lm78.c
@@ -670,7 +670,7 @@ static int lm78_detach_client(struct i2c
 	return 0;
 }
 
-/* The SMBus locks itself, but ISA access must be locked explicitely! 
+/* The SMBus locks itself, but ISA access must be locked explicitly! 
    We don't want to lock the whole ISA bus, so we lock each client
    separately.
    We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks,
@@ -689,7 +689,7 @@ static int lm78_read_value(struct i2c_cl
 		return i2c_smbus_read_byte_data(client, reg);
 }
 
-/* The SMBus locks itself, but ISA access muse be locked explicitely! 
+/* The SMBus locks itself, but ISA access muse be locked explicitly! 
    We don't want to lock the whole ISA bus, so we lock each client
    separately.
    We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks,
diff --git a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c
+++ b/drivers/i2c/chips/lm83.c
@@ -80,7 +80,7 @@ SENSORS_INSMOD_1(lm83);
 
 /*
  * Conversions and various macros
- * The LM83 uses signed 8-bit values with LSB = 1 degree Celcius.
+ * The LM83 uses signed 8-bit values with LSB = 1 degree Celsius.
  */
 
 #define TEMP_FROM_REG(val)	((val) * 1000)
diff --git a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c
+++ b/drivers/i2c/chips/lm90.c
@@ -19,7 +19,7 @@
  * Complete datasheets can be obtained from National's website at:
  *   http://www.national.com/pf/LM/LM89.html
  *   http://www.national.com/pf/LM/LM99.html
- * Note that there is no way to differenciate between both chips.
+ * Note that there is no way to differentiate between both chips.
  *
  * This driver also supports the LM86, another sensor chip made by
  * National Semiconductor. It is exactly similar to the LM90 except it
@@ -39,7 +39,7 @@
  * chips made by Maxim. These chips are similar to the LM86. Complete
  * datasheet can be obtained at Maxim's website at:
  *   http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578
- * Note that there is no easy way to differenciate between the three
+ * Note that there is no easy way to differentiate between the three
  * variants. The extra address and features of the MAX6659 are not
  * supported by this driver.
  *
@@ -138,9 +138,9 @@ SENSORS_INSMOD_6(lm90, adm1032, lm99, lm
 /*
  * Conversions and various macros
  * For local temperatures and limits, critical limits and the hysteresis
- * value, the LM90 uses signed 8-bit values with LSB = 1 degree Celcius.
+ * value, the LM90 uses signed 8-bit values with LSB = 1 degree Celsius.
  * For remote temperatures and limits, it uses signed 11-bit values with
- * LSB = 0.125 degree Celcius, left-justified in 16-bit registers.
+ * LSB = 0.125 degree Celsius, left-justified in 16-bit registers.
  */
 
 #define TEMP1_FROM_REG(val)	((val) * 1000)


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c
  2005-06-22  5:17                                                                     ` [PATCH] I2C: fix up some sysfs device attribute file parameters Greg KH
@ 2005-06-22  5:17                                                                       ` Greg KH
  2005-06-22  5:17                                                                         ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-core.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: tklauser

[PATCH] I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c

This patch fixes a double "the" in a comment section.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 614e24be139c0ae70378349e6c6f0e21751e56bf
tree a2aec8b80eac393adb7b44baf0b875b802d496b7
parent 46b615f453202dbcf66452b500ab69c0e2148593
author Tobias Klauser <tklauser@nuerscht.ch> Thu, 19 May 2005 21:39:06 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:00 -0700

 drivers/i2c/busses/i2c-parport.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -130,7 +130,7 @@ static int parport_getsda(void *data)
 /* Encapsulate the functions above in the correct structure.
    Note that this is only a template, from which the real structures are
    copied. The attaching code will set getscl to NULL for adapters that
-   cannot read SCL back, and will also make the the data field point to
+   cannot read SCL back, and will also make the data field point to
    the parallel port structure. */
 static struct i2c_algo_bit_data parport_algo_data = {
 	.setsda		= parport_setsda,


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: fix up some sysfs device attribute file parameters
  2005-06-22  5:17                                                                   ` [PATCH] I2C: Kill another macro abuse in via686a Greg KH
@ 2005-06-22  5:17                                                                     ` Greg KH
  2005-06-22  5:17                                                                       ` [PATCH] I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: gregkh

[PATCH] I2C: fix up some sysfs device attribute file parameters

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 6f637a6494a1872c613fe68f64ea4831c3e5b037
tree a18368e908290ca7bdf3430b0b5b9cbc0131da5b
parent 563db2fe9e0843da9d1d85d824f022be0ada4a3c
author Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:01:59 -0700
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:59 -0700

 drivers/i2c/chips/adm9240.c   |   54 ++++++++++++++++++++++++++++-------------
 drivers/i2c/chips/atxp1.c     |   12 +++++----
 drivers/i2c/chips/w83627ehf.c |   29 ++++++++++++++--------
 3 files changed, 61 insertions(+), 34 deletions(-)

diff --git a/drivers/i2c/chips/adm9240.c b/drivers/i2c/chips/adm9240.c
--- a/drivers/i2c/chips/adm9240.c
+++ b/drivers/i2c/chips/adm9240.c
@@ -185,7 +185,9 @@ static int adm9240_write_value(struct i2
 
 /* temperature */
 #define show_temp(value, scale)					\
-static ssize_t show_##value(struct device *dev, char *buf)	\
+static ssize_t show_##value(struct device *dev,			\
+			    struct device_attribute *attr,	\
+			    char *buf)				\
 {								\
 	struct adm9240_data *data = adm9240_update_device(dev);	\
 	return sprintf(buf, "%d\n", data->value * scale);	\
@@ -195,8 +197,9 @@ show_temp(temp_hyst, 1000);
 show_temp(temp, 500); /* 0.5'C per bit */
 
 #define set_temp(value, reg)					\
-static ssize_t set_##value(struct device *dev, const char *buf,	\
-		size_t count)					\
+static ssize_t set_##value(struct device *dev, 			\
+			   struct device_attribute *attr,	\
+			   const char *buf, size_t count)	\
 {								\
 	struct i2c_client *client = to_i2c_client(dev);		\
 	struct adm9240_data *data = adm9240_update_device(dev);	\
@@ -266,26 +269,36 @@ static ssize_t set_in_max(struct device 
 }
 
 #define show_in_offset(offset)						\
-static ssize_t show_in##offset(struct device *dev, char *buf)		\
+static ssize_t show_in##offset(struct device *dev,			\
+			       struct device_attribute *attr,		\
+			       char *buf)				\
 {									\
 	return show_in(dev, buf, offset);				\
 }									\
 static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL);	\
-static ssize_t show_in##offset##_min(struct device *dev, char *buf)	\
+static ssize_t show_in##offset##_min(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     char *buf)				\
 {									\
 	return show_in_min(dev, buf, offset);				\
 }									\
-static ssize_t show_in##offset##_max(struct device *dev, char *buf)	\
+static ssize_t show_in##offset##_max(struct device *dev,		\
+				     struct device_attribute *attr,	\
+				     char *buf)				\
 {									\
 	return show_in_max(dev, buf, offset);				\
 }									\
 static ssize_t								\
-set_in##offset##_min(struct device *dev, const char *buf, size_t count)	\
+set_in##offset##_min(struct device *dev,				\
+		     struct device_attribute *attr, const char *buf,	\
+		     size_t count)					\
 {									\
 	return set_in_min(dev, buf, count, offset);			\
 }									\
 static ssize_t								\
-set_in##offset##_max(struct device *dev, const char *buf, size_t count)	\
+set_in##offset##_max(struct device *dev,				\
+		     struct device_attribute *attr, const char *buf,	\
+		     size_t count)					\
 {									\
 	return set_in_max(dev, buf, count, offset);			\
 }									\
@@ -401,20 +414,27 @@ static ssize_t set_fan_min(struct device
 }
 
 #define show_fan_offset(offset)						\
-static ssize_t show_fan_##offset (struct device *dev, char *buf)	\
+static ssize_t show_fan_##offset (struct device *dev,			\
+				  struct device_attribute *attr,	\
+				  char *buf)				\
 {									\
 return show_fan(dev, buf, offset - 1);					\
 }									\
-static ssize_t show_fan_##offset##_div (struct device *dev, char *buf)	\
+static ssize_t show_fan_##offset##_div (struct device *dev,		\
+					struct device_attribute *attr,	\
+					char *buf)			\
 {									\
 return show_fan_div(dev, buf, offset - 1);				\
 }									\
-static ssize_t show_fan_##offset##_min (struct device *dev, char *buf)	\
+static ssize_t show_fan_##offset##_min (struct device *dev,		\
+					struct device_attribute *attr,	\
+					char *buf)			\
 {									\
 return show_fan_min(dev, buf, offset - 1);				\
 }									\
 static ssize_t set_fan_##offset##_min (struct device *dev, 		\
-const char *buf, size_t count)						\
+				       struct device_attribute *attr,	\
+				       const char *buf, size_t count)	\
 {									\
 return set_fan_min(dev, buf, count, offset - 1);			\
 }									\
@@ -429,7 +449,7 @@ show_fan_offset(1);
 show_fan_offset(2);
 
 /* alarms */
-static ssize_t show_alarms(struct device *dev, char *buf)
+static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct adm9240_data *data = adm9240_update_device(dev);
 	return sprintf(buf, "%u\n", data->alarms);
@@ -437,7 +457,7 @@ static ssize_t show_alarms(struct device
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
 /* vid */
-static ssize_t show_vid(struct device *dev, char *buf)
+static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct adm9240_data *data = adm9240_update_device(dev);
 	return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
@@ -445,13 +465,13 @@ static ssize_t show_vid(struct device *d
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
 
 /* analog output */
-static ssize_t show_aout(struct device *dev, char *buf)
+static ssize_t show_aout(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct adm9240_data *data = adm9240_update_device(dev);
 	return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout));
 }
 
-static ssize_t set_aout(struct device *dev, const char *buf, size_t count)
+static ssize_t set_aout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct adm9240_data *data = i2c_get_clientdata(client);
@@ -466,7 +486,7 @@ static ssize_t set_aout(struct device *d
 static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout);
 
 /* chassis_clear */
-static ssize_t chassis_clear(struct device *dev, const char *buf, size_t count)
+static ssize_t chassis_clear(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned long val = simple_strtol(buf, NULL, 10);
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/i2c/chips/atxp1.c
--- a/drivers/i2c/chips/atxp1.c
+++ b/drivers/i2c/chips/atxp1.c
@@ -99,7 +99,7 @@ static struct atxp1_data * atxp1_update_
 }
 
 /* sys file functions for cpu0_vid */
-static ssize_t atxp1_showvcore(struct device *dev, char *buf)
+static ssize_t atxp1_showvcore(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -111,7 +111,7 @@ static ssize_t atxp1_showvcore(struct de
 	return size;
 }
 
-static ssize_t atxp1_storevcore(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storevcore(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
@@ -169,7 +169,7 @@ static ssize_t atxp1_storevcore(struct d
 static DEVICE_ATTR(cpu0_vid, S_IRUGO | S_IWUSR, atxp1_showvcore, atxp1_storevcore);
 
 /* sys file functions for GPIO1 */
-static ssize_t atxp1_showgpio1(struct device *dev, char *buf)
+static ssize_t atxp1_showgpio1(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -181,7 +181,7 @@ static ssize_t atxp1_showgpio1(struct de
 	return size;
 }
 
-static ssize_t atxp1_storegpio1(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storegpio1(struct device *dev, struct device_attribute *attr, const char*buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
@@ -211,7 +211,7 @@ static ssize_t atxp1_storegpio1(struct d
 static DEVICE_ATTR(gpio1, S_IRUGO | S_IWUSR, atxp1_showgpio1, atxp1_storegpio1);
 
 /* sys file functions for GPIO2 */
-static ssize_t atxp1_showgpio2(struct device *dev, char *buf)
+static ssize_t atxp1_showgpio2(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	int size;
 	struct atxp1_data *data;
@@ -223,7 +223,7 @@ static ssize_t atxp1_showgpio2(struct de
 	return size;
 }
 
-static ssize_t atxp1_storegpio2(struct device *dev, const char* buf, size_t count)
+static ssize_t atxp1_storegpio2(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/i2c/chips/w83627ehf.c
--- a/drivers/i2c/chips/w83627ehf.c
+++ b/drivers/i2c/chips/w83627ehf.c
@@ -486,7 +486,8 @@ store_fan_min(struct device *dev, const 
 
 #define sysfs_fan_offset(offset) \
 static ssize_t \
-show_reg_fan_##offset(struct device *dev, char *buf) \
+show_reg_fan_##offset(struct device *dev, struct device_attribute *attr, \
+		      char *buf) \
 { \
 	return show_fan(dev, buf, offset-1); \
 } \
@@ -495,13 +496,14 @@ static DEVICE_ATTR(fan##offset##_input, 
 
 #define sysfs_fan_min_offset(offset) \
 static ssize_t \
-show_reg_fan##offset##_min(struct device *dev, char *buf) \
+show_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \
+			   char *buf) \
 { \
 	return show_fan_min(dev, buf, offset-1); \
 } \
 static ssize_t \
-store_reg_fan##offset##_min(struct device *dev, const char *buf, \
-			    size_t count) \
+store_reg_fan##offset##_min(struct device *dev, struct device_attribute *attr, \
+			    const char *buf, size_t count) \
 { \
 	return store_fan_min(dev, buf, count, offset-1); \
 } \
@@ -511,7 +513,8 @@ static DEVICE_ATTR(fan##offset##_min, S_
 
 #define sysfs_fan_div_offset(offset) \
 static ssize_t \
-show_reg_fan##offset##_div(struct device *dev, char *buf) \
+show_reg_fan##offset##_div(struct device *dev, struct device_attribute *attr, \
+			   char *buf) \
 { \
 	return show_fan_div(dev, buf, offset - 1); \
 } \
@@ -536,7 +539,8 @@ sysfs_fan_div_offset(5);
 
 #define show_temp1_reg(reg) \
 static ssize_t \
-show_##reg(struct device *dev, char *buf) \
+show_##reg(struct device *dev, struct device_attribute *attr, \
+	   char *buf) \
 { \
 	struct w83627ehf_data *data = w83627ehf_update_device(dev); \
 	return sprintf(buf, "%d\n", temp1_from_reg(data->reg)); \
@@ -547,7 +551,8 @@ show_temp1_reg(temp1_max_hyst);
 
 #define store_temp1_reg(REG, reg) \
 static ssize_t \
-store_temp1_##reg(struct device *dev, const char *buf, size_t count) \
+store_temp1_##reg(struct device *dev, struct device_attribute *attr, \
+		  const char *buf, size_t count) \
 { \
 	struct i2c_client *client = to_i2c_client(dev); \
 	struct w83627ehf_data *data = i2c_get_clientdata(client); \
@@ -601,7 +606,8 @@ store_temp_reg(HYST, temp_max_hyst);
 
 #define sysfs_temp_offset(offset) \
 static ssize_t \
-show_reg_temp##offset (struct device *dev, char *buf) \
+show_reg_temp##offset (struct device *dev, struct device_attribute *attr, \
+		       char *buf) \
 { \
 	return show_temp(dev, buf, offset - 2); \
 } \
@@ -610,13 +616,14 @@ static DEVICE_ATTR(temp##offset##_input,
 
 #define sysfs_temp_reg_offset(reg, offset) \
 static ssize_t \
-show_reg_temp##offset##_##reg(struct device *dev, char *buf) \
+show_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \
+			      char *buf) \
 { \
 	return show_temp_##reg(dev, buf, offset - 2); \
 } \
 static ssize_t \
-store_reg_temp##offset##_##reg(struct device *dev, const char *buf, \
-			       size_t count) \
+store_reg_temp##offset##_##reg(struct device *dev, struct device_attribute *attr, \
+			       const char *buf, size_t count) \
 { \
 	return store_temp_##reg(dev, buf, count, offset - 2); \
 } \


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: chips/Kconfig corrections
  2005-06-22  5:17                                                         ` [PATCH] I2C: include of jiffies.h for some i2c drivers Greg KH
@ 2005-06-22  5:17                                                           ` Greg KH
  2005-06-22  5:17                                                             ` [PATCH] I2C: driver adm1021: remove die_code Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: chips/Kconfig corrections

Here are some corrections for drivers/i2c/chips/Kconfig.

Signed-off-by: Alexey Fisher <fishor@gmx.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 057923f0f5ba346fc128ae0a1c3842d8c12bd7f0
tree 6c9cc5d15b6164988c0cb4a994cd22a8d45983c5
parent 6afe15595031bb9801af6207feed0bafc25b6e6b
author Jean Delvare <khali@linux-fr.org> Tue, 17 May 2005 18:09:36 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:58 -0700

 drivers/i2c/chips/Kconfig |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -29,6 +29,7 @@ config SENSORS_ADM1025
 	help
 	  If you say yes here you get support for Analog Devices ADM1025
 	  and Philips NE1619 sensor chips.
+
 	  This driver can also be built as a module.  If so, the module
 	  will be called adm1025.
 
@@ -38,6 +39,8 @@ config SENSORS_ADM1026
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for Analog Devices ADM1026
+	  sensor chip.
+
 	  This driver can also be built as a module.  If so, the module
 	  will be called adm1026.
 
@@ -48,6 +51,7 @@ config SENSORS_ADM1031
 	help
 	  If you say yes here you get support for Analog Devices ADM1031 
 	  and ADM1030 sensor chips.
+
 	  This driver can also be built as a module.  If so, the module
 	  will be called adm1031.
 
@@ -198,8 +202,7 @@ config SENSORS_LM78
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for National Semiconductor LM78,
-	  LM78-J and LM79.  This can also be built as a module which can be
-	  inserted and removed while the kernel is running.
+	  LM78-J and LM79.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called lm78.
@@ -232,7 +235,7 @@ config SENSORS_LM85
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for National Semiconductor LM85
-	  sensor chips and clones: ADT7463 and ADM1027.
+	  sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called lm85.


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: driver adm1021: remove die_code
  2005-06-22  5:17                                                           ` [PATCH] I2C: chips/Kconfig corrections Greg KH
@ 2005-06-22  5:17                                                             ` Greg KH
  2005-06-22  5:17                                                               ` [PATCH] I2C: Coding style cleanups to via686a Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: grant_lkml

[PATCH] I2C: driver adm1021: remove die_code

This patch removes die_code from adm1021 as nothing within the
driver uses it.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 6afe15595031bb9801af6207feed0bafc25b6e6b
tree 144126d9d5e1808e91e46007e5b990bf9b1f1bbc
parent be8992c249e42398ee905450688c135ab761674c
author Grant Coady <grant_lkml@dodo.com.au> Tue, 17 May 2005 17:16:02 +1000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:58 -0700

 drivers/i2c/chips/adm1021.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c
+++ b/drivers/i2c/chips/adm1021.c
@@ -102,8 +102,6 @@ struct adm1021_data {
 	u8	remote_temp_hyst;
 	u8	remote_temp_input;
 	u8	alarms;
-	/* special values for ADM1021 only */
-	u8	die_code;
         /* Special values for ADM1023 only */
 	u8	remote_temp_prec;
 	u8	remote_temp_os_prec;
@@ -155,7 +153,6 @@ static ssize_t show_##value(struct devic
 	return sprintf(buf, "%d\n", data->value);			\
 }
 show2(alarms);
-show2(die_code);
 
 #define set(value, reg)	\
 static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)	\
@@ -182,7 +179,6 @@ static DEVICE_ATTR(temp2_max, S_IWUSR | 
 static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_remote_temp_hyst, set_remote_temp_hyst);
 static DEVICE_ATTR(temp2_input, S_IRUGO, show_remote_temp_input, NULL);
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
-static DEVICE_ATTR(die_code, S_IRUGO, show_die_code, NULL);
 
 
 static int adm1021_attach_adapter(struct i2c_adapter *adapter)
@@ -306,8 +302,6 @@ static int adm1021_detect(struct i2c_ada
 	device_create_file(&new_client->dev, &dev_attr_temp2_min);
 	device_create_file(&new_client->dev, &dev_attr_temp2_input);
 	device_create_file(&new_client->dev, &dev_attr_alarms);
-	if (data->type == adm1021)
-		device_create_file(&new_client->dev, &dev_attr_die_code);
 
 	return 0;
 
@@ -370,8 +364,6 @@ static struct adm1021_data *adm1021_upda
 		data->remote_temp_max = adm1021_read_value(client, ADM1021_REG_REMOTE_TOS_R);
 		data->remote_temp_hyst = adm1021_read_value(client, ADM1021_REG_REMOTE_THYST_R);
 		data->alarms = adm1021_read_value(client, ADM1021_REG_STATUS) & 0x7c;
-		if (data->type == adm1021)
-			data->die_code = adm1021_read_value(client, ADM1021_REG_DIE_CODE);
 		if (data->type == adm1023) {
 			data->remote_temp_prec = adm1021_read_value(client, ADM1021_REG_REM_TEMP_PREC);
 			data->remote_temp_os_prec = adm1021_read_value(client, ADM1021_REG_REM_TOS_PREC);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c
  2005-06-22  5:17                                                               ` [PATCH] I2C: Coding style cleanups to via686a Greg KH
@ 2005-06-22  5:17                                                                 ` Greg KH
  2005-06-22  5:17                                                                   ` [PATCH] I2C: Kill another macro abuse in via686a Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: tklauser

[PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c

This patch fixes the some misspellings and a trailing whitespace in
the comments.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 46b615f453202dbcf66452b500ab69c0e2148593
tree 4f2a4daab8bc675ed72c435cb7cee8e0ad78e751
parent 6f637a6494a1872c613fe68f64ea4831c3e5b037
author Tobias Klauser <tklauser@nuerscht.ch> Thu, 19 May 2005 22:27:23 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:59 -0700

 drivers/i2c/algos/i2c-algo-pca.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -62,7 +62,7 @@ static void pca_start(struct i2c_algo_pc
 }
 
 /*
- * Generate a repeated start condition on the i2c bus 
+ * Generate a repeated start condition on the i2c bus
  *
  * return after the repeated start condition has occurred
  */
@@ -82,7 +82,7 @@ static void pca_repeated_start(struct i2
  * returns after the stop condition has been generated
  *
  * STOPs do not generate an interrupt or set the SI flag, since the
- * part returns the the idle state (0xf8). Hence we don't need to
+ * part returns the idle state (0xf8). Hence we don't need to
  * pca_wait here.
  */
 static void pca_stop(struct i2c_algo_pca_data *adap)


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Coding style cleanups to via686a
  2005-06-22  5:17                                                             ` [PATCH] I2C: driver adm1021: remove die_code Greg KH
@ 2005-06-22  5:17                                                               ` Greg KH
  2005-06-22  5:17                                                                 ` [PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Coding style cleanups to via686a

The via686a hardware monitoring driver has infamous coding style at the
moment. I'd like to clean up the mess before I start working on other
changes to this driver. Is the following patch acceptable? No code
change, only coding style (indentation, alignments, trailing white
space, a few parentheses and a typo).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit be8992c249e42398ee905450688c135ab761674c
tree 29f41874649a86f5616301ca78eae96b79a8c5eb
parent 68188ba7de2db9999ff08a4544a78b2f10eb08bd
author Jean Delvare <khali@linux-fr.org> Mon, 16 May 2005 19:00:52 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:58 -0700

 drivers/i2c/chips/via686a.c |  274 ++++++++++++++++++++++---------------------
 1 files changed, 139 insertions(+), 135 deletions(-)

diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -1,12 +1,12 @@
 /*
     via686a.c - Part of lm_sensors, Linux kernel modules
                 for hardware monitoring
-                
+
     Copyright (c) 1998 - 2002  Frodo Looijaard <frodol@dds.nl>,
                         Kyösti Mälkki <kmalkki@cc.hut.fi>,
 			Mark Studebaker <mdsxyz123@yahoo.com>,
 			and Bob Dougherty <bobd@stanford.edu>
-    (Some conversion-factor data were contributed by Jonathan Teh Soon Yew 
+    (Some conversion-factor data were contributed by Jonathan Teh Soon Yew
     <j.teh@iname.com> and Alex van Kaam <darkside@chello.nl>.)
 
     This program is free software; you can redistribute it and/or modify
@@ -64,19 +64,19 @@ SENSORS_INSMOD_1(via686a);
 /* Many VIA686A constants specified below */
 
 /* Length of ISA address segment */
-#define VIA686A_EXTENT 0x80
-#define VIA686A_BASE_REG 0x70
-#define VIA686A_ENABLE_REG 0x74
+#define VIA686A_EXTENT		0x80
+#define VIA686A_BASE_REG	0x70
+#define VIA686A_ENABLE_REG	0x74
 
 /* The VIA686A registers */
 /* ins numbered 0-4 */
-#define VIA686A_REG_IN_MAX(nr) (0x2b + ((nr) * 2))
-#define VIA686A_REG_IN_MIN(nr) (0x2c + ((nr) * 2))
-#define VIA686A_REG_IN(nr)     (0x22 + (nr))
+#define VIA686A_REG_IN_MAX(nr)	(0x2b + ((nr) * 2))
+#define VIA686A_REG_IN_MIN(nr)	(0x2c + ((nr) * 2))
+#define VIA686A_REG_IN(nr)	(0x22 + (nr))
 
 /* fans numbered 1-2 */
-#define VIA686A_REG_FAN_MIN(nr) (0x3a + (nr))
-#define VIA686A_REG_FAN(nr)     (0x28 + (nr))
+#define VIA686A_REG_FAN_MIN(nr)	(0x3a + (nr))
+#define VIA686A_REG_FAN(nr)	(0x28 + (nr))
 
 /* the following values are as speced by VIA: */
 static const u8 regtemp[] = { 0x20, 0x21, 0x1f };
@@ -87,26 +87,28 @@ static const u8 reghyst[] = { 0x3a, 0x3e
 #define VIA686A_REG_TEMP(nr)		(regtemp[nr])
 #define VIA686A_REG_TEMP_OVER(nr)	(regover[nr])
 #define VIA686A_REG_TEMP_HYST(nr)	(reghyst[nr])
-#define VIA686A_REG_TEMP_LOW1	0x4b	// bits 7-6
-#define VIA686A_REG_TEMP_LOW23	0x49	// 2 = bits 5-4, 3 = bits 7-6
-
-#define VIA686A_REG_ALARM1 0x41
-#define VIA686A_REG_ALARM2 0x42
-#define VIA686A_REG_FANDIV 0x47
-#define VIA686A_REG_CONFIG 0x40
-/* The following register sets temp interrupt mode (bits 1-0 for temp1, 
+/* bits 7-6 */
+#define VIA686A_REG_TEMP_LOW1	0x4b
+/* 2 = bits 5-4, 3 = bits 7-6 */
+#define VIA686A_REG_TEMP_LOW23	0x49
+
+#define VIA686A_REG_ALARM1	0x41
+#define VIA686A_REG_ALARM2	0x42
+#define VIA686A_REG_FANDIV	0x47
+#define VIA686A_REG_CONFIG	0x40
+/* The following register sets temp interrupt mode (bits 1-0 for temp1,
  3-2 for temp2, 5-4 for temp3).  Modes are:
     00 interrupt stays as long as value is out-of-range
     01 interrupt is cleared once register is read (default)
     10 comparator mode- like 00, but ignores hysteresis
     11 same as 00 */
-#define VIA686A_REG_TEMP_MODE 0x4b
+#define VIA686A_REG_TEMP_MODE		0x4b
 /* We'll just assume that you want to set all 3 simultaneously: */
-#define VIA686A_TEMP_MODE_MASK 0x3F
-#define VIA686A_TEMP_MODE_CONTINUOUS (0x00)
+#define VIA686A_TEMP_MODE_MASK		0x3F
+#define VIA686A_TEMP_MODE_CONTINUOUS	0x00
 
 /* Conversions. Limit checking is only done on the TO_REG
-   variants. 
+   variants.
 
 ********* VOLTAGE CONVERSIONS (Bob Dougherty) ********
  From HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew):
@@ -119,7 +121,7 @@ static const u8 reghyst[] = { 0x3a, 0x3e
  That is:
  volts = (25*regVal+133)*factor
  regVal = (volts/factor-133)/25
- (These conversions were contributed by Jonathan Teh Soon Yew 
+ (These conversions were contributed by Jonathan Teh Soon Yew
  <j.teh@iname.com>) */
 static inline u8 IN_TO_REG(long val, int inNum)
 {
@@ -180,55 +182,55 @@ static inline u8 FAN_TO_REG(long rpm, in
       else
               return double(temp)*0.924-127.33;
 
- A fifth-order polynomial fits the unofficial data (provided by Alex van 
- Kaam <darkside@chello.nl>) a bit better.  It also give more reasonable 
- numbers on my machine (ie. they agree with what my BIOS tells me).  
+ A fifth-order polynomial fits the unofficial data (provided by Alex van
+ Kaam <darkside@chello.nl>) a bit better.  It also give more reasonable
+ numbers on my machine (ie. they agree with what my BIOS tells me).
  Here's the fifth-order fit to the 8-bit data:
- temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 - 
+ temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 -
         2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0.
 
- (2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for 
+ (2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for
  finding my typos in this formula!)
 
- Alas, none of the elegant function-fit solutions will work because we 
- aren't allowed to use floating point in the kernel and doing it with 
- integers doesn't rpovide enough precision.  So we'll do boring old 
- look-up table stuff.  The unofficial data (see below) have effectively 
- 7-bit resolution (they are rounded to the nearest degree).  I'm assuming 
- that the transfer function of the device is monotonic and smooth, so a 
- smooth function fit to the data will allow us to get better precision.  
+ Alas, none of the elegant function-fit solutions will work because we
+ aren't allowed to use floating point in the kernel and doing it with
+ integers doesn't provide enough precision.  So we'll do boring old
+ look-up table stuff.  The unofficial data (see below) have effectively
+ 7-bit resolution (they are rounded to the nearest degree).  I'm assuming
+ that the transfer function of the device is monotonic and smooth, so a
+ smooth function fit to the data will allow us to get better precision.
  I used the 5th-order poly fit described above and solved for
- VIA register values 0-255.  I *10 before rounding, so we get tenth-degree 
- precision.  (I could have done all 1024 values for our 10-bit readings, 
- but the function is very linear in the useful range (0-80 deg C), so 
- we'll just use linear interpolation for 10-bit readings.)  So, tempLUT 
+ VIA register values 0-255.  I *10 before rounding, so we get tenth-degree
+ precision.  (I could have done all 1024 values for our 10-bit readings,
+ but the function is very linear in the useful range (0-80 deg C), so
+ we'll just use linear interpolation for 10-bit readings.)  So, tempLUT
  is the temp at via register values 0-255: */
 static const long tempLUT[] =
-    { -709, -688, -667, -646, -627, -607, -589, -570, -553, -536, -519,
-	    -503, -487, -471, -456, -442, -428, -414, -400, -387, -375,
-	    -362, -350, -339, -327, -316, -305, -295, -285, -275, -265,
-	    -255, -246, -237, -229, -220, -212, -204, -196, -188, -180,
-	    -173, -166, -159, -152, -145, -139, -132, -126, -120, -114,
-	    -108, -102, -96, -91, -85, -80, -74, -69, -64, -59, -54, -49,
-	    -44, -39, -34, -29, -25, -20, -15, -11, -6, -2, 3, 7, 12, 16,
-	    20, 25, 29, 33, 37, 42, 46, 50, 54, 59, 63, 67, 71, 75, 79, 84,
-	    88, 92, 96, 100, 104, 109, 113, 117, 121, 125, 130, 134, 138,
-	    142, 146, 151, 155, 159, 163, 168, 172, 176, 181, 185, 189,
-	    193, 198, 202, 206, 211, 215, 219, 224, 228, 232, 237, 241,
-	    245, 250, 254, 259, 263, 267, 272, 276, 281, 285, 290, 294,
-	    299, 303, 307, 312, 316, 321, 325, 330, 334, 339, 344, 348,
-	    353, 357, 362, 366, 371, 376, 380, 385, 390, 395, 399, 404,
-	    409, 414, 419, 423, 428, 433, 438, 443, 449, 454, 459, 464,
-	    469, 475, 480, 486, 491, 497, 502, 508, 514, 520, 526, 532,
-	    538, 544, 551, 557, 564, 571, 578, 584, 592, 599, 606, 614,
-	    621, 629, 637, 645, 654, 662, 671, 680, 689, 698, 708, 718,
-	    728, 738, 749, 759, 770, 782, 793, 805, 818, 830, 843, 856,
-	    870, 883, 898, 912, 927, 943, 958, 975, 991, 1008, 1026, 1044,
-	    1062, 1081, 1101, 1121, 1141, 1162, 1184, 1206, 1229, 1252,
-	    1276, 1301, 1326, 1352, 1378, 1406, 1434, 1462
+{ -709, -688, -667, -646, -627, -607, -589, -570, -553, -536, -519,
+	-503, -487, -471, -456, -442, -428, -414, -400, -387, -375,
+	-362, -350, -339, -327, -316, -305, -295, -285, -275, -265,
+	-255, -246, -237, -229, -220, -212, -204, -196, -188, -180,
+	-173, -166, -159, -152, -145, -139, -132, -126, -120, -114,
+	-108, -102, -96, -91, -85, -80, -74, -69, -64, -59, -54, -49,
+	-44, -39, -34, -29, -25, -20, -15, -11, -6, -2, 3, 7, 12, 16,
+	20, 25, 29, 33, 37, 42, 46, 50, 54, 59, 63, 67, 71, 75, 79, 84,
+	88, 92, 96, 100, 104, 109, 113, 117, 121, 125, 130, 134, 138,
+	142, 146, 151, 155, 159, 163, 168, 172, 176, 181, 185, 189,
+	193, 198, 202, 206, 211, 215, 219, 224, 228, 232, 237, 241,
+	245, 250, 254, 259, 263, 267, 272, 276, 281, 285, 290, 294,
+	299, 303, 307, 312, 316, 321, 325, 330, 334, 339, 344, 348,
+	353, 357, 362, 366, 371, 376, 380, 385, 390, 395, 399, 404,
+	409, 414, 419, 423, 428, 433, 438, 443, 449, 454, 459, 464,
+	469, 475, 480, 486, 491, 497, 502, 508, 514, 520, 526, 532,
+	538, 544, 551, 557, 564, 571, 578, 584, 592, 599, 606, 614,
+	621, 629, 637, 645, 654, 662, 671, 680, 689, 698, 708, 718,
+	728, 738, 749, 759, 770, 782, 793, 805, 818, 830, 843, 856,
+	870, 883, 898, 912, 927, 943, 958, 975, 991, 1008, 1026, 1044,
+	1062, 1081, 1101, 1121, 1141, 1162, 1184, 1206, 1229, 1252,
+	1276, 1301, 1326, 1352, 1378, 1406, 1434, 1462
 };
 
-/* the original LUT values from Alex van Kaam <darkside@chello.nl> 
+/* the original LUT values from Alex van Kaam <darkside@chello.nl>
    (for via register values 12-240):
 {-50,-49,-47,-45,-43,-41,-39,-38,-37,-35,-34,-33,-32,-31,
 -30,-29,-28,-27,-26,-25,-24,-24,-23,-22,-21,-20,-20,-19,-18,-17,-17,-16,-15,
@@ -243,26 +245,26 @@ static const long tempLUT[] =
 
 
  Here's the reverse LUT.  I got it by doing a 6-th order poly fit (needed
- an extra term for a good fit to these inverse data!) and then 
- solving for each temp value from -50 to 110 (the useable range for 
- this chip).  Here's the fit: 
- viaRegVal = -1.160370e-10*val^6 +3.193693e-08*val^5 - 1.464447e-06*val^4 
+ an extra term for a good fit to these inverse data!) and then
+ solving for each temp value from -50 to 110 (the useable range for
+ this chip).  Here's the fit:
+ viaRegVal = -1.160370e-10*val^6 +3.193693e-08*val^5 - 1.464447e-06*val^4
  - 2.525453e-04*val^3 + 1.424593e-02*val^2 + 2.148941e+00*val +7.275808e+01)
  Note that n=161: */
 static const u8 viaLUT[] =
-    { 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23,
-	    23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40,
-	    41, 43, 45, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66,
-	    69, 71, 73, 75, 77, 79, 82, 84, 86, 88, 91, 93, 95, 98, 100,
-	    103, 105, 107, 110, 112, 115, 117, 119, 122, 124, 126, 129,
-	    131, 134, 136, 138, 140, 143, 145, 147, 150, 152, 154, 156,
-	    158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
-	    182, 183, 185, 187, 188, 190, 192, 193, 195, 196, 198, 199,
-	    200, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213,
-	    214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224,
-	    225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232,
-	    233, 233, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239,
-	    239, 240
+{ 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 23,
+	23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 40,
+	41, 43, 45, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 64, 66,
+	69, 71, 73, 75, 77, 79, 82, 84, 86, 88, 91, 93, 95, 98, 100,
+	103, 105, 107, 110, 112, 115, 117, 119, 122, 124, 126, 129,
+	131, 134, 136, 138, 140, 143, 145, 147, 150, 152, 154, 156,
+	158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
+	182, 183, 185, 187, 188, 190, 192, 193, 195, 196, 198, 199,
+	200, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213,
+	214, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224,
+	225, 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, 232,
+	233, 233, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239,
+	239, 240
 };
 
 /* Converting temps to (8-bit) hyst and over registers
@@ -270,7 +272,7 @@ static const u8 viaLUT[] =
    The +50 is because the temps start at -50 */
 static inline u8 TEMP_TO_REG(long val)
 {
-	return viaLUT[val <= -50000 ? 0 : val >= 110000 ? 160 : 
+	return viaLUT[val <= -50000 ? 0 : val >= 110000 ? 160 :
 		      (val < 0 ? val - 500 : val + 500) / 1000 + 50];
 }
 
@@ -289,7 +291,7 @@ static inline long TEMP_FROM_REG10(u16 v
 
 	/* do some linear interpolation */
 	return (tempLUT[eightBits] * (4 - twoBits) +
-	        tempLUT[eightBits + 1] * twoBits) * 25;
+		tempLUT[eightBits + 1] * twoBits) * 25;
 }
 
 #define DIV_FROM_REG(val) (1 << (val))
@@ -354,28 +356,28 @@ static ssize_t show_in_max(struct device
 	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in_max[nr], nr));
 }
 
-static ssize_t set_in_min(struct device *dev, const char *buf, 
+static ssize_t set_in_min(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
 	unsigned long val = simple_strtoul(buf, NULL, 10);
 
 	down(&data->update_lock);
-	data->in_min[nr] = IN_TO_REG(val,nr);
-	via686a_write_value(client, VIA686A_REG_IN_MIN(nr), 
+	data->in_min[nr] = IN_TO_REG(val, nr);
+	via686a_write_value(client, VIA686A_REG_IN_MIN(nr),
 			data->in_min[nr]);
 	up(&data->update_lock);
 	return count;
 }
-static ssize_t set_in_max(struct device *dev, const char *buf, 
+static ssize_t set_in_max(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
 	unsigned long val = simple_strtoul(buf, NULL, 10);
 
 	down(&data->update_lock);
-	data->in_max[nr] = IN_TO_REG(val,nr);
-	via686a_write_value(client, VIA686A_REG_IN_MAX(nr), 
+	data->in_max[nr] = IN_TO_REG(val, nr);
+	via686a_write_value(client, VIA686A_REG_IN_MAX(nr),
 			data->in_max[nr]);
 	up(&data->update_lock);
 	return count;
@@ -431,7 +433,7 @@ static ssize_t show_temp_hyst(struct dev
 	struct via686a_data *data = via686a_update_device(dev);
 	return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_hyst[nr]));
 }
-static ssize_t set_temp_over(struct device *dev, const char *buf, 
+static ssize_t set_temp_over(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
@@ -443,7 +445,7 @@ static ssize_t set_temp_over(struct devi
 	up(&data->update_lock);
 	return count;
 }
-static ssize_t set_temp_hyst(struct device *dev, const char *buf, 
+static ssize_t set_temp_hyst(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
@@ -484,7 +486,7 @@ static DEVICE_ATTR(temp##offset##_input,
 static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, 		\
 		show_temp_##offset##_over, set_temp_##offset##_over);	\
 static DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, 		\
-		show_temp_##offset##_hyst, set_temp_##offset##_hyst);	
+		show_temp_##offset##_hyst, set_temp_##offset##_hyst);
 
 show_temp_offset(1);
 show_temp_offset(2);
@@ -493,19 +495,19 @@ show_temp_offset(3);
 /* 2 Fans */
 static ssize_t show_fan(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr], 
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],
 				DIV_FROM_REG(data->fan_div[nr])) );
 }
 static ssize_t show_fan_min(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf,"%d\n",
+	return sprintf(buf, "%d\n",
 		FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])) );
 }
 static ssize_t show_fan_div(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf,"%d\n", DIV_FROM_REG(data->fan_div[nr]) );
+	return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr]) );
 }
-static ssize_t set_fan_min(struct device *dev, const char *buf, 
+static ssize_t set_fan_min(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
@@ -517,7 +519,7 @@ static ssize_t set_fan_min(struct device
 	up(&data->update_lock);
 	return count;
 }
-static ssize_t set_fan_div(struct device *dev, const char *buf, 
+static ssize_t set_fan_div(struct device *dev, const char *buf,
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
@@ -608,11 +610,12 @@ static int via686a_detect(struct i2c_ada
 	}
 
 	/* 8231 requires multiple of 256, we enforce that on 686 as well */
-	if(force_addr)
+	if (force_addr)
 		address = force_addr & 0xFF00;
 
-	if(force_addr) {
-		dev_warn(&adapter->dev,"forcing ISA address 0x%04X\n", address);
+	if (force_addr) {
+		dev_warn(&adapter->dev, "forcing ISA address 0x%04X\n",
+			 address);
 		if (PCIBIOS_SUCCESSFUL !=
 		    pci_write_config_word(s_bridge, VIA686A_BASE_REG, address))
 			return -ENODEV;
@@ -621,17 +624,17 @@ static int via686a_detect(struct i2c_ada
 	    pci_read_config_word(s_bridge, VIA686A_ENABLE_REG, &val))
 		return -ENODEV;
 	if (!(val & 0x0001)) {
-		dev_warn(&adapter->dev,"enabling sensors\n");
+		dev_warn(&adapter->dev, "enabling sensors\n");
 		if (PCIBIOS_SUCCESSFUL !=
 		    pci_write_config_word(s_bridge, VIA686A_ENABLE_REG,
-		                      val | 0x0001))
+					  val | 0x0001))
 			return -ENODEV;
 	}
 
 	/* Reserve the ISA region */
 	if (!request_region(address, VIA686A_EXTENT, via686a_driver.name)) {
-		dev_err(&adapter->dev,"region 0x%x already in use!\n",
-		       address);
+		dev_err(&adapter->dev, "region 0x%x already in use!\n",
+			address);
 		return -ENODEV;
 	}
 
@@ -656,7 +659,7 @@ static int via686a_detect(struct i2c_ada
 	/* Tell the I2C layer a new client has arrived */
 	if ((err = i2c_attach_client(new_client)))
 		goto ERROR3;
-	
+
 	/* Initialize the VIA686A chip */
 	via686a_init_client(new_client);
 
@@ -695,9 +698,9 @@ static int via686a_detect(struct i2c_ada
 
 	return 0;
 
-      ERROR3:
+ERROR3:
 	kfree(data);
-      ERROR0:
+ERROR0:
 	release_region(address, VIA686A_EXTENT);
 	return err;
 }
@@ -728,7 +731,7 @@ static void via686a_init_client(struct i
 	via686a_write_value(client, VIA686A_REG_CONFIG, (reg|0x01)&0x7F);
 
 	/* Configure temp interrupt mode for continuous-interrupt operation */
-	via686a_write_value(client, VIA686A_REG_TEMP_MODE, 
+	via686a_write_value(client, VIA686A_REG_TEMP_MODE,
 			    via686a_read_value(client, VIA686A_REG_TEMP_MODE) &
 			    !(VIA686A_TEMP_MODE_MASK | VIA686A_TEMP_MODE_CONTINUOUS));
 }
@@ -768,7 +771,7 @@ static struct via686a_data *via686a_upda
 			    via686a_read_value(client,
 					       VIA686A_REG_TEMP_HYST(i));
 		}
-		/* add in lower 2 bits 
+		/* add in lower 2 bits
 		   temp1 uses bits 7-6 of VIA686A_REG_TEMP_LOW1
 		   temp2 uses bits 5-4 of VIA686A_REG_TEMP_LOW23
 		   temp3 uses bits 7-6 of VIA686A_REG_TEMP_LOW23
@@ -800,35 +803,36 @@ static struct via686a_data *via686a_upda
 }
 
 static struct pci_device_id via686a_pci_ids[] = {
-       { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) },
-       { 0, }
+	{ PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4) },
+	{ 0, }
 };
 
 MODULE_DEVICE_TABLE(pci, via686a_pci_ids);
 
 static int __devinit via686a_pci_probe(struct pci_dev *dev,
-                                      const struct pci_device_id *id)
+				       const struct pci_device_id *id)
 {
-       u16 val;
-       int addr = 0;
+	u16 val;
+	int addr = 0;
 
-       if (PCIBIOS_SUCCESSFUL !=
-           pci_read_config_word(dev, VIA686A_BASE_REG, &val))
-               return -ENODEV;
-
-       addr = val & ~(VIA686A_EXTENT - 1);
-       if (addr == 0 && force_addr == 0) {
-               dev_err(&dev->dev,"base address not set - upgrade BIOS or use force_addr=0xaddr\n");
-               return -ENODEV;
-       }
-       if (force_addr)
-               addr = force_addr;      /* so detect will get called */
-
-       if (!addr) {
-               dev_err(&dev->dev,"No Via 686A sensors found.\n");
-               return -ENODEV;
-       }
-       normal_isa[0] = addr;
+	if (PCIBIOS_SUCCESSFUL !=
+	    pci_read_config_word(dev, VIA686A_BASE_REG, &val))
+		return -ENODEV;
+
+	addr = val & ~(VIA686A_EXTENT - 1);
+	if (addr == 0 && force_addr == 0) {
+		dev_err(&dev->dev, "base address not set - upgrade BIOS "
+			"or use force_addr=0xaddr\n");
+		return -ENODEV;
+	}
+	if (force_addr)
+		addr = force_addr;	/* so detect will get called */
+
+	if (!addr) {
+		dev_err(&dev->dev, "No Via 686A sensors found.\n");
+		return -ENODEV;
+	}
+	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
 	if (i2c_add_driver(&via686a_driver)) {
@@ -844,14 +848,14 @@ static int __devinit via686a_pci_probe(s
 }
 
 static struct pci_driver via686a_pci_driver = {
-       .name		= "via686a",
-       .id_table	= via686a_pci_ids,
-       .probe		= via686a_pci_probe,
+	.name		= "via686a",
+	.id_table	= via686a_pci_ids,
+	.probe		= via686a_pci_probe,
 };
 
 static int __init sm_via686a_init(void)
 {
-       return pci_register_driver(&via686a_pci_driver);
+	return pci_register_driver(&via686a_pci_driver);
 }
 
 static void __exit sm_via686a_exit(void)
@@ -865,8 +869,8 @@ static void __exit sm_via686a_exit(void)
 }
 
 MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>, "
-              "Mark Studebaker <mdsxyz123@yahoo.com> "
-             "and Bob Dougherty <bobd@stanford.edu>");
+	      "Mark Studebaker <mdsxyz123@yahoo.com> "
+	      "and Bob Dougherty <bobd@stanford.edu>");
 MODULE_DESCRIPTION("VIA 686A Sensor device");
 MODULE_LICENSE("GPL");
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Kill another macro abuse in via686a
  2005-06-22  5:17                                                                 ` [PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c Greg KH
@ 2005-06-22  5:17                                                                   ` Greg KH
  2005-06-22  5:17                                                                     ` [PATCH] I2C: fix up some sysfs device attribute file parameters Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Kill another macro abuse in via686a

This patch kills another macro abuse in the via686a hardware monitoring
driver. Using a macro just to alias an array is quite useless, isn't it?

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 563db2fe9e0843da9d1d85d824f022be0ada4a3c
tree 2e5cec5b9e1d0cf34e2c03c65bc53d9784b287da
parent 057923f0f5ba346fc128ae0a1c3842d8c12bd7f0
author Jean Delvare <khali@linux-fr.org> Tue, 17 May 2005 22:38:57 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:59 -0700

 drivers/i2c/chips/via686a.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -78,15 +78,10 @@ SENSORS_INSMOD_1(via686a);
 #define VIA686A_REG_FAN_MIN(nr)	(0x3a + (nr))
 #define VIA686A_REG_FAN(nr)	(0x28 + (nr))
 
-/* the following values are as speced by VIA: */
-static const u8 regtemp[] = { 0x20, 0x21, 0x1f };
-static const u8 regover[] = { 0x39, 0x3d, 0x1d };
-static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e };
-
 /* temps numbered 1-3 */
-#define VIA686A_REG_TEMP(nr)		(regtemp[nr])
-#define VIA686A_REG_TEMP_OVER(nr)	(regover[nr])
-#define VIA686A_REG_TEMP_HYST(nr)	(reghyst[nr])
+static const u8 VIA686A_REG_TEMP[]	= { 0x20, 0x21, 0x1f };
+static const u8 VIA686A_REG_TEMP_OVER[]	= { 0x39, 0x3d, 0x1d };
+static const u8 VIA686A_REG_TEMP_HYST[]	= { 0x3a, 0x3e, 0x1e };
 /* bits 7-6 */
 #define VIA686A_REG_TEMP_LOW1	0x4b
 /* 2 = bits 5-4, 3 = bits 7-6 */
@@ -441,7 +436,8 @@ static ssize_t set_temp_over(struct devi
 
 	down(&data->update_lock);
 	data->temp_over[nr] = TEMP_TO_REG(val);
-	via686a_write_value(client, VIA686A_REG_TEMP_OVER(nr), data->temp_over[nr]);
+	via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr],
+			    data->temp_over[nr]);
 	up(&data->update_lock);
 	return count;
 }
@@ -453,7 +449,8 @@ static ssize_t set_temp_hyst(struct devi
 
 	down(&data->update_lock);
 	data->temp_hyst[nr] = TEMP_TO_REG(val);
-	via686a_write_value(client, VIA686A_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
+	via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr],
+			    data->temp_hyst[nr]);
 	up(&data->update_lock);
 	return count;
 }
@@ -763,13 +760,13 @@ static struct via686a_data *via686a_upda
 		}
 		for (i = 0; i <= 2; i++) {
 			data->temp[i] = via686a_read_value(client,
-						 VIA686A_REG_TEMP(i)) << 2;
+						 VIA686A_REG_TEMP[i]) << 2;
 			data->temp_over[i] =
 			    via686a_read_value(client,
-					       VIA686A_REG_TEMP_OVER(i));
+					       VIA686A_REG_TEMP_OVER[i]);
 			data->temp_hyst[i] =
 			    via686a_read_value(client,
-					       VIA686A_REG_TEMP_HYST(i));
+					       VIA686A_REG_TEMP_HYST[i]);
 		}
 		/* add in lower 2 bits
 		   temp1 uses bits 7-6 of VIA686A_REG_TEMP_LOW1


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: include of jiffies.h for some i2c drivers
  2005-06-22  5:17                                                       ` [PATCH] I2C: adm9240 driver cleanup Greg KH
@ 2005-06-22  5:17                                                         ` Greg KH
  2005-06-22  5:17                                                           ` [PATCH] I2C: chips/Kconfig corrections Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: dominik

[PATCH] I2C: include of jiffies.h for some i2c drivers

This patch includes jiffies.h in two i2c drivers.
(jiffies.h is needed for the time_after function.)

Signed-off-by: Dominik Hackl <dominik@hackl.dhs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit ff3240946d6a3d9f2ecf273f7330e09eec5484eb
tree 2bb70f76eb190a9301a7f30f264306f82363c12a
parent 8e8f9289cc5b781d583d5aed935abf060207bbd3
author Dominik Hackl <dominik@hackl.dhs.org> Mon, 16 May 2005 18:12:18 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:51:57 -0700

 drivers/i2c/chips/asb100.c  |    1 +
 drivers/i2c/chips/sis5595.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- a/drivers/i2c/chips/asb100.c
+++ b/drivers/i2c/chips/asb100.c
@@ -42,6 +42,7 @@
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include "lm75.h"
 
 /*
diff --git a/drivers/i2c/chips/sis5595.c b/drivers/i2c/chips/sis5595.c
--- a/drivers/i2c/chips/sis5595.c
+++ b/drivers/i2c/chips/sis5595.c
@@ -57,6 +57,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include <asm/io.h>
 
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: add i2c driver for TPS6501x
  2005-06-22  5:17                                                                           ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-dev.c Greg KH
@ 2005-06-22  5:17                                                                             ` Greg KH
  2005-06-22  5:17                                                                               ` [PATCH] i2c: Race fix for i2c-mpc.c Greg KH
  2005-06-23 23:13                                                                                 ` [lm-sensors] " Jean Delvare
  0 siblings, 2 replies; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: david-b

[PATCH] I2C: add i2c driver for TPS6501x

This adds an I2C driver for the TPS6501x series of power management chips.
It's used on many OMAP based boards, and this driver has been widely used
in the Linux-OMAP trees over the last year or so.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 72cd799544f2b36c2f07ceaeed6d984cb130d4f3
tree ee3f0696bd3b9b09af8f09f449eeac6c0eb3cac5
parent cc0b07ed479fd92806aef7d6dbc58b6dc6da3796
author David Brownell <david-b@pacbell.net> Tue, 24 May 2005 17:34:51 -0700
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:01 -0700

 drivers/i2c/chips/Kconfig            |   19 +
 drivers/i2c/chips/Makefile           |    4 
 drivers/i2c/chips/tps65010.c         | 1072 ++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-omap/tps65010.h |   76 ++
 4 files changed, 1169 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -1,5 +1,5 @@
 #
-# I2C Sensor device configuration
+# I2C Sensor and "other" chip configuration
 #
 
 menu "Hardware Sensors Chip support"
@@ -472,6 +472,23 @@ config ISP1301_OMAP
 	  This driver can also be built as a module.  If so, the module
 	  will be called isp1301_omap.
 
+# NOTE:  This isn't really OMAP-specific, except for the current
+# interface location in  <include/asm-arm/arch-omap/tps65010.h>
+# and having mostly OMAP-specific board support
+config TPS65010
+	tristate "TPS6501x Power Management chips"
+	depends on I2C && ARCH_OMAP
+	default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
+	help
+	  If you say yes here you get support for the TPS6501x series of
+	  Power Management chips.  These include voltage regulators,
+	  lithium ion/polymer battery charging, and other features that
+	  are often used in portable devices like cell phones and cameras.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called tps65010.
+
+
 config SENSORS_M41T00
 	tristate "ST M41T00 RTC chip"
 	depends on I2C && PPC32
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -1,5 +1,5 @@
 #
-# Makefile for the kernel hardware sensors chip drivers.
+# Makefile for sensor and "other" I2C chip drivers.
 #
 
 # asb100, then w83781d go first, as they can override other drivers' addresses.
@@ -43,7 +43,9 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
 obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
+
 obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
+obj-$(CONFIG_TPS65010)		+= tps65010.o
 
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
new file mode 100644
--- /dev/null
+++ b/drivers/i2c/chips/tps65010.c
@@ -0,0 +1,1072 @@
+/*
+ * tps65010 - driver for tps6501x power management chips
+ *
+ * Copyright (C) 2004 Texas Instruments
+ * Copyright (C) 2004-2005 David Brownell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#undef	DEBUG
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/i2c.h>
+#include <linux/delay.h>
+#include <linux/workqueue.h>
+#include <linux/suspend.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <asm/arch/gpio.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/tps65010.h>
+
+/*-------------------------------------------------------------------------*/
+
+#define	DRIVER_VERSION	"2 May 2005"
+#define	DRIVER_NAME	(tps65010_driver.name)
+
+MODULE_DESCRIPTION("TPS6501x Power Management Driver");
+MODULE_LICENSE("GPL");
+
+/* only two addresses possible */
+#define	TPS_BASE	0x48
+static unsigned short normal_i2c[] = {
+	TPS_BASE,
+	I2C_CLIENT_END };
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+
+I2C_CLIENT_INSMOD;
+
+static struct i2c_driver tps65010_driver;
+
+/*-------------------------------------------------------------------------*/
+
+/* This driver handles a family of multipurpose chips, which incorporate
+ * voltage regulators, lithium ion/polymer battery charging, GPIOs, LEDs,
+ * and other features often needed in portable devices like cell phones
+ * or digital cameras.
+ *
+ * The tps65011 and tps65013 have different voltage settings compared
+ * to tps65010 and tps65012.  The tps65013 has a NO_CHG status/irq.
+ * All except tps65010 have "wait" mode, possibly defaulted so that
+ * battery-insert != device-on.
+ *
+ * We could distinguish between some models by checking VDCDC1.UVLO or
+ * other registers, unless they've been changed already after powerup
+ * as part of board setup by a bootloader.
+ */
+enum tps_model {
+	TPS_UNKNOWN = 0,
+	TPS65010,
+	TPS65011,
+	TPS65012,
+	TPS65013,
+};
+
+struct tps65010 {
+	struct i2c_client	client;
+	struct semaphore	lock;
+	int			irq;
+	struct work_struct	work;
+	struct dentry		*file;
+	unsigned		charging:1;
+	unsigned		por:1;
+	unsigned		model:8;
+	u16			vbus;
+	unsigned long		flags;
+#define	FLAG_VBUS_CHANGED	0
+#define	FLAG_IRQ_ENABLE		1
+
+	/* copies of last register state */
+	u8			chgstatus, regstatus, chgconf;
+	u8			nmask1, nmask2;
+
+	/* plus four GPIOs, probably used to switch power */
+};
+
+#define	POWER_POLL_DELAY	msecs_to_jiffies(800)
+
+/*-------------------------------------------------------------------------*/
+
+#if	defined(DEBUG) || defined(CONFIG_DEBUG_FS)
+
+static void dbg_chgstat(char *buf, size_t len, u8 chgstatus)
+{
+	snprintf(buf, len, "%02x%s%s%s%s%s%s%s%s\n",
+		chgstatus,
+		(chgstatus & TPS_CHG_USB) ? " USB" : "",
+		(chgstatus & TPS_CHG_AC) ? " AC" : "",
+		(chgstatus & TPS_CHG_THERM) ? " therm" : "",
+		(chgstatus & TPS_CHG_TERM) ? " done" :
+			((chgstatus & (TPS_CHG_USB|TPS_CHG_AC))
+				? " (charging)" : ""),
+		(chgstatus & TPS_CHG_TAPER_TMO) ? " taper_tmo" : "",
+		(chgstatus & TPS_CHG_CHG_TMO) ? " charge_tmo" : "",
+		(chgstatus & TPS_CHG_PRECHG_TMO) ? " prechg_tmo" : "",
+		(chgstatus & TPS_CHG_TEMP_ERR) ? " temp_err" : "");
+}
+
+static void dbg_regstat(char *buf, size_t len, u8 regstatus)
+{
+	snprintf(buf, len, "%02x %s%s%s%s%s%s%s%s\n",
+		regstatus,
+		(regstatus & TPS_REG_ONOFF) ? "off" : "(on)",
+		(regstatus & TPS_REG_COVER) ? " uncover" : "",
+		(regstatus & TPS_REG_UVLO) ? " UVLO" : "",
+		(regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "",
+		(regstatus & TPS_REG_PG_LD02) ? " ld01_bad" : "",
+		(regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "",
+		(regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "",
+		(regstatus & TPS_REG_PG_CORE) ? " core_bad" : "");
+}
+
+static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
+{
+	char *hibit;
+
+	if (por)
+		hibit = (chgconfig & TPS_CHARGE_POR)
+				? "POR=69ms" : "POR=1sec";
+	else
+		hibit = (chgconfig & TPS65013_AUA) ? "AUA" : "";
+
+	snprintf(buf, len, "%02x %s%s%s AC=%d%% USB=%dmA %sCharge\n",
+		chgconfig, hibit,
+		(chgconfig & TPS_CHARGE_RESET) ? " reset" : "",
+		(chgconfig & TPS_CHARGE_FAST) ? " fast" : "",
+		({int p; switch ((chgconfig >> 3) & 3) {
+		case 3:		p = 100; break;
+		case 2:		p = 75; break;
+		case 1:		p = 50; break;
+		default:	p = 25; break;
+		}; p; }),
+		(chgconfig & TPS_VBUS_CHARGING)
+			? ((chgconfig & TPS_VBUS_500MA) ? 500 : 100)
+			: 0,
+		(chgconfig & TPS_CHARGE_ENABLE) ? "" : "No");
+}
+
+#endif
+
+#ifdef	DEBUG
+
+static void show_chgstatus(const char *label, u8 chgstatus)
+{
+	char buf [100];
+
+	dbg_chgstat(buf, sizeof buf, chgstatus);
+	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
+}
+
+static void show_regstatus(const char *label, u8 regstatus)
+{
+	char buf [100];
+
+	dbg_regstat(buf, sizeof buf, regstatus);
+	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
+}
+
+static void show_chgconfig(int por, const char *label, u8 chgconfig)
+{
+	char buf [100];
+
+	dbg_chgconf(por, buf, sizeof buf, chgconfig);
+	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
+}
+
+#else
+
+static inline void show_chgstatus(const char *label, u8 chgstatus) { }
+static inline void show_regstatus(const char *label, u8 chgstatus) { }
+static inline void show_chgconfig(int por, const char *label, u8 chgconfig) { }
+
+#endif
+
+#ifdef	CONFIG_DEBUG_FS
+
+static int dbg_show(struct seq_file *s, void *_)
+{
+	struct tps65010	*tps = s->private;
+	u8		value, v2;
+	unsigned	i;
+	char		buf[100];
+	const char	*chip;
+
+	switch (tps->model) {
+	case TPS65010:	chip = "tps65010"; break;
+	case TPS65011:	chip = "tps65011"; break;
+	case TPS65012:	chip = "tps65012"; break;
+	case TPS65013:	chip = "tps65013"; break;
+	default:	chip = NULL; break;
+	}
+	seq_printf(s, "driver  %s\nversion %s\nchip    %s\n\n",
+			DRIVER_NAME, DRIVER_VERSION, chip);
+
+	down(&tps->lock);
+
+	/* FIXME how can we tell whether a battery is present?
+	 * likely involves a charge gauging chip (like BQ26501).
+	 */
+
+	seq_printf(s, "%scharging\n\n", tps->charging ? "" : "(not) ");
+
+
+	/* registers for monitoring battery charging and status; note
+	 * that reading chgstat and regstat may ack IRQs...
+	 */
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG);
+	dbg_chgconf(tps->por, buf, sizeof buf, value);
+	seq_printf(s, "chgconfig %s", buf);
+
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS);
+	dbg_chgstat(buf, sizeof buf, value);
+	seq_printf(s, "chgstat   %s", buf);
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_MASK1);
+	dbg_chgstat(buf, sizeof buf, value);
+	seq_printf(s, "mask1     %s", buf);
+	/* ignore ackint1 */
+
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS);
+	dbg_regstat(buf, sizeof buf, value);
+	seq_printf(s, "regstat   %s", buf);
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_MASK2);
+	dbg_regstat(buf, sizeof buf, value);
+	seq_printf(s, "mask2     %s\n", buf);
+	/* ignore ackint2 */
+
+	(void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
+
+
+	/* VMAIN voltage, enable lowpower, etc */
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC1);
+	seq_printf(s, "vdcdc1    %02x\n", value);
+
+	/* VCORE voltage, vibrator on/off */
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC2);
+	seq_printf(s, "vdcdc2    %02x\n", value);
+
+	/* both LD0s, and their lowpower behavior */
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_VREGS1);
+	seq_printf(s, "vregs1    %02x\n\n", value);
+
+
+	/* LEDs and GPIOs */
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_LED1_ON);
+	v2 = i2c_smbus_read_byte_data(&tps->client, TPS_LED1_PER);
+	seq_printf(s, "led1 %s, on=%02x, per=%02x, %d/%d msec\n",
+		(value & 0x80)
+			? ((v2 & 0x80) ? "on" : "off")
+			: ((v2 & 0x80) ? "blink" : "(nPG)"),
+		value, v2,
+		(value & 0x7f) * 10, (v2 & 0x7f) * 100);
+
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_LED2_ON);
+	v2 = i2c_smbus_read_byte_data(&tps->client, TPS_LED2_PER);
+	seq_printf(s, "led2 %s, on=%02x, per=%02x, %d/%d msec\n",
+		(value & 0x80)
+			? ((v2 & 0x80) ? "on" : "off")
+			: ((v2 & 0x80) ? "blink" : "off"),
+		value, v2,
+		(value & 0x7f) * 10, (v2 & 0x7f) * 100);
+
+	value = i2c_smbus_read_byte_data(&tps->client, TPS_DEFGPIO);
+	v2 = i2c_smbus_read_byte_data(&tps->client, TPS_MASK3);
+	seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2);
+
+	for (i = 0; i < 4; i++) {
+		if (value & (1 << (4 +i)))
+			seq_printf(s, "  gpio%d-out %s\n", i + 1,
+				(value & (1 << i)) ? "low" : "hi ");
+		else
+			seq_printf(s, "  gpio%d-in  %s %s %s\n", i + 1,
+				(value & (1 << i)) ? "hi " : "low",
+				(v2 & (1 << i)) ? "no-irq" : "irq",
+				(v2 & (1 << (4 + i))) ? "rising" : "falling");
+	}
+
+	up(&tps->lock);
+	return 0;
+}
+
+static int dbg_tps_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, dbg_show, inode->u.generic_ip);
+}
+
+static struct file_operations debug_fops = {
+	.open		= dbg_tps_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
+#define	DEBUG_FOPS	&debug_fops
+
+#else
+#define	DEBUG_FOPS	NULL
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+/* handle IRQS in a task context, so we can use I2C calls */
+static void tps65010_interrupt(struct tps65010 *tps)
+{
+	u8 tmp = 0, mask, poll;
+
+	/* IRQs won't trigger irqs for certain events, but we can get
+	 * others by polling (normally, with external power applied).
+	 */
+	poll = 0;
+
+	/* regstatus irqs */
+	if (tps->nmask2) {
+		tmp = i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS);
+		mask = tmp ^ tps->regstatus;
+		tps->regstatus = tmp;
+		mask &= tps->nmask2;
+	} else
+		mask = 0;
+	if (mask) {
+		tps->regstatus =  tmp;
+		/* may need to shut something down ... */
+
+		/* "off" usually means deep sleep */
+		if (tmp & TPS_REG_ONOFF) {
+			pr_info("%s: power off button\n", DRIVER_NAME);
+#if 0
+			/* REVISIT:  this might need its own workqueue
+			 * plus tweaks including deadlock avoidance ...
+			 */
+			software_suspend();
+#endif
+			poll = 1;
+		}
+	}
+
+	/* chgstatus irqs */
+	if (tps->nmask1) {
+		tmp = i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS);
+		mask = tmp ^ tps->chgstatus;
+		tps->chgstatus = tmp;
+		mask &= tps->nmask1;
+	} else
+		mask = 0;
+	if (mask) {
+		unsigned	charging = 0;
+
+		show_chgstatus("chg/irq", tmp);
+		if (tmp & (TPS_CHG_USB|TPS_CHG_AC))
+			show_chgconfig(tps->por, "conf", tps->chgconf);
+
+		/* Unless it was turned off or disabled, we charge any
+		 * battery whenever there's power available for it
+		 * and the charger hasn't been disabled.
+		 */
+		if (!(tps->chgstatus & ~(TPS_CHG_USB|TPS_CHG_AC))
+				&& (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC))
+				&& (tps->chgconf & TPS_CHARGE_ENABLE)
+				) {
+			if (tps->chgstatus & TPS_CHG_USB) {
+				/* VBUS options are readonly until reconnect */
+				if (mask & TPS_CHG_USB)
+					set_bit(FLAG_VBUS_CHANGED, &tps->flags);
+				charging = 1;
+			} else if (tps->chgstatus & TPS_CHG_AC)
+				charging = 1;
+		}
+		if (charging != tps->charging) {
+			tps->charging = charging;
+			pr_info("%s: battery %scharging\n",
+				DRIVER_NAME, charging ? "" :
+				((tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC))
+					? "NOT " : "dis"));
+		}
+	}
+
+	/* always poll to detect (a) power removal, without tps65013
+	 * NO_CHG IRQ; or (b) restart of charging after stop.
+	 */
+	if ((tps->model != TPS65013 || !tps->charging)
+			&& (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)))
+		poll = 1;
+	if (poll)
+		(void) schedule_delayed_work(&tps->work, POWER_POLL_DELAY);
+
+	/* also potentially gpio-in rise or fall */
+}
+
+/* handle IRQs and polling using keventd for now */
+static void tps65010_work(void *_tps)
+{
+	struct tps65010		*tps = _tps;
+
+	down(&tps->lock);
+
+	tps65010_interrupt(tps);
+
+	if (test_and_clear_bit(FLAG_VBUS_CHANGED, &tps->flags)) {
+		int	status;
+		u8	chgconfig, tmp;
+
+		chgconfig = i2c_smbus_read_byte_data(&tps->client,
+					TPS_CHGCONFIG);
+		chgconfig &= ~(TPS_VBUS_500MA | TPS_VBUS_CHARGING);
+		if (tps->vbus == 500)
+			chgconfig |= TPS_VBUS_500MA | TPS_VBUS_CHARGING;
+		else if (tps->vbus >= 100)
+			chgconfig |= TPS_VBUS_CHARGING;
+
+		status = i2c_smbus_write_byte_data(&tps->client,
+				TPS_CHGCONFIG, chgconfig);
+
+		/* vbus update fails unless VBUS is connected! */
+		tmp = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG);
+		tps->chgconf = tmp;
+		show_chgconfig(tps->por, "update vbus", tmp);
+	}
+
+	if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags))
+		enable_irq(tps->irq);
+
+	up(&tps->lock);
+}
+
+static irqreturn_t tps65010_irq(int irq, void *_tps, struct pt_regs *regs)
+{
+	struct tps65010		*tps = _tps;
+
+	disable_irq_nosync(irq);
+	set_bit(FLAG_IRQ_ENABLE, &tps->flags);
+	(void) schedule_work(&tps->work);
+	return IRQ_HANDLED;
+}
+
+/*-------------------------------------------------------------------------*/
+
+static struct tps65010 *the_tps;
+
+static int __exit tps65010_detach_client(struct i2c_client *client)
+{
+	struct tps65010		*tps;
+
+	tps = container_of(client, struct tps65010, client);
+#ifdef	CONFIG_ARM
+	if (machine_is_omap_h2())
+		omap_free_gpio(58);
+	if (machine_is_omap_osk())
+		omap_free_gpio(OMAP_MPUIO(1));
+#endif
+	free_irq(tps->irq, tps);
+	debugfs_remove(tps->file);
+	if (i2c_detach_client(client) == 0)
+		kfree(tps);
+	the_tps = 0;
+	return 0;
+}
+
+static int tps65010_noscan(struct i2c_adapter *bus)
+{
+	/* pure paranoia, in case someone adds another i2c bus
+	 * after our init section's gone...
+	 */
+	return -ENODEV;
+}
+
+/* no error returns, they'd just make bus scanning stop */
+static int __init
+tps65010_probe(struct i2c_adapter *bus, int address, int kind)
+{
+	struct tps65010		*tps;
+	int			status;
+
+	if (the_tps) {
+		dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME);
+		return 0;
+	}
+
+	tps = kmalloc(sizeof *tps, GFP_KERNEL);
+	if (!tps)
+		return 0;
+
+	memset(tps, 0, sizeof *tps);
+	init_MUTEX(&tps->lock);
+	INIT_WORK(&tps->work, tps65010_work, tps);
+	tps->irq = -1;
+	tps->client.addr = address;
+	i2c_set_clientdata(&tps->client, tps);
+	tps->client.adapter = bus;
+	tps->client.driver = &tps65010_driver;
+	strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE);
+
+	status = i2c_attach_client(&tps->client);
+	if (status < 0) {
+		dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
+				DRIVER_NAME, address, status);
+fail1:
+		kfree(tps);
+		return 0;
+	}
+
+#ifdef	CONFIG_ARM
+	if (machine_is_omap_h2()) {
+		tps->model = TPS65010;
+		omap_cfg_reg(W4_GPIO58);
+		tps->irq = OMAP_GPIO_IRQ(58);
+		omap_request_gpio(58);
+		omap_set_gpio_direction(58, 1);
+		omap_set_gpio_edge_ctrl(58, OMAP_GPIO_FALLING_EDGE);
+	}
+	if (machine_is_omap_osk()) {
+		tps->model = TPS65010;
+		// omap_cfg_reg(U19_1610_MPUIO1);
+		tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
+		omap_request_gpio(OMAP_MPUIO(1));
+		omap_set_gpio_direction(OMAP_MPUIO(1), 1);
+		omap_set_gpio_edge_ctrl(OMAP_MPUIO(1), OMAP_GPIO_FALLING_EDGE);
+	}
+	if (machine_is_omap_h3()) {
+		tps->model = TPS65013;
+
+		// FIXME set up this board's IRQ ...
+	}
+#else
+#define set_irq_type(num,trigger)	do{}while(0)
+#endif
+
+	if (tps->irq > 0) {
+		set_irq_type(tps->irq, IRQT_LOW);
+		status = request_irq(tps->irq, tps65010_irq,
+			SA_SAMPLE_RANDOM, DRIVER_NAME, tps);
+		if (status < 0) {
+			dev_dbg(&tps->client.dev, "can't get IRQ %d, err %d\n",
+					tps->irq, status);
+			i2c_detach_client(&tps->client);
+			goto fail1;
+		}
+#ifdef	CONFIG_ARM
+		/* annoying race here, ideally we'd have an option
+		 * to claim the irq now and enable it later.
+		 */
+		disable_irq(tps->irq);
+		set_bit(FLAG_IRQ_ENABLE, &tps->flags);
+#endif
+	} else
+		printk(KERN_WARNING "%s: IRQ not configured!\n",
+				DRIVER_NAME);
+
+
+	switch (tps->model) {
+	case TPS65010:
+	case TPS65012:
+		tps->por = 1;
+		break;
+	case TPS_UNKNOWN:
+		printk(KERN_WARNING "%s: unknown TPS chip\n", DRIVER_NAME);
+		break;
+	/* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */
+	}
+	tps->chgconf = i2c_smbus_read_byte_data(&tps->client, TPS_CHGCONFIG);
+	show_chgconfig(tps->por, "conf/init", tps->chgconf);
+
+	show_chgstatus("chg/init",
+		i2c_smbus_read_byte_data(&tps->client, TPS_CHGSTATUS));
+	show_regstatus("reg/init",
+		i2c_smbus_read_byte_data(&tps->client, TPS_REGSTATUS));
+
+	pr_debug("%s: vdcdc1 0x%02x, vdcdc2 %02x, vregs1 %02x\n", DRIVER_NAME,
+		i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC1),
+		i2c_smbus_read_byte_data(&tps->client, TPS_VDCDC2),
+		i2c_smbus_read_byte_data(&tps->client, TPS_VREGS1));
+	pr_debug("%s: defgpio 0x%02x, mask3 0x%02x\n", DRIVER_NAME,
+		i2c_smbus_read_byte_data(&tps->client, TPS_DEFGPIO),
+		i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));
+
+	tps65010_driver.attach_adapter = tps65010_noscan;
+	the_tps = tps;
+
+#if	defined(CONFIG_USB_GADGET) && !defined(CONFIG_USB_OTG)
+	/* USB hosts can't draw VBUS.  OTG devices could, later
+	 * when OTG infrastructure enables it.  USB peripherals
+	 * could be relying on VBUS while booting, though.
+	 */
+	tps->vbus = 100;
+#endif
+
+	/* unmask the "interesting" irqs, then poll once to
+	 * kickstart monitoring, initialize shadowed status
+	 * registers, and maybe disable VBUS draw.
+	 */
+	tps->nmask1 = ~0;
+	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK1, ~tps->nmask1);
+
+	tps->nmask2 = TPS_REG_ONOFF;
+	if (tps->model == TPS65013)
+		tps->nmask2 |= TPS_REG_NO_CHG;
+	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK2, ~tps->nmask2);
+
+	(void) i2c_smbus_write_byte_data(&tps->client, TPS_MASK3, 0x0f
+		| i2c_smbus_read_byte_data(&tps->client, TPS_MASK3));
+
+	tps65010_work(tps);
+
+	tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
+				tps, DEBUG_FOPS);
+	return 0;
+}
+
+static int __init tps65010_scan_bus(struct i2c_adapter *bus)
+{
+	if (!i2c_check_functionality(bus, I2C_FUNC_SMBUS_BYTE_DATA))
+		return -EINVAL;
+	return i2c_probe(bus, &addr_data, tps65010_probe);
+}
+
+static struct i2c_driver tps65010_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "tps65010",
+	.id		= 888,		/* FIXME assign "official" value */
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= tps65010_scan_bus,
+	.detach_client	= __exit_p(tps65010_detach_client),
+};
+
+/*-------------------------------------------------------------------------*/
+
+/* Draw from VBUS:
+ *   0 mA -- DON'T DRAW (might supply power instead)
+ * 100 mA -- usb unit load (slowest charge rate)
+ * 500 mA -- usb high power (fast battery charge)
+ */
+int tps65010_set_vbus_draw(unsigned mA)
+{
+	unsigned long	flags;
+
+	if (!the_tps)
+		return -ENODEV;
+
+	/* assumes non-SMP */
+	local_irq_save(flags);
+	if (mA >= 500)
+		mA = 500;
+	else if (mA >= 100)
+		mA = 100;
+	else
+		mA = 0;
+	the_tps->vbus = mA;
+	if ((the_tps->chgstatus & TPS_CHG_USB)
+			&& test_and_set_bit(
+				FLAG_VBUS_CHANGED, &the_tps->flags)) {
+		/* gadget drivers call this in_irq() */
+		(void) schedule_work(&the_tps->work);
+	}
+	local_irq_restore(flags);
+
+	return 0;
+}
+EXPORT_SYMBOL(tps65010_set_vbus_draw);
+
+/*-------------------------------------------------------------------------*/
+/* tps65010_set_gpio_out_value parameter:
+ * gpio:  GPIO1, GPIO2, GPIO3 or GPIO4
+ * value: LOW or HIGH
+ */
+int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
+{
+	int	 status;
+	unsigned defgpio;
+
+	if (!the_tps)
+		return -ENODEV;
+	if ((gpio < GPIO1) || (gpio > GPIO4))
+		return -EINVAL;
+
+	down(&the_tps->lock);
+
+	defgpio = i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO);
+
+	/* Configure GPIO for output */
+	defgpio |= 1 << (gpio + 3);
+
+	/* Writing 1 forces a logic 0 on that GPIO and vice versa */
+	switch (value) {
+	case LOW:
+		defgpio |= 1 << (gpio - 1);    /* set GPIO low by writing 1 */
+		break;
+	/* case HIGH: */
+	default:
+		defgpio &= ~(1 << (gpio - 1)); /* set GPIO high by writing 0 */
+		break;
+	}
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+		TPS_DEFGPIO, defgpio);
+
+	pr_debug("%s: gpio%dout = %s, defgpio 0x%02x\n", DRIVER_NAME,
+		gpio, value ? "high" : "low",
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_DEFGPIO));
+
+	up(&the_tps->lock);
+	return status;
+}
+EXPORT_SYMBOL(tps65010_set_gpio_out_value);
+
+/*-------------------------------------------------------------------------*/
+/* tps65010_set_led parameter:
+ * led:  LED1 or LED2
+ * mode: ON, OFF or BLINK
+ */
+int tps65010_set_led(unsigned led, unsigned mode)
+{
+	int	 status;
+	unsigned led_on, led_per, offs;
+
+	if (!the_tps)
+		return -ENODEV;
+
+	if(led == LED1)
+		offs = 0;
+	else {
+		offs = 2;
+		led = LED2;
+	}
+
+	down(&the_tps->lock);
+
+	dev_dbg (&the_tps->client.dev, "led%i_on   0x%02x\n", led,
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
+
+	dev_dbg (&the_tps->client.dev, "led%i_per  0x%02x\n", led,
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
+
+	switch (mode) {
+	case OFF:
+		led_on  = 1 << 7;
+		led_per = 0 << 7;
+		break;
+	case ON:
+		led_on  = 1 << 7;
+		led_per = 1 << 7;
+		break;
+	case BLINK:
+		led_on  = 0x30 | (0 << 7);
+		led_per = 0x08 | (1 << 7);
+		break;
+	default:
+		printk(KERN_ERR "%s: Wrong mode parameter for tps65010_set_led()\n",
+		       DRIVER_NAME);
+		up(&the_tps->lock);
+		return -EINVAL;
+	}
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_LED1_ON + offs, led_on);
+
+	if (status != 0) {
+		printk(KERN_ERR "%s: Failed to write led%i_on register\n",
+		       DRIVER_NAME, led);
+		up(&the_tps->lock);
+		return status;
+	}
+
+	dev_dbg (&the_tps->client.dev, "led%i_on   0x%02x\n", led,
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_LED1_PER + offs, led_per);
+
+	if (status != 0) {
+		printk(KERN_ERR "%s: Failed to write led%i_per register\n",
+		       DRIVER_NAME, led);
+		up(&the_tps->lock);
+		return status;
+	}
+
+	dev_dbg (&the_tps->client.dev, "led%i_per  0x%02x\n", led,
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
+
+	up(&the_tps->lock);
+
+	return status;
+}
+EXPORT_SYMBOL(tps65010_set_led);
+
+/*-------------------------------------------------------------------------*/
+/* tps65010_set_vib parameter:
+ * value: ON or OFF
+ */
+int tps65010_set_vib(unsigned value)
+{
+	int	 status;
+	unsigned vdcdc2;
+
+	if (!the_tps)
+		return -ENODEV;
+
+	down(&the_tps->lock);
+
+	vdcdc2 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC2);
+	vdcdc2 &= ~(1 << 1);
+	if (value)
+		vdcdc2 |= (1 << 1);
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+		TPS_VDCDC2, vdcdc2);
+
+	pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off");
+
+	up(&the_tps->lock);
+	return status;
+}
+EXPORT_SYMBOL(tps65010_set_vib);
+
+/*-------------------------------------------------------------------------*/
+/* tps65010_set_low_pwr parameter:
+ * mode: ON or OFF
+ */
+int tps65010_set_low_pwr(unsigned mode)
+{
+	int	 status;
+	unsigned vdcdc1;
+
+	if (!the_tps)
+		return -ENODEV;
+
+	down(&the_tps->lock);
+
+	pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME,
+		mode ? "enable" : "disable",
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+	vdcdc1 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1);
+
+	switch (mode) {
+	case OFF:
+		vdcdc1 &= ~TPS_ENABLE_LP; /* disable ENABLE_LP bit */
+		break;
+	/* case ON: */
+	default:
+		vdcdc1 |= TPS_ENABLE_LP;  /* enable ENABLE_LP bit */
+		break;
+	}
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_VDCDC1, vdcdc1);
+
+	if (status != 0)
+		printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
+		       DRIVER_NAME);
+	else
+		pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
+			i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+	up(&the_tps->lock);
+
+	return status;
+}
+EXPORT_SYMBOL(tps65010_set_low_pwr);
+
+/*-------------------------------------------------------------------------*/
+/* tps65010_config_vregs1 parameter:
+ * value to be written to VREGS1 register
+ * Note: The complete register is written, set all bits you need
+ */
+int tps65010_config_vregs1(unsigned value)
+{
+	int	 status;
+
+	if (!the_tps)
+		return -ENODEV;
+
+	down(&the_tps->lock);
+
+	pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
+		        i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_VREGS1, value);
+
+	if (status != 0)
+		printk(KERN_ERR "%s: Failed to write vregs1 register\n",
+		        DRIVER_NAME);
+	else
+		pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
+			i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+
+	up(&the_tps->lock);
+
+	return status;
+}
+EXPORT_SYMBOL(tps65010_config_vregs1);
+
+/*-------------------------------------------------------------------------*/
+/* tps65013_set_low_pwr parameter:
+ * mode: ON or OFF
+ */
+
+/* FIXME: Assumes AC or USB power is present. Setting AUA bit is not
+	required if power supply is through a battery */
+
+int tps65013_set_low_pwr(unsigned mode)
+{
+	int	 status;
+	unsigned vdcdc1, chgconfig;
+
+	if (!the_tps || the_tps->por)
+		return -ENODEV;
+
+	down(&the_tps->lock);
+
+	pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n",
+		DRIVER_NAME,
+		mode ? "enable" : "disable",
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG),
+		i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+	chgconfig = i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG);
+	vdcdc1 = i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1);
+
+	switch (mode) {
+	case OFF:
+		chgconfig &= ~TPS65013_AUA; /* disable AUA bit */
+		vdcdc1 &= ~TPS_ENABLE_LP; /* disable ENABLE_LP bit */
+		break;
+	/* case ON: */
+	default:
+		chgconfig |= TPS65013_AUA;  /* enable AUA bit */
+		vdcdc1 |= TPS_ENABLE_LP;  /* enable ENABLE_LP bit */
+		break;
+	}
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_CHGCONFIG, chgconfig);
+	if (status != 0) {
+		printk(KERN_ERR "%s: Failed to write chconfig register\n",
+	 DRIVER_NAME);
+		up(&the_tps->lock);
+		return status;
+	}
+
+	chgconfig = i2c_smbus_read_byte_data(&the_tps->client, TPS_CHGCONFIG);
+	the_tps->chgconf = chgconfig;
+	show_chgconfig(0, "chgconf", chgconfig);
+
+	status = i2c_smbus_write_byte_data(&the_tps->client,
+			TPS_VDCDC1, vdcdc1);
+
+	if (status != 0)
+		printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
+	 DRIVER_NAME);
+	else
+		pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
+			i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
+
+	up(&the_tps->lock);
+
+	return status;
+}
+EXPORT_SYMBOL(tps65013_set_low_pwr);
+
+/*-------------------------------------------------------------------------*/
+
+static int __init tps_init(void)
+{
+	u32	tries = 3;
+	int	status = -ENODEV;
+
+	printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
+
+	/* some boards have startup glitches */
+	while (tries--) {
+		status = i2c_add_driver(&tps65010_driver);
+		if (the_tps)
+			break;
+		i2c_del_driver(&tps65010_driver);
+		if (!tries) {
+			printk(KERN_ERR "%s: no chip?\n", DRIVER_NAME);
+			return -ENODEV;
+		}
+		pr_debug("%s: re-probe ...\n", DRIVER_NAME);
+		msleep(10);
+	}
+
+#if defined(CONFIG_ARM)
+	if (machine_is_omap_osk()) {
+
+		// FIXME: More should be placed in the initialization code
+		//	  of the submodules (DSP, ethernet, power management,
+		//	  board-osk.c). Careful: I2C is initialized "late".
+
+		/* Let LED1 (D9) blink */
+		tps65010_set_led(LED1, BLINK);
+
+		/* Disable LED 2 (D2) */
+		tps65010_set_led(LED2, OFF);
+
+		/* Set GPIO 1 HIGH to disable VBUS power supply;
+		 * OHCI driver powers it up/down as needed.
+		 */
+		tps65010_set_gpio_out_value(GPIO1, HIGH);
+
+		/* Set GPIO 2 low to turn on LED D3 */
+		tps65010_set_gpio_out_value(GPIO2, HIGH);
+
+		/* Set GPIO 3 low to take ethernet out of reset */
+		tps65010_set_gpio_out_value(GPIO3, LOW);
+
+		/* gpio4 for VDD_DSP */
+
+		/* Enable LOW_PWR */
+		tps65010_set_low_pwr(ON);
+
+		/* Switch VLDO2 to 3.0V for AIC23 */
+		tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | TPS_LDO1_ENABLE);
+
+	} else if (machine_is_omap_h2()) {
+		/* gpio3 for SD, gpio4 for VDD_DSP */
+
+		/* Enable LOW_PWR */
+		tps65010_set_low_pwr(ON);
+	} else if (machine_is_omap_h3()) {
+		/* gpio4 for SD, gpio3 for VDD_DSP */
+#ifdef CONFIG_PM
+		/* Enable LOW_PWR */
+		tps65013_set_low_pwr(ON);
+#endif
+	}
+#endif
+
+	return status;
+}
+/* NOTE:  this MUST be initialized before the other parts of the system
+ * that rely on it ... but after the i2c bus on which this relies.
+ * That is, much earlier than on PC-type systems, which don't often use
+ * I2C as a core system bus.
+ */
+subsys_initcall(tps_init);
+
+static void __exit tps_exit(void)
+{
+	i2c_del_driver(&tps65010_driver);
+}
+module_exit(tps_exit);
+
diff --git a/include/asm-arm/arch-omap/tps65010.h b/include/asm-arm/arch-omap/tps65010.h
--- a/include/asm-arm/arch-omap/tps65010.h
+++ b/include/asm-arm/arch-omap/tps65010.h
@@ -30,6 +30,66 @@
 
 /*
  * ----------------------------------------------------------------------------
+ * Registers, all 8 bits
+ * ----------------------------------------------------------------------------
+ */
+
+#define	TPS_CHGSTATUS		0x01
+#	define	TPS_CHG_USB		(1 << 7)
+#	define	TPS_CHG_AC		(1 << 6)
+#	define	TPS_CHG_THERM		(1 << 5)
+#	define	TPS_CHG_TERM		(1 << 4)
+#	define	TPS_CHG_TAPER_TMO	(1 << 3)
+#	define	TPS_CHG_CHG_TMO		(1 << 2)
+#	define	TPS_CHG_PRECHG_TMO	(1 << 1)
+#	define	TPS_CHG_TEMP_ERR	(1 << 0)
+#define	TPS_REGSTATUS		0x02
+#	define	TPS_REG_ONOFF		(1 << 7)
+#	define	TPS_REG_COVER		(1 << 6)
+#	define	TPS_REG_UVLO		(1 << 5)
+#	define	TPS_REG_NO_CHG		(1 << 4)	/* tps65013 */
+#	define	TPS_REG_PG_LD02		(1 << 3)
+#	define	TPS_REG_PG_LD01		(1 << 2)
+#	define	TPS_REG_PG_MAIN		(1 << 1)
+#	define	TPS_REG_PG_CORE		(1 << 0)
+#define	TPS_MASK1		0x03
+#define	TPS_MASK2		0x04
+#define	TPS_ACKINT1		0x05
+#define	TPS_ACKINT2		0x06
+#define	TPS_CHGCONFIG		0x07
+#	define	TPS_CHARGE_POR		(1 << 7)	/* 65010/65012 */
+#	define	TPS65013_AUA		(1 << 7)	/* 65011/65013 */
+#	define	TPS_CHARGE_RESET	(1 << 6)
+#	define	TPS_CHARGE_FAST		(1 << 5)
+#	define	TPS_CHARGE_CURRENT	(3 << 3)
+#	define	TPS_VBUS_500MA		(1 << 2)
+#	define	TPS_VBUS_CHARGING	(1 << 1)
+#	define	TPS_CHARGE_ENABLE	(1 << 0)
+#define	TPS_LED1_ON		0x08
+#define	TPS_LED1_PER		0x09
+#define	TPS_LED2_ON		0x0a
+#define	TPS_LED2_PER		0x0b
+#define	TPS_VDCDC1		0x0c
+#	define	TPS_ENABLE_LP		(1 << 3)
+#define	TPS_VDCDC2		0x0d
+#define	TPS_VREGS1		0x0e
+#	define	TPS_LDO2_ENABLE	(1 << 7)
+#	define	TPS_LDO2_OFF	(1 << 6)
+#	define	TPS_VLDO2_3_0V	(3 << 4)
+#	define	TPS_VLDO2_2_75V	(2 << 4)
+#	define	TPS_VLDO2_2_5V	(1 << 4)
+#	define	TPS_VLDO2_1_8V	(0 << 4)
+#	define	TPS_LDO1_ENABLE	(1 << 3)
+#	define	TPS_LDO1_OFF	(1 << 2)
+#	define	TPS_VLDO1_3_0V	(3 << 0)
+#	define	TPS_VLDO1_2_75V	(2 << 0)
+#	define	TPS_VLDO1_2_5V	(1 << 0)
+#	define	TPS_VLDO1_ADJ	(0 << 0)
+#define	TPS_MASK3		0x0f
+#define	TPS_DEFGPIO		0x10
+
+/*
+ * ----------------------------------------------------------------------------
  * Macros used by exported functions
  * ----------------------------------------------------------------------------
  */
@@ -71,10 +131,26 @@ extern int tps65010_set_gpio_out_value(u
  */
 extern int tps65010_set_led(unsigned led, unsigned mode);
 
+/* tps65010_set_vib parameter:
+ * value: ON or OFF
+ */
+extern int tps65010_set_vib(unsigned value);
+
 /* tps65010_set_low_pwr parameter:
  * mode: ON or OFF
  */
 extern int tps65010_set_low_pwr(unsigned mode);
 
+/* tps65010_config_vregs1 parameter:
+ * value to be written to VREGS1 register
+ * Note: The complete register is written, set all bits you need
+ */
+extern int tps65010_config_vregs1(unsigned value);
+
+/* tps65013_set_low_pwr parameter:
+ * mode: ON or OFF
+ */
+extern int tps65013_set_low_pwr(unsigned mode);
+
 #endif /*  __ASM_ARCH_TPS65010_H */
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-core.c
  2005-06-22  5:17                                                                       ` [PATCH] I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c Greg KH
@ 2005-06-22  5:17                                                                         ` Greg KH
  2005-06-22  5:17                                                                           ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-dev.c Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: tklauser

[PATCH] I2C: Spelling fixes for drivers/i2c/i2c-core.c

This patch fixes a misspelling in a comment section.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit a551acc2cb1f13a9bd728b8cf86f9adafefdcfb2
tree 2ee02935a9df422b733969affbdcca3a873479c1
parent 614e24be139c0ae70378349e6c6f0e21751e56bf
author Tobias Klauser <tklauser@nuerscht.ch> Thu, 19 May 2005 21:40:38 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:00 -0700

 drivers/i2c/i2c-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -238,7 +238,7 @@ int i2c_del_adapter(struct i2c_adapter *
 	}
 
 	/* detach any active clients. This must be done first, because
-	 * it can fail; in which case we give upp. */
+	 * it can fail; in which case we give up. */
 	list_for_each_safe(item, _n, &adap->clients) {
 		client = list_entry(item, struct i2c_client, list);
 


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: documentation update 1/3
  2005-06-22  5:17                                                                                 ` [PATCH] I2C: Sensors mailing list has moved Greg KH
@ 2005-06-22  5:17                                                                                   ` Greg KH
  2005-06-22  5:17                                                                                     ` [PATCH] I2C: KConfig update - some EXPERIMENTAL removal Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: R.Marek

[PATCH] I2C: documentation update 1/3

This patch just changes the extension of Documentation/i2c/chips/smsc47b397.txt
to none - to conform with naming in i2c subsystem directory.

Signed-off-by: Rudolf Marek <r.marek@sh.cvut.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 2bf34a1ca9d570dd4fab4d95c4de82d873ecf718
tree 293f1c49c9b0f6bf9421905ef1c475c28ed3d496
parent 72cd799544f2b36c2f07ceaeed6d984cb130d4f3
author R.Marek@sh.cvut.cz <R.Marek@sh.cvut.cz> Thu, 26 May 2005 12:42:11 +0000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:02 -0700

 Documentation/i2c/chips/smsc47b397     |  146 ++++++++++++++++++++++++++++++++
 Documentation/i2c/chips/smsc47b397.txt |  146 --------------------------------
 2 files changed, 146 insertions(+), 146 deletions(-)

diff --git a/Documentation/i2c/chips/smsc47b397 b/Documentation/i2c/chips/smsc47b397
new file mode 100644
--- /dev/null
+++ b/Documentation/i2c/chips/smsc47b397
@@ -0,0 +1,146 @@
+November 23, 2004
+
+The following specification describes the SMSC LPC47B397-NC sensor chip
+(for which there is no public datasheet available).  This document was
+provided by Craig Kelly (In-Store Broadcast Network) and edited/corrected
+by Mark M. Hoffman <mhoffman@lightlink.com>.
+
+* * * * *
+
+Methods for detecting the HP SIO and reading the thermal data on a dc7100.
+
+The thermal information on the dc7100 is contained in the SIO Hardware Monitor
+(HWM).  The information is accessed through an index/data pair.  The index/data
+pair is located at the HWM Base Address + 0 and the HWM Base Address + 1.  The
+HWM Base address can be obtained from Logical Device 8, registers 0x60 (MSB)
+and 0x61 (LSB).  Currently we are using 0x480 for the HWM Base Address and
+0x480 and 0x481 for the index/data pair.
+
+Reading temperature information.
+The temperature information is located in the following registers:
+Temp1		0x25	(Currently, this reflects the CPU temp on all systems).
+Temp2		0x26
+Temp3		0x27
+Temp4		0x80
+
+Programming Example
+The following is an example of how to read the HWM temperature registers:
+MOV	DX,480H
+MOV	AX,25H
+OUT	DX,AL
+MOV	DX,481H
+IN	AL,DX
+
+AL contains the data in hex, the temperature in Celsius is the decimal
+equivalent.
+
+Ex: If AL contains 0x2A, the temperature is 42 degrees C.
+
+Reading tach information.
+The fan speed information is located in the following registers:
+		LSB	MSB
+Tach1		0x28	0x29	(Currently, this reflects the CPU
+				fan speed on all systems).
+Tach2		0x2A	0x2B
+Tach3		0x2C	0x2D
+Tach4		0x2E	0x2F
+
+Important!!!
+Reading the tach LSB locks the tach MSB.
+The LSB Must be read first.
+
+How to convert the tach reading to RPM.
+The tach reading (TCount) is given by:  (Tach MSB * 256) + (Tach LSB)
+The SIO counts the number of 90kHz (11.111us) pulses per revolution.
+RPM = 60/(TCount * 11.111us)
+
+Example:
+Reg 0x28 = 0x9B
+Reg 0x29 = 0x08
+
+TCount = 0x89B = 2203
+
+RPM = 60 / (2203 * 11.11111 E-6) = 2451 RPM
+
+Obtaining the SIO version.
+
+CONFIGURATION SEQUENCE
+To program the configuration registers, the following sequence must be followed:
+1. Enter Configuration Mode
+2. Configure the Configuration Registers
+3. Exit Configuration Mode.
+
+Enter Configuration Mode
+To place the chip into the Configuration State The config key (0x55) is written
+to the CONFIG PORT (0x2E).
+
+Configuration Mode
+In configuration mode, the INDEX PORT is located at the CONFIG PORT address and
+the DATA PORT is at INDEX PORT address + 1.
+
+The desired configuration registers are accessed in two steps:
+a.	Write the index of the Logical Device Number Configuration Register
+	(i.e., 0x07) to the INDEX PORT and then write the number of the
+	desired logical device to the DATA PORT.
+
+b.	Write the address of the desired configuration register within the
+	logical device to the INDEX PORT and then write or read the config-
+	uration register through the DATA PORT.
+
+Note: If accessing the Global Configuration Registers, step (a) is not required.
+
+Exit Configuration Mode
+To exit the Configuration State the write 0xAA to the CONFIG PORT (0x2E).
+The chip returns to the RUN State.  (This is important).
+
+Programming Example
+The following is an example of how to read the SIO Device ID located at 0x20
+
+; ENTER CONFIGURATION MODE
+MOV	DX,02EH
+MOV	AX,055H
+OUT	DX,AL
+; GLOBAL CONFIGURATION  REGISTER
+MOV	DX,02EH
+MOV	AL,20H
+OUT	DX,AL
+; READ THE DATA
+MOV	DX,02FH
+IN	AL,DX
+; EXIT CONFIGURATION MODE
+MOV	DX,02EH
+MOV	AX,0AAH
+OUT	DX,AL
+
+The registers of interest for identifying the SIO on the dc7100 are Device ID
+(0x20) and Device Rev  (0x21).
+
+The Device ID will read 0X6F
+The Device Rev currently reads 0x01
+
+Obtaining the HWM Base Address.
+The following is an example of how to read the HWM Base Address located in
+Logical Device 8.
+
+; ENTER CONFIGURATION MODE
+MOV	DX,02EH
+MOV	AX,055H
+OUT	DX,AL
+; CONFIGURE REGISTER CRE0,
+; LOGICAL DEVICE 8
+MOV	DX,02EH
+MOV	AL,07H
+OUT	DX,AL ;Point to LD# Config Reg
+MOV	DX,02FH
+MOV	AL, 08H
+OUT	DX,AL;Point to Logical Device 8
+;
+MOV	DX,02EH
+MOV	AL,60H
+OUT	DX,AL	; Point to HWM Base Addr MSB
+MOV	DX,02FH
+IN	AL,DX	; Get MSB of HWM Base Addr
+; EXIT CONFIGURATION MODE
+MOV	DX,02EH
+MOV	AX,0AAH
+OUT	DX,AL
diff --git a/Documentation/i2c/chips/smsc47b397.txt b/Documentation/i2c/chips/smsc47b397.txt
deleted file mode 100644
--- a/Documentation/i2c/chips/smsc47b397.txt
+++ /dev/null
@@ -1,146 +0,0 @@
-November 23, 2004
-
-The following specification describes the SMSC LPC47B397-NC sensor chip
-(for which there is no public datasheet available).  This document was
-provided by Craig Kelly (In-Store Broadcast Network) and edited/corrected
-by Mark M. Hoffman <mhoffman@lightlink.com>.
-
-* * * * *
-
-Methods for detecting the HP SIO and reading the thermal data on a dc7100.
-
-The thermal information on the dc7100 is contained in the SIO Hardware Monitor
-(HWM).  The information is accessed through an index/data pair.  The index/data
-pair is located at the HWM Base Address + 0 and the HWM Base Address + 1.  The
-HWM Base address can be obtained from Logical Device 8, registers 0x60 (MSB)
-and 0x61 (LSB).  Currently we are using 0x480 for the HWM Base Address and
-0x480 and 0x481 for the index/data pair.
-
-Reading temperature information.
-The temperature information is located in the following registers:
-Temp1		0x25	(Currently, this reflects the CPU temp on all systems).
-Temp2		0x26
-Temp3		0x27
-Temp4		0x80
-
-Programming Example
-The following is an example of how to read the HWM temperature registers:
-MOV	DX,480H
-MOV	AX,25H
-OUT	DX,AL
-MOV	DX,481H
-IN	AL,DX
-
-AL contains the data in hex, the temperature in Celsius is the decimal
-equivalent.
-
-Ex: If AL contains 0x2A, the temperature is 42 degrees C.
-
-Reading tach information.
-The fan speed information is located in the following registers:
-		LSB	MSB
-Tach1		0x28	0x29	(Currently, this reflects the CPU
-				fan speed on all systems).
-Tach2		0x2A	0x2B
-Tach3		0x2C	0x2D
-Tach4		0x2E	0x2F
-
-Important!!!
-Reading the tach LSB locks the tach MSB.
-The LSB Must be read first.
-
-How to convert the tach reading to RPM.
-The tach reading (TCount) is given by:  (Tach MSB * 256) + (Tach LSB)
-The SIO counts the number of 90kHz (11.111us) pulses per revolution.
-RPM = 60/(TCount * 11.111us)
-
-Example:
-Reg 0x28 = 0x9B
-Reg 0x29 = 0x08
-
-TCount = 0x89B = 2203
-
-RPM = 60 / (2203 * 11.11111 E-6) = 2451 RPM
-
-Obtaining the SIO version.
-
-CONFIGURATION SEQUENCE
-To program the configuration registers, the following sequence must be followed:
-1. Enter Configuration Mode
-2. Configure the Configuration Registers
-3. Exit Configuration Mode.
-
-Enter Configuration Mode
-To place the chip into the Configuration State The config key (0x55) is written
-to the CONFIG PORT (0x2E). 
-
-Configuration Mode
-In configuration mode, the INDEX PORT is located at the CONFIG PORT address and
-the DATA PORT is at INDEX PORT address + 1.
-
-The desired configuration registers are accessed in two steps: 
-a.	Write the index of the Logical Device Number Configuration Register
-	(i.e., 0x07) to the INDEX PORT and then write the number of the
-	desired logical device to the DATA PORT.
-
-b.	Write the address of the desired configuration register within the
-	logical device to the INDEX PORT and then write or read the config-
-	uration register through the DATA PORT.  
-
-Note: If accessing the Global Configuration Registers, step (a) is not required.
-
-Exit Configuration Mode
-To exit the Configuration State the write 0xAA to the CONFIG PORT (0x2E).
-The chip returns to the RUN State.  (This is important).
-
-Programming Example
-The following is an example of how to read the SIO Device ID located at 0x20
-
-; ENTER CONFIGURATION MODE   
-MOV	DX,02EH
-MOV	AX,055H
-OUT	DX,AL
-; GLOBAL CONFIGURATION  REGISTER 
-MOV	DX,02EH
-MOV	AL,20H
-OUT	DX,AL 
-; READ THE DATA
-MOV	DX,02FH
-IN	AL,DX
-; EXIT CONFIGURATION MODE     
-MOV	DX,02EH
-MOV	AX,0AAH
-OUT	DX,AL
-
-The registers of interest for identifying the SIO on the dc7100 are Device ID
-(0x20) and Device Rev  (0x21).
-
-The Device ID will read 0X6F
-The Device Rev currently reads 0x01
-
-Obtaining the HWM Base Address.
-The following is an example of how to read the HWM Base Address located in
-Logical Device 8.
-
-; ENTER CONFIGURATION MODE   
-MOV	DX,02EH
-MOV	AX,055H
-OUT	DX,AL
-; CONFIGURE REGISTER CRE0,   
-; LOGICAL DEVICE 8           
-MOV	DX,02EH
-MOV	AL,07H
-OUT	DX,AL ;Point to LD# Config Reg
-MOV	DX,02FH
-MOV	AL, 08H
-OUT	DX,AL;Point to Logical Device 8
-;
-MOV	DX,02EH 
-MOV	AL,60H
-OUT	DX,AL	; Point to HWM Base Addr MSB
-MOV	DX,02FH
-IN	AL,DX	; Get MSB of HWM Base Addr
-; EXIT CONFIGURATION MODE     
-MOV	DX,02EH
-MOV	AX,0AAH
-OUT	DX,AL


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] i2c: Race fix for i2c-mpc.c
  2005-06-22  5:17                                                                             ` [PATCH] I2C: add i2c driver for TPS6501x Greg KH
@ 2005-06-22  5:17                                                                               ` Greg KH
  2005-06-22  5:17                                                                                 ` [PATCH] I2C: Sensors mailing list has moved Greg KH
  2005-06-23 23:13                                                                                 ` [lm-sensors] " Jean Delvare
  1 sibling, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: tnt

[PATCH] i2c: Race fix for i2c-mpc.c

i2c: Race fix for i2c-mpc.c

The problem was that the clock speed and driver data is
initialized after the i2c adapter was added. This caused
the i2c bus to start working at a wrong speed. (Mostly
noticable on the second bus on mpc5200)

With this patch we've tried to keep the i2c adapter
working perfectly all the time it is included in the system.
Initialize before added, Remove garbage after deleleted.

Submitted-by: Asier Llano Palacios
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 7f02d56e54f2a8afaa01974df650ace9dc15d0cd
tree dd39ab530763bfb2f34e84c83d469199e53fc8b0
parent d68a861d857c11a017a8f755fa250afaf8b1bcdb
author Sylvain Munaut <tnt@246tNt.com> Wed, 18 May 2005 19:39:57 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:01 -0700

 drivers/i2c/busses/i2c-mpc.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -333,6 +333,9 @@ static int __devinit mpc_i2c_probe(struc
 	} else
 		i2c->irq = 0;
 
+	mpc_i2c_setclock(i2c);
+	ocp_set_drvdata(ocp, i2c);
+
 	i2c->adap = mpc_ops;
 	i2c_set_adapdata(&i2c->adap, i2c);
 
@@ -341,8 +344,6 @@ static int __devinit mpc_i2c_probe(struc
 		goto fail_add;
 	}
 
-	mpc_i2c_setclock(i2c);
-	ocp_set_drvdata(ocp, i2c);
 	return result;
 
       fail_add:
@@ -358,8 +359,8 @@ static int __devinit mpc_i2c_probe(struc
 static void __devexit mpc_i2c_remove(struct ocp_device *ocp)
 {
 	struct mpc_i2c *i2c = ocp_get_drvdata(ocp);
-	ocp_set_drvdata(ocp, NULL);
 	i2c_del_adapter(&i2c->adap);
+	ocp_set_drvdata(ocp, NULL);
 
 	if (ocp->def->irq != OCP_IRQ_NA)
 		free_irq(i2c->irq, i2c);
@@ -430,6 +431,9 @@ static int fsl_i2c_probe(struct device *
 			goto fail_irq;
 		}
 
+	mpc_i2c_setclock(i2c);
+	dev_set_drvdata(device, i2c);
+
 	i2c->adap = mpc_ops;
 	i2c_set_adapdata(&i2c->adap, i2c);
 	i2c->adap.dev.parent = &pdev->dev;
@@ -438,8 +442,6 @@ static int fsl_i2c_probe(struct device *
 		goto fail_add;
 	}
 
-	mpc_i2c_setclock(i2c);
-	dev_set_drvdata(device, i2c);
 	return result;
 
       fail_add:
@@ -456,8 +458,8 @@ static int fsl_i2c_remove(struct device 
 {
 	struct mpc_i2c *i2c = dev_get_drvdata(device);
 
-	dev_set_drvdata(device, NULL);
 	i2c_del_adapter(&i2c->adap);
+	dev_set_drvdata(device, NULL);
 
 	if (i2c->irq != 0)
 		free_irq(i2c->irq, i2c);


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Sensors mailing list has moved
  2005-06-22  5:17                                                                               ` [PATCH] i2c: Race fix for i2c-mpc.c Greg KH
@ 2005-06-22  5:17                                                                                 ` Greg KH
  2005-06-22  5:17                                                                                   ` [PATCH] I2C: documentation update 1/3 Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: khali

[PATCH] I2C: Sensors mailing list has moved

The following patch updates all references to the sensors mailing list,
so as to reflect the fact that the list recently moved to a new home and
changed addresses. I'll work out a similar patch for Linux 2.4 soon.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit cc0b07ed479fd92806aef7d6dbc58b6dc6da3796
tree d704525bd37b168e9cf61b7464fe4423b6c46b48
parent 7f02d56e54f2a8afaa01974df650ace9dc15d0cd
author Jean Delvare <khali@linux-fr.org> Sun, 22 May 2005 09:39:11 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:01 -0700

 Documentation/i2c/busses/i2c-sis69x |    2 +-
 Documentation/i2c/porting-clients   |    2 +-
 MAINTAINERS                         |   16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/i2c/busses/i2c-sis69x b/Documentation/i2c/busses/i2c-sis69x
--- a/Documentation/i2c/busses/i2c-sis69x
+++ b/Documentation/i2c/busses/i2c-sis69x
@@ -42,7 +42,7 @@ I suspect that this driver could be made
 chipsets as well: 635, and 635T. If anyone owns a board with those chips
 AND is willing to risk crashing & burning an otherwise well-behaved kernel
 in the name of progress... please contact me at <mhoffman@lightlink.com> or
-via the project's mailing list: <sensors@stimpy.netroedge.com>.  Please
+via the project's mailing list: <lm-sensors@lm-sensors.org>.  Please
 send bug reports and/or success stories as well.
 
 
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
--- a/Documentation/i2c/porting-clients
+++ b/Documentation/i2c/porting-clients
@@ -57,7 +57,7 @@ Technical changes:
   Documentation/i2c/sysfs-interface for the individual files. Also
   convert the units these files read and write to the specified ones.
   If you need to add a new type of file, please discuss it on the
-  sensors mailing list <sensors@stimpy.netroedge.com> by providing a
+  sensors mailing list <lm-sensors@lm-sensors.org> by providing a
   patch to the Documentation/i2c/sysfs-interface file.
 
 * [Attach] For I2C drivers, the attach function should make sure
diff --git a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -194,7 +194,7 @@ S:	Maintained
 ADM1025 HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Maintained
 
 ADT746X FAN DRIVER
@@ -242,7 +242,7 @@ S:	Maintained
 ALI1563 I2C DRIVER
 P:	Rudolf Marek
 M:	r.marek@sh.cvut.cz
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Maintained
 
 ALPHA PORT
@@ -1002,7 +1002,7 @@ P:	Greg Kroah-Hartman
 M:	greg@kroah.com
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 W:	http://www.lm-sensors.nu/
 S:	Maintained
 
@@ -1430,13 +1430,13 @@ S:	Supported
 LM83 HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Maintained
 
 LM90 HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Maintained
 
 LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP Dynamic Disks)
@@ -2075,7 +2075,7 @@ S:	Maintained
 SMSC47M1 HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Odd Fixes
 
 SMB FILESYSTEM
@@ -2614,7 +2614,7 @@ S:	Orphan
 W1 DALLAS'S 1-WIRE BUS
 P:	Evgeniy Polyakov
 M:	johnpol@2ka.mipt.ru
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Maintained
 
 W83L51xD SD/MMC CARD INTERFACE DRIVER
@@ -2627,7 +2627,7 @@ S:	Maintained
 W83L785TS HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
-L:	sensors@stimpy.netroedge.com
+L:	lm-sensors@lm-sensors.org
 S:	Odd Fixes
 
 WAN ROUTER & SANGOMA WANPIPE DRIVERS & API (X.25, FRAME RELAY, PPP, CISCO HDLC)


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-dev.c
  2005-06-22  5:17                                                                         ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-core.c Greg KH
@ 2005-06-22  5:17                                                                           ` Greg KH
  2005-06-22  5:17                                                                             ` [PATCH] I2C: add i2c driver for TPS6501x Greg KH
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: tklauser

[PATCH] I2C: Spelling fixes for drivers/i2c/i2c-dev.c

This patch fixes a misspelling in a comment section.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit d68a861d857c11a017a8f755fa250afaf8b1bcdb
tree 85975dd625d7a58da2a4e90c01729332a533c8a2
parent a551acc2cb1f13a9bd728b8cf86f9adafefdcfb2
author Tobias Klauser <tklauser@nuerscht.ch> Thu, 19 May 2005 21:41:47 +0200
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:00 -0700

 drivers/i2c/i2c-dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -213,7 +213,7 @@ static int i2cdev_ioctl(struct inode *in
 				   sizeof(rdwr_arg)))
 			return -EFAULT;
 
-		/* Put an arbritrary limit on the number of messages that can
+		/* Put an arbitrary limit on the number of messages that can
 		 * be sent at once */
 		if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
 			return -EINVAL;


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH] I2C: KConfig update - some EXPERIMENTAL removal
  2005-06-22  5:17                                                                                   ` [PATCH] I2C: documentation update 1/3 Greg KH
@ 2005-06-22  5:17                                                                                     ` Greg KH
  0 siblings, 0 replies; 48+ messages in thread
From: Greg KH @ 2005-06-22  5:17 UTC (permalink / raw)
  To: linux-kernel, sensors; +Cc: R.Marek

[PATCH] I2C: KConfig update - some EXPERIMENTAL removal

Following patch removes EXPERIMENTAL flag from some of I2C bus and chip
drivers. It is removed when the driver is in kernel at least from
2.6.3 and I generally think there is no problem with it.

Also this patch adds SiS 745 to help option of sis96x and it
also fixes nForce2 driver entry to reflect current state.

Signed-off-by: Rudolf Marek <r.marek@sh.cvut.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 5d740fe9fefda41292b5cabe70f4f8eff9f8aad0
tree 974485c72963e94570b339276ebf5defc8197442
parent 828621dda6381093ceafbe9381b6118cae3f9b13
author R.Marek@sh.cvut.cz <R.Marek@sh.cvut.cz> Sat, 28 May 2005 11:26:24 +0000
committer Greg Kroah-Hartman <gregkh@suse.de> Tue, 21 Jun 2005 21:52:02 -0700

 drivers/i2c/busses/Kconfig |   34 +++++++++++++++++-----------------
 drivers/i2c/chips/Kconfig  |   12 ++++++------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -7,7 +7,7 @@ menu "I2C Hardware Bus support"
 
 config I2C_ALI1535
 	tristate "ALI 1535"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the SMB
 	  Host controller on Acer Labs Inc. (ALI) M1535 South Bridges.  The SMB
@@ -31,7 +31,7 @@ config I2C_ALI1563
 
 config I2C_ALI15X3
 	tristate "ALI 15x3"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the
 	  Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces.
@@ -41,7 +41,7 @@ config I2C_ALI15X3
 
 config I2C_AMD756
 	tristate "AMD 756/766/768/8111 and nVidia nForce"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the AMD
 	  756/766/768 mainboard I2C interfaces.  The driver also includes
@@ -66,7 +66,7 @@ config I2C_AMD756_S4882
 
 config I2C_AMD8111
 	tristate "AMD 8111"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the
 	  second (SMBus 2.0) AMD 8111 mainboard I2C interface.
@@ -109,7 +109,7 @@ config I2C_HYDRA
 
 config I2C_I801
 	tristate "Intel 82801 (ICH)"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  801 family of mainboard I2C interfaces.  Specifically, the following
@@ -130,7 +130,7 @@ config I2C_I801
 
 config I2C_I810
 	tristate "Intel 810/815"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the Intel
@@ -183,7 +183,7 @@ config I2C_IOP3XX
 
 config I2C_ISA
 	tristate "ISA Bus support"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	help
 	  If you say yes to this option, support will be included for i2c
 	  interfaces that are on the ISA bus.
@@ -248,12 +248,11 @@ config I2C_MPC
 	  will be called i2c-mpc.
 
 config I2C_NFORCE2
-	tristate "Nvidia Nforce2"
-	depends on I2C && PCI && EXPERIMENTAL
+	tristate "Nvidia nForce2, nForce3 and nForce4"
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the Nvidia
-	  Nforce2 family of mainboard I2C interfaces.
-	  This driver also supports the nForce3 Pro 150 MCP.
+	  nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-nforce2.
@@ -305,7 +304,7 @@ config I2C_PARPORT_LIGHT
 
 config I2C_PROSAVAGE
 	tristate "S3/VIA (Pro)Savage"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the
@@ -388,7 +387,7 @@ config SCx200_ACB
 
 config I2C_SIS5595
 	tristate "SiS 5595"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the 
 	  SiS5595 SMBus (a subset of I2C) interface.
@@ -398,7 +397,7 @@ config I2C_SIS5595
 
 config I2C_SIS630
 	tristate "SiS 630/730"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the 
 	  SiS630 and SiS730 SMBus (a subset of I2C) interface.
@@ -408,7 +407,7 @@ config I2C_SIS630
 
 config I2C_SIS96X
 	tristate "SiS 96x"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the SiS
 	  96x SMBus (a subset of I2C) interfaces.  Specifically, the following
@@ -419,6 +418,7 @@ config I2C_SIS96X
 	    648/961
 	    650/961
 	    735
+	    745
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-sis96x.
@@ -449,7 +449,7 @@ config I2C_VIA
 
 config I2C_VIAPRO
 	tristate "VIA 82C596/82C686/823x"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	help
 	  If you say yes to this option, support will be included for the VIA
 	  82C596/82C686/823x I2C interfaces.  Specifically, the following 
@@ -467,7 +467,7 @@ config I2C_VIAPRO
 
 config I2C_VOODOO3
 	tristate "Voodoo 3"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	select I2C_ALGOBIT
 	help
 	  If you say yes to this option, support will be included for the
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -11,7 +11,7 @@ config I2C_SENSOR
 
 config SENSORS_ADM1021
 	tristate "Analog Devices ADM1021 and compatibles"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for Analog Devices ADM1021 
@@ -125,7 +125,7 @@ config SENSORS_FSCPOS
 
 config SENSORS_GL518SM
 	tristate "Genesys Logic GL518SM"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for Genesys Logic GL518SM
@@ -147,7 +147,7 @@ config SENSORS_GL520SM
 
 config SENSORS_IT87
 	tristate "ITE IT87xx and compatibles"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for ITE IT87xx sensor chips
@@ -171,7 +171,7 @@ config SENSORS_LM63
 
 config SENSORS_LM75
 	tristate "National Semiconductor LM75 and compatibles"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for National Semiconductor LM75
@@ -341,7 +341,7 @@ config SENSORS_SMSC47M1
 
 config SENSORS_VIA686A
 	tristate "VIA686A"
-	depends on I2C && PCI && EXPERIMENTAL
+	depends on I2C && PCI
 	select I2C_SENSOR
 	select I2C_ISA
 	help
@@ -353,7 +353,7 @@ config SENSORS_VIA686A
 
 config SENSORS_W83781D
 	tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for the Winbond W8378x series


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] I2C: Remove redundancy from i2c-core.c
  2005-06-22  5:17                                             ` [PATCH] I2C: Remove redundancy from i2c-core.c Greg KH
  2005-06-22  5:17                                               ` [PATCH] I2C: sysfs names: rename to cpu0_vid, take 3 Greg KH
@ 2005-06-22  7:37                                               ` Thomas Schneller
  1 sibling, 0 replies; 48+ messages in thread
From: Thomas Schneller @ 2005-06-22  7:37 UTC (permalink / raw)
  To: linux-kernel

unsubscribe linux-kernel

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH] I2C: add i2c driver for TPS6501x
  2005-06-22  5:17                                                                             ` [PATCH] I2C: add i2c driver for TPS6501x Greg KH
@ 2005-06-23 23:13                                                                                 ` Jean Delvare
  2005-06-23 23:13                                                                                 ` [lm-sensors] " Jean Delvare
  1 sibling, 0 replies; 48+ messages in thread
From: Jean Delvare @ 2005-06-23 21:12 UTC (permalink / raw)
  To: Greg KH, David Brownell; +Cc: LKML, LM Sensors

Hi Greg, David,

> [PATCH] I2C: add i2c driver for TPS6501x
> 
> This adds an I2C driver for the TPS6501x series of power management
> chips. It's used on many OMAP based boards, and this driver has been
> widely used in the Linux-OMAP trees over the last year or so.

There is a pending cleanup patch for this driver. It was posted by David
on the lm-sensors mailing list on May 27th:
  http://lists.lm-sensors.org/pipermail/lm-sensors/2005-May/012409.html
Greg, Can you please add this patch to your i2c tree?

Note that I am not entierly happy with this driver even after the patch
is applied. It tries to load several times when the initial attempt
fails. That's ugly and inefficient. The retries should be done on failed
bus reads, rather than reloading the driver entirely on each error, so
that as few actions as possible are retried. Or the bus driver could be
improved to deal with errors at a lower level.

David, could you please work on a patch implementing either solution?

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [lm-sensors] Re: [PATCH] I2C: add i2c driver for TPS6501x
@ 2005-06-23 23:13                                                                                 ` Jean Delvare
  0 siblings, 0 replies; 48+ messages in thread
From: Jean Delvare @ 2005-06-23 23:13 UTC (permalink / raw)
  To: Greg KH, David Brownell; +Cc: LKML, LM Sensors

Hi Greg, David,

> [PATCH] I2C: add i2c driver for TPS6501x
> 
> This adds an I2C driver for the TPS6501x series of power management
> chips. It's used on many OMAP based boards, and this driver has been
> widely used in the Linux-OMAP trees over the last year or so.

There is a pending cleanup patch for this driver. It was posted by David
on the lm-sensors mailing list on May 27th:
  http://lists.lm-sensors.org/pipermail/lm-sensors/2005-May/012409.html
Greg, Can you please add this patch to your i2c tree?

Note that I am not entierly happy with this driver even after the patch
is applied. It tries to load several times when the initial attempt
fails. That's ugly and inefficient. The retries should be done on failed
bus reads, rather than reloading the driver entirely on each error, so
that as few actions as possible are retried. Or the bus driver could be
improved to deal with errors at a lower level.

David, could you please work on a patch implementing either solution?

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [lm-sensors] Re: [PATCH] I2C: add i2c driver for TPS6501x
  2005-06-23 23:13                                                                                 ` [lm-sensors] " Jean Delvare
  (?)
@ 2005-06-29  3:21                                                                                 ` david-b
  -1 siblings, 0 replies; 48+ messages in thread
From: david-b @ 2005-06-29  3:21 UTC (permalink / raw)
  To: lm-sensors

> There is a pending cleanup patch for this driver. It was posted by David
> on the lm-sensors mailing list on May 27th:
>   http://lists.lm-sensors.org/pipermail/lm-sensors/2005-May/012409.html
> Greg, Can you please add this patch to your i2c tree?

I'll post a refreshed version with a signed-off-by-yours-truly line.
It may even have a bugfix for H3 boards, TBD ... :)

That same thread also has an I2C doc patch I sent, which hasn't yet
been merged.  (No point in telling folk to use the ID fields, they
aren't normallly necessary and aren't described enough to be usable.)


> Note that I am not entierly happy with this driver even after the patch
> is applied. It tries to load several times when the initial attempt
> fails. That's ugly and inefficient. The retries should be done on failed
> bus reads,

It's not clear that'd work.  It seems like a hardware startup glitch specific
to the H2 board, but nobody's had a lot of luck chasing down a better fix than
the one you don't like.  I'm told H2 boards are now available enough that some
Universities are going to have them ... maybe we can plant a bug in some
students' ears that will lead to a better software-only fix!


>	rather than reloading the driver entirely on each error, so
> that as few actions as possible are retried. Or the bus driver could be
> improved to deal with errors at a lower level.
>
> David, could you please work on a patch implementing either solution?

When I have some time I'll take another poke at the problem.  
No promises ... that is after all the best known fix.

On the other hand, it's been pointed out offline that the OMAP I2C bus
driver hasn't been submitted yet, so maybe a look at that will turn up
key issues.  It's a more traditional I2C bus driver ... not an atypical
I2C chip driver that needs to use IRQs and (in lieu of that pending async
I2C API!) workqueues, exporting an API that's more at the level of ACPI
power management internals than anything else.  :)

- Dave




^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2005-06-29  3:21 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-22  5:16 [GIT PATCH] I2C patches for 2.6.12 Greg KH
2005-06-22  5:17 ` [PATCH] I2C: Kill address ranges in non-sensors i2c chip drivers Greg KH
2005-06-22  5:17   ` [PATCH] I2C: i2c-vid.h: Support for VID to reg conversion Greg KH
2005-06-22  5:17     ` [PATCH] I2C: Merge unused address lists in some video drivers Greg KH
2005-06-22  5:17       ` [PATCH] I2C: rtc8564.c remove duplicate include Greg KH
2005-06-22  5:17         ` [PATCH] I2C: ds1337 1/4 Greg KH
2005-06-22  5:17           ` [PATCH] I2C: mark all functions static in atxp1 driver Greg KH
2005-06-22  5:17             ` [PATCH] I2C: add new " Greg KH
2005-06-22  5:17               ` [PATCH] I2C: ds1337: i2c_transfer() checking Greg KH
2005-06-22  5:17                 ` [PATCH] I2C: ds1337: Make time format consistent with other RTC drivers Greg KH
2005-06-22  5:17                   ` [PATCH] I2C: ds1337 2/4 Greg KH
2005-06-22  5:17                     ` [PATCH] I2C: ds1337 3/4 Greg KH
2005-06-22  5:17                       ` [PATCH] I2C: ds1337: search by bus number Greg KH
2005-06-22  5:17                         ` [PATCH] ds1337 driver works also with ds1339 chip Greg KH
2005-06-22  5:17                           ` [PATCH] ds1337: export ds1337_do_command Greg KH
2005-06-22  5:17                             ` [PATCH] I2C: add new hardware monitor driver: adm9240 Greg KH
2005-06-22  5:17                               ` [PATCH] I2C: #include <linux/config.h> cleanup Greg KH
2005-06-22  5:17                                 ` [PATCH] I2C: drivers/i2c/*: " Greg KH
2005-06-22  5:17                                   ` [PATCH] I2C: New hardware monitoring driver: w83627ehf Greg KH
2005-06-22  5:17                                     ` [PATCH] I2C: Fix bugs in the new w83627ehf driver Greg KH
2005-06-22  5:17                                       ` [PATCH] I2C: Add support for the LPC47M15x and LPC47M192 chips to smsc47m1 Greg KH
2005-06-22  5:17                                         ` [PATCH] I2C: Allow for sharing of the interrupt line for i2c-mpc.c Greg KH
2005-06-22  5:17                                           ` [PATCH] Spelling fixes for drivers/i2c Greg KH
2005-06-22  5:17                                             ` [PATCH] I2C: Remove redundancy from i2c-core.c Greg KH
2005-06-22  5:17                                               ` [PATCH] I2C: sysfs names: rename to cpu0_vid, take 3 Greg KH
2005-06-22  5:17                                                 ` [PATCH] I2C: Setting w83627hf fan divisor 128 fails Greg KH
2005-06-22  5:17                                                   ` [PATCH] I2C: remove <linux/delay.h> from via686a Greg KH
2005-06-22  5:17                                                     ` [PATCH] I2C: Kill common macro abuse in chip drivers Greg KH
2005-06-22  5:17                                                       ` [PATCH] I2C: adm9240 driver cleanup Greg KH
2005-06-22  5:17                                                         ` [PATCH] I2C: include of jiffies.h for some i2c drivers Greg KH
2005-06-22  5:17                                                           ` [PATCH] I2C: chips/Kconfig corrections Greg KH
2005-06-22  5:17                                                             ` [PATCH] I2C: driver adm1021: remove die_code Greg KH
2005-06-22  5:17                                                               ` [PATCH] I2C: Coding style cleanups to via686a Greg KH
2005-06-22  5:17                                                                 ` [PATCH] I2C: Spelling fixes for drivers/i2c/algos/i2c-algo-pca.c Greg KH
2005-06-22  5:17                                                                   ` [PATCH] I2C: Kill another macro abuse in via686a Greg KH
2005-06-22  5:17                                                                     ` [PATCH] I2C: fix up some sysfs device attribute file parameters Greg KH
2005-06-22  5:17                                                                       ` [PATCH] I2C: Spelling fixes for drivers/i2c/busses/i2c-parport.c Greg KH
2005-06-22  5:17                                                                         ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-core.c Greg KH
2005-06-22  5:17                                                                           ` [PATCH] I2C: Spelling fixes for drivers/i2c/i2c-dev.c Greg KH
2005-06-22  5:17                                                                             ` [PATCH] I2C: add i2c driver for TPS6501x Greg KH
2005-06-22  5:17                                                                               ` [PATCH] i2c: Race fix for i2c-mpc.c Greg KH
2005-06-22  5:17                                                                                 ` [PATCH] I2C: Sensors mailing list has moved Greg KH
2005-06-22  5:17                                                                                   ` [PATCH] I2C: documentation update 1/3 Greg KH
2005-06-22  5:17                                                                                     ` [PATCH] I2C: KConfig update - some EXPERIMENTAL removal Greg KH
2005-06-23 21:12                                                                               ` [PATCH] I2C: add i2c driver for TPS6501x Jean Delvare
2005-06-23 23:13                                                                                 ` [lm-sensors] " Jean Delvare
2005-06-29  3:21                                                                                 ` david-b
2005-06-22  7:37                                               ` [PATCH] I2C: Remove redundancy from i2c-core.c Thomas Schneller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.