diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-12 21:27:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-12 21:27:47 -0400 |
commit | b981d8b3f5e008ff10d993be633ad00564fc22cd (patch) | |
tree | e292dc07b22308912cf6a58354a608b9e5e8e1fd /drivers/i2c | |
parent | b11d2127c4893a7315d1e16273bc8560049fa3ca (diff) | |
parent | 2b9e0aae1d50e880c58d46788e5e3ebd89d75d62 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/macintosh/adbhid.c
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 52 | ||||
-rw-r--r-- | drivers/i2c/busses/Kconfig | 8 | ||||
-rw-r--r-- | drivers/i2c/busses/Makefile | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-gpio.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-iop3xx.c | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-isa.c | 192 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 11 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mv64xxx.c | 31 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 4 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1682.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/isp1301_omap.c | 42 | ||||
-rw-r--r-- | drivers/i2c/chips/menelaus.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 10 |
17 files changed, 95 insertions, 279 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 8a5f5825bb72..7f0a0a62cf60 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -357,13 +357,29 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
357 | return wrcount; | 357 | return wrcount; |
358 | } | 358 | } |
359 | 359 | ||
360 | static int acknak(struct i2c_adapter *i2c_adap, int is_ack) | ||
361 | { | ||
362 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; | ||
363 | |||
364 | /* assert: sda is high */ | ||
365 | if (is_ack) /* send ack */ | ||
366 | setsda(adap, 0); | ||
367 | udelay((adap->udelay + 1) / 2); | ||
368 | if (sclhi(adap) < 0) { /* timeout */ | ||
369 | dev_err(&i2c_adap->dev, "readbytes: ack/nak timeout\n"); | ||
370 | return -ETIMEDOUT; | ||
371 | } | ||
372 | scllo(adap); | ||
373 | return 0; | ||
374 | } | ||
375 | |||
360 | static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | 376 | static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) |
361 | { | 377 | { |
362 | int inval; | 378 | int inval; |
363 | int rdcount=0; /* counts bytes read */ | 379 | int rdcount=0; /* counts bytes read */ |
364 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; | ||
365 | unsigned char *temp = msg->buf; | 380 | unsigned char *temp = msg->buf; |
366 | int count = msg->len; | 381 | int count = msg->len; |
382 | const unsigned flags = msg->flags; | ||
367 | 383 | ||
368 | while (count > 0) { | 384 | while (count > 0) { |
369 | inval = i2c_inb(i2c_adap); | 385 | inval = i2c_inb(i2c_adap); |
@@ -377,28 +393,12 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
377 | temp++; | 393 | temp++; |
378 | count--; | 394 | count--; |
379 | 395 | ||
380 | if (msg->flags & I2C_M_NO_RD_ACK) { | ||
381 | bit_dbg(2, &i2c_adap->dev, "i2c_inb: 0x%02x\n", | ||
382 | inval); | ||
383 | continue; | ||
384 | } | ||
385 | |||
386 | /* assert: sda is high */ | ||
387 | if (count) /* send ack */ | ||
388 | setsda(adap, 0); | ||
389 | udelay((adap->udelay + 1) / 2); | ||
390 | bit_dbg(2, &i2c_adap->dev, "i2c_inb: 0x%02x %s\n", inval, | ||
391 | count ? "A" : "NA"); | ||
392 | if (sclhi(adap)<0) { /* timeout */ | ||
393 | dev_err(&i2c_adap->dev, "readbytes: timeout at ack\n"); | ||
394 | return -ETIMEDOUT; | ||
395 | }; | ||
396 | scllo(adap); | ||
397 | |||
398 | /* Some SMBus transactions require that we receive the | 396 | /* Some SMBus transactions require that we receive the |
399 | transaction length as the first read byte. */ | 397 | transaction length as the first read byte. */ |
400 | if (rdcount == 1 && (msg->flags & I2C_M_RECV_LEN)) { | 398 | if (rdcount == 1 && (flags & I2C_M_RECV_LEN)) { |
401 | if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { | 399 | if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) { |
400 | if (!(flags & I2C_M_NO_RD_ACK)) | ||
401 | acknak(i2c_adap, 0); | ||
402 | dev_err(&i2c_adap->dev, "readbytes: invalid " | 402 | dev_err(&i2c_adap->dev, "readbytes: invalid " |
403 | "block length (%d)\n", inval); | 403 | "block length (%d)\n", inval); |
404 | return -EREMOTEIO; | 404 | return -EREMOTEIO; |
@@ -409,6 +409,18 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
409 | count += inval; | 409 | count += inval; |
410 | msg->len += inval; | 410 | msg->len += inval; |
411 | } | 411 | } |
412 | |||
413 | bit_dbg(2, &i2c_adap->dev, "readbytes: 0x%02x %s\n", | ||
414 | inval, | ||
415 | (flags & I2C_M_NO_RD_ACK) | ||
416 | ? "(no ack/nak)" | ||
417 | : (count ? "A" : "NA")); | ||
418 | |||
419 | if (!(flags & I2C_M_NO_RD_ACK)) { | ||
420 | inval = acknak(i2c_adap, count); | ||
421 | if (inval < 0) | ||
422 | return inval; | ||
423 | } | ||
412 | } | 424 | } |
413 | return rdcount; | 425 | return rdcount; |
414 | } | 426 | } |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 1c77e14480dc..9f3a4cd0b07f 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -92,9 +92,9 @@ config I2C_AU1550 | |||
92 | 92 | ||
93 | config I2C_BLACKFIN_TWI | 93 | config I2C_BLACKFIN_TWI |
94 | tristate "Blackfin TWI I2C support" | 94 | tristate "Blackfin TWI I2C support" |
95 | depends on BF534 || BF536 || BF537 | 95 | depends on BF534 || BF536 || BF537 || BF54x |
96 | help | 96 | help |
97 | This is the TWI I2C device driver for Blackfin 534/536/537. | 97 | This is the TWI I2C device driver for Blackfin 534/536/537/54x. |
98 | This driver can also be built as a module. If so, the module | 98 | This driver can also be built as a module. If so, the module |
99 | will be called i2c-bfin-twi. | 99 | will be called i2c-bfin-twi. |
100 | 100 | ||
@@ -208,6 +208,7 @@ config I2C_PIIX4 | |||
208 | ATI IXP400 | 208 | ATI IXP400 |
209 | ATI SB600 | 209 | ATI SB600 |
210 | ATI SB700 | 210 | ATI SB700 |
211 | ATI SB800 | ||
211 | Serverworks OSB4 | 212 | Serverworks OSB4 |
212 | Serverworks CSB5 | 213 | Serverworks CSB5 |
213 | Serverworks CSB6 | 214 | Serverworks CSB6 |
@@ -237,9 +238,6 @@ config I2C_IOP3XX | |||
237 | This driver can also be built as a module. If so, the module | 238 | This driver can also be built as a module. If so, the module |
238 | will be called i2c-iop3xx. | 239 | will be called i2c-iop3xx. |
239 | 240 | ||
240 | config I2C_ISA | ||
241 | tristate | ||
242 | |||
243 | config I2C_IXP4XX | 241 | config I2C_IXP4XX |
244 | tristate "IXP4xx GPIO-Based I2C Interface (DEPRECATED)" | 242 | tristate "IXP4xx GPIO-Based I2C Interface (DEPRECATED)" |
245 | depends on ARCH_IXP4XX | 243 | depends on ARCH_IXP4XX |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index a6db4e38bda8..5b752e4e1918 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -18,7 +18,6 @@ obj-$(CONFIG_I2C_I801) += i2c-i801.o | |||
18 | obj-$(CONFIG_I2C_I810) += i2c-i810.o | 18 | obj-$(CONFIG_I2C_I810) += i2c-i810.o |
19 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o | 19 | obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o |
20 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o | 20 | obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o |
21 | obj-$(CONFIG_I2C_ISA) += i2c-isa.o | ||
22 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o | 21 | obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o |
23 | obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o | 22 | obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o |
24 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o | 23 | obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o |
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index 025f19423faf..44e1cd21bb01 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c | |||
@@ -147,7 +147,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev) | |||
147 | * The reason to do so is to avoid sysfs names that only make | 147 | * The reason to do so is to avoid sysfs names that only make |
148 | * sense when there are multiple adapters. | 148 | * sense when there are multiple adapters. |
149 | */ | 149 | */ |
150 | adap->nr = pdev->id >= 0 ? pdev->id : 0; | 150 | adap->nr = (pdev->id != -1) ? pdev->id : 0; |
151 | ret = i2c_bit_add_numbered_bus(adap); | 151 | ret = i2c_bit_add_numbered_bus(adap); |
152 | if (ret) | 152 | if (ret) |
153 | goto err_add_bus; | 153 | goto err_add_bus; |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8f5c686123b8..289816db52ae 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -272,11 +272,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data, | |||
272 | /* Make sure the SMBus host is ready to start transmitting */ | 272 | /* Make sure the SMBus host is ready to start transmitting */ |
273 | temp = inb_p(SMBHSTSTS); | 273 | temp = inb_p(SMBHSTSTS); |
274 | if (i == 1) { | 274 | if (i == 1) { |
275 | /* Erronenous conditions before transaction: | 275 | /* Erroneous conditions before transaction: |
276 | * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ | 276 | * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */ |
277 | errmask = 0x9f; | 277 | errmask = 0x9f; |
278 | } else { | 278 | } else { |
279 | /* Erronenous conditions during transaction: | 279 | /* Erroneous conditions during transaction: |
280 | * Failed, Bus_Err, Dev_Err, Intr */ | 280 | * Failed, Bus_Err, Dev_Err, Intr */ |
281 | errmask = 0x1e; | 281 | errmask = 0x1e; |
282 | } | 282 | } |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index 440342bc62e1..ace644e21b14 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -490,6 +490,7 @@ iop3xx_i2c_probe(struct platform_device *pdev) | |||
490 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); | 490 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); |
491 | new_adapter->id = I2C_HW_IOP3XX; | 491 | new_adapter->id = I2C_HW_IOP3XX; |
492 | new_adapter->owner = THIS_MODULE; | 492 | new_adapter->owner = THIS_MODULE; |
493 | new_adapter->class = I2C_CLASS_HWMON; | ||
493 | new_adapter->dev.parent = &pdev->dev; | 494 | new_adapter->dev.parent = &pdev->dev; |
494 | new_adapter->nr = pdev->id; | 495 | new_adapter->nr = pdev->id; |
495 | 496 | ||
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c deleted file mode 100644 index b0e1370075de..000000000000 --- a/drivers/i2c/busses/i2c-isa.c +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | /* | ||
2 | i2c-isa.c - an i2c-core-like thing for ISA hardware monitoring chips | ||
3 | Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | ||
4 | |||
5 | Based on the i2c-isa pseudo-adapter from the lm_sensors project | ||
6 | Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | /* This implements an i2c-core-like thing for ISA hardware monitoring | ||
24 | chips. Such chips are linked to the i2c subsystem for historical | ||
25 | reasons (because the early ISA hardware monitoring chips such as the | ||
26 | LM78 had both an I2C and an ISA interface). They used to be | ||
27 | registered with the main i2c-core, but as a first step in the | ||
28 | direction of a clean separation between I2C and ISA chip drivers, | ||
29 | we now have this separate core for ISA ones. It is significantly | ||
30 | more simple than the real one, of course, because we don't have to | ||
31 | handle multiple busses: there is only one (fake) ISA adapter. | ||
32 | It is worth noting that we still rely on i2c-core for some things | ||
33 | at the moment - but hopefully this won't last. */ | ||
34 | |||
35 | #include <linux/init.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/errno.h> | ||
39 | #include <linux/i2c.h> | ||
40 | #include <linux/i2c-isa.h> | ||
41 | #include <linux/platform_device.h> | ||
42 | #include <linux/completion.h> | ||
43 | |||
44 | /* Exported by i2c-core for i2c-isa only */ | ||
45 | extern void i2c_adapter_dev_release(struct device *dev); | ||
46 | extern struct class i2c_adapter_class; | ||
47 | |||
48 | static u32 isa_func(struct i2c_adapter *adapter); | ||
49 | |||
50 | /* This is the actual algorithm we define */ | ||
51 | static const struct i2c_algorithm isa_algorithm = { | ||
52 | .functionality = isa_func, | ||
53 | }; | ||
54 | |||
55 | /* There can only be one... */ | ||
56 | static struct i2c_adapter isa_adapter = { | ||
57 | .owner = THIS_MODULE, | ||
58 | .id = I2C_HW_ISA, | ||
59 | .class = I2C_CLASS_HWMON, | ||
60 | .algo = &isa_algorithm, | ||
61 | .name = "ISA main adapter", | ||
62 | }; | ||
63 | |||
64 | /* We can't do a thing... */ | ||
65 | static u32 isa_func(struct i2c_adapter *adapter) | ||
66 | { | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | |||
71 | /* We implement an interface which resembles i2c_{add,del}_driver, | ||
72 | but for i2c-isa drivers. We don't have to remember and handle lists | ||
73 | of drivers and adapters so this is much more simple, of course. */ | ||
74 | |||
75 | int i2c_isa_add_driver(struct i2c_driver *driver) | ||
76 | { | ||
77 | int res; | ||
78 | |||
79 | /* Add the driver to the list of i2c drivers in the driver core */ | ||
80 | driver->driver.bus = &i2c_bus_type; | ||
81 | res = driver_register(&driver->driver); | ||
82 | if (res) | ||
83 | return res; | ||
84 | dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name); | ||
85 | |||
86 | /* Now look for clients */ | ||
87 | res = driver->attach_adapter(&isa_adapter); | ||
88 | if (res) { | ||
89 | dev_dbg(&isa_adapter.dev, | ||
90 | "Driver %s failed to attach adapter, unregistering\n", | ||
91 | driver->driver.name); | ||
92 | driver_unregister(&driver->driver); | ||
93 | } | ||
94 | return res; | ||
95 | } | ||
96 | |||
97 | int i2c_isa_del_driver(struct i2c_driver *driver) | ||
98 | { | ||
99 | struct list_head *item, *_n; | ||
100 | struct i2c_client *client; | ||
101 | int res; | ||
102 | |||
103 | /* Detach all clients belonging to this one driver */ | ||
104 | list_for_each_safe(item, _n, &isa_adapter.clients) { | ||
105 | client = list_entry(item, struct i2c_client, list); | ||
106 | if (client->driver != driver) | ||
107 | continue; | ||
108 | dev_dbg(&isa_adapter.dev, "Detaching client %s at 0x%x\n", | ||
109 | client->name, client->addr); | ||
110 | if ((res = driver->detach_client(client))) { | ||
111 | dev_err(&isa_adapter.dev, "Failed, driver " | ||
112 | "%s not unregistered!\n", | ||
113 | driver->driver.name); | ||
114 | return res; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /* Get the driver off the core list */ | ||
119 | driver_unregister(&driver->driver); | ||
120 | dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->driver.name); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | |||
126 | static int __init i2c_isa_init(void) | ||
127 | { | ||
128 | int err; | ||
129 | |||
130 | mutex_init(&isa_adapter.clist_lock); | ||
131 | INIT_LIST_HEAD(&isa_adapter.clients); | ||
132 | |||
133 | isa_adapter.nr = ANY_I2C_ISA_BUS; | ||
134 | isa_adapter.dev.parent = &platform_bus; | ||
135 | sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr); | ||
136 | isa_adapter.dev.release = &i2c_adapter_dev_release; | ||
137 | isa_adapter.dev.class = &i2c_adapter_class; | ||
138 | err = device_register(&isa_adapter.dev); | ||
139 | if (err) { | ||
140 | printk(KERN_ERR "i2c-isa: Failed to register device\n"); | ||
141 | goto exit; | ||
142 | } | ||
143 | |||
144 | dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name); | ||
145 | |||
146 | return 0; | ||
147 | |||
148 | exit: | ||
149 | return err; | ||
150 | } | ||
151 | |||
152 | static void __exit i2c_isa_exit(void) | ||
153 | { | ||
154 | #ifdef DEBUG | ||
155 | struct list_head *item, *_n; | ||
156 | struct i2c_client *client = NULL; | ||
157 | #endif | ||
158 | |||
159 | /* There should be no more active client */ | ||
160 | #ifdef DEBUG | ||
161 | dev_dbg(&isa_adapter.dev, "Looking for clients\n"); | ||
162 | list_for_each_safe(item, _n, &isa_adapter.clients) { | ||
163 | client = list_entry(item, struct i2c_client, list); | ||
164 | dev_err(&isa_adapter.dev, "Driver %s still has an active " | ||
165 | "ISA client at 0x%x\n", client->driver->driver.name, | ||
166 | client->addr); | ||
167 | } | ||
168 | if (client != NULL) | ||
169 | return; | ||
170 | #endif | ||
171 | |||
172 | /* Clean up the sysfs representation */ | ||
173 | dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n"); | ||
174 | init_completion(&isa_adapter.dev_released); | ||
175 | device_unregister(&isa_adapter.dev); | ||
176 | |||
177 | /* Wait for sysfs to drop all references */ | ||
178 | dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n"); | ||
179 | wait_for_completion(&isa_adapter.dev_released); | ||
180 | |||
181 | dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name); | ||
182 | } | ||
183 | |||
184 | EXPORT_SYMBOL(i2c_isa_add_driver); | ||
185 | EXPORT_SYMBOL(i2c_isa_del_driver); | ||
186 | |||
187 | MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>"); | ||
188 | MODULE_DESCRIPTION("ISA bus access through i2c"); | ||
189 | MODULE_LICENSE("GPL"); | ||
190 | |||
191 | module_init(i2c_isa_init); | ||
192 | module_exit(i2c_isa_exit); | ||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 851c3ed513d0..d8de4ac88b7d 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
105 | schedule(); | 105 | schedule(); |
106 | if (time_after(jiffies, orig_jiffies + timeout)) { | 106 | if (time_after(jiffies, orig_jiffies + timeout)) { |
107 | pr_debug("I2C: timeout\n"); | 107 | pr_debug("I2C: timeout\n"); |
108 | writeccr(i2c, 0); | ||
108 | result = -EIO; | 109 | result = -EIO; |
109 | break; | 110 | break; |
110 | } | 111 | } |
@@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
116 | result = wait_event_interruptible_timeout(i2c->queue, | 117 | result = wait_event_interruptible_timeout(i2c->queue, |
117 | (i2c->interrupt & CSR_MIF), timeout * HZ); | 118 | (i2c->interrupt & CSR_MIF), timeout * HZ); |
118 | 119 | ||
119 | if (unlikely(result < 0)) | 120 | if (unlikely(result < 0)) { |
120 | pr_debug("I2C: wait interrupted\n"); | 121 | pr_debug("I2C: wait interrupted\n"); |
121 | else if (unlikely(!(i2c->interrupt & CSR_MIF))) { | 122 | writeccr(i2c, 0); |
123 | } else if (unlikely(!(i2c->interrupt & CSR_MIF))) { | ||
122 | pr_debug("I2C: wait timeout\n"); | 124 | pr_debug("I2C: wait timeout\n"); |
125 | writeccr(i2c, 0); | ||
123 | result = -ETIMEDOUT; | 126 | result = -ETIMEDOUT; |
124 | } | 127 | } |
125 | 128 | ||
@@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c *i2c) | |||
172 | static void mpc_i2c_stop(struct mpc_i2c *i2c) | 175 | static void mpc_i2c_stop(struct mpc_i2c *i2c) |
173 | { | 176 | { |
174 | writeccr(i2c, CCR_MEN); | 177 | writeccr(i2c, CCR_MEN); |
175 | writeccr(i2c, 0); | ||
176 | } | 178 | } |
177 | 179 | ||
178 | static int mpc_write(struct mpc_i2c *i2c, int target, | 180 | static int mpc_write(struct mpc_i2c *i2c, int target, |
@@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
261 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { | 263 | while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) { |
262 | if (signal_pending(current)) { | 264 | if (signal_pending(current)) { |
263 | pr_debug("I2C: Interrupted\n"); | 265 | pr_debug("I2C: Interrupted\n"); |
266 | writeccr(i2c, 0); | ||
264 | return -EINTR; | 267 | return -EINTR; |
265 | } | 268 | } |
266 | if (time_after(jiffies, orig_jiffies + HZ)) { | 269 | if (time_after(jiffies, orig_jiffies + HZ)) { |
@@ -362,7 +365,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) | |||
362 | 365 | ||
363 | fail_add: | 366 | fail_add: |
364 | if (i2c->irq != 0) | 367 | if (i2c->irq != 0) |
365 | free_irq(i2c->irq, NULL); | 368 | free_irq(i2c->irq, i2c); |
366 | fail_irq: | 369 | fail_irq: |
367 | iounmap(i2c->base); | 370 | iounmap(i2c->base); |
368 | fail_map: | 371 | fail_map: |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 251154ae5d97..bb7bf68a7fb6 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -107,6 +107,21 @@ struct mv64xxx_i2c_data { | |||
107 | * | 107 | * |
108 | ***************************************************************************** | 108 | ***************************************************************************** |
109 | */ | 109 | */ |
110 | |||
111 | /* Reset hardware and initialize FSM */ | ||
112 | static void | ||
113 | mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data) | ||
114 | { | ||
115 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET); | ||
116 | writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)), | ||
117 | drv_data->reg_base + MV64XXX_I2C_REG_BAUD); | ||
118 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR); | ||
119 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR); | ||
120 | writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP, | ||
121 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | ||
122 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
123 | } | ||
124 | |||
110 | static void | 125 | static void |
111 | mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | 126 | mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) |
112 | { | 127 | { |
@@ -203,7 +218,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
203 | drv_data->state, status, drv_data->msg->addr, | 218 | drv_data->state, status, drv_data->msg->addr, |
204 | drv_data->msg->flags); | 219 | drv_data->msg->flags); |
205 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; | 220 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; |
206 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | 221 | mv64xxx_i2c_hw_init(drv_data); |
207 | drv_data->rc = -EIO; | 222 | drv_data->rc = -EIO; |
208 | } | 223 | } |
209 | } | 224 | } |
@@ -367,6 +382,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) | |||
367 | "mv64xxx: I2C bus locked, block: %d, " | 382 | "mv64xxx: I2C bus locked, block: %d, " |
368 | "time_left: %d\n", drv_data->block, | 383 | "time_left: %d\n", drv_data->block, |
369 | (int)time_left); | 384 | (int)time_left); |
385 | mv64xxx_i2c_hw_init(drv_data); | ||
370 | } | 386 | } |
371 | } else | 387 | } else |
372 | spin_unlock_irqrestore(&drv_data->lock, flags); | 388 | spin_unlock_irqrestore(&drv_data->lock, flags); |
@@ -443,19 +459,6 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = { | |||
443 | * | 459 | * |
444 | ***************************************************************************** | 460 | ***************************************************************************** |
445 | */ | 461 | */ |
446 | static void __devinit | ||
447 | mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data) | ||
448 | { | ||
449 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET); | ||
450 | writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)), | ||
451 | drv_data->reg_base + MV64XXX_I2C_REG_BAUD); | ||
452 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR); | ||
453 | writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR); | ||
454 | writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP, | ||
455 | drv_data->reg_base + MV64XXX_I2C_REG_CONTROL); | ||
456 | drv_data->state = MV64XXX_I2C_STATE_IDLE; | ||
457 | } | ||
458 | |||
459 | static int __devinit | 462 | static int __devinit |
460 | mv64xxx_i2c_map_regs(struct platform_device *pd, | 463 | mv64xxx_i2c_map_regs(struct platform_device *pd, |
461 | struct mv64xxx_i2c_data *drv_data) | 464 | struct mv64xxx_i2c_data *drv_data) |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index debc76cd2161..167e4137ee21 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -23,7 +23,7 @@ | |||
23 | Supports: | 23 | Supports: |
24 | Intel PIIX4, 440MX | 24 | Intel PIIX4, 440MX |
25 | Serverworks OSB4, CSB5, CSB6, HT-1000 | 25 | Serverworks OSB4, CSB5, CSB6, HT-1000 |
26 | ATI IXP200, IXP300, IXP400, SB600, SB700 | 26 | ATI IXP200, IXP300, IXP400, SB600, SB700, SB800 |
27 | SMSC Victory66 | 27 | SMSC Victory66 |
28 | 28 | ||
29 | Note: we assume there can only be one device, with one SMBus interface. | 29 | Note: we assume there can only be one device, with one SMBus interface. |
@@ -397,9 +397,7 @@ static struct pci_device_id piix4_ids[] = { | |||
397 | .driver_data = 0 }, | 397 | .driver_data = 0 }, |
398 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), | 398 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), |
399 | .driver_data = 0 }, | 399 | .driver_data = 0 }, |
400 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SMBUS), | 400 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS), |
401 | .driver_data = 0 }, | ||
402 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SMBUS), | ||
403 | .driver_data = 0 }, | 401 | .driver_data = 0 }, |
404 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), | 402 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), |
405 | .driver_data = 0 }, | 403 | .driver_data = 0 }, |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 9d6b790d4321..bb5466b27b59 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -926,7 +926,7 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
926 | * The reason to do so is to avoid sysfs names that only make | 926 | * The reason to do so is to avoid sysfs names that only make |
927 | * sense when there are multiple adapters. | 927 | * sense when there are multiple adapters. |
928 | */ | 928 | */ |
929 | i2c->adap.nr = dev->id >= 0 ? dev->id : 0; | 929 | i2c->adap.nr = dev->id != -1 ? dev->id : 0; |
930 | 930 | ||
931 | ret = i2c_add_numbered_adapter(&i2c->adap); | 931 | ret = i2c_add_numbered_adapter(&i2c->adap); |
932 | if (ret < 0) { | 932 | if (ret < 0) { |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index e4540fcf6476..c44ada5f4292 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -39,8 +39,8 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #include <asm/arch/regs-gpio.h> | 41 | #include <asm/arch/regs-gpio.h> |
42 | #include <asm/arch/regs-iic.h> | 42 | #include <asm/plat-s3c/regs-iic.h> |
43 | #include <asm/arch/iic.h> | 43 | #include <asm/plat-s3c/iic.h> |
44 | 44 | ||
45 | /* i2c controller state */ | 45 | /* i2c controller state */ |
46 | 46 | ||
diff --git a/drivers/i2c/chips/ds1682.c b/drivers/i2c/chips/ds1682.c index 5879f0f25495..9e94542c18a2 100644 --- a/drivers/i2c/chips/ds1682.c +++ b/drivers/i2c/chips/ds1682.c | |||
@@ -75,7 +75,8 @@ static ssize_t ds1682_show(struct device *dev, struct device_attribute *attr, | |||
75 | /* Special case: the 32 bit regs are time values with 1/4s | 75 | /* Special case: the 32 bit regs are time values with 1/4s |
76 | * resolution, scale them up to milliseconds */ | 76 | * resolution, scale them up to milliseconds */ |
77 | if (sattr->nr == 4) | 77 | if (sattr->nr == 4) |
78 | return sprintf(buf, "%llu\n", ((u64) le32_to_cpu(val)) * 250); | 78 | return sprintf(buf, "%llu\n", |
79 | ((unsigned long long)le32_to_cpu(val)) * 250); | ||
79 | 80 | ||
80 | /* Format the output string and return # of bytes */ | 81 | /* Format the output string and return # of bytes */ |
81 | return sprintf(buf, "%li\n", (long)le32_to_cpu(val)); | 82 | return sprintf(buf, "%li\n", (long)le32_to_cpu(val)); |
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 9fafadb92510..fe04e46991aa 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
@@ -18,8 +18,6 @@ | |||
18 | * along with this program; if not, write to the Free Software | 18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 20 | */ |
21 | #undef DEBUG | ||
22 | #undef VERBOSE | ||
23 | 21 | ||
24 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
25 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -44,7 +42,7 @@ | |||
44 | 42 | ||
45 | 43 | ||
46 | #define DRIVER_VERSION "24 August 2004" | 44 | #define DRIVER_VERSION "24 August 2004" |
47 | #define DRIVER_NAME (isp1301_driver.name) | 45 | #define DRIVER_NAME (isp1301_driver.driver.name) |
48 | 46 | ||
49 | MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); | 47 | MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); |
50 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
@@ -55,6 +53,7 @@ struct isp1301 { | |||
55 | void (*i2c_release)(struct device *dev); | 53 | void (*i2c_release)(struct device *dev); |
56 | 54 | ||
57 | int irq; | 55 | int irq; |
56 | int irq_type; | ||
58 | 57 | ||
59 | u32 last_otg_ctrl; | 58 | u32 last_otg_ctrl; |
60 | unsigned working:1; | 59 | unsigned working:1; |
@@ -63,7 +62,7 @@ struct isp1301 { | |||
63 | 62 | ||
64 | /* use keventd context to change the state for us */ | 63 | /* use keventd context to change the state for us */ |
65 | struct work_struct work; | 64 | struct work_struct work; |
66 | 65 | ||
67 | unsigned long todo; | 66 | unsigned long todo; |
68 | # define WORK_UPDATE_ISP 0 /* update ISP from OTG */ | 67 | # define WORK_UPDATE_ISP 0 /* update ISP from OTG */ |
69 | # define WORK_UPDATE_OTG 1 /* update OTG from ISP */ | 68 | # define WORK_UPDATE_OTG 1 /* update OTG from ISP */ |
@@ -94,7 +93,7 @@ struct isp1301 { | |||
94 | 93 | ||
95 | /* board-specific PM hooks */ | 94 | /* board-specific PM hooks */ |
96 | 95 | ||
97 | #include <asm/arch/gpio.h> | 96 | #include <asm/gpio.h> |
98 | #include <asm/arch/mux.h> | 97 | #include <asm/arch/mux.h> |
99 | #include <asm/mach-types.h> | 98 | #include <asm/mach-types.h> |
100 | 99 | ||
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp) | |||
291 | { | 290 | { |
292 | // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); | 291 | // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); |
293 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); | 292 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); |
294 | 293 | ||
295 | /* do this only when cpu is driving transceiver, | 294 | /* do this only when cpu is driving transceiver, |
296 | * so host won't see a low speed device... | 295 | * so host won't see a low speed device... |
297 | */ | 296 | */ |
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
799 | /* role is host */ | 798 | /* role is host */ |
800 | } else { | 799 | } else { |
801 | if (!(otg_ctrl & OTG_ID)) { | 800 | if (!(otg_ctrl & OTG_ID)) { |
802 | otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 801 | otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
803 | OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; | 802 | OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; |
804 | } | 803 | } |
805 | 804 | ||
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp) | |||
1100 | } | 1099 | } |
1101 | 1100 | ||
1102 | static void | 1101 | static void |
1103 | isp1301_work(void *data) | 1102 | isp1301_work(struct work_struct *work) |
1104 | { | 1103 | { |
1105 | struct isp1301 *isp = data; | 1104 | struct isp1301 *isp = container_of(work, struct isp1301, work); |
1106 | int stop; | 1105 | int stop; |
1107 | 1106 | ||
1108 | /* implicit lock: we're the only task using this device */ | 1107 | /* implicit lock: we're the only task using this device */ |
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c) | |||
1244 | * - DEVICE mode, for when there's a B/Mini-B (device) connector | 1243 | * - DEVICE mode, for when there's a B/Mini-B (device) connector |
1245 | * | 1244 | * |
1246 | * As a rule, you won't have an isp1301 chip unless it's there to | 1245 | * As a rule, you won't have an isp1301 chip unless it's there to |
1247 | * support the OTG mode. Other modes help testing USB controllers | 1246 | * support the OTG mode. Other modes help testing USB controllers |
1248 | * in isolation from (full) OTG support, or maybe so later board | 1247 | * in isolation from (full) OTG support, or maybe so later board |
1249 | * revisions can help to support those feature. | 1248 | * revisions can help to support those feature. |
1250 | */ | 1249 | */ |
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp) | |||
1260 | * a few more interrupts than are strictly needed. | 1259 | * a few more interrupts than are strictly needed. |
1261 | */ | 1260 | */ |
1262 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1261 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1263 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); | 1262 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); |
1264 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1263 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1265 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); | 1264 | INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND); |
1266 | 1265 | ||
1267 | dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); | 1266 | dev_info(&isp->client.dev, "ready for dual-role USB ...\n"); |
1268 | 1267 | ||
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
1306 | 1305 | ||
1307 | dev_info(&isp->client.dev, "A-Host sessions ok\n"); | 1306 | dev_info(&isp->client.dev, "A-Host sessions ok\n"); |
1308 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1307 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1309 | INTR_ID_GND); | 1308 | INTR_ID_GND); |
1310 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1309 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1311 | INTR_ID_GND); | 1310 | INTR_ID_GND); |
1312 | 1311 | ||
1313 | /* If this has a Mini-AB connector, this mode is highly | 1312 | /* If this has a Mini-AB connector, this mode is highly |
1314 | * nonstandard ... but can be handy for testing, especially with | 1313 | * nonstandard ... but can be handy for testing, especially with |
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1368 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); | 1367 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); |
1369 | 1368 | ||
1370 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1369 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
1371 | INTR_SESS_VLD); | 1370 | INTR_SESS_VLD); |
1372 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, | 1371 | isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING, |
1373 | INTR_VBUS_VLD); | 1372 | INTR_VBUS_VLD); |
1374 | dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); | 1373 | dev_info(&isp->client.dev, "B-Peripheral sessions ok\n"); |
1375 | dump_regs(isp, __FUNCTION__); | 1374 | dump_regs(isp, __FUNCTION__); |
1376 | 1375 | ||
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind) | |||
1494 | if (!isp) | 1493 | if (!isp) |
1495 | return 0; | 1494 | return 0; |
1496 | 1495 | ||
1497 | INIT_WORK(&isp->work, isp1301_work, isp); | 1496 | INIT_WORK(&isp->work, isp1301_work); |
1498 | init_timer(&isp->timer); | 1497 | init_timer(&isp->timer); |
1499 | isp->timer.function = isp1301_timer; | 1498 | isp->timer.function = isp1301_timer; |
1500 | isp->timer.data = (unsigned long) isp; | 1499 | isp->timer.data = (unsigned long) isp; |
@@ -1572,13 +1571,14 @@ fail1: | |||
1572 | /* IRQ wired at M14 */ | 1571 | /* IRQ wired at M14 */ |
1573 | omap_cfg_reg(M14_1510_GPIO2); | 1572 | omap_cfg_reg(M14_1510_GPIO2); |
1574 | isp->irq = OMAP_GPIO_IRQ(2); | 1573 | isp->irq = OMAP_GPIO_IRQ(2); |
1575 | omap_request_gpio(2); | 1574 | if (gpio_request(2, "isp1301") == 0) |
1576 | omap_set_gpio_direction(2, 1); | 1575 | gpio_direction_input(2); |
1577 | omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE); | 1576 | isp->irq_type = IRQF_TRIGGER_FALLING; |
1578 | } | 1577 | } |
1579 | 1578 | ||
1579 | isp->irq_type |= IRQF_SAMPLE_RANDOM; | ||
1580 | status = request_irq(isp->irq, isp1301_irq, | 1580 | status = request_irq(isp->irq, isp1301_irq, |
1581 | IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); | 1581 | isp->irq_type, DRIVER_NAME, isp); |
1582 | if (status < 0) { | 1582 | if (status < 0) { |
1583 | dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", | 1583 | dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", |
1584 | isp->irq, status); | 1584 | isp->irq, status); |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 48a7e2f0bdd3..d9c92c5e0077 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define DEBUG | ||
2 | /* | 1 | /* |
3 | * Copyright (C) 2004 Texas Instruments, Inc. | 2 | * Copyright (C) 2004 Texas Instruments, Inc. |
4 | * | 3 | * |
@@ -933,7 +932,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t) | |||
933 | return status; | 932 | return status; |
934 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); | 933 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); |
935 | if (status < 0) { | 934 | if (status < 0) { |
936 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x", | 935 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " |
937 | "err %d\n", MENELAUS_RTC_WKDAY, status); | 936 | "err %d\n", MENELAUS_RTC_WKDAY, status); |
938 | return status; | 937 | return status; |
939 | } | 938 | } |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 3c3f2ebf3fc9..503ffec2ce07 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tps65010 *tps) | |||
352 | /* REVISIT: this might need its own workqueue | 352 | /* REVISIT: this might need its own workqueue |
353 | * plus tweaks including deadlock avoidance ... | 353 | * plus tweaks including deadlock avoidance ... |
354 | * also needs to get error handling and probably | 354 | * also needs to get error handling and probably |
355 | * an #ifdef CONFIG_SOFTWARE_SUSPEND | 355 | * an #ifdef CONFIG_HIBERNATION |
356 | */ | 356 | */ |
357 | hibernate(); | 357 | hibernate(); |
358 | #endif | 358 | #endif |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6971a62397db..910a62de190d 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -67,20 +67,16 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) | |||
67 | #ifdef CONFIG_HOTPLUG | 67 | #ifdef CONFIG_HOTPLUG |
68 | 68 | ||
69 | /* uevent helps with hotplug: modprobe -q $(MODALIAS) */ | 69 | /* uevent helps with hotplug: modprobe -q $(MODALIAS) */ |
70 | static int i2c_device_uevent(struct device *dev, char **envp, int num_envp, | 70 | static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) |
71 | char *buffer, int buffer_size) | ||
72 | { | 71 | { |
73 | struct i2c_client *client = to_i2c_client(dev); | 72 | struct i2c_client *client = to_i2c_client(dev); |
74 | int i = 0, length = 0; | ||
75 | 73 | ||
76 | /* by definition, legacy drivers can't hotplug */ | 74 | /* by definition, legacy drivers can't hotplug */ |
77 | if (dev->driver || !client->driver_name) | 75 | if (dev->driver || !client->driver_name) |
78 | return 0; | 76 | return 0; |
79 | 77 | ||
80 | if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | 78 | if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) |
81 | "MODALIAS=%s", client->driver_name)) | ||
82 | return -ENOMEM; | 79 | return -ENOMEM; |
83 | envp[i] = NULL; | ||
84 | dev_dbg(dev, "uevent\n"); | 80 | dev_dbg(dev, "uevent\n"); |
85 | return 0; | 81 | return 0; |
86 | } | 82 | } |
@@ -288,7 +284,6 @@ void i2c_adapter_dev_release(struct device *dev) | |||
288 | struct i2c_adapter *adap = to_i2c_adapter(dev); | 284 | struct i2c_adapter *adap = to_i2c_adapter(dev); |
289 | complete(&adap->dev_released); | 285 | complete(&adap->dev_released); |
290 | } | 286 | } |
291 | EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); /* exported to i2c-isa */ | ||
292 | 287 | ||
293 | static ssize_t | 288 | static ssize_t |
294 | show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) | 289 | show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -307,7 +302,6 @@ struct class i2c_adapter_class = { | |||
307 | .name = "i2c-adapter", | 302 | .name = "i2c-adapter", |
308 | .dev_attrs = i2c_adapter_attrs, | 303 | .dev_attrs = i2c_adapter_attrs, |
309 | }; | 304 | }; |
310 | EXPORT_SYMBOL_GPL(i2c_adapter_class); /* exported to i2c-isa */ | ||
311 | 305 | ||
312 | static void i2c_scan_static_board_info(struct i2c_adapter *adapter) | 306 | static void i2c_scan_static_board_info(struct i2c_adapter *adapter) |
313 | { | 307 | { |