diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/i2c/algos | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/i2c/algos')
-rw-r--r-- | drivers/i2c/algos/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/algos/Makefile | 4 | ||||
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 51 | ||||
-rw-r--r-- | drivers/i2c/algos/i2c-algo-pca.c | 2 |
4 files changed, 36 insertions, 23 deletions
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig index 7b2ce4a08524..f1cfe7e5508b 100644 --- a/drivers/i2c/algos/Kconfig +++ b/drivers/i2c/algos/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menu "I2C Algorithms" | 5 | menu "I2C Algorithms" |
6 | depends on !I2C_HELPER_AUTO | 6 | visible if !I2C_HELPER_AUTO |
7 | 7 | ||
8 | config I2C_ALGOBIT | 8 | config I2C_ALGOBIT |
9 | tristate "I2C bit-banging interfaces" | 9 | tristate "I2C bit-banging interfaces" |
diff --git a/drivers/i2c/algos/Makefile b/drivers/i2c/algos/Makefile index 18b3e962ec09..215303f60d61 100644 --- a/drivers/i2c/algos/Makefile +++ b/drivers/i2c/algos/Makefile | |||
@@ -6,6 +6,4 @@ obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o | |||
6 | obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o | 6 | obj-$(CONFIG_I2C_ALGOPCF) += i2c-algo-pcf.o |
7 | obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o | 7 | obj-$(CONFIG_I2C_ALGOPCA) += i2c-algo-pca.o |
8 | 8 | ||
9 | ifeq ($(CONFIG_I2C_DEBUG_ALGO),y) | 9 | ccflags-$(CONFIG_I2C_DEBUG_ALGO) := -DDEBUG |
10 | EXTRA_CFLAGS += -DDEBUG | ||
11 | endif | ||
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index a39e6cff86e7..d6d58684712b 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -232,9 +232,17 @@ static int i2c_inb(struct i2c_adapter *i2c_adap) | |||
232 | * Sanity check for the adapter hardware - check the reaction of | 232 | * Sanity check for the adapter hardware - check the reaction of |
233 | * the bus lines only if it seems to be idle. | 233 | * the bus lines only if it seems to be idle. |
234 | */ | 234 | */ |
235 | static int test_bus(struct i2c_algo_bit_data *adap, char *name) | 235 | static int test_bus(struct i2c_adapter *i2c_adap) |
236 | { | 236 | { |
237 | int scl, sda; | 237 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; |
238 | const char *name = i2c_adap->name; | ||
239 | int scl, sda, ret; | ||
240 | |||
241 | if (adap->pre_xfer) { | ||
242 | ret = adap->pre_xfer(i2c_adap); | ||
243 | if (ret < 0) | ||
244 | return -ENODEV; | ||
245 | } | ||
238 | 246 | ||
239 | if (adap->getscl == NULL) | 247 | if (adap->getscl == NULL) |
240 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); | 248 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); |
@@ -297,11 +305,19 @@ static int test_bus(struct i2c_algo_bit_data *adap, char *name) | |||
297 | "while pulling SCL high!\n", name); | 305 | "while pulling SCL high!\n", name); |
298 | goto bailout; | 306 | goto bailout; |
299 | } | 307 | } |
308 | |||
309 | if (adap->post_xfer) | ||
310 | adap->post_xfer(i2c_adap); | ||
311 | |||
300 | pr_info("%s: Test OK\n", name); | 312 | pr_info("%s: Test OK\n", name); |
301 | return 0; | 313 | return 0; |
302 | bailout: | 314 | bailout: |
303 | sdahi(adap); | 315 | sdahi(adap); |
304 | sclhi(adap); | 316 | sclhi(adap); |
317 | |||
318 | if (adap->post_xfer) | ||
319 | adap->post_xfer(i2c_adap); | ||
320 | |||
305 | return -ENODEV; | 321 | return -ENODEV; |
306 | } | 322 | } |
307 | 323 | ||
@@ -600,12 +616,14 @@ static const struct i2c_algorithm i2c_bit_algo = { | |||
600 | /* | 616 | /* |
601 | * registering functions to load algorithms at runtime | 617 | * registering functions to load algorithms at runtime |
602 | */ | 618 | */ |
603 | static int i2c_bit_prepare_bus(struct i2c_adapter *adap) | 619 | static int __i2c_bit_add_bus(struct i2c_adapter *adap, |
620 | int (*add_adapter)(struct i2c_adapter *)) | ||
604 | { | 621 | { |
605 | struct i2c_algo_bit_data *bit_adap = adap->algo_data; | 622 | struct i2c_algo_bit_data *bit_adap = adap->algo_data; |
623 | int ret; | ||
606 | 624 | ||
607 | if (bit_test) { | 625 | if (bit_test) { |
608 | int ret = test_bus(bit_adap, adap->name); | 626 | ret = test_bus(adap); |
609 | if (ret < 0) | 627 | if (ret < 0) |
610 | return -ENODEV; | 628 | return -ENODEV; |
611 | } | 629 | } |
@@ -614,30 +632,27 @@ static int i2c_bit_prepare_bus(struct i2c_adapter *adap) | |||
614 | adap->algo = &i2c_bit_algo; | 632 | adap->algo = &i2c_bit_algo; |
615 | adap->retries = 3; | 633 | adap->retries = 3; |
616 | 634 | ||
635 | ret = add_adapter(adap); | ||
636 | if (ret < 0) | ||
637 | return ret; | ||
638 | |||
639 | /* Complain if SCL can't be read */ | ||
640 | if (bit_adap->getscl == NULL) { | ||
641 | dev_warn(&adap->dev, "Not I2C compliant: can't read SCL\n"); | ||
642 | dev_warn(&adap->dev, "Bus may be unreliable\n"); | ||
643 | } | ||
617 | return 0; | 644 | return 0; |
618 | } | 645 | } |
619 | 646 | ||
620 | int i2c_bit_add_bus(struct i2c_adapter *adap) | 647 | int i2c_bit_add_bus(struct i2c_adapter *adap) |
621 | { | 648 | { |
622 | int err; | 649 | return __i2c_bit_add_bus(adap, i2c_add_adapter); |
623 | |||
624 | err = i2c_bit_prepare_bus(adap); | ||
625 | if (err) | ||
626 | return err; | ||
627 | |||
628 | return i2c_add_adapter(adap); | ||
629 | } | 650 | } |
630 | EXPORT_SYMBOL(i2c_bit_add_bus); | 651 | EXPORT_SYMBOL(i2c_bit_add_bus); |
631 | 652 | ||
632 | int i2c_bit_add_numbered_bus(struct i2c_adapter *adap) | 653 | int i2c_bit_add_numbered_bus(struct i2c_adapter *adap) |
633 | { | 654 | { |
634 | int err; | 655 | return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter); |
635 | |||
636 | err = i2c_bit_prepare_bus(adap); | ||
637 | if (err) | ||
638 | return err; | ||
639 | |||
640 | return i2c_add_numbered_adapter(adap); | ||
641 | } | 656 | } |
642 | EXPORT_SYMBOL(i2c_bit_add_numbered_bus); | 657 | EXPORT_SYMBOL(i2c_bit_add_numbered_bus); |
643 | 658 | ||
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 2b9a8f54bb2c..4ca9cf9cde73 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -343,7 +343,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, | |||
343 | 343 | ||
344 | ret = curmsg; | 344 | ret = curmsg; |
345 | out: | 345 | out: |
346 | DEB1("}}} transfered %d/%d messages. " | 346 | DEB1("}}} transferred %d/%d messages. " |
347 | "status is %#04x. control is %#04x\n", | 347 | "status is %#04x. control is %#04x\n", |
348 | curmsg, num, pca_status(adap), | 348 | curmsg, num, pca_status(adap), |
349 | pca_get_con(adap)); | 349 | pca_get_con(adap)); |