diff options
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 148 |
1 files changed, 136 insertions, 12 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 9419bc5584ad..3ad3969b6f0d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -565,24 +565,148 @@ union i2c_smbus_data { | |||
565 | module_param_array(var, short, &var##_num, 0); \ | 565 | module_param_array(var, short, &var##_num, 0); \ |
566 | MODULE_PARM_DESC(var,desc) | 566 | MODULE_PARM_DESC(var,desc) |
567 | 567 | ||
568 | /* This is the one you want to use in your own modules */ | 568 | #define I2C_CLIENT_MODULE_PARM_FORCE(name) \ |
569 | I2C_CLIENT_MODULE_PARM(force_##name, \ | ||
570 | "List of adapter,address pairs which are " \ | ||
571 | "unquestionably assumed to contain a `" \ | ||
572 | # name "' chip") | ||
573 | |||
574 | |||
575 | #define I2C_CLIENT_INSMOD_COMMON \ | ||
576 | I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ | ||
577 | "additionally"); \ | ||
578 | I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ | ||
579 | "scan"); \ | ||
580 | static struct i2c_client_address_data addr_data = { \ | ||
581 | .normal_i2c = normal_i2c, \ | ||
582 | .probe = probe, \ | ||
583 | .ignore = ignore, \ | ||
584 | .forces = forces, \ | ||
585 | } | ||
586 | |||
587 | /* These are the ones you want to use in your own drivers. Pick the one | ||
588 | which matches the number of devices the driver differenciates between. */ | ||
569 | #define I2C_CLIENT_INSMOD \ | 589 | #define I2C_CLIENT_INSMOD \ |
570 | I2C_CLIENT_MODULE_PARM(probe, \ | ||
571 | "List of adapter,address pairs to scan additionally"); \ | ||
572 | I2C_CLIENT_MODULE_PARM(ignore, \ | ||
573 | "List of adapter,address pairs not to scan"); \ | ||
574 | I2C_CLIENT_MODULE_PARM(force, \ | 590 | I2C_CLIENT_MODULE_PARM(force, \ |
575 | "List of adapter,address pairs to boldly assume " \ | 591 | "List of adapter,address pairs to boldly assume " \ |
576 | "to be present"); \ | 592 | "to be present"); \ |
577 | static unsigned short *addr_forces[] = { \ | 593 | static unsigned short *forces[] = { \ |
578 | force, \ | 594 | force, \ |
579 | NULL \ | 595 | NULL \ |
580 | }; \ | 596 | }; \ |
581 | static struct i2c_client_address_data addr_data = { \ | 597 | I2C_CLIENT_INSMOD_COMMON |
582 | .normal_i2c = normal_i2c, \ | 598 | |
583 | .probe = probe, \ | 599 | #define I2C_CLIENT_INSMOD_1(chip1) \ |
584 | .ignore = ignore, \ | 600 | enum chips { any_chip, chip1 }; \ |
585 | .forces = addr_forces, \ | 601 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ |
586 | } | 602 | "boldly assume to be present"); \ |
603 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
604 | static unsigned short *forces[] = { force, force_##chip1, NULL }; \ | ||
605 | I2C_CLIENT_INSMOD_COMMON | ||
606 | |||
607 | #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ | ||
608 | enum chips { any_chip, chip1, chip2 }; \ | ||
609 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
610 | "boldly assume to be present"); \ | ||
611 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
612 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
613 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
614 | force_##chip2, NULL }; \ | ||
615 | I2C_CLIENT_INSMOD_COMMON | ||
616 | |||
617 | #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ | ||
618 | enum chips { any_chip, chip1, chip2, chip3 }; \ | ||
619 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
620 | "boldly assume to be present"); \ | ||
621 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
622 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
623 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
624 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
625 | force_##chip2, force_##chip3, \ | ||
626 | NULL }; \ | ||
627 | I2C_CLIENT_INSMOD_COMMON | ||
628 | |||
629 | #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ | ||
630 | enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ | ||
631 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
632 | "boldly assume to be present"); \ | ||
633 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
634 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
635 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
636 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
637 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
638 | force_##chip2, force_##chip3, \ | ||
639 | force_##chip4, NULL}; \ | ||
640 | I2C_CLIENT_INSMOD_COMMON | ||
641 | |||
642 | #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ | ||
643 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ | ||
644 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
645 | "boldly assume to be present"); \ | ||
646 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
647 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
648 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
649 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
650 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
651 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
652 | force_##chip2, force_##chip3, \ | ||
653 | force_##chip4, force_##chip5, \ | ||
654 | NULL }; \ | ||
655 | I2C_CLIENT_INSMOD_COMMON | ||
656 | |||
657 | #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ | ||
658 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ | ||
659 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
660 | "boldly assume to be present"); \ | ||
661 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
662 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
663 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
664 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
665 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
666 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
667 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
668 | force_##chip2, force_##chip3, \ | ||
669 | force_##chip4, force_##chip5, \ | ||
670 | force_##chip6, NULL }; \ | ||
671 | I2C_CLIENT_INSMOD_COMMON | ||
672 | |||
673 | #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ | ||
674 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
675 | chip7 }; \ | ||
676 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
677 | "boldly assume to be present"); \ | ||
678 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
679 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
680 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
681 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
682 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
683 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
684 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
685 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
686 | force_##chip2, force_##chip3, \ | ||
687 | force_##chip4, force_##chip5, \ | ||
688 | force_##chip6, force_##chip7, \ | ||
689 | NULL }; \ | ||
690 | I2C_CLIENT_INSMOD_COMMON | ||
691 | |||
692 | #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ | ||
693 | enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ | ||
694 | chip7, chip8 }; \ | ||
695 | I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ | ||
696 | "boldly assume to be present"); \ | ||
697 | I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ | ||
698 | I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ | ||
699 | I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ | ||
700 | I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ | ||
701 | I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ | ||
702 | I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ | ||
703 | I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ | ||
704 | I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ | ||
705 | static unsigned short *forces[] = { force, force_##chip1, \ | ||
706 | force_##chip2, force_##chip3, \ | ||
707 | force_##chip4, force_##chip5, \ | ||
708 | force_##chip6, force_##chip7, \ | ||
709 | force_##chip8, NULL }; \ | ||
710 | I2C_CLIENT_INSMOD_COMMON | ||
587 | 711 | ||
588 | #endif /* _LINUX_I2C_H */ | 712 | #endif /* _LINUX_I2C_H */ |