diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-14 14:13:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-14 14:13:04 -0400 |
commit | bced86359918326a65258b1be245834e5c493c88 (patch) | |
tree | 72566bf1beefd3e1cc267e2dd5cc3188ab87b836 | |
parent | ceb804cd0f63b0e0a87b81913b66add6de03043d (diff) | |
parent | 0a9c14751377a1407f5e35791e13651d2fc7801c (diff) |
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
i2c-algo-bit: Add pre- and post-xfer hooks
at24: Init dynamic bin_attribute structures
i2c: Drop configure option I2C_DEBUG_CHIP
tsl2550: Move from i2c/chips to misc
i2c-i801: Don't use the block buffer for I2C block writes
i2c-powermac: Be less verbose in the absence of real errors.
i2c-smbus: Use device_lock/device_unlock
-rw-r--r-- | drivers/i2c/Kconfig | 9 | ||||
-rw-r--r-- | drivers/i2c/Makefile | 2 | ||||
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 9 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-powermac.c | 25 | ||||
-rw-r--r-- | drivers/i2c/chips/Kconfig | 19 | ||||
-rw-r--r-- | drivers/i2c/chips/Makefile | 18 | ||||
-rw-r--r-- | drivers/i2c/i2c-smbus.c | 5 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 10 | ||||
-rw-r--r-- | drivers/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/misc/eeprom/at24.c | 1 | ||||
-rw-r--r-- | drivers/misc/tsl2550.c (renamed from drivers/i2c/chips/tsl2550.c) | 4 | ||||
-rw-r--r-- | include/linux/i2c-algo-bit.h | 2 |
13 files changed, 50 insertions, 61 deletions
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 02ce9cff5fcf..d06083fdffbb 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -73,7 +73,6 @@ config I2C_SMBUS | |||
73 | 73 | ||
74 | source drivers/i2c/algos/Kconfig | 74 | source drivers/i2c/algos/Kconfig |
75 | source drivers/i2c/busses/Kconfig | 75 | source drivers/i2c/busses/Kconfig |
76 | source drivers/i2c/chips/Kconfig | ||
77 | 76 | ||
78 | config I2C_DEBUG_CORE | 77 | config I2C_DEBUG_CORE |
79 | bool "I2C Core debugging messages" | 78 | bool "I2C Core debugging messages" |
@@ -98,12 +97,4 @@ config I2C_DEBUG_BUS | |||
98 | a problem with I2C support and want to see more of what is going | 97 | a problem with I2C support and want to see more of what is going |
99 | on. | 98 | on. |
100 | 99 | ||
101 | config I2C_DEBUG_CHIP | ||
102 | bool "I2C Chip debugging messages" | ||
103 | help | ||
104 | Say Y here if you want the I2C chip drivers to produce a bunch of | ||
105 | debug messages to the system log. Select this if you are having | ||
106 | a problem with I2C support and want to see more of what is going | ||
107 | on. | ||
108 | |||
109 | endif # I2C | 100 | endif # I2C |
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index acd0250c16a0..a7d9b4be9bb3 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -6,7 +6,7 @@ obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | |||
6 | obj-$(CONFIG_I2C) += i2c-core.o | 6 | obj-$(CONFIG_I2C) += i2c-core.o |
7 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | 7 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o |
8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
9 | obj-y += busses/ chips/ algos/ | 9 | obj-y += algos/ busses/ |
10 | 10 | ||
11 | ifeq ($(CONFIG_I2C_DEBUG_CORE),y) | 11 | ifeq ($(CONFIG_I2C_DEBUG_CORE),y) |
12 | EXTRA_CFLAGS += -DDEBUG | 12 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index e25e13980af3..e8d568c3fb09 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -522,6 +522,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
522 | int i, ret; | 522 | int i, ret; |
523 | unsigned short nak_ok; | 523 | unsigned short nak_ok; |
524 | 524 | ||
525 | if (adap->pre_xfer) { | ||
526 | ret = adap->pre_xfer(i2c_adap); | ||
527 | if (ret < 0) | ||
528 | return ret; | ||
529 | } | ||
530 | |||
525 | bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); | 531 | bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); |
526 | i2c_start(adap); | 532 | i2c_start(adap); |
527 | for (i = 0; i < num; i++) { | 533 | for (i = 0; i < num; i++) { |
@@ -570,6 +576,9 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, | |||
570 | bailout: | 576 | bailout: |
571 | bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); | 577 | bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); |
572 | i2c_stop(adap); | 578 | i2c_stop(adap); |
579 | |||
580 | if (adap->post_xfer) | ||
581 | adap->post_xfer(i2c_adap); | ||
573 | return ret; | 582 | return ret; |
574 | } | 583 | } |
575 | 584 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 9da5b05cdb52..299b918455a3 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -416,9 +416,11 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
416 | data->block[0] = 32; /* max for SMBus block reads */ | 416 | data->block[0] = 32; /* max for SMBus block reads */ |
417 | } | 417 | } |
418 | 418 | ||
419 | /* Experience has shown that the block buffer can only be used for | ||
420 | SMBus (not I2C) block transactions, even though the datasheet | ||
421 | doesn't mention this limitation. */ | ||
419 | if ((i801_features & FEATURE_BLOCK_BUFFER) | 422 | if ((i801_features & FEATURE_BLOCK_BUFFER) |
420 | && !(command == I2C_SMBUS_I2C_BLOCK_DATA | 423 | && command != I2C_SMBUS_I2C_BLOCK_DATA |
421 | && read_write == I2C_SMBUS_READ) | ||
422 | && i801_set_block_buffer_mode() == 0) | 424 | && i801_set_block_buffer_mode() == 0) |
423 | result = i801_block_transaction_by_block(data, read_write, | 425 | result = i801_block_transaction_by_block(data, read_write, |
424 | hwpec); | 426 | hwpec); |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 1c440a70ec61..b289ec99eeba 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -122,9 +122,14 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap, | |||
122 | 122 | ||
123 | rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); | 123 | rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); |
124 | if (rc) { | 124 | if (rc) { |
125 | dev_err(&adap->dev, | 125 | if (rc == -ENXIO) |
126 | "I2C transfer at 0x%02x failed, size %d, err %d\n", | 126 | dev_dbg(&adap->dev, |
127 | addrdir >> 1, size, rc); | 127 | "I2C transfer at 0x%02x failed, size %d, " |
128 | "err %d\n", addrdir >> 1, size, rc); | ||
129 | else | ||
130 | dev_err(&adap->dev, | ||
131 | "I2C transfer at 0x%02x failed, size %d, " | ||
132 | "err %d\n", addrdir >> 1, size, rc); | ||
128 | goto bail; | 133 | goto bail; |
129 | } | 134 | } |
130 | 135 | ||
@@ -175,10 +180,16 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, | |||
175 | goto bail; | 180 | goto bail; |
176 | } | 181 | } |
177 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); | 182 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); |
178 | if (rc < 0) | 183 | if (rc < 0) { |
179 | dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", | 184 | if (rc == -ENXIO) |
180 | addrdir & 1 ? "read from" : "write to", addrdir >> 1, | 185 | dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n", |
181 | rc); | 186 | addrdir & 1 ? "read from" : "write to", |
187 | addrdir >> 1, rc); | ||
188 | else | ||
189 | dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", | ||
190 | addrdir & 1 ? "read from" : "write to", | ||
191 | addrdir >> 1, rc); | ||
192 | } | ||
182 | bail: | 193 | bail: |
183 | pmac_i2c_close(bus); | 194 | pmac_i2c_close(bus); |
184 | return rc < 0 ? rc : 1; | 195 | return rc < 0 ? rc : 1; |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig deleted file mode 100644 index ae4539d99bef..000000000000 --- a/drivers/i2c/chips/Kconfig +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # | ||
2 | # Miscellaneous I2C chip drivers configuration | ||
3 | # | ||
4 | # *** DEPRECATED! Do not add new entries! See Makefile *** | ||
5 | # | ||
6 | |||
7 | menu "Miscellaneous I2C Chip support" | ||
8 | |||
9 | config SENSORS_TSL2550 | ||
10 | tristate "Taos TSL2550 ambient light sensor" | ||
11 | depends on EXPERIMENTAL | ||
12 | help | ||
13 | If you say yes here you get support for the Taos TSL2550 | ||
14 | ambient light sensor. | ||
15 | |||
16 | This driver can also be built as a module. If so, the module | ||
17 | will be called tsl2550. | ||
18 | |||
19 | endmenu | ||
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile deleted file mode 100644 index fe0af0f81f2d..000000000000 --- a/drivers/i2c/chips/Makefile +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for miscellaneous I2C chip drivers. | ||
3 | # | ||
4 | # Do not add new drivers to this directory! It is DEPRECATED. | ||
5 | # | ||
6 | # Device drivers are better grouped according to the functionality they | ||
7 | # implement rather than to the bus they are connected to. In particular: | ||
8 | # * Hardware monitoring chip drivers go to drivers/hwmon | ||
9 | # * RTC chip drivers go to drivers/rtc | ||
10 | # * I/O expander drivers go to drivers/gpio | ||
11 | # | ||
12 | |||
13 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o | ||
14 | |||
15 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) | ||
16 | EXTRA_CFLAGS += -DDEBUG | ||
17 | endif | ||
18 | |||
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c index 421278221243..7a8201ed2181 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/semaphore.h> | ||
26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
27 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
28 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
@@ -55,7 +54,7 @@ static int smbus_do_alert(struct device *dev, void *addrp) | |||
55 | * Drivers should either disable alerts, or provide at least | 54 | * Drivers should either disable alerts, or provide at least |
56 | * a minimal handler. Lock so client->driver won't change. | 55 | * a minimal handler. Lock so client->driver won't change. |
57 | */ | 56 | */ |
58 | down(&dev->sem); | 57 | device_lock(dev); |
59 | if (client->driver) { | 58 | if (client->driver) { |
60 | if (client->driver->alert) | 59 | if (client->driver->alert) |
61 | client->driver->alert(client, data->flag); | 60 | client->driver->alert(client, data->flag); |
@@ -63,7 +62,7 @@ static int smbus_do_alert(struct device *dev, void *addrp) | |||
63 | dev_warn(&client->dev, "no driver alert()!\n"); | 62 | dev_warn(&client->dev, "no driver alert()!\n"); |
64 | } else | 63 | } else |
65 | dev_dbg(&client->dev, "alert with no driver\n"); | 64 | dev_dbg(&client->dev, "alert with no driver\n"); |
66 | up(&dev->sem); | 65 | device_unlock(dev); |
67 | 66 | ||
68 | /* Stop iterating after we find the device */ | 67 | /* Stop iterating after we find the device */ |
69 | return -EBUSY; | 68 | return -EBUSY; |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index d16af6a423fb..2191c8d896a0 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -268,6 +268,16 @@ config ISL29003 | |||
268 | This driver can also be built as a module. If so, the module | 268 | This driver can also be built as a module. If so, the module |
269 | will be called isl29003. | 269 | will be called isl29003. |
270 | 270 | ||
271 | config SENSORS_TSL2550 | ||
272 | tristate "Taos TSL2550 ambient light sensor" | ||
273 | depends on I2C && SYSFS | ||
274 | help | ||
275 | If you say yes here you get support for the Taos TSL2550 | ||
276 | ambient light sensor. | ||
277 | |||
278 | This driver can also be built as a module. If so, the module | ||
279 | will be called tsl2550. | ||
280 | |||
271 | config EP93XX_PWM | 281 | config EP93XX_PWM |
272 | tristate "EP93xx PWM support" | 282 | tristate "EP93xx PWM support" |
273 | depends on ARCH_EP93XX | 283 | depends on ARCH_EP93XX |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 049ff2482f30..27c484355414 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
@@ -21,6 +21,7 @@ obj-$(CONFIG_SGI_GRU) += sgi-gru/ | |||
21 | obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o | 21 | obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o |
22 | obj-$(CONFIG_HP_ILO) += hpilo.o | 22 | obj-$(CONFIG_HP_ILO) += hpilo.o |
23 | obj-$(CONFIG_ISL29003) += isl29003.o | 23 | obj-$(CONFIG_ISL29003) += isl29003.o |
24 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o | ||
24 | obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o | 25 | obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o |
25 | obj-$(CONFIG_DS1682) += ds1682.o | 26 | obj-$(CONFIG_DS1682) += ds1682.o |
26 | obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o | 27 | obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 2cb2736d65aa..db7d0f21b65d 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
@@ -505,6 +505,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
505 | * Export the EEPROM bytes through sysfs, since that's convenient. | 505 | * Export the EEPROM bytes through sysfs, since that's convenient. |
506 | * By default, only root should see the data (maybe passwords etc) | 506 | * By default, only root should see the data (maybe passwords etc) |
507 | */ | 507 | */ |
508 | sysfs_bin_attr_init(&at24->bin); | ||
508 | at24->bin.attr.name = "eeprom"; | 509 | at24->bin.attr.name = "eeprom"; |
509 | at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; | 510 | at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; |
510 | at24->bin.read = at24_bin_read; | 511 | at24->bin.read = at24_bin_read; |
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/misc/tsl2550.c index a0702f36a72f..483ae5f7f68e 100644 --- a/drivers/i2c/chips/tsl2550.c +++ b/drivers/misc/tsl2550.c | |||
@@ -47,8 +47,8 @@ struct tsl2550_data { | |||
47 | struct i2c_client *client; | 47 | struct i2c_client *client; |
48 | struct mutex update_lock; | 48 | struct mutex update_lock; |
49 | 49 | ||
50 | unsigned int power_state : 1; | 50 | unsigned int power_state:1; |
51 | unsigned int operating_mode : 1; | 51 | unsigned int operating_mode:1; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /* | 54 | /* |
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index 111334f5b922..4f98148c11c3 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
@@ -36,6 +36,8 @@ struct i2c_algo_bit_data { | |||
36 | void (*setscl) (void *data, int state); | 36 | void (*setscl) (void *data, int state); |
37 | int (*getsda) (void *data); | 37 | int (*getsda) (void *data); |
38 | int (*getscl) (void *data); | 38 | int (*getscl) (void *data); |
39 | int (*pre_xfer) (struct i2c_adapter *); | ||
40 | void (*post_xfer) (struct i2c_adapter *); | ||
39 | 41 | ||
40 | /* local settings */ | 42 | /* local settings */ |
41 | int udelay; /* half clock cycle time in us, | 43 | int udelay; /* half clock cycle time in us, |