aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h148
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) \
569I2C_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 \
576I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
577 "additionally"); \
578I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
579 "scan"); \
580static 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 = { \ 597I2C_CLIENT_INSMOD_COMMON
582 .normal_i2c = normal_i2c, \ 598
583 .probe = probe, \ 599#define I2C_CLIENT_INSMOD_1(chip1) \
584 .ignore = ignore, \ 600enum chips { any_chip, chip1 }; \
585 .forces = addr_forces, \ 601I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
586 } 602 "boldly assume to be present"); \
603I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
604static unsigned short *forces[] = { force, force_##chip1, NULL }; \
605I2C_CLIENT_INSMOD_COMMON
606
607#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
608enum chips { any_chip, chip1, chip2 }; \
609I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
610 "boldly assume to be present"); \
611I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
612I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
613static unsigned short *forces[] = { force, force_##chip1, \
614 force_##chip2, NULL }; \
615I2C_CLIENT_INSMOD_COMMON
616
617#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
618enum chips { any_chip, chip1, chip2, chip3 }; \
619I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
620 "boldly assume to be present"); \
621I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
622I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
623I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
624static unsigned short *forces[] = { force, force_##chip1, \
625 force_##chip2, force_##chip3, \
626 NULL }; \
627I2C_CLIENT_INSMOD_COMMON
628
629#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
630enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
631I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
632 "boldly assume to be present"); \
633I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
634I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
635I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
636I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
637static unsigned short *forces[] = { force, force_##chip1, \
638 force_##chip2, force_##chip3, \
639 force_##chip4, NULL}; \
640I2C_CLIENT_INSMOD_COMMON
641
642#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
643enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
644I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
645 "boldly assume to be present"); \
646I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
647I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
648I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
649I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
650I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
651static unsigned short *forces[] = { force, force_##chip1, \
652 force_##chip2, force_##chip3, \
653 force_##chip4, force_##chip5, \
654 NULL }; \
655I2C_CLIENT_INSMOD_COMMON
656
657#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
658enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
659I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
660 "boldly assume to be present"); \
661I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
662I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
663I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
664I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
665I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
666I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
667static unsigned short *forces[] = { force, force_##chip1, \
668 force_##chip2, force_##chip3, \
669 force_##chip4, force_##chip5, \
670 force_##chip6, NULL }; \
671I2C_CLIENT_INSMOD_COMMON
672
673#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
674enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
675 chip7 }; \
676I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
677 "boldly assume to be present"); \
678I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
679I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
680I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
681I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
682I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
683I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
684I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
685static unsigned short *forces[] = { force, force_##chip1, \
686 force_##chip2, force_##chip3, \
687 force_##chip4, force_##chip5, \
688 force_##chip6, force_##chip7, \
689 NULL }; \
690I2C_CLIENT_INSMOD_COMMON
691
692#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
693enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
694 chip7, chip8 }; \
695I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
696 "boldly assume to be present"); \
697I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
698I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
699I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
700I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
701I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
702I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
703I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
704I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
705static 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 }; \
710I2C_CLIENT_INSMOD_COMMON
587 711
588#endif /* _LINUX_I2C_H */ 712#endif /* _LINUX_I2C_H */