aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c-sensor.h203
-rw-r--r--include/linux/i2c.h148
2 files changed, 136 insertions, 215 deletions
diff --git a/include/linux/i2c-sensor.h b/include/linux/i2c-sensor.h
deleted file mode 100644
index 1563d445dfd1..000000000000
--- a/include/linux/i2c-sensor.h
+++ /dev/null
@@ -1,203 +0,0 @@
1/*
2 i2c-sensor.h - Part of the i2c package
3 was originally sensors.h - Part of lm_sensors, Linux kernel modules
4 for hardware monitoring
5 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef _LINUX_I2C_SENSOR_H
23#define _LINUX_I2C_SENSOR_H
24
25#include <linux/i2c.h>
26
27#define SENSORS_MODULE_PARM_FORCE(name) \
28 I2C_CLIENT_MODULE_PARM(force_ ## name, \
29 "List of adapter,address pairs which are unquestionably" \
30 " assumed to contain a `" # name "' chip")
31
32
33/* This defines several insmod variables, and the addr_data structure */
34#define SENSORS_INSMOD \
35 I2C_CLIENT_MODULE_PARM(probe, \
36 "List of adapter,address pairs to scan additionally"); \
37 I2C_CLIENT_MODULE_PARM(ignore, \
38 "List of adapter,address pairs not to scan"); \
39 static struct i2c_client_address_data addr_data = { \
40 .normal_i2c = normal_i2c, \
41 .probe = probe, \
42 .ignore = ignore, \
43 .forces = forces, \
44 }
45
46/* The following functions create an enum with the chip names as elements.
47 The first element of the enum is any_chip. These are the only macros
48 a module will want to use. */
49
50#define SENSORS_INSMOD_0 \
51 enum chips { any_chip }; \
52 I2C_CLIENT_MODULE_PARM(force, \
53 "List of adapter,address pairs to boldly assume " \
54 "to be present"); \
55 static unsigned short *forces[] = { force, \
56 NULL }; \
57 SENSORS_INSMOD
58
59#define SENSORS_INSMOD_1(chip1) \
60 enum chips { any_chip, chip1 }; \
61 I2C_CLIENT_MODULE_PARM(force, \
62 "List of adapter,address pairs to boldly assume " \
63 "to be present"); \
64 SENSORS_MODULE_PARM_FORCE(chip1); \
65 static unsigned short *forces[] = { force, \
66 force_##chip1, \
67 NULL }; \
68 SENSORS_INSMOD
69
70#define SENSORS_INSMOD_2(chip1,chip2) \
71 enum chips { any_chip, chip1, chip2 }; \
72 I2C_CLIENT_MODULE_PARM(force, \
73 "List of adapter,address pairs to boldly assume " \
74 "to be present"); \
75 SENSORS_MODULE_PARM_FORCE(chip1); \
76 SENSORS_MODULE_PARM_FORCE(chip2); \
77 static unsigned short *forces[] = { force, \
78 force_##chip1, \
79 force_##chip2, \
80 NULL }; \
81 SENSORS_INSMOD
82
83#define SENSORS_INSMOD_3(chip1,chip2,chip3) \
84 enum chips { any_chip, chip1, chip2, chip3 }; \
85 I2C_CLIENT_MODULE_PARM(force, \
86 "List of adapter,address pairs to boldly assume " \
87 "to be present"); \
88 SENSORS_MODULE_PARM_FORCE(chip1); \
89 SENSORS_MODULE_PARM_FORCE(chip2); \
90 SENSORS_MODULE_PARM_FORCE(chip3); \
91 static unsigned short *forces[] = { force, \
92 force_##chip1, \
93 force_##chip2, \
94 force_##chip3, \
95 NULL }; \
96 SENSORS_INSMOD
97
98#define SENSORS_INSMOD_4(chip1,chip2,chip3,chip4) \
99 enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
100 I2C_CLIENT_MODULE_PARM(force, \
101 "List of adapter,address pairs to boldly assume " \
102 "to be present"); \
103 SENSORS_MODULE_PARM_FORCE(chip1); \
104 SENSORS_MODULE_PARM_FORCE(chip2); \
105 SENSORS_MODULE_PARM_FORCE(chip3); \
106 SENSORS_MODULE_PARM_FORCE(chip4); \
107 static unsigned short *forces[] = { force, \
108 force_##chip1, \
109 force_##chip2, \
110 force_##chip3, \
111 force_##chip4, \
112 NULL}; \
113 SENSORS_INSMOD
114
115#define SENSORS_INSMOD_5(chip1,chip2,chip3,chip4,chip5) \
116 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
117 I2C_CLIENT_MODULE_PARM(force, \
118 "List of adapter,address pairs to boldly assume " \
119 "to be present"); \
120 SENSORS_MODULE_PARM_FORCE(chip1); \
121 SENSORS_MODULE_PARM_FORCE(chip2); \
122 SENSORS_MODULE_PARM_FORCE(chip3); \
123 SENSORS_MODULE_PARM_FORCE(chip4); \
124 SENSORS_MODULE_PARM_FORCE(chip5); \
125 static unsigned short *forces[] = { force, \
126 force_##chip1, \
127 force_##chip2, \
128 force_##chip3, \
129 force_##chip4, \
130 force_##chip5, \
131 NULL }; \
132 SENSORS_INSMOD
133
134#define SENSORS_INSMOD_6(chip1,chip2,chip3,chip4,chip5,chip6) \
135 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
136 I2C_CLIENT_MODULE_PARM(force, \
137 "List of adapter,address pairs to boldly assume " \
138 "to be present"); \
139 SENSORS_MODULE_PARM_FORCE(chip1); \
140 SENSORS_MODULE_PARM_FORCE(chip2); \
141 SENSORS_MODULE_PARM_FORCE(chip3); \
142 SENSORS_MODULE_PARM_FORCE(chip4); \
143 SENSORS_MODULE_PARM_FORCE(chip5); \
144 SENSORS_MODULE_PARM_FORCE(chip6); \
145 static unsigned short *forces[] = { force, \
146 force_##chip1, \
147 force_##chip2, \
148 force_##chip3, \
149 force_##chip4, \
150 force_##chip5, \
151 force_##chip6, \
152 NULL }; \
153 SENSORS_INSMOD
154
155#define SENSORS_INSMOD_7(chip1,chip2,chip3,chip4,chip5,chip6,chip7) \
156 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7 }; \
157 I2C_CLIENT_MODULE_PARM(force, \
158 "List of adapter,address pairs to boldly assume " \
159 "to be present"); \
160 SENSORS_MODULE_PARM_FORCE(chip1); \
161 SENSORS_MODULE_PARM_FORCE(chip2); \
162 SENSORS_MODULE_PARM_FORCE(chip3); \
163 SENSORS_MODULE_PARM_FORCE(chip4); \
164 SENSORS_MODULE_PARM_FORCE(chip5); \
165 SENSORS_MODULE_PARM_FORCE(chip6); \
166 SENSORS_MODULE_PARM_FORCE(chip7); \
167 static unsigned short *forces[] = { force, \
168 force_##chip1, \
169 force_##chip2, \
170 force_##chip3, \
171 force_##chip4, \
172 force_##chip5, \
173 force_##chip6, \
174 force_##chip7, \
175 NULL }; \
176 SENSORS_INSMOD
177
178#define SENSORS_INSMOD_8(chip1,chip2,chip3,chip4,chip5,chip6,chip7,chip8) \
179 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8 }; \
180 I2C_CLIENT_MODULE_PARM(force, \
181 "List of adapter,address pairs to boldly assume " \
182 "to be present"); \
183 SENSORS_MODULE_PARM_FORCE(chip1); \
184 SENSORS_MODULE_PARM_FORCE(chip2); \
185 SENSORS_MODULE_PARM_FORCE(chip3); \
186 SENSORS_MODULE_PARM_FORCE(chip4); \
187 SENSORS_MODULE_PARM_FORCE(chip5); \
188 SENSORS_MODULE_PARM_FORCE(chip6); \
189 SENSORS_MODULE_PARM_FORCE(chip7); \
190 SENSORS_MODULE_PARM_FORCE(chip8); \
191 static unsigned short *forces[] = { force, \
192 force_##chip1, \
193 force_##chip2, \
194 force_##chip3, \
195 force_##chip4, \
196 force_##chip5, \
197 force_##chip6, \
198 force_##chip7, \
199 force_##chip8, \
200 NULL }; \
201 SENSORS_INSMOD
202
203#endif /* def _LINUX_I2C_SENSOR_H */
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 */