diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 11:12:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-08 11:12:16 -0500 |
commit | 41440ffe21f29bdb985cab76b2d0b06d83e63b19 (patch) | |
tree | 1d7d1ff6f699ccbabb71c7bc4172f7d15bc4bc45 /include | |
parent | dad3de7d0090280f44ff27131ed2878f1ab6ddad (diff) | |
parent | 6471b68982d3bb1a593c3e183c804ecf830125d3 (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-stub: Documentation update
i2c-stub: Allow user to disable some commands
i2c-stub: Implement I2C block support
i2c: Refactor for_each callbacks
i2c-i801: Retry on lost arbitration
i2c: Remove big kernel lock from i2cdev_open
ics932s401: Clean up detect function
i2c: Simplify i2c_detect_address
i2c: Drop probe, ignore and force module parameters
i2c: Add missing __devinit markers to old i2c adapter drivers
i2c: Bus drivers don't have to support I2C_M_REV_DIR_ADDR
i2c: Prevent priority inversion on top of bus lock
i2c-voodoo3: Delete
i2c-powermac: Drop temporary name buffer
i2c-powermac: Include the i2c_adapter in struct pmac_i2c_bus
i2c-powermac: Log errors
i2c-powermac: Refactor i2c_powermac_smbus_xfer
i2c-powermac: Reject unsupported I2C transactions
i2c/chips: Move ds1682 to drivers/misc
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i2c.h | 98 |
1 files changed, 4 insertions, 94 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 7b40cda57a70..419ab546b266 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -110,7 +110,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | |||
110 | * @driver: Device driver model driver | 110 | * @driver: Device driver model driver |
111 | * @id_table: List of I2C devices supported by this driver | 111 | * @id_table: List of I2C devices supported by this driver |
112 | * @detect: Callback for device detection | 112 | * @detect: Callback for device detection |
113 | * @address_data: The I2C addresses to probe, ignore or force (for detect) | 113 | * @address_data: The I2C addresses to probe (for detect) |
114 | * @clients: List of detected clients we created (for i2c-core use only) | 114 | * @clients: List of detected clients we created (for i2c-core use only) |
115 | * | 115 | * |
116 | * The driver.owner field should be set to the module owner of this driver. | 116 | * The driver.owner field should be set to the module owner of this driver. |
@@ -338,8 +338,7 @@ struct i2c_adapter { | |||
338 | void *algo_data; | 338 | void *algo_data; |
339 | 339 | ||
340 | /* data fields that are valid for all devices */ | 340 | /* data fields that are valid for all devices */ |
341 | u8 level; /* nesting level for lockdep */ | 341 | struct rt_mutex bus_lock; |
342 | struct mutex bus_lock; | ||
343 | 342 | ||
344 | int timeout; /* in jiffies */ | 343 | int timeout; /* in jiffies */ |
345 | int retries; | 344 | int retries; |
@@ -367,7 +366,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
367 | */ | 366 | */ |
368 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | 367 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) |
369 | { | 368 | { |
370 | mutex_lock(&adapter->bus_lock); | 369 | rt_mutex_lock(&adapter->bus_lock); |
371 | } | 370 | } |
372 | 371 | ||
373 | /** | 372 | /** |
@@ -376,7 +375,7 @@ static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | |||
376 | */ | 375 | */ |
377 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | 376 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) |
378 | { | 377 | { |
379 | mutex_unlock(&adapter->bus_lock); | 378 | rt_mutex_unlock(&adapter->bus_lock); |
380 | } | 379 | } |
381 | 380 | ||
382 | /*flags for the client struct: */ | 381 | /*flags for the client struct: */ |
@@ -398,9 +397,6 @@ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | |||
398 | */ | 397 | */ |
399 | struct i2c_client_address_data { | 398 | struct i2c_client_address_data { |
400 | const unsigned short *normal_i2c; | 399 | const unsigned short *normal_i2c; |
401 | const unsigned short *probe; | ||
402 | const unsigned short *ignore; | ||
403 | const unsigned short * const *forces; | ||
404 | }; | 400 | }; |
405 | 401 | ||
406 | /* Internal numbers to terminate lists */ | 402 | /* Internal numbers to terminate lists */ |
@@ -614,134 +610,48 @@ union i2c_smbus_data { | |||
614 | module_param_array(var, short, &var##_num, 0); \ | 610 | module_param_array(var, short, &var##_num, 0); \ |
615 | MODULE_PARM_DESC(var, desc) | 611 | MODULE_PARM_DESC(var, desc) |
616 | 612 | ||
617 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ | ||
618 | I2C_CLIENT_MODULE_PARM(force_##name, \ | ||
619 | "List of adapter,address pairs which are " \ | ||
620 | "unquestionably assumed to contain a `" \ | ||
621 | # name "' chip") | ||
622 | |||
623 | |||
624 | #define I2C_CLIENT_INSMOD_COMMON \ | 613 | #define I2C_CLIENT_INSMOD_COMMON \ |
625 | I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ | ||
626 | "additionally"); \ | ||
627 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ | ||
628 | "scan"); \ | ||
629 | static const struct i2c_client_address_data addr_data = { \ | 614 | static const struct i2c_client_address_data addr_data = { \ |
630 | .normal_i2c = normal_i2c, \ | 615 | .normal_i2c = normal_i2c, \ |
631 | .probe = probe, \ | ||
632 | .ignore = ignore, \ | ||
633 | .forces = forces, \ | ||
634 | } | 616 | } |
635 | 617 | ||
636 | #define I2C_CLIENT_FORCE_TEXT \ | ||
637 | "List of adapter,address pairs to boldly assume to be present" | ||
638 | |||
639 | /* These are the ones you want to use in your own drivers. Pick the one | 618 | /* These are the ones you want to use in your own drivers. Pick the one |
640 | which matches the number of devices the driver differenciates between. */ | 619 | which matches the number of devices the driver differenciates between. */ |
641 | #define I2C_CLIENT_INSMOD \ | 620 | #define I2C_CLIENT_INSMOD \ |
642 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
643 | static const unsigned short * const forces[] = { force, NULL }; \ | ||
644 | I2C_CLIENT_INSMOD_COMMON | 621 | I2C_CLIENT_INSMOD_COMMON |
645 | 622 | ||
646 | #define I2C_CLIENT_INSMOD_1(chip1) \ | 623 | #define I2C_CLIENT_INSMOD_1(chip1) \ |
647 | enum chips { any_chip, chip1 }; \ | 624 | enum chips { any_chip, chip1 }; \ |
648 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
649 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
650 | static const unsigned short * const forces[] = { force, \ | ||
651 | force_##chip1, NULL }; \ | ||
652 | I2C_CLIENT_INSMOD_COMMON | 625 | I2C_CLIENT_INSMOD_COMMON |
653 | 626 | ||
654 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | 627 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ |
655 | enum chips { any_chip, chip1, chip2 }; \ | 628 | enum chips { any_chip, chip1, chip2 }; \ |
656 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
657 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
658 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
659 | static const unsigned short * const forces[] = { force, \ | ||
660 | force_##chip1, force_##chip2, NULL }; \ | ||
661 | I2C_CLIENT_INSMOD_COMMON | 629 | I2C_CLIENT_INSMOD_COMMON |
662 | 630 | ||
663 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | 631 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ |
664 | enum chips { any_chip, chip1, chip2, chip3 }; \ | 632 | enum chips { any_chip, chip1, chip2, chip3 }; \ |
665 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
666 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
667 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
668 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
669 | static const unsigned short * const forces[] = { force, \ | ||
670 | force_##chip1, force_##chip2, force_##chip3, NULL }; \ | ||
671 | I2C_CLIENT_INSMOD_COMMON | 633 | I2C_CLIENT_INSMOD_COMMON |
672 | 634 | ||
673 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ | 635 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ |
674 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | 636 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ |
675 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
676 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
677 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
678 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
679 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
680 | static const unsigned short * const forces[] = { force, \ | ||
681 | force_##chip1, force_##chip2, force_##chip3, \ | ||
682 | force_##chip4, NULL}; \ | ||
683 | I2C_CLIENT_INSMOD_COMMON | 637 | I2C_CLIENT_INSMOD_COMMON |
684 | 638 | ||
685 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ | 639 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ |
686 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | 640 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ |
687 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
688 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
689 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
690 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
691 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
692 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
693 | static const unsigned short * const forces[] = { force, \ | ||
694 | force_##chip1, force_##chip2, force_##chip3, \ | ||
695 | force_##chip4, force_##chip5, NULL }; \ | ||
696 | I2C_CLIENT_INSMOD_COMMON | 641 | I2C_CLIENT_INSMOD_COMMON |
697 | 642 | ||
698 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ | 643 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ |
699 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | 644 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ |
700 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
701 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
702 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
703 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
704 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
705 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
706 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
707 | static const unsigned short * const forces[] = { force, \ | ||
708 | force_##chip1, force_##chip2, force_##chip3, \ | ||
709 | force_##chip4, force_##chip5, force_##chip6, NULL }; \ | ||
710 | I2C_CLIENT_INSMOD_COMMON | 645 | I2C_CLIENT_INSMOD_COMMON |
711 | 646 | ||
712 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ | 647 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ |
713 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | 648 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ |
714 | chip7 }; \ | 649 | chip7 }; \ |
715 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
716 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
717 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
718 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
719 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
720 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
721 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
722 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
723 | static const unsigned short * const forces[] = { force, \ | ||
724 | force_##chip1, force_##chip2, force_##chip3, \ | ||
725 | force_##chip4, force_##chip5, force_##chip6, \ | ||
726 | force_##chip7, NULL }; \ | ||
727 | I2C_CLIENT_INSMOD_COMMON | 650 | I2C_CLIENT_INSMOD_COMMON |
728 | 651 | ||
729 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ | 652 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ |
730 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | 653 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ |
731 | chip7, chip8 }; \ | 654 | chip7, chip8 }; \ |
732 | I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \ | ||
733 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
734 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
735 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
736 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
737 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
738 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
739 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
740 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ | ||
741 | static const unsigned short * const forces[] = { force, \ | ||
742 | force_##chip1, force_##chip2, force_##chip3, \ | ||
743 | force_##chip4, force_##chip5, force_##chip6, \ | ||
744 | force_##chip7, force_##chip8, NULL }; \ | ||
745 | I2C_CLIENT_INSMOD_COMMON | 655 | I2C_CLIENT_INSMOD_COMMON |
746 | #endif /* __KERNEL__ */ | 656 | #endif /* __KERNEL__ */ |
747 | #endif /* _LINUX_I2C_H */ | 657 | #endif /* _LINUX_I2C_H */ |