Commit 700b988c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] i2c updates

a few new ids, a name change and 10 lines of new code, ported over from
the external i2c package.
parent 84fed9da
...@@ -877,7 +877,7 @@ static struct i2c_algorithm iic_algo = { ...@@ -877,7 +877,7 @@ static struct i2c_algorithm iic_algo = {
// //
// Description: Register bus structure // Description: Register bus structure
// //
int i2c_iic_add_bus(struct i2c_adapter *adap) int i2c_ocp_add_bus(struct i2c_adapter *adap)
{ {
struct i2c_algo_iic_data *iic_adap = adap->algo_data; struct i2c_algo_iic_data *iic_adap = adap->algo_data;
...@@ -912,7 +912,7 @@ int i2c_iic_add_bus(struct i2c_adapter *adap) ...@@ -912,7 +912,7 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
// //
// Done // Done
// //
int i2c_iic_del_bus(struct i2c_adapter *adap) int i2c_ocp_del_bus(struct i2c_adapter *adap)
{ {
int res; int res;
if ((res = i2c_del_adapter(adap)) < 0) if ((res = i2c_del_adapter(adap)) < 0)
...@@ -942,8 +942,8 @@ void i2c_algo_iic_exit(void) ...@@ -942,8 +942,8 @@ void i2c_algo_iic_exit(void)
} }
EXPORT_SYMBOL(i2c_iic_add_bus); EXPORT_SYMBOL(i2c_ocp_add_bus);
EXPORT_SYMBOL(i2c_iic_del_bus); EXPORT_SYMBOL(i2c_ocp_del_bus);
// //
// The MODULE_* macros resolve to nothing if MODULES is not defined // The MODULE_* macros resolve to nothing if MODULES is not defined
......
...@@ -49,7 +49,7 @@ struct i2c_algo_iic_data { ...@@ -49,7 +49,7 @@ struct i2c_algo_iic_data {
#define I2C_IIC_ADAP_MAX 16 #define I2C_IIC_ADAP_MAX 16
int i2c_iic_add_bus(struct i2c_adapter *); int i2c_ocp_add_bus(struct i2c_adapter *);
int i2c_iic_del_bus(struct i2c_adapter *); int i2c_ocp_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_IIC_H */ #endif /* I2C_ALGO_IIC_H */
...@@ -138,9 +138,9 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count, ...@@ -138,9 +138,9 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
#endif /* DEBUG */ #endif /* DEBUG */
if(count > 8192) if (count > 8192)
count = 8192; count = 8192;
/* copy user space data to kernel space. */ /* copy user space data to kernel space. */
tmp = kmalloc(count,GFP_KERNEL); tmp = kmalloc(count,GFP_KERNEL);
if (tmp==NULL) if (tmp==NULL)
......
...@@ -97,10 +97,21 @@ int i2c_create_name(char **name, const char *prefix, ...@@ -97,10 +97,21 @@ int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr) struct i2c_adapter *adapter, int addr)
{ {
char name_buffer[50]; char name_buffer[50];
int id; int id, i, end;
if (i2c_is_isa_adapter(adapter)) if (i2c_is_isa_adapter(adapter))
sprintf(name_buffer, "%s-isa-%04x", prefix, addr); sprintf(name_buffer, "%s-isa-%04x", prefix, addr);
else { else if (!adapter->algo->smbus_xfer && !adapter->algo->master_xfer) {
/* dummy adapter, generate prefix */
sprintf(name_buffer, "%s-", prefix);
end = strlen(name_buffer);
for(i = 0; i < 32; i++) {
if(adapter->algo->name[i] == ' ')
break;
name_buffer[end++] = tolower(adapter->algo->name[i]);
}
name_buffer[end] = 0;
sprintf(name_buffer + end, "-%04x", addr);
} else {
if ((id = i2c_adapter_id(adapter)) < 0) if ((id = i2c_adapter_id(adapter)) < 0)
return -ENOENT; return -ENOENT;
sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr); sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr);
......
...@@ -42,9 +42,10 @@ struct i2c_algo_bit_data { ...@@ -42,9 +42,10 @@ struct i2c_algo_bit_data {
int (*getscl) (void *data); int (*getscl) (void *data);
/* local settings */ /* local settings */
int udelay; int udelay; /* half-clock-cycle time in microsecs */
int mdelay; /* i.e. clock is (500 / udelay) KHz */
int timeout; int mdelay; /* in millisecs, unused */
int timeout; /* in jiffies */
}; };
#define I2C_BIT_ADAP_MAX 16 #define I2C_BIT_ADAP_MAX 16
......
...@@ -145,6 +145,8 @@ ...@@ -145,6 +145,8 @@
#define I2C_DRIVERID_LM92 1033 #define I2C_DRIVERID_LM92 1033
#define I2C_DRIVERID_VT8231 1034 #define I2C_DRIVERID_VT8231 1034
#define I2C_DRIVERID_SMARTBATT 1035 #define I2C_DRIVERID_SMARTBATT 1035
#define I2C_DRIVERID_BMCSENSORS 1036
#define I2C_DRIVERID_FS451 1037
/* /*
* ---- Adapter types ---------------------------------------------------- * ---- Adapter types ----------------------------------------------------
...@@ -164,6 +166,8 @@ ...@@ -164,6 +166,8 @@
#define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */ #define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */
#define I2C_ALGO_SAA7134 0x090000 #define I2C_ALGO_SAA7134 0x090000
#define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */ #define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */
#define I2C_ALGO_IPMI 0x0b0000 /* IPMI dummy adapter */
#define I2C_ALGO_IPMB 0x0c0000 /* IPMB adapter */
#define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */ #define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */
#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */ #define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */
...@@ -196,6 +200,7 @@ ...@@ -196,6 +200,7 @@
#define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */ #define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */
#define I2C_HW_B_PPORT 0x0c /* Primitive parallel port adapter */ #define I2C_HW_B_PPORT 0x0c /* Primitive parallel port adapter */
#define I2C_HW_B_SAVG 0x0d /* Savage 4 */ #define I2C_HW_B_SAVG 0x0d /* Savage 4 */
#define I2C_HW_B_SCX200 0x0e /* Nat'l Semi SCx200 I2C */
#define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */ #define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */
#define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */ #define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */
#define I2C_HW_B_TSUNA 0x12 /* DEC Tsunami chipset */ #define I2C_HW_B_TSUNA 0x12 /* DEC Tsunami chipset */
...@@ -234,8 +239,15 @@ ...@@ -234,8 +239,15 @@
#define I2C_HW_SMBUS_SIS630 0x08 #define I2C_HW_SMBUS_SIS630 0x08
#define I2C_HW_SMBUS_SIS645 0x09 #define I2C_HW_SMBUS_SIS645 0x09
#define I2C_HW_SMBUS_AMD8111 0x0a #define I2C_HW_SMBUS_AMD8111 0x0a
#define I2C_HW_SMBUS_SCX200 0x0b
/* --- ISA pseudo-adapter */ /* --- ISA pseudo-adapter */
#define I2C_HW_ISA 0x00 #define I2C_HW_ISA 0x00
/* --- IPMI pseudo-adapter */
#define I2C_HW_IPMI 0x00
/* --- IPMB adapter */
#define I2C_HW_IPMB 0x00
#endif /* I2C_ID_H */ #endif /* I2C_ID_H */
...@@ -367,6 +367,8 @@ struct i2c_msg { ...@@ -367,6 +367,8 @@ struct i2c_msg {
#define I2C_M_RD 0x01 #define I2C_M_RD 0x01
#define I2C_M_NOSTART 0x4000 #define I2C_M_NOSTART 0x4000
#define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_REV_DIR_ADDR 0x2000
#define I2C_M_IGNORE_NAK 0x1000
#define I2C_M_NO_RD_ACK 0x0800
short len; /* msg length */ short len; /* msg length */
char *buf; /* pointer to msg data */ char *buf; /* pointer to msg data */
}; };
...@@ -375,7 +377,7 @@ struct i2c_msg { ...@@ -375,7 +377,7 @@ struct i2c_msg {
#define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_I2C 0x00000001
#define I2C_FUNC_10BIT_ADDR 0x00000002 #define I2C_FUNC_10BIT_ADDR 0x00000002
#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART} */ #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment