aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:12:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-08 11:12:16 -0500
commit41440ffe21f29bdb985cab76b2d0b06d83e63b19 (patch)
tree1d7d1ff6f699ccbabb71c7bc4172f7d15bc4bc45 /include
parentdad3de7d0090280f44ff27131ed2878f1ab6ddad (diff)
parent6471b68982d3bb1a593c3e183c804ecf830125d3 (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.h98
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 */
368static inline void i2c_lock_adapter(struct i2c_adapter *adapter) 367static 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 */
377static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) 376static 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 */
399struct i2c_client_address_data { 398struct 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) \
618I2C_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 \
625I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
626 "additionally"); \
627I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
628 "scan"); \
629static const struct i2c_client_address_data addr_data = { \ 614static 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 \
642I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
643static const unsigned short * const forces[] = { force, NULL }; \
644I2C_CLIENT_INSMOD_COMMON 621I2C_CLIENT_INSMOD_COMMON
645 622
646#define I2C_CLIENT_INSMOD_1(chip1) \ 623#define I2C_CLIENT_INSMOD_1(chip1) \
647enum chips { any_chip, chip1 }; \ 624enum chips { any_chip, chip1 }; \
648I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
649I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
650static const unsigned short * const forces[] = { force, \
651 force_##chip1, NULL }; \
652I2C_CLIENT_INSMOD_COMMON 625I2C_CLIENT_INSMOD_COMMON
653 626
654#define I2C_CLIENT_INSMOD_2(chip1, chip2) \ 627#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
655enum chips { any_chip, chip1, chip2 }; \ 628enum chips { any_chip, chip1, chip2 }; \
656I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
657I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
658I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
659static const unsigned short * const forces[] = { force, \
660 force_##chip1, force_##chip2, NULL }; \
661I2C_CLIENT_INSMOD_COMMON 629I2C_CLIENT_INSMOD_COMMON
662 630
663#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ 631#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
664enum chips { any_chip, chip1, chip2, chip3 }; \ 632enum chips { any_chip, chip1, chip2, chip3 }; \
665I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
666I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
667I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
668I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
669static const unsigned short * const forces[] = { force, \
670 force_##chip1, force_##chip2, force_##chip3, NULL }; \
671I2C_CLIENT_INSMOD_COMMON 633I2C_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) \
674enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ 636enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
675I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
676I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
677I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
678I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
679I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
680static const unsigned short * const forces[] = { force, \
681 force_##chip1, force_##chip2, force_##chip3, \
682 force_##chip4, NULL}; \
683I2C_CLIENT_INSMOD_COMMON 637I2C_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) \
686enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ 640enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
687I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
688I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
689I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
690I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
691I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
692I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
693static const unsigned short * const forces[] = { force, \
694 force_##chip1, force_##chip2, force_##chip3, \
695 force_##chip4, force_##chip5, NULL }; \
696I2C_CLIENT_INSMOD_COMMON 641I2C_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) \
699enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ 644enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
700I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
701I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
702I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
703I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
704I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
705I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
706I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
707static const unsigned short * const forces[] = { force, \
708 force_##chip1, force_##chip2, force_##chip3, \
709 force_##chip4, force_##chip5, force_##chip6, NULL }; \
710I2C_CLIENT_INSMOD_COMMON 645I2C_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) \
713enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 648enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
714 chip7 }; \ 649 chip7 }; \
715I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
716I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
717I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
718I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
719I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
720I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
721I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
722I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
723static const unsigned short * const forces[] = { force, \
724 force_##chip1, force_##chip2, force_##chip3, \
725 force_##chip4, force_##chip5, force_##chip6, \
726 force_##chip7, NULL }; \
727I2C_CLIENT_INSMOD_COMMON 650I2C_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) \
730enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 653enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
731 chip7, chip8 }; \ 654 chip7, chip8 }; \
732I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
733I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
734I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
735I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
736I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
737I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
738I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
739I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
740I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
741static 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 }; \
745I2C_CLIENT_INSMOD_COMMON 655I2C_CLIENT_INSMOD_COMMON
746#endif /* __KERNEL__ */ 656#endif /* __KERNEL__ */
747#endif /* _LINUX_I2C_H */ 657#endif /* _LINUX_I2C_H */