rename patch (v2.6.22.24-op1)
[linux-2.6.22.y-op-patches.git] / backport / i2c-i801-smb / 04-i2c-i801-pec.patch
blob9d17d804144cd97fb2beee3620e5fe8636988f7c
1 From 6662cbb989ee71712176570759bdc4e596aed417 Mon Sep 17 00:00:00 2001
2 From: David Brownell <david-b@pacbell.net>
3 Date: Sat, 13 Oct 2007 23:56:33 +0200
4 Subject: [PATCH] i2c: Rename the PEC functionality bit
6 Rename I2C_FUNC_SMBUS_HWPEC_CALC as I2C_FUNC_SMBUS_PEC, and list that
7 functionality as always available through the software implementation.
8 Update documentation accordingly (and list similar requirements).
10 The way it's currently packaged doesn't present the capability in a
11 useful way.
13 Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
17 index b849ad6..9dd7912 100644
18 --- a/Documentation/i2c/dev-interface
19 +++ b/Documentation/i2c/dev-interface
20 @@ -90,12 +90,15 @@ ioctl(file,I2C_SLAVE,long addr)
22 ioctl(file,I2C_TENBIT,long select)
23 Selects ten bit addresses if select not equals 0, selects normal 7 bit
24 - addresses if select equals 0. Default 0.
25 + addresses if select equals 0. Default 0. This request is only valid
26 + if the adapter has I2C_FUNC_10BIT_ADDR.
28 ioctl(file,I2C_PEC,long select)
29 Selects SMBus PEC (packet error checking) generation and verification
30 if select not equals 0, disables if select equals 0. Default 0.
31 - Used only for SMBus transactions.
32 + Used only for SMBus transactions. This request only has an effect if the
33 + the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just
34 + doesn't have any effect.
36 ioctl(file,I2C_FUNCS,unsigned long *funcs)
37 Gets the adapter functionality and puts it in *funcs.
38 @@ -103,8 +106,10 @@ ioctl(file,I2C_FUNCS,unsigned long *funcs)
39 ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset)
41 Do combined read/write transaction without stop in between.
42 - The argument is a pointer to a struct i2c_rdwr_ioctl_data {
43 + Only valid if the adapter has I2C_FUNC_I2C. The argument is
44 + a pointer to a
46 + struct i2c_rdwr_ioctl_data {
47 struct i2c_msg *msgs; /* ptr to array of simple messages */
48 int nmsgs; /* number of messages to exchange */
50 diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
51 index c9fca7b..5d1a27e 100644
52 --- a/drivers/i2c/busses/i2c-amd8111.c
53 +++ b/drivers/i2c/busses/i2c-amd8111.c
54 @@ -326,7 +326,7 @@ static u32 amd8111_func(struct i2c_adapter *adapter)
55 I2C_FUNC_SMBUS_BYTE_DATA |
56 I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA |
57 I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
58 - I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC;
59 + I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_PEC;
62 static const struct i2c_algorithm smbus_algorithm = {
63 diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
64 index f78a808..ac27e5f 100644
65 --- a/drivers/i2c/busses/i2c-i801.c
66 +++ b/drivers/i2c/busses/i2c-i801.c
67 @@ -516,7 +516,7 @@ static u32 i801_func(struct i2c_adapter *adapter)
68 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
69 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
70 I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
71 - | (isich4 ? I2C_FUNC_SMBUS_HWPEC_CALC : 0);
72 + | (isich4 ? I2C_FUNC_SMBUS_PEC : 0);
75 static const struct i2c_algorithm smbus_algorithm = {
76 diff --git a/include/linux/i2c.h b/include/linux/i2c.h
77 index e43d99d..8033e6b 100644
78 --- a/include/linux/i2c.h
79 +++ b/include/linux/i2c.h
80 @@ -491,7 +491,7 @@ struct i2c_msg {
81 #define I2C_FUNC_I2C 0x00000001
82 #define I2C_FUNC_10BIT_ADDR 0x00000002
83 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
84 -#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
85 +#define I2C_FUNC_SMBUS_PEC 0x00000008
86 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
87 #define I2C_FUNC_SMBUS_QUICK 0x00010000
88 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
89 @@ -527,7 +527,8 @@ struct i2c_msg {
90 I2C_FUNC_SMBUS_WORD_DATA | \
91 I2C_FUNC_SMBUS_PROC_CALL | \
92 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
93 - I2C_FUNC_SMBUS_I2C_BLOCK)
94 + I2C_FUNC_SMBUS_I2C_BLOCK | \
95 + I2C_FUNC_SMBUS_PEC)
98 * Data for SMBus Messages