Browse Source

Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

Pull i2c update from Jean Delvare:
 "This is my last pull request for the i2c subsystem.  It includes all
  the patches I collected between kernel v3.7-rc1 and me passing i2c
  maintenance duties over to Wolfram.

  Future patches to the many i2c bus drivers I still maintain will go
  through Wolfram's tree."

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c: Mention functionality flags in SMBus protocol documentation
  i2c-piix4: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
  i2c-i801: Enable interrupts for all post-ICH5 chips
  i2c-i801: Add device tree support
  MAINTAINERS: Fix drivers/i2c/busses/i2c-stub.c
Linus Torvalds 12 years ago
parent
commit
123df7ae0d
4 changed files with 37 additions and 23 deletions
  1. 31 9
      Documentation/i2c/smbus-protocol
  2. 1 1
      MAINTAINERS
  3. 3 10
      drivers/i2c/busses/i2c-i801.c
  4. 2 3
      drivers/i2c/busses/i2c-piix4.c

+ 31 - 9
Documentation/i2c/smbus-protocol

@@ -23,6 +23,12 @@ don't match these function names.  For some of the operations which pass a
 single data byte, the functions using SMBus protocol operation names execute
 single data byte, the functions using SMBus protocol operation names execute
 a different protocol operation entirely.
 a different protocol operation entirely.
 
 
+Each transaction type corresponds to a functionality flag. Before calling a
+transaction function, a device driver should always check (just once) for
+the corresponding functionality flag to ensure that the underlying I2C
+adapter supports the transaction in question. See
+<file:Documentation/i2c/functionality> for the details.
+
 
 
 Key to symbols
 Key to symbols
 ==============
 ==============
@@ -49,6 +55,8 @@ This sends a single bit to the device, at the place of the Rd/Wr bit.
 
 
 A Addr Rd/Wr [A] P
 A Addr Rd/Wr [A] P
 
 
+Functionality flag: I2C_FUNC_SMBUS_QUICK
+
 
 
 SMBus Receive Byte:  i2c_smbus_read_byte()
 SMBus Receive Byte:  i2c_smbus_read_byte()
 ==========================================
 ==========================================
@@ -60,6 +68,8 @@ the previous SMBus command.
 
 
 S Addr Rd [A] [Data] NA P
 S Addr Rd [A] [Data] NA P
 
 
+Functionality flag: I2C_FUNC_SMBUS_READ_BYTE
+
 
 
 SMBus Send Byte:  i2c_smbus_write_byte()
 SMBus Send Byte:  i2c_smbus_write_byte()
 ========================================
 ========================================
@@ -69,6 +79,8 @@ to a device.  See Receive Byte for more information.
 
 
 S Addr Wr [A] Data [A] P
 S Addr Wr [A] Data [A] P
 
 
+Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE
+
 
 
 SMBus Read Byte:  i2c_smbus_read_byte_data()
 SMBus Read Byte:  i2c_smbus_read_byte_data()
 ============================================
 ============================================
@@ -78,6 +90,8 @@ The register is specified through the Comm byte.
 
 
 S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
 S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
 
 
+Functionality flag: I2C_FUNC_SMBUS_READ_BYTE_DATA
+
 
 
 SMBus Read Word:  i2c_smbus_read_word_data()
 SMBus Read Word:  i2c_smbus_read_word_data()
 ============================================
 ============================================
@@ -88,6 +102,8 @@ byte. But this time, the data is a complete word (16 bits).
 
 
 S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
 S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
 
 
+Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA
+
 Note the convenience function i2c_smbus_read_word_swapped is
 Note the convenience function i2c_smbus_read_word_swapped is
 available for reads where the two data bytes are the other way
 available for reads where the two data bytes are the other way
 around (not SMBus compliant, but very popular.)
 around (not SMBus compliant, but very popular.)
@@ -102,6 +118,8 @@ the Read Byte operation.
 
 
 S Addr Wr [A] Comm [A] Data [A] P
 S Addr Wr [A] Comm [A] Data [A] P
 
 
+Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE_DATA
+
 
 
 SMBus Write Word:  i2c_smbus_write_word_data()
 SMBus Write Word:  i2c_smbus_write_word_data()
 ==============================================
 ==============================================
@@ -112,6 +130,8 @@ specified through the Comm byte.
 
 
 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
 
 
+Functionality flag: I2C_FUNC_SMBUS_WRITE_WORD_DATA
+
 Note the convenience function i2c_smbus_write_word_swapped is
 Note the convenience function i2c_smbus_write_word_swapped is
 available for writes where the two data bytes are the other way
 available for writes where the two data bytes are the other way
 around (not SMBus compliant, but very popular.)
 around (not SMBus compliant, but very popular.)
@@ -126,6 +146,8 @@ This command selects a device register (through the Comm byte), sends
 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] 
 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] 
                              S Addr Rd [A] [DataLow] A [DataHigh] NA P
                              S Addr Rd [A] [DataLow] A [DataHigh] NA P
 
 
+Functionality flag: I2C_FUNC_SMBUS_PROC_CALL
+
 
 
 SMBus Block Read:  i2c_smbus_read_block_data()
 SMBus Block Read:  i2c_smbus_read_block_data()
 ==============================================
 ==============================================
@@ -137,6 +159,8 @@ of data is specified by the device in the Count byte.
 S Addr Wr [A] Comm [A] 
 S Addr Wr [A] Comm [A] 
            S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
            S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
 
 
+Functionality flag: I2C_FUNC_SMBUS_READ_BLOCK_DATA
+
 
 
 SMBus Block Write:  i2c_smbus_write_block_data()
 SMBus Block Write:  i2c_smbus_write_block_data()
 ================================================
 ================================================
@@ -147,6 +171,8 @@ Comm byte. The amount of data is specified in the Count byte.
 
 
 S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
 S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
 
 
+Functionality flag: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
+
 
 
 SMBus Block Write - Block Read Process Call
 SMBus Block Write - Block Read Process Call
 ===========================================
 ===========================================
@@ -160,6 +186,8 @@ This command selects a device register (through the Comm byte), sends
 S Addr Wr [A] Comm [A] Count [A] Data [A] ...
 S Addr Wr [A] Comm [A] Count [A] Data [A] ...
                              S Addr Rd [A] [Count] A [Data] ... A P
                              S Addr Rd [A] [Count] A [Data] ... A P
 
 
+Functionality flag: I2C_FUNC_SMBUS_BLOCK_PROC_CALL
+
 
 
 SMBus Host Notify
 SMBus Host Notify
 =================
 =================
@@ -229,15 +257,7 @@ designated register that is specified through the Comm byte.
 S Addr Wr [A] Comm [A] 
 S Addr Wr [A] Comm [A] 
            S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
            S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
 
 
-
-I2C Block Read (2 Comm bytes)
-=============================
-
-This command reads a block of bytes from a device, from a 
-designated register that is specified through the two Comm bytes.
-
-S Addr Wr [A] Comm1 [A] Comm2 [A] 
-           S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
+Functionality flag: I2C_FUNC_SMBUS_READ_I2C_BLOCK
 
 
 
 
 I2C Block Write:  i2c_smbus_write_i2c_block_data()
 I2C Block Write:  i2c_smbus_write_i2c_block_data()
@@ -249,3 +269,5 @@ Comm byte. Note that command lengths of 0, 2, or more bytes are
 supported as they are indistinguishable from data.
 supported as they are indistinguishable from data.
 
 
 S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
 S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
+
+Functionality flag: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK

+ 1 - 1
MAINTAINERS

@@ -3712,7 +3712,7 @@ I2C/SMBUS STUB DRIVER
 M:	"Mark M. Hoffman" <mhoffman@lightlink.com>
 M:	"Mark M. Hoffman" <mhoffman@lightlink.com>
 L:	linux-i2c@vger.kernel.org
 L:	linux-i2c@vger.kernel.org
 S:	Maintained
 S:	Maintained
-F:	drivers/i2c/busses/i2c-stub.c
+F:	drivers/i2c/i2c-stub.c
 
 
 I2C SUBSYSTEM
 I2C SUBSYSTEM
 M:	Wolfram Sang <w.sang@pengutronix.de>
 M:	Wolfram Sang <w.sang@pengutronix.de>

+ 3 - 10
drivers/i2c/busses/i2c-i801.c

@@ -81,6 +81,7 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/wait.h>
 #include <linux/wait.h>
 #include <linux/err.h>
 #include <linux/err.h>
+#include <linux/of_i2c.h>
 
 
 #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
 #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
 		defined CONFIG_DMI
 		defined CONFIG_DMI
@@ -1108,6 +1109,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		/* fall through */
 		/* fall through */
 	default:
 	default:
 		priv->features |= FEATURE_I2C_BLOCK_READ;
 		priv->features |= FEATURE_I2C_BLOCK_READ;
+		priv->features |= FEATURE_IRQ;
 		/* fall through */
 		/* fall through */
 	case PCI_DEVICE_ID_INTEL_82801DB_3:
 	case PCI_DEVICE_ID_INTEL_82801DB_3:
 		priv->features |= FEATURE_SMBUS_PEC;
 		priv->features |= FEATURE_SMBUS_PEC;
@@ -1120,16 +1122,6 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		break;
 		break;
 	}
 	}
 
 
-	/* IRQ processing tested on CougarPoint PCH, ICH5, ICH7-M and ICH10 */
-	if (dev->device == PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS ||
-	    dev->device == PCI_DEVICE_ID_INTEL_82801EB_3 ||
-	    dev->device == PCI_DEVICE_ID_INTEL_ICH7_17 ||
-	    dev->device == PCI_DEVICE_ID_INTEL_ICH8_5 ||
-	    dev->device == PCI_DEVICE_ID_INTEL_ICH9_6 ||
-	    dev->device == PCI_DEVICE_ID_INTEL_ICH10_4 ||
-	    dev->device == PCI_DEVICE_ID_INTEL_ICH10_5)
-		priv->features |= FEATURE_IRQ;
-
 	/* Disable features on user request */
 	/* Disable features on user request */
 	for (i = 0; i < ARRAY_SIZE(i801_feature_names); i++) {
 	for (i = 0; i < ARRAY_SIZE(i801_feature_names); i++) {
 		if (priv->features & disable_features & (1 << i))
 		if (priv->features & disable_features & (1 << i))
@@ -1215,6 +1207,7 @@ static int __devinit i801_probe(struct pci_dev *dev,
 		goto exit_free_irq;
 		goto exit_free_irq;
 	}
 	}
 
 
+	of_i2c_register_devices(&priv->adapter);
 	i801_probe_optional_slaves(priv);
 	i801_probe_optional_slaves(priv);
 	/* We ignore errors - multiplexing is optional */
 	/* We ignore errors - multiplexing is optional */
 	i801_add_mux(priv);
 	i801_add_mux(priv);

+ 2 - 3
drivers/i2c/busses/i2c-piix4.c

@@ -204,9 +204,8 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
 			 */
 			 */
 			pci_write_config_byte(PIIX4_dev, SMBHSTCFG,
 			pci_write_config_byte(PIIX4_dev, SMBHSTCFG,
 					      temp | 1);
 					      temp | 1);
-			dev_printk(KERN_NOTICE, &PIIX4_dev->dev,
-				"WARNING: SMBus interface has been "
-				"FORCEFULLY ENABLED!\n");
+			dev_notice(&PIIX4_dev->dev,
+				   "WARNING: SMBus interface has been FORCEFULLY ENABLED!\n");
 		} else {
 		} else {
 			dev_err(&PIIX4_dev->dev,
 			dev_err(&PIIX4_dev->dev,
 				"Host SMBus controller not enabled!\n");
 				"Host SMBus controller not enabled!\n");