linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BK PATCH] I2C fixes for 2.6.10-rc2
@ 2004-11-19 21:59 Greg KH
  2004-11-19 22:00 ` [PATCH] " Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2004-11-19 21:59 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, sensors

Hi,

Here are some i2c driver fixes for 2.6.10-rc2.

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

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

thanks,

greg k-h

 Documentation/i2c/writing-clients     |   20 ++++++++++++++++----
 drivers/i2c/busses/Kconfig            |    1 +
 drivers/i2c/busses/i2c-amd756-s4882.c |    7 +++++--
 drivers/i2c/busses/i2c-nforce2.c      |    9 ++++-----
 drivers/i2c/chips/smsc47m1.c          |   29 +++++++++++++++++++++--------
 drivers/i2c/i2c-core.c                |   20 --------------------
 include/linux/pci_ids.h               |    2 ++
 7 files changed, 49 insertions(+), 39 deletions(-)
-----


<thomas:plx.com>:
  o I2C: i2c-nforce2.c add support for nForce3 Pro 150 MCP

Gabriel Paubert:
  o I2C: minor comment fix

Jean Delvare:
  o I2C: Cleanups to the recent smbus functions removal
  o I2C: Fixes to the i2c-amd756-s4882 driver
  o I2C: Do not register useless smsc47m1


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

* [PATCH] I2C fixes for 2.6.10-rc2
  2004-11-19 21:59 [BK PATCH] I2C fixes for 2.6.10-rc2 Greg KH
@ 2004-11-19 22:00 ` Greg KH
  2004-11-19 22:00   ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2004-11-19 22:00 UTC (permalink / raw)
  To: linux-kernel, sensors

ChangeSet 1.2164, 2004/11/19 09:12:35-08:00, khali@linux-fr.org

[PATCH] I2C: Do not register useless smsc47m1

While verifying my stack of patches against what you sent to Linus last
week, I noticed this one. Looks like I simply forgot to send it to you,
as I cannot find any trace of it in the lm_sensors mailing-list
archives.

The patch prevents an smsc47m1 device from being registered when no
monitoring function is actually active within the chip. See this ticket
for background:
  http://secure.netroedge.com/~lm78/readticket.cgi?ticket=1801
This is certainly better to explicitely fail in this case than leave the
user with an empty sysfs directory (except for alarms), which tends to
make him/her think of a driver bug, which it isn't (what it really is is
a BIOS brokenness).

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/chips/smsc47m1.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)


diff -Nru a/drivers/i2c/chips/smsc47m1.c b/drivers/i2c/chips/smsc47m1.c
--- a/drivers/i2c/chips/smsc47m1.c	2004-11-19 11:40:54 -08:00
+++ b/drivers/i2c/chips/smsc47m1.c	2004-11-19 11:40:54 -08:00
@@ -394,6 +394,7 @@
 	struct i2c_client *new_client;
 	struct smsc47m1_data *data;
 	int err = 0;
+	int fan1, fan2, pwm1, pwm2;
 
 	if (!i2c_is_isa_adapter(adapter)) {
 		return 0;
@@ -423,6 +424,22 @@
 	new_client->id = smsc47m1_id++;
 	init_MUTEX(&data->update_lock);
 
+	/* If no function is properly configured, there's no point in
+	   actually registering the chip. */
+	fan1 = (smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(0)) & 0x05)
+	       == 0x05;
+	fan2 = (smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(1)) & 0x05)
+	       == 0x05;
+	pwm1 = (smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(0)) & 0x05)
+	       == 0x04;
+	pwm2 = (smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(1)) & 0x05)
+	       == 0x04;
+	if (!(fan1 || fan2 || pwm1 || pwm2)) {
+		dev_warn(&new_client->dev, "Device is not configured, will not use\n");
+		err = -ENODEV;
+		goto error_free;
+	}
+
 	if ((err = i2c_attach_client(new_client)))
 		goto error_free;
 
@@ -434,8 +451,7 @@
 	   function. */
 	smsc47m1_update_device(&new_client->dev, 1);
 
-	if ((smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(0)) & 0x05)
-	    == 0x05) {
+	if (fan1) {
 		device_create_file(&new_client->dev, &dev_attr_fan1_input);
 		device_create_file(&new_client->dev, &dev_attr_fan1_min);
 		device_create_file(&new_client->dev, &dev_attr_fan1_div);
@@ -443,8 +459,7 @@
 		dev_dbg(&new_client->dev, "Fan 1 not enabled by hardware, "
 			"skipping\n");
 
-	if ((smsc47m1_read_value(new_client, SMSC47M1_REG_TPIN(1)) & 0x05)
-	    == 0x05) {
+	if (fan2) {
 		device_create_file(&new_client->dev, &dev_attr_fan2_input);
 		device_create_file(&new_client->dev, &dev_attr_fan2_min);
 		device_create_file(&new_client->dev, &dev_attr_fan2_div);
@@ -452,15 +467,13 @@
 		dev_dbg(&new_client->dev, "Fan 2 not enabled by hardware, "
 			"skipping\n");
 
-	if ((smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(0)) & 0x05)
-	    == 0x04) {
+	if (pwm1) {
 		device_create_file(&new_client->dev, &dev_attr_pwm1);
 		device_create_file(&new_client->dev, &dev_attr_pwm1_enable);
 	} else
 		dev_dbg(&new_client->dev, "PWM 1 not enabled by hardware, "
 			"skipping\n");
-	if ((smsc47m1_read_value(new_client, SMSC47M1_REG_PPIN(1)) & 0x05)
-	    == 0x04) {
+	if (pwm2) {
 		device_create_file(&new_client->dev, &dev_attr_pwm2);
 		device_create_file(&new_client->dev, &dev_attr_pwm2_enable);
 	} else

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

* Re: [PATCH] I2C fixes for 2.6.10-rc2
  2004-11-19 22:00 ` [PATCH] " Greg KH
@ 2004-11-19 22:00   ` Greg KH
  2004-11-19 22:00     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2004-11-19 22:00 UTC (permalink / raw)
  To: linux-kernel, sensors

ChangeSet 1.2165, 2004/11/19 09:13:08-08:00, khali@linux-fr.org

[PATCH] I2C: Fixes to the i2c-amd756-s4882 driver

While working on the 2.4 version of the i2c-amd756-s4882 driver, I
noticed a few quirks on the 2.6 version I sent to you. The following
patch attempts to fix them.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/busses/i2c-amd756-s4882.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


diff -Nru a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
--- a/drivers/i2c/busses/i2c-amd756-s4882.c	2004-11-19 11:40:48 -08:00
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c	2004-11-19 11:40:48 -08:00
@@ -35,6 +35,7 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 
@@ -156,7 +157,9 @@
 	/* Unregister physical bus */
 	error = i2c_del_adapter(&amd756_smbus);
 	if (error) {
-		if (error != -EINVAL)
+		if (error == -EINVAL)
+			error = -ENODEV;
+		else
 			dev_err(&amd756_smbus.dev, "Physical bus removal "
 				"failed\n");
 		goto ERROR0;
@@ -200,7 +203,7 @@
 					      I2C_SMBUS_WRITE, 0x03,
 					      I2C_SMBUS_BYTE_DATA, &ioconfig);
 	if (error) {
-		dev_dbg(&amd756_smbus.dev, "PCA9556 configuration failed\n");
+		dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
 		error = -EIO;
 		goto ERROR3;
 	}

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

* Re: [PATCH] I2C fixes for 2.6.10-rc2
  2004-11-19 22:00   ` Greg KH
@ 2004-11-19 22:00     ` Greg KH
  2004-11-19 22:00       ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2004-11-19 22:00 UTC (permalink / raw)
  To: linux-kernel, sensors

ChangeSet 1.2166, 2004/11/19 09:13:45-08:00, khali@linux-fr.org

[PATCH] I2C: Cleanups to the recent smbus functions removal

This patch cleans up the recent removal of smbus functions proposed by
Arjan and then fixed by Gabriel. Changes are as follow:

1* Discard i2c_smbus_block_process_call, as it isn't used anywhere
   either. I guess that Arjan missed it because it wasn't exported.

2* Document the functions removal, so that people have at least an idea
   that the functions can be restored later if needed.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 Documentation/i2c/writing-clients |   20 ++++++++++++++++----
 drivers/i2c/i2c-core.c            |   19 -------------------
 2 files changed, 16 insertions(+), 23 deletions(-)


diff -Nru a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
--- a/Documentation/i2c/writing-clients	2004-11-19 11:40:43 -08:00
+++ b/Documentation/i2c/writing-clients	2004-11-19 11:40:43 -08:00
@@ -676,13 +676,25 @@
   extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command);
   extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
                                        u8 command, u16 value);
-  extern s32 i2c_smbus_process_call(struct i2c_client * client,
-                                    u8 command, u16 value);
-  extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
-                                       u8 command, u8 *values);
   extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
                                         u8 command, u8 length,
                                         u8 *values);
+
+These ones were removed in Linux 2.6.10 because they had no users, but could
+be added back later if needed:
+
+  extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
+                                           u8 command, u8 *values);
+  extern s32 i2c_smbus_read_block_data(struct i2c_client * client,
+                                       u8 command, u8 *values);
+  extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
+                                            u8 command, u8 length,
+                                            u8 *values);
+  extern s32 i2c_smbus_process_call(struct i2c_client * client,
+                                    u8 command, u16 value);
+  extern s32 i2c_smbus_block_process_call(struct i2c_client *client,
+                                          u8 command, u8 length,
+                                          u8 *values)
 
 All these transactions return -1 on failure. The 'write' transactions 
 return 0 on success; the 'read' transactions return the read value, except 
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c	2004-11-19 11:40:43 -08:00
+++ b/drivers/i2c/i2c-core.c	2004-11-19 11:40:43 -08:00
@@ -1038,25 +1038,6 @@
 }
 
 /* Returns the number of read bytes */
-s32 i2c_smbus_block_process_call(struct i2c_client *client, u8 command, u8 length, u8 *values)
-{
-	union i2c_smbus_data data;
-	int i;
-	if (length > I2C_SMBUS_BLOCK_MAX - 1)
-		return -1;
-	data.block[0] = length;
-	for (i = 1; i <= length; i++)
-		data.block[i] = values[i-1];
-	if(i2c_smbus_xfer(client->adapter,client->addr,client->flags,
-	                  I2C_SMBUS_WRITE, command,
-	                  I2C_SMBUS_BLOCK_PROC_CALL, &data))
-		return -1;
-	for (i = 1; i <= data.block[0]; i++)
-		values[i-1] = data.block[i];
-	return data.block[0];
-}
-
-/* Returns the number of read bytes */
 s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values)
 {
 	union i2c_smbus_data data;

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

* Re: [PATCH] I2C fixes for 2.6.10-rc2
  2004-11-19 22:00     ` Greg KH
@ 2004-11-19 22:00       ` Greg KH
  2004-11-19 22:01         ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2004-11-19 22:00 UTC (permalink / raw)
  To: linux-kernel, sensors

ChangeSet 1.2167, 2004/11/19 09:14:15-08:00, paubert@iram.es

[PATCH] I2C: minor comment fix

It seems so. BTW I hate wrong comments and happened to add one
in my patch. To fix my blunder, can you apply the appended one
line removal on top of Jean's patch.


Signed-off-by: Gabriel Paubert <paubert@iram.es>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/i2c-core.c |    1 -
 1 files changed, 1 deletion(-)


diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c	2004-11-19 11:40:37 -08:00
+++ b/drivers/i2c/i2c-core.c	2004-11-19 11:40:37 -08:00
@@ -1021,7 +1021,6 @@
 	                      I2C_SMBUS_WORD_DATA,&data);
 }
 
-/* Returns the number of bytes transferred */
 s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command,
 			       u8 length, u8 *values)
 {

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

* Re: [PATCH] I2C fixes for 2.6.10-rc2
  2004-11-19 22:00       ` Greg KH
@ 2004-11-19 22:01         ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-11-19 22:01 UTC (permalink / raw)
  To: linux-kernel, sensors

ChangeSet 1.2168, 2004/11/19 09:14:38-08:00, thomas@plx.com

[PATCH] I2C: i2c-nforce2.c add support for nForce3 Pro 150 MCP

This is the all new and improved version of the patch:
- following the advise from Jean Delvare I removed the redundant definition
  of the PCI IDs from the driver and just add them to the pci_ids.h file.
- the patch is now created against linux 2.6.10-RC2.

Signed-off-by: Thomas Leibold <thomas@plx.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/i2c/busses/Kconfig       |    1 +
 drivers/i2c/busses/i2c-nforce2.c |    9 ++++-----
 include/linux/pci_ids.h          |    2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)


diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig	2004-11-19 11:40:32 -08:00
+++ b/drivers/i2c/busses/Kconfig	2004-11-19 11:40:32 -08:00
@@ -218,6 +218,7 @@
 	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.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-nforce2.
diff -Nru a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
--- a/drivers/i2c/busses/i2c-nforce2.c	2004-11-19 11:40:32 -08:00
+++ b/drivers/i2c/busses/i2c-nforce2.c	2004-11-19 11:40:32 -08:00
@@ -1,6 +1,7 @@
 /*
     SMBus driver for nVidia nForce2 MCP
 
+    Added nForce3 Pro 150  Thomas Leibold <thomas@plx.com>,
 	Ported to 2.5 Patrick Dreker <patrick@dreker.de>,
     Copyright (c) 2003  Hans-Frieder Vogt <hfvogt@arcor.de>,
     Based on
@@ -25,6 +26,7 @@
 /*
     SUPPORTED DEVICES	PCI ID
     nForce2 MCP		0064
+    nForce3 Pro150 MCP	00D4
 
     This driver supports the 2 SMBuses that are included in the MCP2 of the
     nForce2 chipset.
@@ -49,11 +51,6 @@
 MODULE_DESCRIPTION("nForce2 SMBus driver");
 
 
-#ifndef PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS
-#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS   0x0064
-#endif
-
-
 struct nforce2_smbus {
 	struct pci_dev *dev;
 	struct i2c_adapter adapter;
@@ -293,6 +290,8 @@
 
 static struct pci_device_id nforce2_ids[] = {
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS,
+	       	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS,
 	       	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0 }
 };
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	2004-11-19 11:40:32 -08:00
+++ b/include/linux/pci_ids.h	2004-11-19 11:40:32 -08:00
@@ -1082,6 +1082,7 @@
 #define PCI_DEVICE_ID_NVIDIA_NVENET_8		0x0056
 #define PCI_DEVICE_ID_NVIDIA_NVENET_9		0x0057
 #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO	0x0059
+#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS	0x0064
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE	0x0065
 #define PCI_DEVICE_ID_NVIDIA_NVENET_2		0x0066
 #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO		0x006a
@@ -1093,6 +1094,7 @@
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3		0x00d1
 #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO		0x00da
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S  		0x00e1
+#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS	0x00d4
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE	0x00d5
 #define PCI_DEVICE_ID_NVIDIA_NVENET_3		0x00d6
 #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO		0x00da

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

* [BK PATCH] I2C fixes for 2.6.10-rc2
@ 2004-12-01  0:12 Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2004-12-01  0:12 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, sensors

Hi,

Here are some i2c driver fixes and the addition of a new chip driver for
2.6.10-rc2 (it is self-contained) for 2.6.10-rc2

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

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

thanks,

greg k-h

 drivers/i2c/busses/i2c-elektor.c     |   28 
 drivers/i2c/busses/i2c-ite.c         |   31 
 drivers/i2c/busses/i2c-nforce2.c     |    9 
 drivers/i2c/chips/Kconfig            |    9 
 drivers/i2c/chips/Makefile           |    1 
 drivers/i2c/chips/adm1026.c          | 1781 ++++++++++++++++++++++++++++++++++-
 drivers/i2c/chips/w83l785ts.c        |    9 
 drivers/macintosh/therm_adt746x.c    |   11 
 drivers/macintosh/therm_pm72.c       |    3 
 drivers/macintosh/therm_windtunnel.c |    8 
 drivers/w1/Kconfig                   |    2 
 drivers/w1/dscore.c                  |   40 
 drivers/w1/dscore.h                  |   34 
 drivers/w1/w1_int.c                  |   11 
 drivers/w1/w1_netlink.c              |    3 
 include/linux/pci_ids.h              |    1 
 16 files changed, 1902 insertions(+), 79 deletions(-)
-----

<jthiessen:penguincomputing.com>:
  o I2C: add adm1026 chip driver

Aristeu Sergio Rozanski Filho:
  o i2c-ite: get rid of cli()/sti()
  o [2/2] i2c-elektor: adding missing casts
  o i2c-elektor: get rid of cli/sti

Evgeniy Polyakov:
  o W1: check nls in return path
  o drivers/w1/dscore: fix the inline mess
  o w1: make W1_DS9490_BRIDGE available
  o w1: do not stop and oops if netlink socket was not allocated

Greg Kroah-Hartman:
  o I2C: make fixup_fan_min static in adm1026 driver

Jean Delvare:
  o I2C: macintoch/therm_* drivers cleanups
  o I2C: Add support for the nForce2 Ultra 400 to i2c-nforce2
  o I2C: More verbose w83l785ts driver


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

end of thread, other threads:[~2004-12-01  0:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-19 21:59 [BK PATCH] I2C fixes for 2.6.10-rc2 Greg KH
2004-11-19 22:00 ` [PATCH] " Greg KH
2004-11-19 22:00   ` Greg KH
2004-11-19 22:00     ` Greg KH
2004-11-19 22:00       ` Greg KH
2004-11-19 22:01         ` Greg KH
2004-12-01  0:12 [BK PATCH] " Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).